Skip to content

Commit

Permalink
Restrict to desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
davidxuang committed Mar 11, 2024
1 parent b9bd53d commit e27f716
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/extension-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,34 @@ export function activate(context: vscode.ExtensionContext): void {
commandRegistrar.register('citeWeb', addWebCiteFactory);

configureLuaLibrary(
"Scribunto",
vscode.workspace.getConfiguration("wikitext").get<string>("scopedLuaIntegration") !== "disabled"
'Scribunto',
vscode.workspace.getConfiguration('wikitext').get<string>('scopedLuaIntegration') !== 'disabled'
);
}

export function deactivate(): void {
console.log("Extension is inactive.");

if (vscode.workspace.getConfiguration("wikitext").get<string>("scopedLuaIntegration") !== "enabled") {
configureLuaLibrary("Scribunto", false);
if (vscode.workspace.getConfiguration('wikitext').get<string>('scopedLuaIntegration') !== 'enabled') {
configureLuaLibrary('Scribunto', false);
}
}

export function configureLuaLibrary(folder: string, enable: boolean) {
const extensionId = "rowewilsonfrederiskholme.wikitext";
// https://github.com/LuaLS/lua-language-server/issues/1689
if (vscode.env.uiKind !== vscode.UIKind.Desktop) {
return;
}

const extensionId = 'rowewilsonfrederiskholme.wikitext';
const extensionPath = vscode.extensions.getExtension(extensionId)?.extensionPath;
if (extensionPath === undefined) {
return;
}

const folderPath = path.join(extensionPath, "EmmyLua", folder);
const config = vscode.workspace.getConfiguration("Lua");
let library: string[] | undefined = config.get("workspace.library");
const folderPath = path.join(extensionPath, 'EmmyLua', folder);
const config = vscode.workspace.getConfiguration('Lua');
let library: string[] | undefined = config.get('workspace.library');
if (library === undefined) {
return;
}
Expand All @@ -75,6 +80,6 @@ export function configureLuaLibrary(folder: string, enable: boolean) {
else if (index >= 0) {
library.splice(index, 1);
}
config.update("workspace.library", library, false);
config.update('workspace.library', library, false);
}
}

0 comments on commit e27f716

Please sign in to comment.