feat: setup for intelliwacc ide with syntax highlights
This commit is contained in:
38
wacc-syntax/extension.js
Normal file
38
wacc-syntax/extension.js
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
};
|
||||
Reference in New Issue
Block a user