Change Show FC format to match vscode's expectation
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
- [x] Take the parens off of FC to make vscode happy
|
||||||
- [ ] in-scope type at point in vscode
|
- [ ] in-scope type at point in vscode
|
||||||
- So the idea here is that the references will be via FC, we remember the type at declaration and then point the usage back to the declaration (FC -> FC). We could dump all of this. (If we're still doing json.)
|
- So the idea here is that the references will be via FC, we remember the type at declaration and then point the usage back to the declaration (FC -> FC). We could dump all of this. (If we're still doing json.)
|
||||||
- Do we want to (maybe later) keep the scope as a FC? We could do scope at point then.
|
- Do we want to (maybe later) keep the scope as a FC? We could do scope at point then.
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
console.log("top data", topData);
|
console.log("top data", topData);
|
||||||
}
|
}
|
||||||
const match = line.match(
|
const match = line.match(
|
||||||
/(INFO|WARN|ERROR) at (.*):\((\d+):(\d+)-(\d+):(\d+)\):\s*(.*)/
|
/(INFO|WARN|ERROR) at (.*):(\d+):(\d+)--(\d+):(\d+):\s*(.*)/
|
||||||
);
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
let [_full, kind, file, line, column, eline, ecol, message] = match;
|
let [_full, kind, file, line, column, eline, ecol, message] = match;
|
||||||
@@ -288,12 +288,12 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
provideCodeActions(document, range, context, token) {
|
provideCodeActions(document, range, context, token) {
|
||||||
const actions: vscode.CodeAction[] = [];
|
const actions: vscode.CodeAction[] = [];
|
||||||
for (const diagnostic of context.diagnostics) {
|
for (const diagnostic of context.diagnostics) {
|
||||||
let {message,range} = diagnostic
|
let {message,range} = diagnostic;
|
||||||
let m = diagnostic.message.match(/missing cases: (.*)/);
|
let m = message.match(/missing cases: (.*)/);
|
||||||
if (m) {
|
if (m) {
|
||||||
// A lot of this logic would also apply to case split.
|
// A lot of this logic would also apply to case split.
|
||||||
let cons = m[1].split(', ');
|
let cons = m[1].split(', ');
|
||||||
const line = diagnostic.range.start.line;
|
const line = range.start.line;
|
||||||
const lineText = document.lineAt(line).text;
|
const lineText = document.lineAt(line).text;
|
||||||
let m2 = lineText.match(/(.*=>?)/);
|
let m2 = lineText.match(/(.*=>?)/);
|
||||||
if (!m2) continue;
|
if (!m2) continue;
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ const processOutput = (
|
|||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
const line = lines[i];
|
const line = lines[i];
|
||||||
const match = line.match(
|
const match = line.match(
|
||||||
/(INFO|ERROR) at ([^:]+):\((\d+):(\d+)-(\d+):(\d+)\):\s*(.*)/
|
/(INFO|ERROR) at ([^:]+):(\d+):(\d+)--(\d+):(\d+):\s*(.*)/
|
||||||
);
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
let [_full, kind, file, line, col, eline, ecol, message] = match;
|
let [_full, kind, file, line, col, eline, ecol, message] = match;
|
||||||
|
|||||||
@@ -158,8 +158,7 @@ data Error
|
|||||||
|
|
||||||
instance Show FC where
|
instance Show FC where
|
||||||
-- We add one to the end column so it points after the end, which seems to be what Idris does
|
-- We add one to the end column so it points after the end, which seems to be what Idris does
|
||||||
show (MkFC file (MkBounds l c el ec)) = "\{file}:(\{show $ l + 1}:\{show $ c + 1}-\{show $ el + 1}:\{show $ ec + 2})"
|
show (MkFC file (MkBounds l c el ec)) = "\{file}:\{show $ l + 1}:\{show $ c + 1}--\{show $ el + 1}:\{show $ ec + 2}"
|
||||||
|
|
||||||
|
|
||||||
showError : String -> Error -> String
|
showError : String -> Error -> String
|
||||||
showError src (E fc msg) = "ERROR at \{show fc}: \{msg}\n" ++ go 0 (lines src)
|
showError src (E fc msg) = "ERROR at \{show fc}: \{msg}\n" ++ go 0 (lines src)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
*** Process tests/BadAlt.newt
|
*** Process tests/BadAlt.newt
|
||||||
module Prelude
|
module Prelude
|
||||||
module BadAlt
|
module BadAlt
|
||||||
ERROR at tests/BadAlt.newt:(6, 9): Prelude._:<_ not a constructor for (Prelude.List Prim.Int)
|
ERROR at tests/BadAlt.newt:6:6--6:13: Prelude._:<_ not a constructor for (Prelude.List Prim.Int)
|
||||||
|
|
||||||
foo : List Int → Int
|
foo : List Int → Int
|
||||||
foo (xs :< x) = x
|
foo (xs :< x) = x
|
||||||
^
|
^^^^^^^
|
||||||
|
|
||||||
Compile failed
|
Compile failed
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
*** Process tests/LitConCase.newt
|
*** Process tests/LitConCase.newt
|
||||||
module LitConCase
|
module LitConCase
|
||||||
ERROR at tests/LitConCase.newt:(7, 5): expected Prim.Int
|
ERROR at tests/LitConCase.newt:7:5--7:11: expected Prim.Int
|
||||||
foo : Int → Unit
|
foo : Int → Unit
|
||||||
foo 0 = MkUnit
|
foo 0 = MkUnit
|
||||||
foo MkUnit = MkUnit
|
foo MkUnit = MkUnit
|
||||||
^
|
^^^^^^
|
||||||
|
|
||||||
Compile failed
|
Compile failed
|
||||||
|
|||||||
Reference in New Issue
Block a user