Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/angular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 +203 to +210
Copy link

Copilot AI Feb 25, 2026

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_id argument and hard-codes Self::LANGUAGE_SERVER_ID when reading per-worktree LSP settings. Using the provided language_server_id keeps this method correct if the server id ever differs (and is consistent with read_user_settings).

Copilot uses AI. Check for mistakes.
Comment on lines +206 to +210
Copy link

Copilot AI Feb 25, 2026

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 (e.g., malformed user settings) and silently falls back to {}. Consider propagating the error (using ?) or at least emitting a log/warning so configuration problems don’t become hard-to-diagnose runtime behavior.

Copilot uses AI. Check for mistakes.
}

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
Copy link

Copilot AI Feb 25, 2026

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_id argument and hard-codes Self::LANGUAGE_SERVER_ID when reading per-worktree LSP settings. Using the provided language_server_id avoids accidental mismatches and keeps the implementation consistent with other trait methods that accept a server id.

Suggested change
_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 uses AI. Check for mistakes.
Ok(Some(settings))
Comment on lines +218 to +222
Copy link

Copilot AI Feb 25, 2026

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.

Copilot uses AI. Check for mistakes.
}

fn label_for_completion(
&self,
_language_server_id: &zed::LanguageServerId,
Expand Down
Loading