dschwen / switch-header-source

Quick switching between C/C++ header and source files
MIT License
13 stars 49 forks source link

Does not work if multiple windows are open #27

Open kalsan opened 6 years ago

kalsan commented 6 years ago

Does not work if multiple windows are open (Arch Linux, i3 WM). To reproduce:

dschwen commented 6 years ago

Sorry for the long delay. I have confirmed the issue. I'm investigating.

kalsan commented 6 years ago

With the newest update, it works on the primary window but not on the freshly opened.

dschwen commented 6 years ago

Super weird. If you close the newly opened window and do 'open in new window' on sub again, the switching works. Still investigating.

dschwen commented 6 years ago

Ok, got it. atom.project.onDidChangePaths did get triggered in the new window right after the activate method of the plugin got run (which starts the file indexing). The callback I registered just stopped the indexing. I now make it restart the indexing (so that new project paths get picked up - this should have been the behavior from the get go). It is a bit weird to receive this even and have activate called on the plugin. Effectively it starts indexing to immediately stop and restart it. This should not cause any inconvenience to the user, but it is not 100% satisfactory from a design standpoint. But I guess it is an Atom issue.

@kalsan could you please verify if v0.31.0 fixes your issue?

kalsan commented 6 years ago

Thanks for the fix! Indeed the multi-window switching now works.

There's one little weird thing left, but it could be considered a bug or a feature: When pressing Ctrl+K, Left in order to open a new pane and then open a cpp or h file, the switch sometimes changes to the other pane.

Example:

If you consider this a feature, feel free to close the issue ;-)