diff options
Diffstat (limited to 'cli/tsc')
-rw-r--r-- | cli/tsc/99_main_compiler.js | 38 | ||||
-rw-r--r-- | cli/tsc/compiler.d.ts | 17 |
2 files changed, 55 insertions, 0 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index f5cfe38dd..29a387887 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -584,6 +584,44 @@ delete Object.prototype.__proto__; ); return respond(id, sourceFile && sourceFile.text); } + case "getApplicableRefactors": { + return respond( + id, + languageService.getApplicableRefactors( + request.specifier, + request.range, + { + quotePreference: "double", + allowTextChangesInNewFiles: true, + provideRefactorNotApplicableReason: true, + }, + undefined, + request.kind, + ), + ); + } + case "getEditsForRefactor": { + return respond( + id, + languageService.getEditsForRefactor( + request.specifier, + { + indentSize: 2, + indentStyle: ts.IndentStyle.Smart, + semicolons: ts.SemicolonPreference.Insert, + convertTabsToSpaces: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterCommaDelimiter: true, + }, + request.range, + request.refactorName, + request.actionName, + { + quotePreference: "double", + }, + ), + ); + } case "getCodeFixes": { return respond( id, diff --git a/cli/tsc/compiler.d.ts b/cli/tsc/compiler.d.ts index 949d98ee0..ff2e59e8e 100644 --- a/cli/tsc/compiler.d.ts +++ b/cli/tsc/compiler.d.ts @@ -47,6 +47,8 @@ declare global { | ConfigureRequest | FindRenameLocationsRequest | GetAsset + | GetApplicableRefactors + | GetEditsForRefactor | GetCodeFixes | GetCombinedCodeFix | GetCompletionDetails @@ -92,6 +94,21 @@ declare global { specifier: string; } + interface GetApplicableRefactors extends BaseLanguageServerRequest { + method: "getApplicableRefactors"; + specifier: string; + range: ts.TextRange; + kind: string; + } + + interface GetEditsForRefactor extends BaseLanguageServerRequest { + method: "getEditsForRefactor"; + specifier: string; + range: ts.TextRange; + refactorName: string; + actionName: string; + } + interface GetCodeFixes extends BaseLanguageServerRequest { method: "getCodeFixes"; specifier: string; |