diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2022-02-02 13:04:26 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 13:04:26 +1100 |
commit | 26f5c223df26962f19ccc957d0507facc09c55c5 (patch) | |
tree | 2d12e824acefba3e35d8a117693a7b4a7f210cf3 /cli/lsp/language_server.rs | |
parent | 8176a4d1663529fb8aeebf7734c4994fa1d583f4 (diff) |
fix(lsp): properly display x-deno-warning with redirects (#13554)
Fixes: #13472
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 426710b83..a26bafa3f 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -28,7 +28,7 @@ use super::analysis::fix_ts_import_changes; use super::analysis::ts_changes_to_edit; use super::analysis::CodeActionCollection; use super::analysis::CodeActionData; -use super::cache::CacheServer; +use super::cache; use super::capabilities; use super::client::Client; use super::code_lens; @@ -79,6 +79,7 @@ pub struct LanguageServer(Arc<tokio::sync::Mutex<Inner>>); #[derive(Debug, Default)] pub(crate) struct StateSnapshot { pub assets: AssetsSnapshot, + pub cache_metadata: cache::CacheMetadata, pub documents: Documents, pub root_uri: Option<Url>, } @@ -88,6 +89,9 @@ pub(crate) struct Inner { /// Cached versions of "fixed" assets that can either be inlined in Rust or /// are part of the TypeScript snapshot and have to be fetched out. assets: Assets, + /// A representation of metadata associated with specifiers in the DENO_DIR + /// which is used by the language server + cache_metadata: cache::CacheMetadata, /// The LSP client that this LSP server is connected to. pub(crate) client: Client, /// Configuration information. @@ -104,7 +108,7 @@ pub(crate) struct Inner { /// options. maybe_cache_path: Option<PathBuf>, /// A lazily created "server" for handling cache requests. - maybe_cache_server: Option<CacheServer>, + maybe_cache_server: Option<cache::CacheServer>, /// An optional configuration file which has been specified in the client /// options. maybe_config_file: Option<ConfigFile>, @@ -147,6 +151,7 @@ impl Inner { .expect("could not create module registries"); let location = dir.root.join(CACHE_PATH); let documents = Documents::new(&location); + let cache_metadata = cache::CacheMetadata::new(&location); let performance = Arc::new(Performance::default()); let ts_server = Arc::new(TsServer::new(performance.clone())); let config = Config::new(); @@ -159,6 +164,7 @@ impl Inner { Self { assets, + cache_metadata, client, config, diagnostics_server, @@ -390,6 +396,7 @@ impl Inner { pub(crate) fn snapshot(&self) -> Arc<StateSnapshot> { Arc::new(StateSnapshot { assets: self.assets.snapshot(), + cache_metadata: self.cache_metadata.clone(), documents: self.documents.clone(), root_uri: self.root_uri.clone(), }) @@ -447,7 +454,9 @@ impl Inner { }, )?; self.module_registries_location = module_registries_location; - self.documents.set_location(dir.root.join(CACHE_PATH)); + let location = dir.root.join(CACHE_PATH); + self.documents.set_location(&location); + self.cache_metadata.set_location(&location); self.maybe_cache_path = maybe_cache_path; } Ok(()) @@ -2695,7 +2704,7 @@ impl Inner { if self.maybe_cache_server.is_none() { self.maybe_cache_server = Some( - CacheServer::new( + cache::CacheServer::new( self.maybe_cache_path.clone(), self.maybe_import_map.clone(), self.maybe_config_file.clone(), |