From 7fcc4ba3438e3ea8a2d1c436090a88fc8c853b6c Mon Sep 17 00:00:00 2001 From: YangChengxxyy <45156288+YangChengxxyy@users.noreply.github.com> Date: Thu, 7 May 2026 16:58:17 +0800 Subject: [PATCH] =?UTF-8?q?eslint:=20Fix=20`workspaceFolder.uri`=20sent=20?= =?UTF-8?q?as=20raw=20path=20instead=20of=20`file:/=E2=80=A6=20(#54383)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …/` URI The ESLint adapter was sending `workspaceFolder.uri` as a raw filesystem path (e.g. `/Users/foo/project`) instead of a proper `file://` URI (e.g. `file:///Users/foo/project`). This caused the vscode-eslint server's `workingDirectory: { mode: "auto" }` to fail when resolving the workspace root, falling back to the linted file's directory as the working directory. As a result, `eslint-import-resolver-typescript` could not locate `tsconfig.json`, breaking path alias resolution for rules like `import/order` — producing different lint results compared to VS Code. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A or Added/Fixed/Improved ... --- crates/languages/src/eslint.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/languages/src/eslint.rs b/crates/languages/src/eslint.rs index 7ef55c64ef1b35fa42f35e779c4cf46b30a18ee5..e9b94380191731e044f79863db5acba989310f3c 100644 --- a/crates/languages/src/eslint.rs +++ b/crates/languages/src/eslint.rs @@ -254,7 +254,9 @@ impl LspAdapter for EsLintLspAdapter { "mode": "auto" }, "workspaceFolder": { - "uri": worktree_root, + "uri": Uri::from_file_path(worktree_root) + .map(|uri| uri.as_str().to_owned()) + .unwrap_or_default(), "name": worktree_root.file_name() .unwrap_or(worktree_root.as_os_str()) .to_string_lossy(),