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:
Jess Frazelle
2025-04-28 12:07:10 -07:00
committed by GitHub
parent 2e754f2a11
commit 94452cce88
10 changed files with 339 additions and 266 deletions

View File

@ -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()),
}]
}