Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Build Language Server
working-directory: editors/vscode
run: pnpm run server:build:release
run: pnpm run server:build:debug

- name: Compile VSCode
working-directory: editors/vscode
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/editors/vscode/dist/*.js"],
"env": {
"SERVER_PATH_DEV": "${workspaceRoot}/target/debug/oxc_language_server",
"SERVER_PATH_DEV": "${workspaceRoot}/editors/vscode/target/debug/oxc_language_server",
"RUST_LOG": "debug"
}
},
Expand Down
16 changes: 14 additions & 2 deletions editors/vscode/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { defineConfig } from '@vscode/test-cli';
import { existsSync, mkdirSync } from 'node:fs';
import path from 'node:path';

if (!existsSync('./test_workspace')) {
mkdirSync('./test_workspace');
}

const ext = process.platform === 'win32' ? '.exe' : '';

export default defineConfig({
files: 'out/**/*.spec.js',
workspaceFolder: './test_workspace',
tests: [{
files: 'out/**/*.spec.js',
workspaceFolder: './test_workspace',
launchArgs: [
// This disables all extensions except the one being testing
'--disable-extensions',
],
env: {
SERVER_PATH_DEV: path.resolve(import.meta.dirname, `./target/debug/oxc_language_server${ext}`),
},
}],
});
5 changes: 5 additions & 0 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ This is the linter for Oxc. The currently supported features are listed below.
- Command to fix all auto-fixable content within the current text editor.
- Support for `source.fixAll.oxc` as a code action provider. Configure this in your settings `editor.codeActionsOnSave`
to automatically apply fixes when saving the file.

## Testing

Run `pnpm server:build:debug` to build the language server.
After that, you can test the vscode plugin + E2E Tests with `pnm test`
4 changes: 3 additions & 1 deletion editors/vscode/client/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ suite('commands', () => {

suiteTeardown(async () => {
const edit = new WorkspaceEdit();
edit.deleteFile(fileUri);
edit.deleteFile(fileUri, {
ignoreIfNotExists: true,
});
await workspace.applyEdit(edit);
});

Expand Down
2 changes: 1 addition & 1 deletion editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"watch": "pnpm run compile --watch",
"package": "vsce package --no-dependencies -o oxc_language_server.vsix",
"install-extension": "code --install-extension oxc_language_server.vsix --force",
"server:build:debug": "cargo build -p oxc_language_server",
"server:build:debug": "cross-env CARGO_TARGET_DIR=./target cargo build -p oxc_language_server",
"server:build:release": "cross-env CARGO_TARGET_DIR=./target cargo build -p oxc_language_server --release",
"lint": "npx oxlint --config=oxlint.json --tsconfig=tsconfig.json",
"test": "esbuild client/*.spec.ts --bundle --outdir=out --external:vscode --format=cjs --platform=node --target=node16 --minify --sourcemap && vscode-test",
Expand Down