From 3f8c3b856809de5682b47845976869bcf4067293 Mon Sep 17 00:00:00 2001 From: igorsaux <55196698+igorsaux@users.noreply.github.com> Date: Tue, 23 Nov 2021 20:32:40 +0300 Subject: [PATCH] fix(lsp): normalize urls in did_change_watched_files (#12873) --- cli/lsp/language_server.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index e13215efbb..a2faf8a83e 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -930,9 +930,15 @@ impl Inner { .performance .mark("did_change_watched_files", Some(¶ms)); let mut touched = false; + let changes: Vec = 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 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 { 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 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() { self.client.show_message(MessageType::Warning, err).await; }