-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"rename file" and "move to new file" refactors do not work when using files
#24857
Comments
Can you share the log from your tsserver? i suspect it is a duplicate of #24613 |
@mhegazy Does this help? tsserver.log |
This looks different. |
@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.
|
@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 |
@mjbvz In this log I attempt to use the "move to new file" command as described in my original post. @mjbvz Are you able to reproduce the issue as I described? |
@OliverJAsh looks like this log is using |
@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. |
I can still reproduce this issue using Code Insiders with |
@OliverJAsh I am not sure what the issue is here. I am seeing same behavior irrespective of tsconfig containing files entry. That is when i rename file other to other2 there is no prompt to update the imports. |
This doesn't match the behaviour I'm seeing. When I create to move it to a new file, nothing happens. I've attached a TS server log in which I try to do this. tsserver.log |
@andy-ms Can you please take a look. The tsserver log shows assert:
|
I can't reproduce the assert, but I have noticed that renaming |
no. |
@OliverJAsh Could you test again now that #25522 is in? |
Yes. Just tried with 3.1.0-dev.20180801.
macOS 10.13.5.
I'm not completely familiar with how to do that. Is there a guide somewhere I can follow? @andy-ms Are you able to reproduce the problem on your end? |
I'm trying to use move to new file in JavaScript but it doesn't work (no proposition to move function to another file). Should it work in JavaScript or only in TypeScript? I have created new projected using React +Redux template from ASP.NET Core 2.1 |
@rosieks Please make a new issue. It should work in JavaScript. Be sure to test with |
Ok - I will create separate issue - could you just tell me where should I have |
@rosieks move to file isn't yet supported in Visual Studio 15.8, so unfortunately even a new build of TypeScript won't help you in this case. We're working on adding VS support for this soon. |
@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. |
Testing "move to new file", unfortunately that doesn't seem to help. |
@OliverJAsh Thank you for the log. Will investigate. |
@OliverJAsh its been now fixed by #26280 Please verify with typescript@next and report back with tsserver log if it still repros. Thank you, |
It fixes the problem—thank you! One small thing though: it adds the new file to |
@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 |
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
.bar
in./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.ts
is 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.bar
in./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
include
option 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.The text was updated successfully, but these errors were encountered: