Show source of diagnostic hovers
This commit is contained in:
parent
45c7073934
commit
3f7533a0b4
9 changed files with 48 additions and 24 deletions
|
@ -138,6 +138,7 @@ pub struct GroupId {
|
|||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Diagnostic {
|
||||
pub source: Option<String>,
|
||||
pub code: Option<String>,
|
||||
pub severity: DiagnosticSeverity,
|
||||
pub message: String,
|
||||
|
@ -2881,6 +2882,7 @@ impl operation_queue::Operation for Operation {
|
|||
impl Default for Diagnostic {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
source: Default::default(),
|
||||
code: None,
|
||||
severity: DiagnosticSeverity::ERROR,
|
||||
message: Default::default(),
|
||||
|
|
|
@ -173,6 +173,7 @@ pub fn serialize_diagnostics<'a>(
|
|||
diagnostics
|
||||
.into_iter()
|
||||
.map(|entry| proto::Diagnostic {
|
||||
source: entry.diagnostic.source.clone(),
|
||||
start: Some(serialize_anchor(&entry.range.start)),
|
||||
end: Some(serialize_anchor(&entry.range.end)),
|
||||
message: entry.diagnostic.message.clone(),
|
||||
|
@ -359,6 +360,7 @@ pub fn deserialize_diagnostics(
|
|||
Some(DiagnosticEntry {
|
||||
range: deserialize_anchor(diagnostic.start?)?..deserialize_anchor(diagnostic.end?)?,
|
||||
diagnostic: Diagnostic {
|
||||
source: diagnostic.source,
|
||||
severity: match proto::diagnostic::Severity::from_i32(diagnostic.severity)? {
|
||||
proto::diagnostic::Severity::Error => DiagnosticSeverity::ERROR,
|
||||
proto::diagnostic::Severity::Warning => DiagnosticSeverity::WARNING,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue