1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 21:50:00 -05:00

fix(lsp): better handling of registry config errors (#13418)

Fixes: #13383
Fixes: denoland/vscode_deno#609
This commit is contained in:
Kitson Kelly 2022-01-20 08:05:19 +11:00 committed by GitHub
parent 1cece36fa5
commit 6cf05220e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -43,6 +43,7 @@ use super::documents::to_lsp_range;
use super::documents::AssetOrDocument;
use super::documents::Documents;
use super::documents::LanguageId;
use super::logging::lsp_log;
use super::lsp_custom;
use super::parent_process_checker;
use super::performance::Performance;
@ -63,7 +64,6 @@ use crate::deno_dir;
use crate::file_fetcher::get_source_from_data_url;
use crate::fs_util;
use crate::logger;
use crate::lsp::logging::lsp_log;
use crate::proc_state::import_map_from_text;
use crate::tools::fmt::format_file;
use crate::tools::fmt::format_parsed_source;

View file

@ -1,5 +1,6 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use super::logging::lsp_log;
use super::path_to_regex::parse;
use super::path_to_regex::string_to_regex;
use super::path_to_regex::Compiler;
@ -544,8 +545,19 @@ impl ModuleRegistry {
// we can't use entry().or_insert_with() because we can't use async closures
if !self.origins.contains_key(&origin) {
let specifier = origin_url.join(CONFIG_PATH)?;
let configs = self.fetch_config(&specifier).await?;
self.origins.insert(origin, configs);
match self.fetch_config(&specifier).await {
Ok(configs) => {
self.origins.insert(origin, configs);
}
Err(err) => {
lsp_log!(
" Error fetching registry config for \"{}\": {}",
origin,
err.to_string()
);
self.origins.remove(&origin);
}
}
}
Ok(())