diff --git a/package.json b/package.json index 115a8f0..a516755 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@types/vscode": "^1.36.0", "tslint": "^5.12.1", "typescript": "^5.4.0", + "vscode-languageclient": "^9.0.1", "vscode-test": "^1.0.0" } } diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..bc9e121 --- /dev/null +++ b/src/client.ts @@ -0,0 +1,22 @@ +import { + Executable, + LanguageClient, + LanguageClientOptions, + ServerOptions, +} from 'vscode-languageclient/node'; + +const serverOptions: ServerOptions = { + command: "M2-language-server"}; + +const clientOptions: LanguageClientOptions = { + documentSelector: [ + { scheme: 'file', language: 'macaulay2' }, + { scheme: 'untitled', language: 'macaulay2' } + ], +}; + +export default new LanguageClient( + "macaulay2-language-server", + "Macaulay2 Language Server", + serverOptions, + clientOptions); diff --git a/src/extension.ts b/src/extension.ts index b94f12d..41e29bd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,6 +5,7 @@ import * as vscode from 'vscode'; import * as completions from "./completionProviders"; import * as repl from "./repl"; +import client from "./client"; // this method is called when your extension is activated // your extension is activated the very first time the command is executed @@ -16,6 +17,7 @@ export function activate(context: vscode.ExtensionContext) { completions.activate(context); repl.activate(context); + client.start(); }