lsp: Pass back diagnostic .data when querying code actions for it (#14962)
Per the LSP spec, we should pass .data field of diagnostics into code action request: ``` /** * A data entry field that is preserved between a * `textDocument/publishDiagnostics` notification and * `textDocument/codeAction` request. * * @since 3.16.0 */ data?: LSPAny; ``` Release Notes: - Fixed rare cases where a code action triggered by diagnostic may not be available for use.
This commit is contained in:
parent
10d2353e07
commit
865904a0c9
6 changed files with 18 additions and 1 deletions
|
@ -27,6 +27,7 @@ use gpui::{
|
|||
use lazy_static::lazy_static;
|
||||
use lsp::LanguageServerId;
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::Value;
|
||||
use similar::{ChangeTag, TextDiff};
|
||||
use smallvec::SmallVec;
|
||||
use smol::future::yield_now;
|
||||
|
@ -213,6 +214,8 @@ pub struct Diagnostic {
|
|||
pub is_disk_based: bool,
|
||||
/// Whether this diagnostic marks unnecessary code.
|
||||
pub is_unnecessary: bool,
|
||||
/// Data from language server that produced this diagnostic. Passed back to the LS when we request code actions for this diagnostic.
|
||||
pub data: Option<Value>,
|
||||
}
|
||||
|
||||
/// TODO - move this into the `project` crate and make it private.
|
||||
|
@ -3844,6 +3847,7 @@ impl Default for Diagnostic {
|
|||
is_primary: false,
|
||||
is_disk_based: false,
|
||||
is_unnecessary: false,
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue