-
Notifications
You must be signed in to change notification settings - Fork 3
/
extension.ts
46 lines (41 loc) · 1.24 KB
/
extension.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
38
39
40
41
42
43
44
45
46
import * as path from 'path';
import { workspace, ExtensionContext } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node';
let client: LanguageClient;
export async function activate(context: ExtensionContext) {
const serverDll = path.join(context.extensionPath, 'server', 'Facility.LanguageServer.dll');
// const serverDll = path.join(
// context.extensionPath,
// '..',
// 'FacilityLanguageServer',
// 'src',
// 'Facility.LanguageServer',
// 'bin',
// 'Debug',
// 'net6.0',
// 'Facility.LanguageServer.dll'
// );
const serverOptions: ServerOptions = {
run: { command: 'dotnet', args: [serverDll, '-lsp'] },
debug: { command: 'dotnet', args: [serverDll, '-lsp'] },
};
const clientOptions: LanguageClientOptions = {
documentSelector: [
{
pattern: '**/*.fsd',
},
],
synchronize: {
configurationSection: 'languageServerFsd',
fileEvents: workspace.createFileSystemWatcher('**/*.fsd'),
},
};
client = new LanguageClient('languageServerFsd', 'Facility Service Definition', serverOptions, clientOptions);
await client.start();
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}