mirror of
https://github.com/danbulant/oxc
synced 2026-05-22 21:58:36 +00:00
fix(cli): spawn linting in another thread so diagnostics can be printed immediately
This commit is contained in:
parent
db95503f09
commit
b89e931b33
2 changed files with 9 additions and 1 deletions
|
|
@ -47,7 +47,14 @@ impl Runner for LintRunner {
|
|||
let paths = Walk::new(&paths, &ignore_options).paths();
|
||||
let number_of_files = paths.len();
|
||||
|
||||
lint_service.run(paths, &diagnostic_service.sender().clone());
|
||||
// Spawn linting in another thread so diagnostics can be printed immediately from diagnostic_service.run.
|
||||
rayon::spawn({
|
||||
let tx_error = diagnostic_service.sender().clone();
|
||||
let lint_service = lint_service.clone();
|
||||
move || {
|
||||
lint_service.run(paths, &tx_error);
|
||||
}
|
||||
});
|
||||
diagnostic_service.run();
|
||||
|
||||
lint_service.linter().print_execution_times_if_enable();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use oxc_span::SourceType;
|
|||
use crate::{Fixer, LintContext, LintOptions, Linter, Message};
|
||||
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LintService {
|
||||
linter: Arc<Linter>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue