@@ -1668,7 +1668,7 @@ namespace ts.server {
16681668 }
16691669 }
16701670
1671- private getCodeFixes ( args : protocol . CodeFixRequestArgs , simplifiedResult : boolean ) : ReadonlyArray < protocol . CodeAction > | ReadonlyArray < CodeAction > {
1671+ private getCodeFixes ( args : protocol . CodeFixRequestArgs , simplifiedResult : boolean ) : ReadonlyArray < protocol . CodeFixAction > | ReadonlyArray < CodeFixAction > {
16721672 if ( args . errorCodes . length === 0 ) {
16731673 return undefined ;
16741674 }
@@ -1678,15 +1678,7 @@ namespace ts.server {
16781678 const { startPosition, endPosition } = this . getStartAndEndPosition ( args , scriptInfo ) ;
16791679
16801680 const codeActions = project . getLanguageService ( ) . getCodeFixesAtPosition ( file , startPosition , endPosition , args . errorCodes , this . getFormatOptions ( file ) , this . getPreferences ( file ) ) ;
1681- if ( ! codeActions ) {
1682- return undefined ;
1683- }
1684- if ( simplifiedResult ) {
1685- return codeActions . map ( codeAction => this . mapCodeAction ( project , codeAction ) ) ;
1686- }
1687- else {
1688- return codeActions ;
1689- }
1681+ return simplifiedResult ? codeActions . map ( codeAction => this . mapCodeFixAction ( project , codeAction ) ) : codeActions ;
16901682 }
16911683
16921684 private getCombinedCodeFix ( { scope, fixId } : protocol . GetCombinedCodeFixRequestArgs , simplifiedResult : boolean ) : protocol . CombinedCodeActions | CombinedCodeActions {
@@ -1734,9 +1726,12 @@ namespace ts.server {
17341726 return { startPosition, endPosition } ;
17351727 }
17361728
1737- private mapCodeAction ( project : Project , { description, changes : unmappedChanges , commands, fixId, fixAllDescription } : CodeFixAction ) : protocol . CodeFixAction {
1738- const changes = unmappedChanges . map ( change => this . mapTextChangesToCodeEditsUsingScriptinfo ( change , project . getScriptInfoForNormalizedPath ( toNormalizedPath ( change . fileName ) ) ) ) ;
1739- return { description, changes, commands, fixId, fixAllDescription } ;
1729+ private mapCodeAction ( project : Project , { description, changes, commands } : CodeAction ) : protocol . CodeAction {
1730+ return { description, changes : this . mapTextChangesToCodeEdits ( project , changes ) , commands } ;
1731+ }
1732+
1733+ private mapCodeFixAction ( project : Project , { fixName, description, changes, commands, fixId, fixAllDescription } : CodeFixAction ) : protocol . CodeFixAction {
1734+ return { fixName, description, changes : this . mapTextChangesToCodeEdits ( project , changes ) , commands, fixId, fixAllDescription } ;
17401735 }
17411736
17421737 private mapTextChangesToCodeEdits ( project : Project , textChanges : ReadonlyArray < FileTextChanges > ) : protocol . FileCodeEdits [ ] {
0 commit comments