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
|
||||
|
||||
- [x] Take the parens off of FC to make vscode happy
|
||||
- [ ] 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.)
|
||||
- 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);
|
||||
}
|
||||
const match = line.match(
|
||||
/(INFO|WARN|ERROR) at (.*):\((\d+):(\d+)-(\d+):(\d+)\):\s*(.*)/
|
||||
/(INFO|WARN|ERROR) at (.*):(\d+):(\d+)--(\d+):(\d+):\s*(.*)/
|
||||
);
|
||||
if (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) {
|
||||
const actions: vscode.CodeAction[] = [];
|
||||
for (const diagnostic of context.diagnostics) {
|
||||
let {message,range} = diagnostic
|
||||
let m = diagnostic.message.match(/missing cases: (.*)/);
|
||||
let {message,range} = diagnostic;
|
||||
let m = message.match(/missing cases: (.*)/);
|
||||
if (m) {
|
||||
// A lot of this logic would also apply to case split.
|
||||
let cons = m[1].split(', ');
|
||||
const line = diagnostic.range.start.line;
|
||||
const line = range.start.line;
|
||||
const lineText = document.lineAt(line).text;
|
||||
let m2 = lineText.match(/(.*=>?)/);
|
||||
if (!m2) continue;
|
||||
|
||||
@@ -440,7 +440,7 @@ const processOutput = (
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const match = line.match(
|
||||
/(INFO|ERROR) at ([^:]+):\((\d+):(\d+)-(\d+):(\d+)\):\s*(.*)/
|
||||
/(INFO|ERROR) at ([^:]+):(\d+):(\d+)--(\d+):(\d+):\s*(.*)/
|
||||
);
|
||||
if (match) {
|
||||
let [_full, kind, file, line, col, eline, ecol, message] = match;
|
||||
|
||||
@@ -158,8 +158,7 @@ data Error
|
||||
|
||||
instance Show FC where
|
||||
-- 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 src (E fc msg) = "ERROR at \{show fc}: \{msg}\n" ++ go 0 (lines src)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
*** Process tests/BadAlt.newt
|
||||
module Prelude
|
||||
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 (xs :< x) = x
|
||||
^
|
||||
^^^^^^^
|
||||
|
||||
Compile failed
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
*** Process tests/LitConCase.newt
|
||||
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 0 = MkUnit
|
||||
foo MkUnit = MkUnit
|
||||
^
|
||||
^^^^^^
|
||||
|
||||
Compile failed
|
||||
|
||||
Reference in New Issue
Block a user