Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

extension_host: Restore project LSP settings for extensions using old API versions (#63072)

Zhuoyuan Hao (Larry Hao / 郝卓远)7eec89207ccf
diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs
index cd731372276..8f81802ad2c 100644
--- a/crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs
+++ b/crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs
@@ -56,7 +56,13 @@ impl From<SettingsLocation> for latest::SettingsLocation {
fn from(value: SettingsLocation) -> Self {
Self {
worktree_id: value.worktree_id,
- path: value.path,
+ // Passing the path here causes project settings reads to fail,
+ // since the extension passes the absolute path to the worktree,
+ // not a relative one like the settings API expects.
+ //
+ // This has been fixed in the API itself as of v0.2.0. Align the behavior
+ // here so that older extensions can also read project settings.
+ path: String::new(),
}
}
}
diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs
index 83ba2ad3dfd..88bcfeff8ba 100644
--- a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs
+++ b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs
@@ -77,7 +77,13 @@ impl From<SettingsLocation> for latest::SettingsLocation {
fn from(value: SettingsLocation) -> Self {
Self {
worktree_id: value.worktree_id,
- path: value.path,
+ // Passing the path here causes project settings reads to fail,
+ // since the extension passes the absolute path to the worktree,
+ // not a relative one like the settings API expects.
+ //
+ // This has been fixed in the API itself as of v0.2.0. Align the behavior
+ // here so that older extensions can also read project settings.
+ path: String::new(),
}
}
}