mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Set the 'source' field for general langserver diagnostics
This commit is contained in:
parent
316ddb286a
commit
ac971ee8f5
1 changed files with 8 additions and 4 deletions
|
|
@ -353,7 +353,7 @@ impl<'a, W: io::ResponseWrite> Engine<'a, W> {
|
|||
message: error.description().to_owned(),
|
||||
severity: Some(convert_severity(error.severity())),
|
||||
range: location_to_range(loc),
|
||||
source: error.component().name().map(ToOwned::to_owned),
|
||||
source: component_to_source(error.component()),
|
||||
related_information,
|
||||
.. Default::default()
|
||||
};
|
||||
|
|
@ -368,7 +368,7 @@ impl<'a, W: io::ResponseWrite> Engine<'a, W> {
|
|||
message: note.description().to_owned(),
|
||||
severity: Some(langserver::DiagnosticSeverity::Information),
|
||||
range: location_to_range(note.location()),
|
||||
source: error.component().name().map(ToOwned::to_owned),
|
||||
source: component_to_source(error.component()),
|
||||
.. Default::default()
|
||||
};
|
||||
map.entry(self.file_url(note.location().file)?)
|
||||
|
|
@ -491,7 +491,7 @@ impl<'a, W: io::ResponseWrite> Engine<'a, W> {
|
|||
message: error.description().to_owned(),
|
||||
severity: Some(convert_severity(error.severity())),
|
||||
range: location_to_range(loc),
|
||||
source: error.component().name().map(ToOwned::to_owned),
|
||||
source: component_to_source(error.component()),
|
||||
related_information,
|
||||
.. Default::default()
|
||||
};
|
||||
|
|
@ -504,7 +504,7 @@ impl<'a, W: io::ResponseWrite> Engine<'a, W> {
|
|||
message: note.description().to_owned(),
|
||||
severity: Some(langserver::DiagnosticSeverity::Information),
|
||||
range: location_to_range(note.location()),
|
||||
source: error.component().name().map(ToOwned::to_owned),
|
||||
source: component_to_source(error.component()),
|
||||
.. Default::default()
|
||||
};
|
||||
diagnostics.push(diag);
|
||||
|
|
@ -1720,3 +1720,7 @@ where
|
|||
}));
|
||||
write.write(serde_json::to_string(&request).expect("notification bad to_string"))
|
||||
}
|
||||
|
||||
fn component_to_source(component: dm::Component) -> Option<String> {
|
||||
Some(component.name().unwrap_or("dm-langserver").to_owned())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue