-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
32 lines (29 loc) · 876 Bytes
/
index.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
import {} from '@hydrooj/ui-default';
import alias from 'esbuild-plugin-alias';
import { Context, SystemModel, UiContextBase } from 'hydrooj';
declare module 'hydrooj' {
interface UiContextBase {
lspHost?: string;
}
}
export const name = 'lsp-client';
export function apply(ctx: Context) {
Hydro.ui.esbuildPlugins ||= [];
Hydro.ui.esbuildPlugins.push(
alias({
vscode: require.resolve('@codingame/monaco-languageclient/lib/vscode-compatibility'),
}),
);
Object.defineProperty(UiContextBase, 'lspHost', {
configurable: true,
enumerable: true,
get() {
return SystemModel.get('language-server.host') || 'wss://hydro.ac';
},
});
ctx.on('dispose', () => {
Object.defineProperty(UiContextBase, 'lspHost', {
enumerable: false,
});
});
}