Skip to content

Commit

Permalink
fix path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarlevin committed Oct 16, 2024
1 parent c3c8ab3 commit bbcb101
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
},
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions src/lsp-server/completions/get-completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export async function getCompletions(
newText: snippetCompletion.insertText,
range: range,
};
snippetCompletion.kind = CompletionItemKind.TypeParameter;
completionItems.push(snippetCompletion);
} else {
const snippetCompletion: CompletionItem = {
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/lsp-server/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bbcb101

Please sign in to comment.