Skip to content

Commit e5ffb8d

Browse files
committed
feat: Implement batch linting for multiple URIs in TsGoLinter
- Added `lint_batch` method to `TsgoLinter` for batch linting multiple URIs. - Enhanced `lint_source` to accept multiple paths and return diagnostics grouped by file. - Introduced logging for batch linting metrics and diagnostics. - Updated `WorkspaceWorker` to support workspace-wide linting based on user configuration. - Added support for workspace mode in VSCode extension configuration. - Implemented logging bridge to forward log messages to LSP client. - Enhanced error handling and diagnostics reporting in the linter. - Updated `Options` struct to include supported extensions for linting. - Refactored code for better clarity and maintainability.
1 parent 010c88f commit e5ffb8d

File tree

22 files changed

+1236
-158
lines changed

22 files changed

+1236
-158
lines changed

.vscode/launch.json

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
"runtimeExecutable": "${execPath}",
1010
"args": ["--extensionDevelopmentPath=${workspaceFolder}/editors/vscode"],
1111
"sourceMaps": true,
12-
"outFiles": ["${workspaceFolder}/editors/vscode/dist/*.js"],
12+
"outFiles": ["${workspaceFolder}/editors/vscode/out/**/*.js"],
1313
"env": {
1414
"SERVER_PATH_DEV": "${workspaceRoot}/editors/vscode/target/debug/oxc_language_server",
1515
"RUST_LOG": "debug"
16-
}
16+
},
17+
"preLaunchTask": "build: extension+rust"
1718
},
1819
{
1920
"type": "lldb",
@@ -28,9 +29,59 @@
2829
"name": "oxlint",
2930
"kind": "bin"
3031
}
31-
}
32+
},
33+
"preLaunchTask": "rust: cargo test --no-run"
3234
// "args": ["--ARGS-TO-OXLINT"],
3335
// "cwd": "PATH-TO-TEST-PROJECT"
36+
},
37+
{
38+
"type": "lldb",
39+
"request": "attach",
40+
"name": "Rust LS Attach",
41+
"pid": "${command:pickProcess}",
42+
"stopOnEntry": false,
43+
"sourceLanguages": ["rust"]
44+
},
45+
{
46+
"type": "lldb",
47+
"request": "launch",
48+
"name": "Language Server (Socket)",
49+
"cargo": {
50+
"args": ["build", "--package", "oxc_language_server"],
51+
"filter": {
52+
"name": "oxc_language_server",
53+
"kind": "bin"
54+
}
55+
},
56+
"env": {
57+
"OXC_LS_LISTEN": "unix:/tmp/oxc_ls.sock",
58+
"RUST_LOG": "debug"
59+
},
60+
"sourceLanguages": ["rust"],
61+
"stopOnEntry": false
62+
},
63+
{
64+
"type": "extensionHost",
65+
"request": "launch",
66+
"name": "Launch Client (External LS)",
67+
"runtimeExecutable": "${execPath}",
68+
"args": ["--extensionDevelopmentPath=${workspaceFolder}/editors/vscode"],
69+
"sourceMaps": true,
70+
"outFiles": ["${workspaceFolder}/editors/vscode/out/**/*.js"],
71+
"env": {
72+
"OXC_LS_CONNECT": "unix:/tmp/oxc_ls.sock",
73+
"RUST_LOG": "debug"
74+
},
75+
"preLaunchTask": "extension: compile"
76+
},
77+
78+
]
79+
,
80+
"compounds": [
81+
{
82+
"name": "External LS Debug",
83+
"configurations": ["Language Server (Socket)", "Launch Client (External LS)"],
84+
"stopAll": true
3485
}
3586
]
3687
}

.vscode/tasks.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@
5858
"$tsc"
5959
]
6060
},
61+
{
62+
"label": "extension: compile",
63+
"type": "npm",
64+
"script": "compile",
65+
"options": {
66+
"cwd": "${workspaceFolder}/editors/vscode"
67+
},
68+
"group": "build",
69+
"presentation": {
70+
"panel": "dedicated",
71+
"reveal": "silent",
72+
"clear": true
73+
},
74+
"problemMatcher": [
75+
"$tsc"
76+
]
77+
},
6178
{
6279
"type": "shell",
6380
"command": "cd ./editors/vscode && npm run watch",
@@ -71,6 +88,17 @@
7188
"panel": "dedicated",
7289
"reveal": "never"
7390
}
91+
},
92+
{
93+
"label": "build: extension+rust",
94+
"dependsOn": [
95+
"extension: compile",
96+
"rust: cargo test --no-run"
97+
],
98+
"problemMatcher": [],
99+
"group": {
100+
"kind": "build"
101+
}
74102
}
75103
]
76104
}

Cargo.lock

Lines changed: 110 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ oxc_ast_macros.opt-level = 1
252252
insta.opt-level = 3
253253
similar.opt-level = 3
254254

255+
# Re-enable debuginfo for the language server specifically so Rust breakpoints bind when
256+
# debugging via the "Language Server (Socket)" launch configuration. The top-level
257+
# `[profile.dev] debug = false` disables DWARF info globally which caused LLDB to only
258+
# show assembly and ignore source breakpoints in this binary.
259+
[profile.dev.package.oxc_language_server]
260+
debug = true
261+
opt-level = 0
262+
255263
[profile.release.package.oxc_playground_napi]
256264
opt-level = 'z'
257265

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ For more information, check out our website at [oxc.rs](https://oxc.rs).
2828

2929
<sub>* Oxidation is the chemical process that creates rust</sub>
3030

31+
## Workspace-wide Linting (Experimental)
32+
33+
Oxlint now supports an optional workspace-wide linting mode in the VS Code extension.
34+
35+
When enabled, all lintable files in the workspace are analyzed eagerly (not only the ones you open). This provides:
36+
37+
- Immediate visibility of problems across the entire codebase in the Problems panel
38+
- Automatic incremental re-linting of changed files via LSP file watchers
39+
- Respect for `.gitignore` and oxlint ignore patterns
40+
- High performance through internal parallelization and batching
41+
42+
Enable it via the VS Code setting: `oxc.lint.workspaceMode`.
43+
44+
Notes:
45+
- This feature is currently experimental and disabled by default.
46+
- Designed to scale to large monorepos (thousands of files) while remaining fast.
47+
- Only re-lints changed files after the initial scan to minimize overhead.
48+
- Supports common JS/TS framework file extensions (js, mjs, cjs, jsx, ts, mts, cts, tsx, vue, svelte, astro).
49+
50+
Planned improvements include progress reporting during the initial scan and additional configurability (custom include/exclude globs).
51+
3152
## 🏗️ Design Principles
3253

3354
- **Performance**: Through rigorous performance engineering.

crates/oxc_language_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ papaya = { workspace = true }
3838
rustc-hash = { workspace = true }
3939
serde = { workspace = true, features = ["derive"] }
4040
serde_json = { workspace = true }
41-
tokio = { workspace = true, features = ["rt-multi-thread", "io-std", "macros"] }
41+
tokio = { workspace = true, features = ["rt-multi-thread", "io-std", "io-util", "macros", "net"] }
4242
tower-lsp-server = { workspace = true, features = ["proposed"] }
4343

4444
[dev-dependencies]

0 commit comments

Comments
 (0)