/
browserClientMain.ts
37 lines (33 loc) · 1 KB
/
browserClientMain.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as vscode from 'vscode';
import * as lsp from 'vscode-languageclient/browser';
import { activate as commonActivate, deactivate as commonDeactivate } from './common';
export function activate(context: vscode.ExtensionContext) {
return commonActivate(context, async (
id,
name,
documentSelector,
initOptions,
) => {
const serverMain = vscode.Uri.joinPath(context.extensionUri, 'dist/browser/server.js');
const worker = new Worker(serverMain.toString());
const clientOptions: lsp.LanguageClientOptions = {
documentSelector,
initializationOptions: initOptions,
progressOnInitialization: true,
synchronize: {
fileEvents: vscode.workspace.createFileSystemWatcher('{**/*.vue,**/*.md,**/*.html,**/*.js,**/*.jsx,**/*.ts,**/*.tsx,**/*.json}')
}
};
const client = new lsp.LanguageClient(
id,
name,
clientOptions,
worker,
);
await client.start();
return client;
}, 'browser');
}
export function deactivate(): Thenable<any> | undefined {
return commonDeactivate();
}