From 60b59fdeaf034b60f4b54eedf3fc496933be3825 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 19 May 2025 16:25:23 -0400 Subject: [PATCH 1/4] Add vscode-languageclient to dependencies --- package.json | 1 + 1 file changed, 1 insertion(+) 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" } } From c37b6a6aa72f8af6efd8b3ddcba16b5699cb6ca5 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Tue, 17 Dec 2024 18:29:31 -0500 Subject: [PATCH 2/4] Add LSP client --- src/client.ts | 16 ++++++++++++++++ src/extension.ts | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 src/client.ts diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..e8aff7c --- /dev/null +++ b/src/client.ts @@ -0,0 +1,16 @@ +import { + Executable, + LanguageClient, + LanguageClientOptions, + ServerOptions, +} from 'vscode-languageclient/node'; + +const serverOptions: ServerOptions = { + command: "M2-language-server"}; + +const clientOptions: LanguageClientOptions = {}; + +export default new LanguageClient( + "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(); } From 80963768a3f547fcfe1f63f76e93d38e8ace10a4 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 18 May 2025 22:22:47 -0400 Subject: [PATCH 3/4] Set document selector client options --- src/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index e8aff7c..d3f83e5 100644 --- a/src/client.ts +++ b/src/client.ts @@ -8,7 +8,12 @@ import { const serverOptions: ServerOptions = { command: "M2-language-server"}; -const clientOptions: LanguageClientOptions = {}; +const clientOptions: LanguageClientOptions = { + documentSelector: [ + { scheme: 'file', language: 'macaulay2' }, + { scheme: 'untitled', language: 'macaulay2' } + ], +}; export default new LanguageClient( "macaulay2-language-server", From 415ba2e01ca66ec579c7c3d0b734f26e5fea6213 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 18 May 2025 22:23:03 -0400 Subject: [PATCH 4/4] Set LSP server name --- src/client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client.ts b/src/client.ts index d3f83e5..bc9e121 100644 --- a/src/client.ts +++ b/src/client.ts @@ -17,5 +17,6 @@ const clientOptions: LanguageClientOptions = { export default new LanguageClient( "macaulay2-language-server", + "Macaulay2 Language Server", serverOptions, clientOptions);