Files
oxc-project__oxc/.vscode/settings.json
overlookmotel 94d815d7ff build(vscode): VS Code settings use --all-features (#26259)
Some code in Oxc repo is Cargo feature-gated - most notably all the code in `oxc_data_structures`, but also bits and pieces all over the place.

Currently, when using VS Code, Rust Analyzer only gives you jump-to-definition etc on code which is part of default features set. Code that's gated behind a Cargo feature is "dark" to RA. Ditto `cargo check` and Clippy which are run on save in VS Code. This makes working on feature-gated code slow and annoying.

This PR alters the default VS Code settings for the repo to run Rust Analyzer, check, and Clippy within VS Code with the equivalent of `--all-features`. This matches what `just check` / `cargo ck` and `just lint` do.

This also has a beneficial side effect:

RA shares `target` directory with the terminal. In a workflow where you're using RA and also running `just check` / `just lint` regularly (which agents do), previously each would compile separately with different settings. Now they all use the same settings, so share the same build artifacts. This reduces both compile/check/lint time, and reduces the speed at which `target` directory grows.
2026-09-03 10:59:04 +00:00

51 lines
2.1 KiB
JSON

{
// "oxc.path.oxlint": "apps/oxlint/dist/cli.js", // debug with local oxlint build
"oxc.typeAware": true,
"oxc.configPath": "oxlintrc.json",
"oxc.unusedDisableDirectives": "deny",
// "oxc.path.oxfmt": "apps/oxfmt/dist/cli.js", // debug with local oxfmt build
"oxc.fmt.configPath": "oxfmtrc.jsonc",
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file", // oxfmt can only format whole files
"editor.codeActionsOnSave": {
"source.organizeImports": "never" // let oxfmt handle import organization
},
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
// Analyze and check with all features enabled, matching the `ck` and `lint` aliases
// in `.cargo/config.toml` which `just check` / `just lint` / CI use.
// Without this, rust-analyzer only sees default features, so feature-gated code gets
// no completions, no jump-to-definition, and no diagnostics.
// `rust-analyzer.check.features` defaults to this setting, so it covers `cargo check`
// and `cargo clippy` on save too.
"rust-analyzer.cargo.features": "all",
// Exclude huge gitignored submodules and `node_modules` from rust-analyzer's file scan -
// it does not respect `.gitignore`.
// Skipping these directories (500k+ files) speeds up server startup and reduces memory use.
// Paths are workspace-root relative. Globs are not supported, so each is listed explicitly.
"rust-analyzer.files.exclude": [
"apps/oxfmt/node_modules",
"crates/oxc_formatter_tests/prettier",
"apps/oxlint/conformance/submodules",
"apps/oxlint/node_modules",
"apps/shared/node_modules",
"napi/minify/node_modules",
"napi/parser/node_modules",
"napi/playground/node_modules",
"napi/transform/node_modules",
"napi/transform-react/node_modules",
"node_modules",
"npm/oxfmt/node_modules",
"npm/oxlint/node_modules",
"tasks/e2e/node_modules",
"tasks/compat_data/node_modules",
"tasks/coverage/test262",
"tasks/coverage/babel",
"tasks/coverage/typescript",
"tasks/coverage/estree-conformance",
"tasks/transform_conformance/node_modules"
]
}