1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(lsp): preload documents when deno.documentPreloadLimit changes (#19103)

This commit is contained in:
David Sherret 2023-05-11 21:53:09 -04:00 committed by GitHub
parent e0f07ab8cd
commit a39263e067
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1170,11 +1170,13 @@ impl Documents {
pub fn update_config(&mut self, options: UpdateDocumentConfigOptions) { pub fn update_config(&mut self, options: UpdateDocumentConfigOptions) {
fn calculate_resolver_config_hash( fn calculate_resolver_config_hash(
enabled_urls: &[Url], enabled_urls: &[Url],
document_preload_limit: usize,
maybe_import_map: Option<&import_map::ImportMap>, maybe_import_map: Option<&import_map::ImportMap>,
maybe_jsx_config: Option<&JsxImportSourceConfig>, maybe_jsx_config: Option<&JsxImportSourceConfig>,
maybe_package_json_deps: Option<&PackageJsonDeps>, maybe_package_json_deps: Option<&PackageJsonDeps>,
) -> u64 { ) -> u64 {
let mut hasher = FastInsecureHasher::default(); let mut hasher = FastInsecureHasher::default();
hasher.write_hashable(&document_preload_limit);
hasher.write_hashable(&{ hasher.write_hashable(&{
// ensure these are sorted so the hashing is deterministic // ensure these are sorted so the hashing is deterministic
let mut enabled_urls = enabled_urls.to_vec(); let mut enabled_urls = enabled_urls.to_vec();
@ -1215,6 +1217,7 @@ impl Documents {
.and_then(|cf| cf.to_maybe_jsx_import_source_config()); .and_then(|cf| cf.to_maybe_jsx_import_source_config());
let new_resolver_config_hash = calculate_resolver_config_hash( let new_resolver_config_hash = calculate_resolver_config_hash(
&options.enabled_urls, &options.enabled_urls,
options.document_preload_limit,
options.maybe_import_map.as_deref(), options.maybe_import_map.as_deref(),
maybe_jsx_config.as_ref(), maybe_jsx_config.as_ref(),
maybe_package_json_deps.as_ref(), maybe_package_json_deps.as_ref(),