Closed
Description
🔎 Search Terms
After invoking the code action "Move To A New File" on a react class component, this error is printed to the dev console:
semantic> TypeScript Server Error (5.5.4)
Debug Failure.
Error: Debug Failure.
at Object.addImportFromExportedSymbol (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:154243:32)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144288:19
at Map.forEach (<anonymous>)
at addTargetFileImports (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144282:17)
at getNewStatementsAndRemoveFromOldFile (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:143512:3)
at doChange4 (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144488:3)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144477:77
at _ChangeTracker.with (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:174306:5)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144477:60)
at Object.getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:142603:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:149939:32)
at decorator.<computed> [as getEditsForRefactor] (c:\Users\hdieterichs\.vscode-insiders\extensions\p42ai.refactor-3.0.1\node_modules\@p42\hide-typescript-refactors\build\index.js:28:36)
at IpcIOSession.getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191087:49)
at getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:189305:43)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191491:69
at IpcIOSession.executeWithRequestId (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191483:14)
at IpcIOSession.executeCommand (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191491:29)
at IpcIOSession.onMessage (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191533:51)
at process.<anonymous> (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:523:14)
at process.emit (node:events:519:28)
at emit (node:internal/child_process:951:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21): Error: <semantic> TypeScript Server Error (5.5.4)
Debug Failure.
Error: Debug Failure.
at Object.addImportFromExportedSymbol (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:154243:32)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144288:19
at Map.forEach (<anonymous>)
at addTargetFileImports (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144282:17)
at getNewStatementsAndRemoveFromOldFile (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:143512:3)
at doChange4 (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144488:3)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144477:77
at _ChangeTracker.with (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:174306:5)
at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:144477:60)
at Object.getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:142603:31)
at Object.getEditsForRefactor2 [as getEditsForRefactor] (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:149939:32)
at decorator.<computed> [as getEditsForRefactor] (c:\Users\hdieterichs\.vscode-insiders\extensions\p42ai.refactor-3.0.1\node_modules\@p42\hide-typescript-refactors\build\index.js:28:36)
at IpcIOSession.getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191087:49)
at getEditsForRefactor (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:189305:43)
at c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191491:69
at IpcIOSession.executeWithRequestId (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191483:14)
at IpcIOSession.executeCommand (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191491:29)
at IpcIOSession.onMessage (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\typescript.js:191533:51)
at process.<anonymous> (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:523:14)
at process.emit (node:events:519:28)
at emit (node:internal/child_process:951:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
at Function.create (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\typescript-language-features\dist\extension.js:1:473974)
at v.dispatchResponse (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\typescript-language-features\dist\extension.js:1:467944)
at v.dispatchMessage (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\typescript-language-features\dist\extension.js:1:466742)
at ChildProcess.<anonymous> (c:\Users\hdieterichs\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\typescript-language-features\dist\extension.js:1:466235)
at ChildProcess.emit (node:events:519:28)
at emit (node:internal/child_process:951:14)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react",
"useDefineForClassFields": false,
"experimentalDecorators": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"exactOptionalPropertyTypes": false,
"useUnknownInCatchVariables": false,
"strict": true,
"sourceMap": true,
"noEmit": true,
"skipLibCheck": true
},
"include": [
"./src/**/*",
"./node_modules/@types/wicg-web-app-launch/index.d.ts"
]
}
🕗 Version & Regression Information
- This changed between versions 5.3 and 5.5.4 (VS Code's latest version)
Probably reproducible in newer and older versions within that range.
⏯ Playground Link
No response
💻 Code
import React from "react";
class MyComponent extends React.Component { // Call "Move to new file" here
render() {
return <div />;
}
}
🙁 Actual behavior
The refactoring does not do anything.
🙂 Expected behavior
The refactoring should work.
Additional information about the issue
No response
Activity
mujehoxe commentedon Sep 3, 2024
Any fixes yet?
tmtk75 commentedon Sep 12, 2024
Workaround
I noticed this issue yesterday.
Move to a file worked with 5.4.5 when I tried. 5.5.2 didn't.
I reverted the version of the local typescript to 5.4.5 and use it.
hediet commentedon Sep 23, 2024
I get this quite frequently (also in non tsx code files). Because we moved to relative file imports, it is quite important that this feature works reliably, as manual "move to file" is very involved. FYI @alexdima
CGNonofr commentedon Oct 30, 2024
If it can help, I'm able to reproduce that issue on a simple scenari as well:
test1.ts:
test2.ts:
then tries to "move to new file" the test function from test1.ts