summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2024-11-04 20:01:31 +0000
committerGitHub <noreply@github.com>2024-11-04 20:01:31 +0000
commitd67765b0b48d711cd0878e168ccb1e28178c4006 (patch)
tree9e1bbbfdecb48d31c45a3caaecbf8de278f118ee /cli/tsc/99_main_compiler.js
parentd55e30f41855d40b36019f347a15b6c8984eb3e9 (diff)
fix(lsp): scope attribution for lazily loaded assets (#26699)
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index bdc4340e3..52c9134da 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -801,13 +801,18 @@ delete Object.prototype.__proto__;
if (logDebug) {
debug(`host.getScriptSnapshot("${specifier}")`);
}
- const sourceFile = sourceFileCache.get(specifier);
- if (sourceFile) {
- if (!assetScopes.has(specifier)) {
- assetScopes.set(specifier, lastRequestScope);
+ if (specifier.startsWith(ASSETS_URL_PREFIX)) {
+ const sourceFile = this.getSourceFile(
+ specifier,
+ ts.ScriptTarget.ESNext,
+ );
+ if (sourceFile) {
+ if (!assetScopes.has(specifier)) {
+ assetScopes.set(specifier, lastRequestScope);
+ }
+ // This case only occurs for assets.
+ return ts.ScriptSnapshot.fromString(sourceFile.text);
}
- // This case only occurs for assets.
- return ts.ScriptSnapshot.fromString(sourceFile.text);
}
let sourceText = sourceTextCache.get(specifier);
if (sourceText == undefined) {