From 9159efb7344c3c1e9498952cb723aaef611a4c9c Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 7 Nov 2024 22:13:29 -0800 Subject: [PATCH] fix(typescript): fix interactive refactors (#244) --- packages/typescript/lib/node/proxyLanguageService.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/typescript/lib/node/proxyLanguageService.ts b/packages/typescript/lib/node/proxyLanguageService.ts index 39b99e0d..b6cc56da 100644 --- a/packages/typescript/lib/node/proxyLanguageService.ts +++ b/packages/typescript/lib/node/proxyLanguageService.ts @@ -485,7 +485,7 @@ function getApplicableRefactors(language: Language, getApplicableRefacto }; } function getEditsForRefactor(language: Language, getEditsForRefactor: ts.LanguageService['getEditsForRefactor']): ts.LanguageService['getEditsForRefactor'] { - return (filePath, formatOptions, positionOrRange, refactorName, actionName, preferences) => { + return (filePath, formatOptions, positionOrRange, refactorName, actionName, preferences, interactiveRefactorArguments) => { let edits: ts.RefactorEditInfo | undefined; const fileName = filePath.replace(windowsPathReg, '/'); const [serviceScript, targetScript, sourceScript] = getServiceScript(language, fileName); @@ -496,17 +496,17 @@ function getEditsForRefactor(language: Language, getEditsForRefactor: ts if (typeof positionOrRange === 'number') { const generatePosition = toGeneratedOffset(language, serviceScript, sourceScript, positionOrRange, isCodeActionsEnabled); if (generatePosition !== undefined) { - edits = getEditsForRefactor(targetScript.id, formatOptions, generatePosition, refactorName, actionName, preferences); + edits = getEditsForRefactor(targetScript.id, formatOptions, generatePosition, refactorName, actionName, preferences, interactiveRefactorArguments); } } else { for (const [generatedStart, generatedEnd] of toGeneratedRanges(language, serviceScript, sourceScript, positionOrRange.pos, positionOrRange.end, isCodeActionsEnabled)) { - edits = getEditsForRefactor(targetScript.id, formatOptions, { pos: generatedStart, end: generatedEnd }, refactorName, actionName, preferences); + edits = getEditsForRefactor(targetScript.id, formatOptions, { pos: generatedStart, end: generatedEnd }, refactorName, actionName, preferences, interactiveRefactorArguments); } } } else { - edits = getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences); + edits = getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences, interactiveRefactorArguments); } if (edits) { edits.edits = transformFileTextChanges(language, edits.edits, false, isCodeActionsEnabled);