diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-03-11 11:43:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 11:43:45 -0500 |
commit | 8db853514caae431a0ce91360d854c1b7f3c405f (patch) | |
tree | 4173976ce6c836b715af22c9aeb9f336debb8544 /cli/lsp/documents.rs | |
parent | e4430400ced48529730a8752c547b613a23c76ce (diff) |
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)
cc @nayeemrmn
Diffstat (limited to 'cli/lsp/documents.rs')
-rw-r--r-- | cli/lsp/documents.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 893a30103..d49cd0b1f 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -818,7 +818,7 @@ pub struct Documents { resolver_config_hash: u64, /// Any imports to the context supplied by configuration files. This is like /// the imports into the a module graph in CLI. - imports: Arc<HashMap<ModuleSpecifier, GraphImport>>, + imports: Arc<IndexMap<ModuleSpecifier, GraphImport>>, /// A resolver that takes into account currently loaded import map and JSX /// settings. resolver: CliGraphResolver, @@ -851,6 +851,14 @@ impl Documents { } } + pub fn module_graph_imports(&self) -> impl Iterator<Item = &ModuleSpecifier> { + self + .imports + .values() + .flat_map(|i| i.dependencies.values()) + .flat_map(|value| value.get_type().or_else(|| value.get_code())) + } + /// "Open" a document from the perspective of the editor, meaning that /// requests for information from the document will come from the in-memory /// representation received from the language server client, versus reading @@ -946,7 +954,6 @@ impl Documents { /// Return `true` if the specifier can be resolved to a document. pub fn exists(&self, specifier: &ModuleSpecifier) -> bool { - // keep this fast because it's used by op_exists, which is a hot path in tsc let specifier = self.specifier_resolver.resolve(specifier); if let Some(specifier) = specifier { if self.open_docs.contains_key(&specifier) { @@ -1239,7 +1246,7 @@ impl Documents { }) .collect() } else { - HashMap::new() + IndexMap::new() }, ); |