Description
TypeScript Version: 3.9.7
Search Terms:
update imports on rename, update imports on file move
Expected behavior:
When renaming a typescript file/folder in VS code, import statements pointing at the file in question should be updated.
Actual behavior:
Although this used to work, I am now running into an issue where the imports are no longer being updated.
I ran tsserver with verbose logs, and noticed the following issue which seems related to the behavior I'm seeing (entire log file uploaded too, you can see this around line 5246 of tsserver.log):
Info 2254 [12:43:47.630] event:
{"seq":0,"type":"event","event":"projectLoadingFinish","body":{"projectName":"c:/AIMDev/CI-Web/libs/lib-forms/tsconfig.spec.json"}}
Info 2255 [12:43:47.630] event:
{"seq":0,"type":"event","event":"telemetry","body":{"telemetryEventName":"projectInfo","payload":{"projectId":"e17614f21b281be9dace752d26bd0c1eef44fe366fc005e02deb7ef7b1277935","fileStats":{"js":0,"jsSize":0,"jsx":0,"jsxSize":0,"ts":3,"tsSize":3450,"tsx":0,"tsxSize":0,"dts":87,"dtsSize":1935892,"deferred":0,"deferredSize":0},"compilerOptions":{"baseUrl":"","declaration":false,"emitDecoratorMetadata":true,"experimentalDecorators":true,"importHelpers":true,"lib":["es2017","dom"],"module":"commonjs","moduleResolution":"node","paths":"","preserveSymlinks":true,"resolveJsonModule":true,"rootDir":"","skipLibCheck":true,"sourceMap":true,"strict":true,"target":"es6","typeRoots":[""],"outDir":"","types":["",""]},"typeAcquisition":{"enable":false,"include":false,"exclude":false},"extends":true,"files":true,"include":true,"exclude":true,"compileOnSave":false,"configFileName":"other","projectType":"configured","languageServiceEnabled":true,"version":"3.9.7"}}}
Err 2256 [12:43:48.478] Exception on executing command {"seq":255,"type":"request","command":"getEditsForFileRename","arguments":{"oldFilePath":"c:/AIMDev/CI-Web/libs/lib-forms/src/lib/i18n/lib-forms-messages.service.ts","newFilePath":"c:/AIMDev/CI-Web/libs/lib-forms/src/lib/i18n/aim-forms-messages.service.ts"}}:
Debug Failure.
Error: Debug Failure.
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:117897:61
at forEachProperty (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:118061:17)
at updateTsconfigFiles (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:117887:9)
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:117851:13
at Function.ChangeTracker.with (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:126223:17)
at Object.getEditsForFileRename (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:117850:49)
at Proxy.getEditsForFileRename (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:139227:23)
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149297:146
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:147536:36
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:144905:25
at Map.forEach (<anonymous>)
at ProjectService.forEachProject (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:144898:41)
at ProjectService.forEachEnabledProject (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:144903:22)
at combineProjectOutputFromEveryProject (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:147535:28)
at IOSession.Session.getEditsForFileRename (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149297:31)
at Session.handlers.ts.createMapFromTemplate._a.<computed> (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:148075:61)
at c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149555:88
at IOSession.Session.executeWithRequestId (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149546:28)
at IOSession.Session.executeCommand (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149555:33)
at IOSession.Session.onMessage (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:149579:35)
at Interface.<anonymous> (c:\Users\A9FZGZZ\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:150895:27)
at Interface.emit (events.js:203:13)
at Interface._onLine (readline.js:316:10)
at Interface._normalWrite (readline.js:461:12)
at Socket.ondata (readline.js:172:10)
at Socket.emit (events.js:203:13)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:276:11)
at Socket.Readable.push (_stream_readable.js:210:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
I have also attached the other tsserver.log file (named tsserver2.log in this issue). It didn't contain any explicit errors, but did contain the following:
Info 302 [12:46:46.283] Project '/dev/null/inferredProject1*' (Inferred)
Info 302 [12:46:46.283] Files (0) NoProgram
Perhaps it's related, perhaps not.
Playground Link: n/a
Related Issues:
#28771 (Mac specific)
#30535 (performance-related)
#26927 (Seems this issue was fixed back in 2018, I'm definitely on a newer version of TS)
#24857
Attachments:
tsserver.log
tsserver2.log