1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

perf(lsp): don't pass remote modules as tsc roots (#23259)

This commit is contained in:
Nayeem Rahman 2024-04-08 19:45:20 +01:00 committed by GitHub
parent 9752a153ea
commit 3c346c8ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View file

@ -1146,6 +1146,13 @@ impl Documents {
}
}
pub fn is_open(&self, specifier: &ModuleSpecifier) -> bool {
let Some(specifier) = self.resolve_specifier(specifier) else {
return false;
};
self.open_docs.contains_key(&specifier)
}
/// Return a collection of documents that are contained in the document store
/// based on the provided filter.
pub fn documents(&self, filter: DocumentsFilter) -> Vec<Arc<Document>> {

View file

@ -4064,7 +4064,9 @@ fn op_script_names(state: &mut OpState) -> Vec<String> {
if seen.insert(specifier.as_str()) {
if let Some(specifier) = documents.resolve_specifier(specifier) {
// only include dependencies we know to exist otherwise typescript will error
if documents.exists(&specifier) {
if documents.exists(&specifier)
&& (specifier.scheme() == "file" || documents.is_open(&specifier))
{
result.push(specifier.to_string());
}
}

View file

@ -550,7 +550,7 @@ delete Object.prototype.__proto__;
ts.toPath(
fileName,
this.getCurrentDirectory(),
this.getCanonicalFileName(fileName),
this.getCanonicalFileName.bind(this),
);
},
// @ts-ignore Undocumented method.