mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
perf: Segregate syntax and semantic diagnostics
This commit is contained in:
parent
aa00ddcf65
commit
eea1e9b21f
9 changed files with 255 additions and 146 deletions
|
@ -672,14 +672,33 @@ impl Analysis {
|
|||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Computes the set of diagnostics for the given file.
|
||||
pub fn diagnostics(
|
||||
/// Computes the set of parser level diagnostics for the given file.
|
||||
pub fn syntax_diagnostics(
|
||||
&self,
|
||||
config: &DiagnosticsConfig,
|
||||
file_id: FileId,
|
||||
) -> Cancellable<Vec<Diagnostic>> {
|
||||
self.with_db(|db| ide_diagnostics::syntax_diagnostics(db, config, file_id))
|
||||
}
|
||||
|
||||
/// Computes the set of semantic diagnostics for the given file.
|
||||
pub fn semantic_diagnostics(
|
||||
&self,
|
||||
config: &DiagnosticsConfig,
|
||||
resolve: AssistResolveStrategy,
|
||||
file_id: FileId,
|
||||
) -> Cancellable<Vec<Diagnostic>> {
|
||||
self.with_db(|db| ide_diagnostics::diagnostics(db, config, &resolve, file_id))
|
||||
self.with_db(|db| ide_diagnostics::semantic_diagnostics(db, config, &resolve, file_id))
|
||||
}
|
||||
|
||||
/// Computes the set of both syntax and semantic diagnostics for the given file.
|
||||
pub fn full_diagnostics(
|
||||
&self,
|
||||
config: &DiagnosticsConfig,
|
||||
resolve: AssistResolveStrategy,
|
||||
file_id: FileId,
|
||||
) -> Cancellable<Vec<Diagnostic>> {
|
||||
self.with_db(|db| ide_diagnostics::full_diagnostics(db, config, &resolve, file_id))
|
||||
}
|
||||
|
||||
/// Convenience function to return assists + quick fixes for diagnostics
|
||||
|
@ -697,7 +716,7 @@ impl Analysis {
|
|||
|
||||
self.with_db(|db| {
|
||||
let diagnostic_assists = if diagnostics_config.enabled && include_fixes {
|
||||
ide_diagnostics::diagnostics(db, diagnostics_config, &resolve, frange.file_id)
|
||||
ide_diagnostics::full_diagnostics(db, diagnostics_config, &resolve, frange.file_id)
|
||||
.into_iter()
|
||||
.flat_map(|it| it.fixes.unwrap_or_default())
|
||||
.filter(|it| it.target.intersect(frange.range).is_some())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue