show newt failure in vscode
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -27,7 +27,7 @@ I may be done with `U` - I keep typing `Type`.
|
|||||||
- have separate type of implict with `{{}}`
|
- have separate type of implict with `{{}}`
|
||||||
- [ ] do blocks
|
- [ ] do blocks
|
||||||
- [ ] some solution for `+` problem (classes? ambiguity?)
|
- [ ] some solution for `+` problem (classes? ambiguity?)
|
||||||
- [ ] show compiler failure in the editor (exit code != 0)
|
- [x] show compiler failure in the editor (exit code != 0)
|
||||||
- [ ] write js files into `out` directory
|
- [ ] write js files into `out` directory
|
||||||
- [ ] detect extra clauses in case statements
|
- [ ] detect extra clauses in case statements
|
||||||
- [ ] add test framework
|
- [ ] add test framework
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
const cmd = config.get<string>("path", "build/exec/newt");
|
const cmd = config.get<string>("path", "build/exec/newt");
|
||||||
const command = `${cmd} ${fileName}`;
|
const command = `${cmd} ${fileName}`;
|
||||||
exec(command, { cwd }, (err, stdout, _stderr) => {
|
exec(command, { cwd }, (err, stdout, _stderr) => {
|
||||||
|
// I think I ignored 1 here because I wanted failure to launch
|
||||||
if (err && err.code !== 1) {
|
if (err && err.code !== 1) {
|
||||||
vscode.window.showErrorMessage(`newt error: ${err}`);
|
vscode.window.showErrorMessage(`newt error: ${err}`);
|
||||||
}
|
}
|
||||||
@@ -25,6 +26,14 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
const lines = stdout.split("\n");
|
const lines = stdout.split("\n");
|
||||||
const diagnostics: vscode.Diagnostic[] = [];
|
const diagnostics: vscode.Diagnostic[] = [];
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
let start = new vscode.Position(0,0)
|
||||||
|
let end = new vscode.Position(0,1)
|
||||||
|
let range = document.getWordRangeAtPosition(start) ?? new vscode.Range(start,end)
|
||||||
|
const diag = new vscode.Diagnostic(range, "newt execution failed", vscode.DiagnosticSeverity.Error)
|
||||||
|
diagnostics.push(diag)
|
||||||
|
}
|
||||||
|
|
||||||
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(/(INFO|ERROR) at \((\d+), (\d+)\): (.*)/);
|
const match = line.match(/(INFO|ERROR) at \((\d+), (\d+)\): (.*)/);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "keyword.newt",
|
"name": "keyword.newt",
|
||||||
"match": "\\b(data|where|case|of|let|in|U|module|ptype|pfunc)\\b"
|
"match": "\\b(data|where|case|of|let|in|U|module|ptype|pfunc|infix|infixl|infixr)\\b"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ infer ctx (RPi fc nm icit ty ty2) = do
|
|||||||
let nm := fromMaybe "_" nm
|
let nm := fromMaybe "_" nm
|
||||||
ty2' <- check (extend ctx nm vty') ty2 (VU fc)
|
ty2' <- check (extend ctx nm vty') ty2 (VU fc)
|
||||||
pure (Pi fc nm icit ty' ty2', (VU fc))
|
pure (Pi fc nm icit ty' ty2', (VU fc))
|
||||||
infer ctx (RLet fc str tm tm1 tm2) = error fc "implement RLet"
|
infer ctx (RLet fc nm ty v sc) = error fc "implement RLet"
|
||||||
infer ctx (RAnn fc tm rty) = do
|
infer ctx (RAnn fc tm rty) = do
|
||||||
ty <- check ctx rty (VU fc)
|
ty <- check ctx rty (VU fc)
|
||||||
vty <- eval ctx.env CBN ty
|
vty <- eval ctx.env CBN ty
|
||||||
|
|||||||
Reference in New Issue
Block a user