@@ -7695,7 +7695,7 @@ impl Editor {
#[ztracing::instrument(skip_all)]
fn refresh_outline_symbols_at_cursor(&mut self, cx: &mut Context<Editor>) {
- if !self.mode.is_full() {
+ if !self.lsp_data_enabled() {
return;
}
let cursor = self.selections.newest_anchor().head();
@@ -17079,13 +17079,17 @@ impl Editor {
}
fn refresh_runnables(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Task<()> {
- if !EditorSettings::get_global(cx).gutter.runnables || !self.enable_runnables {
+ if !self.mode().is_full()
+ || !EditorSettings::get_global(cx).gutter.runnables
+ || !self.enable_runnables
+ {
self.clear_tasks();
return Task::ready(());
}
let project = self.project().map(Entity::downgrade);
let task_sources = self.lsp_task_sources(cx);
let multi_buffer = self.buffer.downgrade();
+ let lsp_data_enabled = self.lsp_data_enabled();
cx.spawn_in(window, async move |editor, cx| {
cx.background_executor().timer(UPDATE_DEBOUNCE).await;
let Some(project) = project.and_then(|p| p.upgrade()) else {
@@ -17101,20 +17105,27 @@ impl Editor {
if hide_runnables {
return;
}
- let new_rows =
- cx.background_spawn({
+ let new_rows = cx
+ .background_spawn({
let snapshot = display_snapshot.clone();
async move {
- Self::fetch_runnable_ranges(&snapshot, Anchor::min()..Anchor::max())
+ snapshot
+ .buffer_snapshot()
+ .runnable_ranges(Anchor::min()..Anchor::max())
+ .collect()
}
})
- .await;
- let Ok(lsp_tasks) =
- cx.update(|_, cx| crate::lsp_tasks(project.clone(), &task_sources, None, cx))
- else {
- return;
+ .await;
+ let lsp_tasks = if lsp_data_enabled {
+ let Ok(lsp_tasks) =
+ cx.update(|_, cx| crate::lsp_tasks(project.clone(), &task_sources, None, cx))
+ else {
+ return;
+ };
+ lsp_tasks.await
+ } else {
+ Vec::new()
};
- let lsp_tasks = lsp_tasks.await;
let Ok(mut lsp_tasks_by_rows) = cx.update(|_, cx| {
lsp_tasks
@@ -17195,12 +17206,6 @@ impl Editor {
.ok();
})
}
- fn fetch_runnable_ranges(
- snapshot: &DisplaySnapshot,
- range: Range<Anchor>,
- ) -> Vec<(Range<MultiBufferOffset>, language::RunnableRange)> {
- snapshot.buffer_snapshot().runnable_ranges(range).collect()
- }
fn runnable_rows(
project: Entity<Project>,
@@ -19519,7 +19524,7 @@ impl Editor {
}
pub fn diagnostics_enabled(&self) -> bool {
- self.diagnostics_enabled && self.mode.is_full()
+ self.diagnostics_enabled && self.lsp_data_enabled()
}
pub fn inline_diagnostics_enabled(&self) -> bool {
@@ -19683,10 +19688,7 @@ impl Editor {
// `ActiveDiagnostic::All` is a special mode where editor's diagnostics are managed by the external view,
// skip any LSP updates for it.
- if self.active_diagnostics == ActiveDiagnostic::All
- || !self.mode().is_full()
- || !self.diagnostics_enabled()
- {
+ if self.active_diagnostics == ActiveDiagnostic::All || !self.diagnostics_enabled() {
return None;
}
let pull_diagnostics_settings = ProjectSettings::get_global(cx)
@@ -25552,13 +25554,17 @@ impl Editor {
}
}
+ fn lsp_data_enabled(&self) -> bool {
+ self.enable_lsp_data && self.mode().is_full()
+ }
+
fn update_lsp_data(
&mut self,
for_buffer: Option<BufferId>,
window: &mut Window,
cx: &mut Context<'_, Self>,
) {
- if !self.enable_lsp_data {
+ if !self.lsp_data_enabled() {
return;
}
@@ -25572,7 +25578,7 @@ impl Editor {
}
fn register_visible_buffers(&mut self, cx: &mut Context<Self>) {
- if !self.mode().is_full() {
+ if !self.lsp_data_enabled() {
return;
}
for (_, (visible_buffer, _, _)) in self.visible_excerpts(true, cx) {
@@ -25581,7 +25587,7 @@ impl Editor {
}
fn register_buffer(&mut self, buffer_id: BufferId, cx: &mut Context<Self>) {
- if !self.mode().is_full() {
+ if !self.lsp_data_enabled() {
return;
}
@@ -13,7 +13,7 @@ impl Editor {
_window: &Window,
cx: &mut Context<Self>,
) {
- if !self.mode().is_full() || !self.use_document_folding_ranges {
+ if !self.lsp_data_enabled() || !self.use_document_folding_ranges {
return;
}
let Some(project) = self.project.clone() else {
@@ -292,7 +292,7 @@ impl Editor {
reason: InlayHintRefreshReason,
cx: &mut Context<Self>,
) {
- if !self.mode().is_full() || self.inlay_hints.is_none() {
+ if !self.lsp_data_enabled() || self.inlay_hints.is_none() {
return;
}
let Some(semantics_provider) = self.semantics_provider() else {
@@ -50,7 +50,7 @@ pub(super) fn refresh_linked_ranges(
window: &mut Window,
cx: &mut Context<Editor>,
) -> Option<()> {
- if !editor.mode().is_full() || editor.pending_rename.is_some() {
+ if !editor.lsp_data_enabled() || editor.pending_rename.is_some() {
return None;
}
let project = editor.project()?.downgrade();
@@ -119,7 +119,7 @@ impl Editor {
for_server: Option<RefreshForServer>,
cx: &mut Context<Self>,
) {
- if !self.mode().is_full() || !self.semantic_token_state.enabled() {
+ if !self.lsp_data_enabled() || !self.semantic_token_state.enabled() {
self.invalidate_semantic_tokens(None);
self.display_map.update(cx, |display_map, _| {
match Arc::get_mut(&mut display_map.semantic_token_highlights) {
@@ -446,6 +446,9 @@ impl SplittableEditor {
let mut editor =
Editor::for_multibuffer(rhs_multibuffer.clone(), Some(project.clone()), window, cx);
editor.set_expand_all_diff_hunks(cx);
+ editor.disable_runnables();
+ editor.disable_diagnostics(cx);
+ editor.set_minimap_visibility(crate::MinimapVisibility::Disabled, window, cx);
editor
});
// TODO(split-diff) we might want to tag editor events with whether they came from rhs/lhs