Skip to content

Commit 1b85768

Browse files
committed
Added setting to disable the language server in the VSCode extension - fixes #99
1 parent 1bec8b2 commit 1b85768

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
"type": "integer",
6363
"default": 250,
6464
"description": "[DEBUG] Specifies the debounce time limit. Lower to increase responsiveness at the cost of possibile stability issues"
65+
},
66+
"kotlin.languageServer.enabled": {
67+
"type": "boolean",
68+
"default": true,
69+
"description": "Specifies whether the language server should be used. When enabled the extension will provide code completions and linting, otherwise just syntax highlighting. Might require a reload to apply."
6570
}
6671
}
6772
}

vscode-extension-src/extension.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ import { LOG } from './logger';
1414
export async function activate(context: vscode.ExtensionContext): Promise<void> {
1515
configureLanguage();
1616

17+
const serverEnabled = vscode.workspace.getConfiguration("kotlin").get("languageServer.enabled");
18+
19+
if (serverEnabled) {
20+
activateLanguageServer(context);
21+
} else {
22+
LOG.info("Skipping language server activation since 'kotlin.languageServer.enabled' is false");
23+
}
24+
}
25+
26+
// this method is called when your extension is deactivated
27+
export function deactivate(): void {}
28+
29+
async function activateLanguageServer(context: vscode.ExtensionContext) {
1730
LOG.info('Activating Kotlin language server...');
1831
let barItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
1932
context.subscriptions.push(barItem);
@@ -78,9 +91,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
7891
barItem.dispose();
7992
}
8093

81-
// this method is called when your extension is deactivated
82-
export function deactivate(): void {}
83-
8494
function configureLanguage(): void {
8595
// Source: https://github.com/Microsoft/vscode/blob/9d611d4dfd5a4a101b5201b8c9e21af97f06e7a7/extensions/typescript/src/typescriptMain.ts#L186
8696
// License: https://github.com/Microsoft/vscode/blob/9d611d4dfd5a4a101b5201b8c9e21af97f06e7a7/extensions/typescript/OSSREADME.json

0 commit comments

Comments
 (0)