Cant get "Move to a new file" code action working.
every time i hit move to a new file, i get this error:
-32603: Request codeAction/resolve failed with message:
Seems identical: https://github.com/microsoft/TypeScript/issues/59650. Does this happen after upgrade to typescript 5.7?
Nope, tested with 5.7.3:
2025-01-29 10:58:31.188 [error] <semantic> TypeScript Server Error (5.7.3)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
at Object.addImportForModuleSymbol (xyz/node_modules/typescript/lib/typescript.js:156990:11)
at xyz/node_modules/typescript/lib/typescript.js:146715:19
at Map.forEach (<anonymous>)
at addTargetFileImports (xyz/node_modules/typescript/lib/typescript.js:146708:17)
at getNewStatementsAndRemoveFromOldFile (xyz/node_modules/typescript/lib/typescript.js:145939:3)
at doChange4 (xyz/node_modules/typescript/lib/typescript.js:146935:3)
at xyz/node_modules/typescript/lib/typescript.js:146924:77
at _ChangeTracker.with (xyz/node_modules/typescript/lib/typescript.js:177632:5)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (xyz/node_modules/typescript/lib/typescript.js:146924:60)
at Object.getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:145029:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (xyz/node_modules/typescript/lib/typescript.js:152529:32)
at IpcIOSession.getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:194809:49)
at getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:192960:43)
at xyz/node_modules/typescript/lib/typescript.js:195231:15
at IpcIOSession.executeWithRequestId (xyz/node_modules/typescript/lib/typescript.js:195220:14)
at IpcIOSession.executeCommand (xyz/node_modules/typescript/lib/typescript.js:195229:29)
at IpcIOSession.onMessage (xyz/node_modules/typescript/lib/typescript.js:195277:68)
at process.<anonymous> (xyz/node_modules/typescript/lib/_tsserver.js:525:14)
at process.emit (node:events:518:28)
at emit (node:internal/child_process:950:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21): Error: <semantic> TypeScript Server Error (5.7.3)
Debug Failure. False expression: Expected symbol to be a module
Error: Debug Failure. False expression: Expected symbol to be a module
at Object.addImportForModuleSymbol (xyz/node_modules/typescript/lib/typescript.js:156990:11)
at xyz/node_modules/typescript/lib/typescript.js:146715:19
at Map.forEach (<anonymous>)
at addTargetFileImports (xyz/node_modules/typescript/lib/typescript.js:146708:17)
at getNewStatementsAndRemoveFromOldFile (xyz/node_modules/typescript/lib/typescript.js:145939:3)
at doChange4 (xyz/node_modules/typescript/lib/typescript.js:146935:3)
at xyz/node_modules/typescript/lib/typescript.js:146924:77
at _ChangeTracker.with (xyz/node_modules/typescript/lib/typescript.js:177632:5)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (xyz/node_modules/typescript/lib/typescript.js:146924:60)
at Object.getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:145029:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (xyz/node_modules/typescript/lib/typescript.js:152529:32)
at IpcIOSession.getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:194809:49)
at getEditsForRefactor (xyz/node_modules/typescript/lib/typescript.js:192960:43)
at xyz/node_modules/typescript/lib/typescript.js:195231:15
at IpcIOSession.executeWithRequestId (xyz/node_modules/typescript/lib/typescript.js:195220:14)
at IpcIOSession.executeCommand (xyz/node_modules/typescript/lib/typescript.js:195229:29)
at IpcIOSession.onMessage (xyz/node_modules/typescript/lib/typescript.js:195277:68)
at process.<anonymous> (xyz/node_modules/typescript/lib/_tsserver.js:525:14)
at process.emit (node:events:518:28)
at emit (node:internal/child_process:950:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
at n.create (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:486292)
at y.dispatchResponse (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:480262)
at y.dispatchMessage (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:479060)
at ChildProcess.<anonymous> (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:478553)
at ChildProcess.emit (node:events:518:28)
at emit (node:internal/child_process:950:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
I do not know, why it expects the symbol to be a module. Might be related with ESM & specific tsconfig settings?
It is failing at moving "export async function foobar() { /* ...code */}"
To me, it has been an issue for a long time.
For simple typescript export variable / function / class, most of the time it works, sometimes doesnt -- just does nothing after clicking move to a new file.
For React component, it seems stopped working for a long while...
Tried setting the typescript version to workspace or the latest or whatever just doesnt work.
2025-03-16 19:45:22.441 [error] [vscode.typescript-language-features] provider FAILED
2025-03-16 19:45:22.441 [error] Error: <semantic> TypeScript Server Error (5.8.2)
Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":0,"end":422} and {"pos":337,"end":337}
Error: Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":0,"end":422} and {"pos":337,"end":337}
at c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:178699:15
at mapDefined (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:2606:22)
at Object.getTextChangesFromChanges (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:178695:12)
at _ChangeTracker.getChanges (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:178592:35)
at _ChangeTracker.with (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:178071:20)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:147349:60)
at Object.getEditsForRefactor (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:145454:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:152954:32)
at decorator.<computed> [as getEditsForRefactor] (c:\Users\nshln\.vscode\extensions\p42ai.refactor-3.0.1\node_modules\@p42\hide-typescript-refactors\build\index.js:28:36)
at IpcIOSession.getEditsForRefactor (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:195255:49)
at getEditsForRefactor (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:193406:43)
at c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:195676:15
at IpcIOSession.executeWithRequestId (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:195665:14)
at IpcIOSession.executeCommand (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:195674:29)
at IpcIOSession.onMessage (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\typescript.js:195722:68)
at process.<anonymous> (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\node_modules\typescript\lib\_tsserver.js:519:14)
at process.emit (node:events:518:28)
at emit (node:internal/child_process:950:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
at n.create (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\typescript-language-features\dist\extension.js:2:492527)
at y.dispatchResponse (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\typescript-language-features\dist\extension.js:2:486497)
at y.dispatchMessage (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\typescript-language-features\dist\extension.js:2:485295)
at ChildProcess.<anonymous> (c:\usp\progsware\MicrosoftVSCode\resources\app\extensions\typescript-language-features\dist\extension.js:2:484788)
at ChildProcess.emit (node:events:518:28)
at ChildProcess.emit (node:domain:489:12)
at emit (node:internal/child_process:950:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
refactor: New file generates import from wrong module specifier · Issue #58897 · microsoft/TypeScript
https://github.com/microsoft/TypeScript/issues/58897
Refactor: move to new file does not work · Issue #59650 · microsoft/TypeScript
https://github.com/microsoft/TypeScript/issues/59650
Refactor > Move to a new file -- not working (update, nothing in Refactor menu working) · Issue #58711 · microsoft/vscode
https://github.com/microsoft/vscode/issues/58711
Cant get "Move to a new file" code action working. · Issue #216 · yioneko/vtsls
https://github.com/yioneko/vtsls/issues/216
(Feel like posting on a wrong repo... wte)