summaryrefslogtreecommitdiff
path: root/cli/lsp/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r--cli/lsp/config.rs34
1 files changed, 12 insertions, 22 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index e1f3e3207..4b96511c0 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -16,7 +16,6 @@ use crate::util::fs::canonicalize_path_maybe_not_exists;
use deno_ast::MediaType;
use deno_config::FmtOptionsConfig;
use deno_config::TsConfig;
-use deno_core::anyhow::anyhow;
use deno_core::normalize_path;
use deno_core::serde::de::DeserializeOwned;
use deno_core::serde::Deserialize;
@@ -27,6 +26,8 @@ use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier;
use deno_lint::linter::LintConfig;
use deno_npm::npm_rc::ResolvedNpmRc;
+use deno_runtime::deno_fs::DenoConfigFsAdapter;
+use deno_runtime::deno_fs::RealFs;
use deno_runtime::deno_node::PackageJson;
use deno_runtime::deno_permissions::PermissionsContainer;
use deno_runtime::fs_util::specifier_to_file_path;
@@ -935,7 +936,7 @@ impl Config {
pub fn specifier_enabled(&self, specifier: &ModuleSpecifier) -> bool {
let config_file = self.tree.config_file_for_specifier(specifier);
if let Some(cf) = config_file {
- if let Ok(files) = cf.to_files_config() {
+ if let Ok(files) = cf.to_exclude_files_config() {
if !files.matches_specifier(specifier) {
return false;
}
@@ -952,7 +953,7 @@ impl Config {
specifier: &ModuleSpecifier,
) -> bool {
if let Some(cf) = self.tree.config_file_for_specifier(specifier) {
- if let Some(options) = cf.to_test_config().ok().flatten() {
+ if let Ok(options) = cf.to_test_config() {
if !options.files.matches_specifier(specifier) {
return false;
}
@@ -1135,8 +1136,9 @@ impl ConfigData {
) -> Self {
if let Some(specifier) = config_file_specifier {
match ConfigFile::from_specifier(
+ &DenoConfigFsAdapter::new(&RealFs),
specifier.clone(),
- &deno_config::ParseOptions::default(),
+ &deno_config::ConfigParseOptions::default(),
) {
Ok(config_file) => {
lsp_log!(
@@ -1230,13 +1232,7 @@ impl ConfigData {
.and_then(|config_file| {
config_file
.to_fmt_config()
- .and_then(|o| {
- let base_path = config_file
- .specifier
- .to_file_path()
- .map_err(|_| anyhow!("Invalid base path."))?;
- FmtOptions::resolve(o, None, &base_path)
- })
+ .and_then(|o| FmtOptions::resolve(o, &Default::default(), None))
.inspect_err(|err| {
lsp_warn!(" Couldn't read formatter configuration: {}", err)
})
@@ -1264,13 +1260,7 @@ impl ConfigData {
.and_then(|config_file| {
config_file
.to_lint_config()
- .and_then(|o| {
- let base_path = config_file
- .specifier
- .to_file_path()
- .map_err(|_| anyhow!("Invalid base path."))?;
- LintOptions::resolve(o, None, &base_path)
- })
+ .and_then(|o| LintOptions::resolve(o, Default::default(), None))
.inspect_err(|err| {
lsp_warn!(" Couldn't read lint configuration: {}", err)
})
@@ -2115,7 +2105,7 @@ mod tests {
ConfigFile::new(
"{}",
root_uri.join("deno.json").unwrap(),
- &deno_config::ParseOptions::default(),
+ &deno_config::ConfigParseOptions::default(),
)
.unwrap(),
)
@@ -2173,7 +2163,7 @@ mod tests {
})
.to_string(),
root_uri.join("deno.json").unwrap(),
- &deno_config::ParseOptions::default(),
+ &deno_config::ConfigParseOptions::default(),
)
.unwrap(),
)
@@ -2199,7 +2189,7 @@ mod tests {
})
.to_string(),
root_uri.join("deno.json").unwrap(),
- &deno_config::ParseOptions::default(),
+ &deno_config::ConfigParseOptions::default(),
)
.unwrap(),
)
@@ -2217,7 +2207,7 @@ mod tests {
})
.to_string(),
root_uri.join("deno.json").unwrap(),
- &deno_config::ParseOptions::default(),
+ &deno_config::ConfigParseOptions::default(),
)
.unwrap(),
)