Skip to content

Commit b16292c

Browse files
feat: Bun-based language server (DEV only) (#2604)
1 parent 9a3059a commit b16292c

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

packages/vscode-vue/client.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
let modulePath = './dist/client';
2-
try { modulePath = require.resolve('./out/nodeClientMain'); } catch { }
3-
module.exports = require(modulePath);
1+
try {
2+
module.exports = require('./out/nodeClientMain');
3+
} catch { }
4+
5+
module.exports = require('./dist/client');

packages/vscode-vue/server.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
let modulePath = './dist/server';
2-
try { modulePath = require.resolve('@volar/vue-language-server/bin/vue-language-server'); } catch { }
3-
module.exports = require(modulePath);
1+
try {
2+
module.exports = require('@volar/vue-language-server/bin/vue-language-server');
3+
} catch { }
4+
5+
module.exports = require('./dist/server');

packages/vscode-vue/src/nodeClientMain.ts

+24-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function activate(context: vscode.ExtensionContext) {
4949
runOptions.execArgv.push("--max-old-space-size=" + maxOldSpaceSize);
5050
}
5151
const debugOptions: lsp.ForkOptions = { execArgv: ['--nolazy', '--inspect=' + port] };
52-
const serverOptions: lsp.ServerOptions = {
52+
let serverOptions: lsp.ServerOptions = {
5353
run: {
5454
module: serverModule.fsPath,
5555
transport: lsp.TransportKind.ipc,
@@ -61,6 +61,29 @@ export function activate(context: vscode.ExtensionContext) {
6161
options: debugOptions
6262
},
6363
};
64+
const bunPath: string | undefined = undefined; // path to .bun/bin/bun
65+
if (bunPath) {
66+
serverOptions = {
67+
run: {
68+
transport: {
69+
kind: lsp.TransportKind.socket,
70+
port: port + 10,
71+
},
72+
options: runOptions,
73+
command: bunPath,
74+
args: ['run', serverModule.fsPath],
75+
},
76+
debug: {
77+
transport: {
78+
kind: lsp.TransportKind.socket,
79+
port: port + 10,
80+
},
81+
options: debugOptions,
82+
command: bunPath,
83+
args: ['run', serverModule.fsPath],
84+
},
85+
};
86+
}
6487
const clientOptions: lsp.LanguageClientOptions = {
6588
middleware,
6689
documentSelector: langs.map<lsp.DocumentFilter>(lang => ({ language: lang })),

0 commit comments

Comments
 (0)