From e212e1fc35ddae63f457f0f2a2e95154e008941f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 8 Jan 2024 12:18:42 -0500 Subject: perf: skip expanding exclude globs (#21817) We were calling `expand_glob` on our excludes, which is very expensive and unnecessary because we can pattern match while traversing instead. 1. Doesn't expand "exclude" globs. Instead pattern matches while walking the directory. 2. Splits up the "include" into base paths and applicable file patterns. This causes less pattern matching to occur because we're only pattern matching on patterns that might match and not ones in completely unrelated directories. --- cli/lsp/language_server.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cli/lsp/language_server.rs') diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 754ccd680..1271d8fd9 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1046,10 +1046,12 @@ impl Inner { self.fmt_options = Default::default(); self.lint_options = Default::default(); if let Some(config_file) = self.get_config_file()? { + // this doesn't need to be an actual directory because flags is specified as `None` + let dummy_args_cwd = PathBuf::from("/"); let lint_options = config_file .to_lint_config() .and_then(|maybe_lint_config| { - LintOptions::resolve(maybe_lint_config, None) + LintOptions::resolve(maybe_lint_config, None, &dummy_args_cwd) }) .map_err(|err| { anyhow!("Unable to update lint configuration: {:?}", err) @@ -1057,7 +1059,7 @@ impl Inner { let fmt_options = config_file .to_fmt_config() .and_then(|maybe_fmt_config| { - FmtOptions::resolve(maybe_fmt_config, None) + FmtOptions::resolve(maybe_fmt_config, None, &dummy_args_cwd) }) .map_err(|err| { anyhow!("Unable to update formatter configuration: {:?}", err) -- cgit v1.2.3