diff --git a/editors/vscode/.gitignore b/editors/vscode/.gitignore index 773dc5cc..45f94c8a 100644 --- a/editors/vscode/.gitignore +++ b/editors/vscode/.gitignore @@ -1,4 +1,4 @@ /fusion-*.vsix /node_modules /out -/src/parser.js +/src/fucheck.js diff --git a/editors/vscode/Makefile b/editors/vscode/Makefile index 71e854be..bac8528a 100644 --- a/editors/vscode/Makefile +++ b/editors/vscode/Makefile @@ -3,10 +3,10 @@ VERSION = 3.1.2 run: fusion-$(VERSION).vsix '$(LOCALAPPDATA)\Programs\Microsoft VS Code\bin\code' --extensionDevelopmentPath=$(abspath .) -fusion-$(VERSION).vsix: package.json fu-logo.png fu-file.svg language-configuration.json tsconfig.json syntaxes/fusion.tmLanguage.json src/extension.ts src/parser.js node_modules +fusion-$(VERSION).vsix: package.json fu-logo.png fu-file.svg language-configuration.json tsconfig.json syntaxes/fusion.tmLanguage.json src/extension.ts src/fucheck.js node_modules vsce package -src/parser.js: ../../Lexer.fu ../../AST.fu ../../Parser.fu +src/fucheck.js: ../../Lexer.fu ../../AST.fu ../../Parser.fu ../../Sema.fu fut -o $@ $^ node_modules: package.json diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts index fa603134..ef42fa76 100644 --- a/editors/vscode/src/extension.ts +++ b/editors/vscode/src/extension.ts @@ -19,9 +19,9 @@ // along with Fusion Transpiler. If not, see http://www.gnu.org/licenses/ import * as vscode from "vscode"; -import { FuParser, FuProgram, FuSystem, FuParserHost } from "./parser.js"; +import { FuParser, FuProgram, FuSystem, FuSema, FuSemaHost } from "./fucheck.js"; -class VsCodeHost extends FuParserHost +class VsCodeHost extends FuSemaHost { #system = FuSystem.new(); #diagnostics: vscode.Diagnostic[] = []; @@ -43,6 +43,11 @@ class VsCodeHost extends FuParserHost parser.program.system = this.#system; const input = new TextEncoder().encode(document.getText()); parser.parse(document.fileName, input, input.length); + if (this.#diagnostics.length == 0) { + const sema = new FuSema(); + sema.setHost(this); + sema.process(parser.program); + } diagnosticCollection.set(document.uri, this.#diagnostics); } } diff --git a/editors/vscode/tsconfig.json b/editors/vscode/tsconfig.json index eed00969..6c2b0f0f 100644 --- a/editors/vscode/tsconfig.json +++ b/editors/vscode/tsconfig.json @@ -1,7 +1,7 @@ { "files": [ "src/extension.ts", - "src/parser.js" + "src/fucheck.js" ], "compilerOptions": { "target": "es2021",