VS Code Extension
TIP
This page is for contributing to the Oxc VS Code extension. To download the extension, see the Visual Studio Marketplace or the Open VSX Registry.
Development
Clone the oxc-vscode repository and run pnpm install.
Building and running the extension locally
There are two options for running and testing your changes to the Oxc VS Code extension.
Via command line:
- Run
pnpm buildto compile the VS Code extension and build the release version of the language server. - Run
pnpm install-extensionto install it into VS Code. - Press
Ctrl+Shift+Pand search for "Developer: Reload Window". - You are now able to manually test your changes inside VS Code.
Via VS Code itself:
- Open the
oxc-vscoderepository in VS Code. - Go to the "Run and Debug" tab in the left sidebar of your editor.
- Select the
Launch VS Code Extensionconfiguration. - Click the green play button at the top.
- This will build the VS Code extension and launch a new VS Code window with the newly built VS Code extension installed.
Testing unreleased versions of oxlint/oxfmt
Build the project in the oxc project with:
cd apps/oxlint && pnpm build-test
cd ../oxfmt && pnpm build-testThen configure the VS Code extension to use the local build via the extension settings in settings.json:
{
"oxc.path.oxlint": "/path/to/oxc/apps/oxlint/dist/cli.js",
"oxc.path.oxfmt": "/path/to/oxc/apps/oxfmt/dist/cli.js"
}Use the output channel
To see what the extension and language server are doing, use the Oxc output channel in VS Code. To get more information, enable the following extension setting in settings.json:
{
"oxc.trace.server": "verbose"
}In the language server integration for oxlint/oxfmt (for example, the oxc_language_server crate), you can use the info! or error! macros to send messages to the Oxc output channel in VS Code.
Writing a test
Depending on your changes, you should create a test. Write tests in the VS Code extension only when they are specific to VS Code. Tests for LSP communication with the tools should be added in oxlint/oxfmt or in the Rust crate oxc_language_server.
Example:
- VS Code: status bar changes
- oxlint: returned diagnostics / code actions
- oxc_language_server: workspace problems
