Repository navigation
"rename file" and "move to new file" refactors do not work when using files #24857
Description
Activity
Can you share the log from your tsserver? i suspect it is a duplicate of #24613
- addedNeeds More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarified
on Jun 11, 2018 OliverJAsh commented
on Jun 12, 2018 ContributorAuthorMore actionsMohamed Hegazy (@mhegazy) Does this help? tsserver.log
- addedBugA bug in TypeScriptA bug in TypeScriptand removedNeeds More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarified
on Jun 12, 2018 This looks different.
sheetalkamat commented
on Jun 13, 2018 MemberMore actionsMatt Bierner (@mjbvz) this seems like there are 2 open requests on same file. Can you check why? We do not expect open on same file without closing it first. Thats the assert that raised error in the log.
Interesting open requests:Info 7 [11:4:3.833] request: {"seq":0,"type":"request","command":"open","arguments":{"file":"/Users/OliverJAsh/Development/temp/typescript-files-refactors-test/src/index.ts","fileContent":"// ./src/index.ts\nimport foo from './other';"}} nfo 52 [11:4:7.163] request: {"seq":6,"type":"request","command":"open","arguments":{"file":"/Users/OliverJAsh/Development/temp/typescript-files-refactors-test/src/index.ts","fileContent":"// ./src/index.ts\nimport foo from './other';","scriptKindName":"TS","projectRootPath":"/Users/OliverJAsh/Development/temp/typescript-files-refactors-test"}}Oliver Joseph Ash (@OliverJAsh) Can you please try collecting the TS Server log again in the latest VS Code insiders build. I made some changes to how we track opened files and haven't been able to reproduce the duplicate open requests in recent VS Code builds
OliverJAsh commented
on Jun 28, 2018 ContributorAuthorMore actionsMatt Bierner (@mjbvz) In this log I attempt to use the "move to new file" command as described in my original post.
tsserver.logMatt Bierner (@mjbvz) Are you able to reproduce the issue as I described?
Oliver Joseph Ash (@OliverJAsh) looks like this log is using
typescript@2.9.1can you try withtypescript@next?Oliver Joseph Ash (@OliverJAsh) The error you are seeing in the log, i think is fixed by #24613. Please try typescript@next and let us know if you still see the issue. Thank you.
- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on Jul 2, 2018 43 remaining items
- Repository owner unassigned
on Nov 16, 2018 Oliver Joseph Ash (@OliverJAsh) Sorry for getting back but can you please try your repro with typescript@next and see if it repros. Providing log if it repros will help. Thanks.
- addedNeeds More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarified
on Jan 3, 2019 OliverJAsh commented
on Jan 5, 2019 ContributorAuthorMore actionsTesting "move to new file", unfortunately that doesn't seem to help.
Oliver Joseph Ash (@OliverJAsh) Thank you for the log. Will investigate.
sheetalkamat commented
on Jan 11, 2019 MemberMore actionsOliver Joseph Ash (@OliverJAsh) its been now fixed by #26280 Please verify with typescript@next and report back with tsserver log if it still repros. Thank you,
OliverJAsh commented
on Jan 13, 2019 ContributorAuthorMore actionsIt fixes the problem—thank you! One small thing though: it adds the new file to
fileseven though it doesn't need to be (when it's included via the dependency graph of existingfiles).sheetalkamat commented
on Jan 14, 2019 MemberMore actionsOliver Joseph Ash (@OliverJAsh) can you please share tsserver log where your newFile gets added to the files list? I don't see that when I do it with typescript@next
- locked as resolved and limited conversation to collaborators
on Oct 21, 2025
TypeScript Version: 2.9.1
Search Terms:
files "move to new file" "rename file"
Code
Expected behavior:
./src/other.ts, I expect TypeScript/VSCode to prompt me to update the import in./src/index.ts.barin./src/other.ts, TypeScript/VSCode offers to move this to a new file. When actioning this, I expect this to work.(TypeScript knows that
./src/other.tsis in the project because it is part of the traced dependency graph from the entry file./src/index.ts.)Actual behavior:
./src/other.ts, there is no prompt to update the import.barin./src/other.ts, TypeScript/VSCode offers to move this to a new file. When actioning this, nothing happens.Playground Link:
Related Issues:
microsoft/vscode#51366
#23573
#23726
A known workaround is to use the
includeoption instead offiles. However, I am curious why this is necessary. I prefer to list the entry file and let TypeScript work the rest out. This is especially helpful when a folder has a combination of source and test files—TypeScript automatically knows not to include the test files because they are not part of the dependency graph.If there is a good reason why these commands/refactors can't work with
files, could we make the experience clearer? Why is the "move to new file" command suggested in VSCode when it leads to nothing? If so, perhaps this is an issue for VSCode.