1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 16:49:18 -05:00

fix(lsp): normalize urls in did_change_watched_files (#12873)

This commit is contained in:
igorsaux 2021-11-23 20:32:40 +03:00 committed by Bert Belder
parent 0ef5b21a3c
commit 47d516a4a0
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -930,9 +930,15 @@ impl Inner {
.performance .performance
.mark("did_change_watched_files", Some(&params)); .mark("did_change_watched_files", Some(&params));
let mut touched = false; let mut touched = false;
let changes: Vec<Url> = params
.changes
.iter()
.map(|f| self.url_map.normalize_url(&f.uri))
.collect();
// if the current import map has changed, we need to reload it // if the current import map has changed, we need to reload it
if let Some(import_map_uri) = &self.maybe_import_map_uri { if let Some(import_map_uri) = &self.maybe_import_map_uri {
if params.changes.iter().any(|fe| *import_map_uri == fe.uri) { if changes.iter().any(|uri| import_map_uri == uri) {
if let Err(err) = self.update_import_map().await { if let Err(err) = self.update_import_map().await {
self.client.show_message(MessageType::Warning, err).await; self.client.show_message(MessageType::Warning, err).await;
} }
@ -941,7 +947,7 @@ impl Inner {
} }
// if the current tsconfig has changed, we need to reload it // if the current tsconfig has changed, we need to reload it
if let Some(config_uri) = &self.maybe_config_uri { if let Some(config_uri) = &self.maybe_config_uri {
if params.changes.iter().any(|fe| *config_uri == fe.uri) { if changes.iter().any(|uri| config_uri == uri) {
if let Err(err) = self.update_config_file() { if let Err(err) = self.update_config_file() {
self.client.show_message(MessageType::Warning, err).await; self.client.show_message(MessageType::Warning, err).await;
} }