tinymist/crates/tinymist-query/src/check.rs
Myriad-Dreamin 054d3aecc0
refactor: prepare for linting on syntaxes (#1640)
* refactor: for query

* refactor: for diag

* feat: lazy hash expr info

* feat: hash resolves

* fix: update snapshot
2025-04-09 04:10:47 +08:00

19 lines
569 B
Rust

use tinymist_project::LspCompiledArtifact;
use crate::{prelude::*, DiagWorker, DiagnosticsMap, SemanticRequest};
/// A request to check the document for errors and lints.
#[derive(Clone)]
pub struct CheckRequest {
/// The compilation result of the document.
pub snap: LspCompiledArtifact,
}
impl SemanticRequest for CheckRequest {
type Response = DiagnosticsMap;
fn request(self, ctx: &mut LocalContext) -> Option<Self::Response> {
let worker = DiagWorker::new(ctx);
Some(worker.check().convert_all(self.snap.diagnostics()))
}
}