diff --git a/.vscode/launch.json b/.vscode/launch.json index feee94a..62a3b21 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -23,7 +23,7 @@ "type": "node", "request": "attach", "name": "Attach to LSP Only", - "port": 6009, + "port": 6019, "restart": true, "outFiles": ["${workspaceRoot}/out/lsp-server.js"] }, diff --git a/src/extension.ts b/src/extension.ts index f6cd94e..d99a6f2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -48,7 +48,7 @@ export async function activate(context: ExtensionContext) { console.log("PreTeXt Tools schema configuration changed"); // Set schema for pretext files: try { - utils.setSchema(); + utils.setSchema(context); } catch { console.log("Error setting schema"); } @@ -74,7 +74,7 @@ export async function activate(context: ExtensionContext) { // Set schema for pretext files: // NB this is done for the XML extension for validation. Also done in the LSP for completions. Eventually this will all be in the LSP. try { - utils.setSchema(); + utils.setSchema(context); } catch { console.log("Error setting schema"); } diff --git a/src/lsp-server/completions/get-completions.ts b/src/lsp-server/completions/get-completions.ts index 1a32826..2401a14 100644 --- a/src/lsp-server/completions/get-completions.ts +++ b/src/lsp-server/completions/get-completions.ts @@ -139,6 +139,7 @@ export async function getCompletions( newText: snippetCompletion.insertText, range: range, }; + snippetCompletion.kind = CompletionItemKind.TypeParameter; completionItems.push(snippetCompletion); } else { const snippetCompletion: CompletionItem = { @@ -183,6 +184,7 @@ export async function getCompletions( newText: snippetCompletion.insertText, range: range, }; + snippetCompletion.kind = CompletionItemKind.TypeParameter; completionItems.push(snippetCompletion); } else { // Give a very basic snippet completion since we haven't implemented a more specific one in ELEMENTS. diff --git a/src/lsp-server/schema.ts b/src/lsp-server/schema.ts index 965cb2f..7b21ccd 100644 --- a/src/lsp-server/schema.ts +++ b/src/lsp-server/schema.ts @@ -27,6 +27,7 @@ function setSchema(schemaConfig: { versionName: string; customPath: string }) { if (schemaPath === "") { const extensionPath = path.resolve(__dirname); let schemaDir = path.join(extensionPath, "assets", "schema"); + console.log("in LSP, extension path is: ", extensionPath); switch (schemaConfig.versionName) { case "Stable": schemaPath = path.join(schemaDir, "pretext.rng"); diff --git a/src/utils.ts b/src/utils.ts index b2f8a12..741d106 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -160,13 +160,15 @@ function setSpellCheckConfig() { cSpellConfig.update("languageSettings", languageSettings); } -function setSchema() { +function setSchema(context: vscode.ExtensionContext) { let schemaPath: string | undefined = vscode.workspace .getConfiguration("pretext-tools") .get("schema.customPath"); if (schemaPath === "") { - const extensionPath = path.resolve(__dirname); + //get the extensions installed path: + const extensionPath = context.extensionPath; + console.log("Extension path is: ", extensionPath); let schemaDir = path.join(extensionPath, "assets", "schema"); const schemaConfig = vscode.workspace .getConfiguration("pretext-tools")