feat: feed more information to linter (#1642)

* feat: move expr struct to common crate

* feat: feed more information to linter
This commit is contained in:
Myriad-Dreamin 2025-04-09 16:57:33 +08:00 committed by GitHub
parent fcb060280d
commit 6cf7739fb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 205 additions and 202 deletions

View file

@ -1,11 +1,12 @@
//! A linter for Typst.
use tinymist_analysis::syntax::ExprInfo;
use typst::{
diag::{eco_format, EcoString, SourceDiagnostic},
ecow::EcoVec,
syntax::{
ast::{self, AstNode},
Source, SyntaxNode,
SyntaxNode,
},
};
@ -13,8 +14,8 @@ use typst::{
type DiagnosticVec = EcoVec<SourceDiagnostic>;
/// Lints a Typst source and returns a vector of diagnostics.
pub fn lint_source(source: &Source) -> DiagnosticVec {
SourceLinter::new().lint(source.root())
pub fn lint_source(expr: &ExprInfo) -> DiagnosticVec {
SourceLinter::new().lint(expr.source.root())
}
struct SourceLinter {