diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-07 20:16:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 20:16:32 -0500 |
commit | 2dfc0aca7c6a04d54fe6f9a73be70fc4c591d552 (patch) | |
tree | 58fb01c46364e4888097e7135b2f829f38ce990c /cli/lsp/config.rs | |
parent | 2ed984ba3aa638c3f088ac1edc5c779c7d9195d1 (diff) |
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r-- | cli/lsp/config.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 3d24c8c20..120828a79 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1083,7 +1083,7 @@ impl Config { pub fn get_disabled_paths(&self) -> PathOrPatternSet { let mut path_or_patterns = vec![]; if let Some(cf) = self.maybe_config_file() { - if let Some(files) = cf.to_files_config().ok().flatten() { + if let Ok(files) = cf.to_files_config() { for path in files.exclude.into_path_or_patterns() { path_or_patterns.push(path); } @@ -1095,7 +1095,14 @@ impl Config { continue; }; let settings = self.workspace_settings_for_specifier(workspace_uri); - if settings.enable.unwrap_or_else(|| self.has_config_file()) { + let is_enabled = settings + .enable_paths + .as_ref() + .map(|p| !p.is_empty()) + .unwrap_or_else(|| { + settings.enable.unwrap_or_else(|| self.has_config_file()) + }); + if is_enabled { for path in &settings.disable_paths { path_or_patterns.push(PathOrPattern::Path(workspace_path.join(path))); } @@ -1177,7 +1184,7 @@ fn specifier_enabled( workspace_folders: &[(Url, lsp::WorkspaceFolder)], ) -> bool { if let Some(cf) = config_file { - if let Some(files) = cf.to_files_config().ok().flatten() { + if let Ok(files) = cf.to_files_config() { if !files.matches_specifier(specifier) { return false; } |