Working base lsp
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import * as path from 'path';
|
||||
import { workspace, ExtensionContext } from 'vscode';
|
||||
|
||||
import {
|
||||
LanguageClient,
|
||||
LanguageClientOptions,
|
||||
ServerOptions,
|
||||
TransportKind
|
||||
} from 'vscode-languageclient/node';
|
||||
|
||||
let client: LanguageClient | undefined;
|
||||
|
||||
export async function activate(context: ExtensionContext) {
|
||||
// If the extension is launched in debug mode then the debug server options are used
|
||||
// Otherwise the run options are used
|
||||
let serverOptions: ServerOptions = {
|
||||
run: {
|
||||
command: "cmd.exe",
|
||||
args: ["/c", "D:\\projects\\mist\\mist\\analyzer.bat"],
|
||||
transport: TransportKind.stdio
|
||||
},
|
||||
debug: {
|
||||
command: "cmd.exe",
|
||||
args: ["/c", "D:\\projects\\mist\\mist\\analyzer.bat"],
|
||||
transport: TransportKind.stdio
|
||||
}
|
||||
};
|
||||
|
||||
// Options to control the language client
|
||||
let clientOptions: LanguageClientOptions = {
|
||||
// Register the server for plain text documents
|
||||
documentSelector: [{ scheme: 'file', language: 'mist' }],
|
||||
synchronize: {
|
||||
fileEvents: workspace.createFileSystemWatcher('**/mist.json')
|
||||
}
|
||||
};
|
||||
|
||||
// Create the language client and start the client.
|
||||
client = new LanguageClient(
|
||||
'MistAnalyzer',
|
||||
'Mist Analyzer',
|
||||
serverOptions,
|
||||
clientOptions
|
||||
);
|
||||
|
||||
// Start the client. This will also launch the server
|
||||
await client.start();
|
||||
}
|
||||
|
||||
export async function deactivate() {
|
||||
await client?.dispose();
|
||||
client = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user