-
Notifications
You must be signed in to change notification settings - Fork 22
fix: implement LSP initialization and configuration handlers #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -198,6 +198,30 @@ impl zed::Extension for AngularExtension { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn language_server_initialization_options( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &mut self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _language_server_id: &zed::LanguageServerId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| worktree: &zed::Worktree, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Result<Option<serde_json::Value>> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let initialization_options = LspSettings::for_worktree(Self::LANGUAGE_SERVER_ID, worktree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .ok() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .and_then(|settings| settings.initialization_options) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .unwrap_or_else(|| serde_json::json!({})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ok(Some(initialization_options)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+206
to
+210
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn language_server_workspace_configuration( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &mut self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _language_server_id: &zed::LanguageServerId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| worktree: &zed::Worktree, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Result<Option<serde_json::Value>> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let settings = LspSettings::for_worktree(Self::LANGUAGE_SERVER_ID, worktree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .ok() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .and_then(|settings| settings.settings) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .unwrap_or_else(|| serde_json::json!({})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+203
to
+221
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _language_server_id: &zed::LanguageServerId, | |
| worktree: &zed::Worktree, | |
| ) -> Result<Option<serde_json::Value>> { | |
| let initialization_options = LspSettings::for_worktree(Self::LANGUAGE_SERVER_ID, worktree) | |
| .ok() | |
| .and_then(|settings| settings.initialization_options) | |
| .unwrap_or_else(|| serde_json::json!({})); | |
| Ok(Some(initialization_options)) | |
| } | |
| fn language_server_workspace_configuration( | |
| &mut self, | |
| _language_server_id: &zed::LanguageServerId, | |
| worktree: &zed::Worktree, | |
| ) -> Result<Option<serde_json::Value>> { | |
| let settings = LspSettings::for_worktree(Self::LANGUAGE_SERVER_ID, worktree) | |
| .ok() | |
| .and_then(|settings| settings.settings) | |
| .unwrap_or_else(|| serde_json::json!({})); | |
| language_server_id: &zed::LanguageServerId, | |
| worktree: &zed::Worktree, | |
| ) -> Result<Option<serde_json::Value>> { | |
| let initialization_options = | |
| LspSettings::for_worktree(language_server_id, worktree) | |
| .ok() | |
| .and_then(|settings| settings.initialization_options) | |
| .unwrap_or_else(|| serde_json::json!({})); | |
| Ok(Some(initialization_options)) | |
| } | |
| fn language_server_workspace_configuration( | |
| &mut self, | |
| language_server_id: &zed::LanguageServerId, | |
| worktree: &zed::Worktree, | |
| ) -> Result<Option<serde_json::Value>> { | |
| let settings = | |
| LspSettings::for_worktree(language_server_id, worktree) | |
| .ok() | |
| .and_then(|settings| settings.settings) | |
| .unwrap_or_else(|| serde_json::json!({})); |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LspSettings::for_worktree(...).ok() discards any error and silently falls back to {}. If settings parsing fails, returning {} may hide the underlying issue; consider propagating the error or logging it before falling back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ignores the
language_server_idargument and hard-codesSelf::LANGUAGE_SERVER_IDwhen reading per-worktree LSP settings. Using the providedlanguage_server_idkeeps this method correct if the server id ever differs (and is consistent withread_user_settings).