-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Refactor > Move to a new file -- not working (update, nothing in Refactor menu working) #58711
Comments
Update: can confirm the feature works on VS Code Version 1.25.1 (1.25.1), does not work on latest. |
Ah, yeah I see it now. I get this output just my highlighting text (not actually selecting "Move to new file"). I get no output when actually selecting Move To New File. Nothing happens. Works on VS Code 1.25 just fine (my current work around is to use this older build)
|
You can switch the typescript version independently of VS Code by following these instructions. In the latest VS Code insiders build, can you please try:
Do either of those fix the problem? Let me know if you have any questions about switching the typescript version in your workspace. |
Also, does this happen for every refactoring you try to trigger? Does it happen in a new project if you just try to extract a simple expression like |
Hey, actually I'm using Typescript 3.0.3 on VS Code 1.25 by choosing the "Workspace" Typescript--and refactoring works as expected.
|
To follow up, every option on the refactoring menu is not working in the latest VS Code, including the "Insiders" edition with no plugins or extensions running. All options work as expected on VS Code 1.25, I've not tried VS Code 1.26 |
Thanks. Unfortunately I'm unable to reproduce this on any machine so I need a bit more information from you:
class Foo {}
class Bar extends Foo {
constructor() {}
} Can you successfully trigger the quick fix that adds the missing super call in the constructor?
|
Hey, so I just noticed something. If I click on the lightbulb icon when I select code, it works! But it doesn't work if I select the code, right click on the selected code, choose "Refactor..." then choose "Move To New File" Log output
Nothing else! |
Oh here is potentially useful log, last one was from
|
Thanks @babakness. I can repo now using the refactoring menu @sbatten and @bpasero I believe I have tracked this down to the refactor context menu seemingly not firing its actions when the user select an item. This may because the refactor context menu is triggered from within another context menu. I'll keep debugging tomorrow but let me know if you have any ideas on what may be going wrong here |
@mjbvz does it reproduce with the custom menu but not the native menu? |
This is on MacOS, so native context menus (Haven't been able to repo on windows at all yet) |
@mjbvz that would be very weird. I am not even able to bring up anything when I click on "Refactoring...", is this broken? E.g. I selected some code and triggered it and was at least expecting something like "Extract method". |
Ok I can reproduce, steps:
=> nothing happens Works fine when invoked from the command palette. Reproduces in stable for me. |
@mjbvz I verified that the "Organize Imports" action is triggered, so it does not seem to be an issue with the menu. |
This is a bug with how we handle context menus. I added these log points in which shows the following sequence of events. To summarize:
This explains why adding a slight delay when creating the refactor context menu fixes the problem |
Where? |
The editor and refactor menus both register a close event handler. When the editor context menu is closed, both of the menus receive the same close event so we end up removing the refactor menu’s click handler too even though is only just started showing |
Fixes microsoft#58711 When a context menu is triggered from inside another context menu, we have a race condition related to ipc. This is cause by the `close` event for context menus being global. In the retrigger case, `close` ends up being fired after the second context menu is created. This ends up removing the click handler for the new context menu Fix is to add a menu id to the close event.
Fixes #58711 When a context menu is triggered from inside another context menu, we have a race condition related to ipc. This is cause by the `close` event for context menus being global. In the retrigger case, `close` ends up being fired after the second context menu is created. This ends up removing the click handler for the new context menu Fix is to add a menu id to the close event.
Also not working
Steps to Reproduce:
1. Highlight a function
2. Select refactor > move to new file
Does this issue occur when all extensions are disabled?: Yes/No
Yes -- meaning it also fails to work with --disable-extensions
--
I'm not sure why, the feature was working just fine before. I also tried setting
"typescript.tsserver.trace": "verbose"
Tried on multiple projects
I see nothing in the Output pane.
This feature was working prior to update.
-- UPDATE:
Also not working on the refactor menu:
The text was updated successfully, but these errors were encountered: