summaryrefslogtreecommitdiff
path: root/cli/tsc
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-04-25 11:23:24 -0400
committerGitHub <noreply@github.com>2022-04-25 11:23:24 -0400
commitc0e3b6096d37e9a4243c7ad461487db291c824fa (patch)
tree83a2cd2c0c002cb84a4f3f1accbc8805daa56701 /cli/tsc
parent12f7581ed9ee5324a425074d30aedd38b89d4838 (diff)
refactor(lsp): store all the assets in Rust when initializing (#14367)
Diffstat (limited to 'cli/tsc')
-rw-r--r--cli/tsc/99_main_compiler.js17
-rw-r--r--cli/tsc/compiler.d.ts7
2 files changed, 14 insertions, 10 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index c124703a8..68f4f37f6 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -611,12 +611,17 @@ delete Object.prototype.__proto__;
),
);
}
- case "getAsset": {
- const sourceFile = host.getSourceFile(
- request.specifier,
- ts.ScriptTarget.ESNext,
- );
- return respond(id, sourceFile && sourceFile.text);
+ case "getAssets": {
+ const assets = [];
+ for (const sourceFile of sourceFileCache.values()) {
+ if (sourceFile.fileName.startsWith(ASSETS)) {
+ assets.push({
+ specifier: sourceFile.fileName,
+ text: sourceFile.text,
+ });
+ }
+ }
+ return respond(id, assets);
}
case "getApplicableRefactors": {
return respond(
diff --git a/cli/tsc/compiler.d.ts b/cli/tsc/compiler.d.ts
index 946b23486..e84484884 100644
--- a/cli/tsc/compiler.d.ts
+++ b/cli/tsc/compiler.d.ts
@@ -46,7 +46,7 @@ declare global {
type LanguageServerRequest =
| ConfigureRequest
| FindRenameLocationsRequest
- | GetAsset
+ | GetAssets
| GetApplicableRefactors
| GetEditsForRefactor
| GetCodeFixes
@@ -91,9 +91,8 @@ declare global {
providePrefixAndSuffixTextForRename: boolean;
}
- interface GetAsset extends BaseLanguageServerRequest {
- method: "getAsset";
- specifier: string;
+ interface GetAssets extends BaseLanguageServerRequest {
+ method: "getAssets";
}
interface GetApplicableRefactors extends BaseLanguageServerRequest {