Use 1-based row/column in error messages

This commit is contained in:
2025-09-29 12:42:13 -07:00
parent bab25f8dce
commit 495ed78c80
6 changed files with 630 additions and 855 deletions

View File

@@ -1,7 +1,7 @@
## TODO
- [ ] Increment row/col in printing, so vscode can click on compiler output
- [x] Increment row/col in printing, so vscode can click on compiler output
- [ ] Raw is duplicated between Lib.Syntax and Lib.Compile, but not detected
- Maybe add qualified names
- [ ] vscode - run newt when switching editors

File diff suppressed because one or more lines are too long

View File

@@ -114,8 +114,8 @@ export function activate(context: vscode.ExtensionContext) {
);
if (match) {
let [_full, kind, file, line, column, message] = match;
let lnum = Number(line);
let cnum = Number(column);
let lnum = Number(line) - 1;
let cnum = Number(column) - 1;
if (file !== fileName) lnum = cnum = 0;
let start = new vscode.Position(lnum, cnum);

View File

@@ -10,7 +10,6 @@
"dependencies": {
"@preact/signals": "^1.3.0",
"codemirror": "^6.0.1",
"monaco-editor": "^0.52.0",
"preact": "^10.24.3"
},
"devDependencies": {
@@ -990,12 +989,6 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/monaco-editor": {
"version": "0.52.2",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz",
"integrity": "sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==",
"license": "MIT"
},
"node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",

View File

@@ -444,8 +444,8 @@ const processOutput = (
);
if (match) {
let [_full, kind, file, line, col, message] = match;
let lineNumber = +line + 1;
let column = +col + 1;
let lineNumber = +line;
let column = +col;
// FIXME - pass the real path in
if (fn && fn !== file) {
lineNumber = column = 0;

View File

@@ -119,7 +119,7 @@ data Error
| Postpone FC QName String
instance Show FC where
show fc = "\{fc.file}:\{show fc.start}"
show (MkFC file (l,c)) = "\{file}:(\{show $ l + 1}, \{show $ c + 1})"
showError : String -> Error -> String