const path = require('path'); const { LanguageClient, TransportKind } = require('vscode-languageclient/node'); /** @type {LanguageClient} */ let client; /** * @param {import('vscode').ExtensionContext} context */ function activate(context) { const isWindows = process.platform === 'win32'; const serverExe = isWindows ? 'aster-lsp.exe' : 'aster-lsp'; // __dirname resolves to the real filesystem path (following the junction), // so .. goes to the workspace root where target/ lives const serverPath = path.join(__dirname, '..', 'target', 'debug', serverExe); const serverOptions = { command: serverPath, args: [], }; const clientOptions = { documentSelector: [{ scheme: 'file', language: 'aster' }], }; client = new LanguageClient( 'aster-lsp', 'Aster Language Server', serverOptions, clientOptions ); client.start(); } function deactivate() { if (client) { return client.stop(); } } module.exports = { activate, deactivate };