summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-02-05 05:53:02 +1100
committerGitHub <noreply@github.com>2021-02-05 05:53:02 +1100
commitb77fcbc518428429e39f5ba94e41fcd0418ee7a0 (patch)
tree0051cc7e5ac0c8f83278de093a2be7209cf9fcfc /cli/tsc/99_main_compiler.js
parent644a7ff2d70cbd8bfba4c87b75a047e79830c4b6 (diff)
feat(lsp): add TS quick fix code actions (#9396)
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index fa25b207f..50631e83f 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -555,6 +555,45 @@ delete Object.prototype.__proto__;
);
return respond(id, sourceFile && sourceFile.text);
}
+ case "getCodeFixes": {
+ return respond(
+ id,
+ languageService.getCodeFixesAtPosition(
+ request.specifier,
+ request.startPosition,
+ request.endPosition,
+ request.errorCodes.map((v) => Number(v)),
+ {
+ indentSize: 2,
+ indentStyle: ts.IndentStyle.Block,
+ semicolons: ts.SemicolonPreference.Insert,
+ },
+ {
+ quotePreference: "double",
+ },
+ ),
+ );
+ }
+ case "getCombinedCodeFix": {
+ return respond(
+ id,
+ languageService.getCombinedCodeFix(
+ {
+ type: "file",
+ fileName: request.specifier,
+ },
+ request.fixId,
+ {
+ indentSize: 2,
+ indentStyle: ts.IndentStyle.Block,
+ semicolons: ts.SemicolonPreference.Insert,
+ },
+ {
+ quotePreference: "double",
+ },
+ ),
+ );
+ }
case "getCompletions": {
return respond(
id,
@@ -638,6 +677,12 @@ delete Object.prototype.__proto__;
),
);
}
+ case "getSupportedCodeFixes": {
+ return respond(
+ id,
+ ts.getSupportedCodeFixes(),
+ );
+ }
default:
throw new TypeError(
// @ts-ignore exhausted case statement sets type to never