mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-25 05:22:52 +00:00
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:
parent
fcb060280d
commit
6cf7739fb6
10 changed files with 205 additions and 202 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue