summaryrefslogtreecommitdiff
path: root/cli/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp')
-rw-r--r--cli/lsp/documents.rs7
-rw-r--r--cli/lsp/tsc.rs4
2 files changed, 10 insertions, 1 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs
index fceb3fb4b..6a4832eae 100644
--- a/cli/lsp/documents.rs
+++ b/cli/lsp/documents.rs
@@ -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>> {
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 9c27f3f21..923a0d443 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -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());
}
}