diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-11-24 15:14:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 15:14:19 -0500 |
commit | adc5974333174bd59796f5b7bb8b010c17479dd0 (patch) | |
tree | 969e9ec5e1bdd2f037ad87a283858306bf2a18d2 /cli/tools/fmt.rs | |
parent | 88000b5feb531fc3969bfa8d60faec0f204cc659 (diff) |
fix(lsp): lsp should respect include/exclude files in format config (#12876)
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r-- | cli/tools/fmt.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index ae9d68b29..004b390d3 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -15,6 +15,7 @@ use crate::diff::diff; use crate::file_watcher; use crate::file_watcher::ResolutionResult; use crate::flags::FmtFlags; +use crate::fs_util::specifier_to_file_path; use crate::fs_util::{collect_files, get_extension, is_supported_ext_fmt}; use crate::text_encoding; use deno_ast::ParsedSource; @@ -55,11 +56,21 @@ pub async fn format( if let Some(fmt_config) = maybe_fmt_config.as_ref() { if include_files.is_empty() { - include_files = fmt_config.files.include.clone(); + include_files = fmt_config + .files + .include + .iter() + .filter_map(|s| specifier_to_file_path(s).ok()) + .collect::<Vec<_>>(); } if exclude_files.is_empty() { - exclude_files = fmt_config.files.exclude.clone(); + exclude_files = fmt_config + .files + .exclude + .iter() + .filter_map(|s| specifier_to_file_path(s).ok()) + .collect::<Vec<_>>(); } } |