Skip to content

Commit 410b8d6

Browse files
committedMar 28, 2025·
test(editor): use debug build of the language server (#10083)
closes #10064
1 parent c0e5251 commit 410b8d6

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed
 

‎.github/workflows/ci_vscode.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949

5050
- name: Build Language Server
5151
working-directory: editors/vscode
52-
run: pnpm run server:build:release
52+
run: pnpm run server:build:debug
5353

5454
- name: Compile VSCode
5555
working-directory: editors/vscode

‎.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"sourceMaps": true,
1212
"outFiles": ["${workspaceFolder}/editors/vscode/dist/*.js"],
1313
"env": {
14-
"SERVER_PATH_DEV": "${workspaceRoot}/target/debug/oxc_language_server",
14+
"SERVER_PATH_DEV": "${workspaceRoot}/editors/vscode/target/debug/oxc_language_server",
1515
"RUST_LOG": "debug"
1616
}
1717
},

‎editors/vscode/.vscode-test.mjs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
import { defineConfig } from '@vscode/test-cli';
22
import { existsSync, mkdirSync } from 'node:fs';
3+
import path from 'node:path';
34

45
if (!existsSync('./test_workspace')) {
56
mkdirSync('./test_workspace');
67
}
78

9+
const ext = process.platform === 'win32' ? '.exe' : '';
10+
811
export default defineConfig({
9-
files: 'out/**/*.spec.js',
10-
workspaceFolder: './test_workspace',
12+
tests: [{
13+
files: 'out/**/*.spec.js',
14+
workspaceFolder: './test_workspace',
15+
launchArgs: [
16+
// This disables all extensions except the one being testing
17+
'--disable-extensions',
18+
],
19+
env: {
20+
SERVER_PATH_DEV: path.resolve(import.meta.dirname, `./target/debug/oxc_language_server${ext}`),
21+
},
22+
}],
1123
});

‎editors/vscode/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ This is the linter for Oxc. The currently supported features are listed below.
1919
- Command to fix all auto-fixable content within the current text editor.
2020
- Support for `source.fixAll.oxc` as a code action provider. Configure this in your settings `editor.codeActionsOnSave`
2121
to automatically apply fixes when saving the file.
22+
23+
## Testing
24+
25+
Run `pnpm server:build:debug` to build the language server.
26+
After that, you can test the vscode plugin + E2E Tests with `pnm test`

‎editors/vscode/client/extension.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ suite('commands', () => {
1616

1717
suiteTeardown(async () => {
1818
const edit = new WorkspaceEdit();
19-
edit.deleteFile(fileUri);
19+
edit.deleteFile(fileUri, {
20+
ignoreIfNotExists: true,
21+
});
2022
await workspace.applyEdit(edit);
2123
});
2224

‎editors/vscode/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"watch": "pnpm run compile --watch",
144144
"package": "vsce package --no-dependencies -o oxc_language_server.vsix",
145145
"install-extension": "code --install-extension oxc_language_server.vsix --force",
146-
"server:build:debug": "cargo build -p oxc_language_server",
146+
"server:build:debug": "cross-env CARGO_TARGET_DIR=./target cargo build -p oxc_language_server",
147147
"server:build:release": "cross-env CARGO_TARGET_DIR=./target cargo build -p oxc_language_server --release",
148148
"lint": "npx oxlint --config=oxlint.json --tsconfig=tsconfig.json",
149149
"test": "esbuild client/*.spec.ts --bundle --outdir=out --external:vscode --format=cjs --platform=node --target=node16 --minify --sourcemap && vscode-test",

0 commit comments

Comments
 (0)
Please sign in to comment.