tinymist_query/
check.rs

1use tinymist_project::LspCompiledArtifact;
2
3use crate::{DiagWorker, DiagnosticsMap, SemanticRequest, prelude::*};
4
5/// A request to check the document for errors and lints.
6#[derive(Clone)]
7pub struct CheckRequest {
8    /// The compilation result of the document.
9    pub snap: LspCompiledArtifact,
10}
11
12impl SemanticRequest for CheckRequest {
13    type Response = DiagnosticsMap;
14
15    fn request(self, ctx: &mut LocalContext) -> Option<Self::Response> {
16        let worker = DiagWorker::new(ctx);
17        Some(worker.check().convert_all(self.snap.diagnostics()))
18    }
19}