project: Fine-grained language server management (#23805)

Closes #ISSUE
https://github.com/zed-industries/zed/pull/23804
Release Notes:

- Improved detection of project roots for use by language servers.
This commit is contained in:
Piotr Osiewicz 2025-01-30 09:35:36 +01:00 committed by GitHub
parent b62812c49e
commit e662e819fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 2227 additions and 936 deletions

View file

@ -95,26 +95,17 @@ impl Render for QuickActionBar {
show_git_blame_gutter,
auto_signature_help_enabled,
inline_completions_enabled,
) = {
let editor = editor.read(cx);
let selection_menu_enabled = editor.selection_menu_enabled(cx);
let inlay_hints_enabled = editor.inlay_hints_enabled();
let supports_inlay_hints = editor.supports_inlay_hints(cx);
let git_blame_inline_enabled = editor.git_blame_inline_enabled();
let show_git_blame_gutter = editor.show_git_blame_gutter();
let auto_signature_help_enabled = editor.auto_signature_help_enabled(cx);
let inline_completions_enabled = editor.inline_completions_enabled(cx);
) = editor.update(cx, |editor, cx| {
(
selection_menu_enabled,
inlay_hints_enabled,
supports_inlay_hints,
git_blame_inline_enabled,
show_git_blame_gutter,
auto_signature_help_enabled,
inline_completions_enabled,
editor.selection_menu_enabled(cx),
editor.inlay_hints_enabled(),
editor.supports_inlay_hints(cx),
editor.git_blame_inline_enabled(),
editor.show_git_blame_gutter(),
editor.auto_signature_help_enabled(cx),
editor.inline_completions_enabled(cx),
)
};
});
let focus_handle = editor.read(cx).focus_handle(cx);
@ -462,16 +453,19 @@ impl ToolbarItemView for QuickActionBar {
if let Some(editor) = active_item.downcast::<Editor>() {
let mut inlay_hints_enabled = editor.read(cx).inlay_hints_enabled();
let mut supports_inlay_hints = editor.read(cx).supports_inlay_hints(cx);
let mut supports_inlay_hints =
editor.update(cx, |this, cx| this.supports_inlay_hints(cx));
self._inlay_hints_enabled_subscription =
Some(cx.observe(&editor, move |_, editor, cx| {
let editor = editor.read(cx);
let new_inlay_hints_enabled = editor.inlay_hints_enabled();
let new_supports_inlay_hints = editor.supports_inlay_hints(cx);
let should_notify = inlay_hints_enabled != new_inlay_hints_enabled
|| supports_inlay_hints != new_supports_inlay_hints;
inlay_hints_enabled = new_inlay_hints_enabled;
supports_inlay_hints = new_supports_inlay_hints;
let mut should_notify = false;
editor.update(cx, |editor, cx| {
let new_inlay_hints_enabled = editor.inlay_hints_enabled();
let new_supports_inlay_hints = editor.supports_inlay_hints(cx);
should_notify = inlay_hints_enabled != new_inlay_hints_enabled
|| supports_inlay_hints != new_supports_inlay_hints;
inlay_hints_enabled = new_inlay_hints_enabled;
supports_inlay_hints = new_supports_inlay_hints;
});
if should_notify {
cx.notify()
}