Files
WACC_37/wacc-syntax/extension.js

39 lines
1.1 KiB
JavaScript

const vscode = require('vscode');
function activate(context) {
console.log('IntelliWACC is now active!');
// Create a DiagnosticCollection for error highlighting
let diagnosticCollection = vscode.languages.createDiagnosticCollection('wacc');
context.subscriptions.push(diagnosticCollection);
// Listen for document saves and run error checking
vscode.workspace.onDidSaveTextDocument((document) => {
if (document.languageId !== 'wacc') return;
let diagnostics = [];
let errors = runCompilerAndGetErrors(document.getText());
errors.forEach(error => {
let range = new vscode.Range(error.line, error.column, error.line, error.column + 1);
let diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
diagnostics.push(diagnostic);
});
diagnosticCollection.set(document.uri, diagnostics);
});
}
function deactivate() {
console.log('IntelliWACC is deactivating...');
}
function runCompilerAndGetErrors(code) {
// COMPILER INTEGRATION
}
module.exports = {
activate,
deactivate
};