Move diagnostics to the LocalLspStore (#21782)

This should be a no-op, but clarifies that some fields of the LspStore
were never actually used in the remote case.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-12-09 22:47:13 -07:00 committed by GitHub
parent a35ef5b79f
commit 48eed7499f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 957 additions and 920 deletions

View file

@ -1,9 +1,10 @@
mod signature_help; mod signature_help;
use crate::{ use crate::{
lsp_store::LspStore, CodeAction, CoreCompletion, DocumentHighlight, Hover, HoverBlock, lsp_store::{LocalLspStore, LspStore},
HoverBlockKind, InlayHint, InlayHintLabel, InlayHintLabelPart, InlayHintLabelPartTooltip, CodeAction, CoreCompletion, DocumentHighlight, Hover, HoverBlock, HoverBlockKind, InlayHint,
InlayHintTooltip, Location, LocationLink, MarkupContent, ProjectTransaction, ResolveState, InlayHintLabel, InlayHintLabelPart, InlayHintLabelPartTooltip, InlayHintTooltip, Location,
LocationLink, MarkupContent, ProjectTransaction, ResolveState,
}; };
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
@ -348,7 +349,7 @@ impl LspCommand for PerformRename {
if let Some(edit) = message { if let Some(edit) = message {
let (lsp_adapter, lsp_server) = let (lsp_adapter, lsp_server) =
language_server_for_buffer(&lsp_store, &buffer, server_id, &mut cx)?; language_server_for_buffer(&lsp_store, &buffer, server_id, &mut cx)?;
LspStore::deserialize_workspace_edit( LocalLspStore::deserialize_workspace_edit(
lsp_store, lsp_store,
edit, edit,
self.push_to_history, self.push_to_history,
@ -2306,7 +2307,7 @@ impl LspCommand for OnTypeFormatting {
if let Some(edits) = message { if let Some(edits) = message {
let (lsp_adapter, lsp_server) = let (lsp_adapter, lsp_server) =
language_server_for_buffer(&lsp_store, &buffer, server_id, &mut cx)?; language_server_for_buffer(&lsp_store, &buffer, server_id, &mut cx)?;
LspStore::deserialize_text_edits( LocalLspStore::deserialize_text_edits(
lsp_store, lsp_store,
buffer, buffer,
edits, edits,

File diff suppressed because it is too large Load diff

View file

@ -2222,7 +2222,7 @@ async fn test_edits_from_lsp2_with_past_version(cx: &mut gpui::TestAppContext) {
let edits = lsp_store let edits = lsp_store
.update(cx, |lsp_store, cx| { .update(cx, |lsp_store, cx| {
lsp_store.edits_from_lsp( lsp_store.as_local_mut().unwrap().edits_from_lsp(
&buffer, &buffer,
vec![ vec![
// replace body of first function // replace body of first function
@ -2317,7 +2317,7 @@ async fn test_edits_from_lsp2_with_edits_on_adjacent_lines(cx: &mut gpui::TestAp
// Rust-analyzer does this when performing a merge-imports code action. // Rust-analyzer does this when performing a merge-imports code action.
let edits = lsp_store let edits = lsp_store
.update(cx, |lsp_store, cx| { .update(cx, |lsp_store, cx| {
lsp_store.edits_from_lsp( lsp_store.as_local_mut().unwrap().edits_from_lsp(
&buffer, &buffer,
[ [
// Replace the first use statement without editing the semicolon. // Replace the first use statement without editing the semicolon.
@ -2426,7 +2426,7 @@ async fn test_invalid_edits_from_lsp2(cx: &mut gpui::TestAppContext) {
// with ranges sometimes being inverted or pointing to invalid locations. // with ranges sometimes being inverted or pointing to invalid locations.
let edits = lsp_store let edits = lsp_store
.update(cx, |lsp_store, cx| { .update(cx, |lsp_store, cx| {
lsp_store.edits_from_lsp( lsp_store.as_local_mut().unwrap().edits_from_lsp(
&buffer, &buffer,
[ [
lsp::TextEdit { lsp::TextEdit {