ability to set suggestions on lints (#6535)
* fix the lint tests which were not compiling Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * apply sugggestions for offsetplanes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * diagnostics and suggestions for offset planes Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -19,10 +19,7 @@ use crate::{
|
||||
|
||||
impl IntoDiagnostic for CompilationError {
|
||||
fn to_lsp_diagnostics(&self, code: &str) -> Vec<Diagnostic> {
|
||||
let edit = self.suggestion.as_ref().map(|s| {
|
||||
let range = s.source_range.to_lsp_range(code);
|
||||
serde_json::to_value((s, range)).unwrap()
|
||||
});
|
||||
let edit = self.suggestion.as_ref().map(|s| s.to_lsp_edit(code));
|
||||
|
||||
vec![Diagnostic {
|
||||
range: self.source_range.to_lsp_range(code),
|
||||
@ -33,7 +30,7 @@ impl IntoDiagnostic for CompilationError {
|
||||
message: self.message.clone(),
|
||||
related_information: None,
|
||||
tags: self.tag.to_lsp_tags(),
|
||||
data: edit,
|
||||
data: edit.map(|e| serde_json::to_value(e).unwrap()),
|
||||
}]
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user