diff --git a/TODO.md b/TODO.md index 5e90adb..7f2c4e7 100644 --- a/TODO.md +++ b/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. diff --git a/newt-vscode/src/extension.ts b/newt-vscode/src/extension.ts index b87aae8..fc66a4b 100644 --- a/newt-vscode/src/extension.ts +++ b/newt-vscode/src/extension.ts @@ -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; diff --git a/playground/src/main.ts b/playground/src/main.ts index 2252228..4356051 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -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; diff --git a/src/Lib/Common.newt b/src/Lib/Common.newt index bca886a..9b39ec5 100644 --- a/src/Lib/Common.newt +++ b/src/Lib/Common.newt @@ -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) diff --git a/tests/BadAlt.newt.fail b/tests/BadAlt.newt.fail index 747ccdd..6bcbdc9 100644 --- a/tests/BadAlt.newt.fail +++ b/tests/BadAlt.newt.fail @@ -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 diff --git a/tests/LitConCase.newt.fail b/tests/LitConCase.newt.fail index fb1dc6c..000172f 100644 --- a/tests/LitConCase.newt.fail +++ b/tests/LitConCase.newt.fail @@ -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