Skip to content

Commit

Permalink
fix(typescript): add code actions support for TS plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jul 22, 2024
1 parent 669ce2e commit ec54c6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/typescript/lib/node/proxyLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function createProxyLanguageService(languageService: ts.LanguageService)
case 'getDocumentHighlights': return getDocumentHighlights(language, target[p]);
case 'getApplicableRefactors': return getApplicableRefactors(language, target[p]);
case 'getEditsForRefactor': return getEditsForRefactor(language, target[p]);
case 'getCombinedCodeFix': return getCombinedCodeFix(language, target[p]);
case 'getRenameInfo': return getRenameInfo(language, target[p]);
case 'getCodeFixesAtPosition': return getCodeFixesAtPosition(language, target[p]);
case 'getEncodedSemanticClassifications': return getEncodedSemanticClassifications(language, target[p]);
Expand Down Expand Up @@ -513,6 +514,13 @@ function getEditsForRefactor(language: Language<string>, getEditsForRefactor: ts
}
};
}
function getCombinedCodeFix(language: Language<string>, getCombinedCodeFix: ts.LanguageService['getCombinedCodeFix']): ts.LanguageService['getCombinedCodeFix'] {
return (...args) => {
const codeActions = getCombinedCodeFix(...args);
codeActions.changes = transformFileTextChanges(language, codeActions.changes, isCodeActionsEnabled);
return codeActions;
};
}
function getRenameInfo(language: Language<string>, getRenameInfo: ts.LanguageService['getRenameInfo']): ts.LanguageService['getRenameInfo'] {
return (filePath, position, options) => {
const fileName = filePath.replace(windowsPathReg, '/');
Expand Down

0 comments on commit ec54c6d

Please sign in to comment.