diff options
Diffstat (limited to 'cli/lsp')
-rw-r--r-- | cli/lsp/cache.rs | 10 | ||||
-rw-r--r-- | cli/lsp/documents.rs | 12 | ||||
-rw-r--r-- | cli/lsp/jsr.rs | 7 |
3 files changed, 6 insertions, 23 deletions
diff --git a/cli/lsp/cache.rs b/cli/lsp/cache.rs index 5dae38c20..d3c05ca91 100644 --- a/cli/lsp/cache.rs +++ b/cli/lsp/cache.rs @@ -17,16 +17,6 @@ use std::path::Path; use std::sync::Arc; use std::time::SystemTime; -/// In the LSP, we disallow the cache from automatically copying from -/// the global cache to the local cache for technical reasons. -/// -/// 1. We need to verify the checksums from the lockfile are correct when -/// moving from the global to the local cache. -/// 2. We need to verify the checksums for JSR https specifiers match what -/// is found in the package's manifest. -pub const LSP_DISALLOW_GLOBAL_TO_LOCAL_COPY: deno_cache_dir::GlobalToLocalCopy = - deno_cache_dir::GlobalToLocalCopy::Disallow; - pub fn calculate_fs_version( cache: &LspCache, specifier: &ModuleSpecifier, diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index a8ddc8fd7..80c5a4dc5 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -2,7 +2,6 @@ use super::cache::calculate_fs_version; use super::cache::LspCache; -use super::cache::LSP_DISALLOW_GLOBAL_TO_LOCAL_COPY; use super::config::Config; use super::resolver::LspResolver; use super::testing::TestCollector; @@ -872,22 +871,19 @@ impl FileSystemDocuments { } else { let http_cache = cache.for_specifier(file_referrer); let cache_key = http_cache.cache_item_key(specifier).ok()?; - let bytes = http_cache - .read_file_bytes(&cache_key, None, LSP_DISALLOW_GLOBAL_TO_LOCAL_COPY) - .ok()??; - let specifier_headers = http_cache.read_headers(&cache_key).ok()??; + let cached_file = http_cache.get(&cache_key, None).ok()??; let (_, maybe_charset) = deno_graph::source::resolve_media_type_and_charset_from_headers( specifier, - Some(&specifier_headers), + Some(&cached_file.metadata.headers), ); let content = deno_graph::source::decode_owned_source( specifier, - bytes, + cached_file.content, maybe_charset, ) .ok()?; - let maybe_headers = Some(specifier_headers); + let maybe_headers = Some(cached_file.metadata.headers); Document::new( specifier.clone(), content.into(), diff --git a/cli/lsp/jsr.rs b/cli/lsp/jsr.rs index 9ffcdf9e6..c0a82383d 100644 --- a/cli/lsp/jsr.rs +++ b/cli/lsp/jsr.rs @@ -258,12 +258,9 @@ fn read_cached_url( cache: &Arc<dyn HttpCache>, ) -> Option<Vec<u8>> { cache - .read_file_bytes( - &cache.cache_item_key(url).ok()?, - None, - deno_cache_dir::GlobalToLocalCopy::Disallow, - ) + .get(&cache.cache_item_key(url).ok()?, None) .ok()? + .map(|f| f.content) } #[derive(Debug)] |