Valentin-Guillet / ProjectManager

Project Manager for Sublime Text 3
MIT License
2 stars 0 forks source link

Reopening a project already open in another window does not work #2

Closed tukusejssirs closed 2 years ago

tukusejssirs commented 2 years ago

Reproduction steps:

  1. Open a project (Project 1) in window 1.
  2. Open another project (or an empty window; let’s name it window 2).
  3. While being in window 2, I try to open a project in [a] new window:
    • in your downstream Project Manager: nothing happens;
    • in the upstream Project Manager:
    • Project 1 in window 1 is closed (ProjectClose Project / close_workspace);
    • a new window (window 3) is open with Project 1.

When I try to do the same, but instead of open[ing] a project in [a] new window, I try to simply open [a] project in an empty window, the empty window is closed and the window on the left from the empty window is selected (I use SwayWM in tabbed mode; on other enviroments/platforms it might behave a bit differently).

I would expect to always open the selected project, other in current window or in a new window, regardless if it is already open.

Valentin-Guillet commented 2 years ago

I'm not sure I understand why this can be an issue. In the case where the workspace is already open, I prefer to use the existing window instead of closing and reopening it, which can take some time and cause screen blinking for no reason. What would be the reason to prioritize closing and opening again ? Is this an issue for the tiling window manager ?

tukusejssirs commented 2 years ago

I'm not sure I understand why this can be an issue.

For me, it is an issue, as I work with multiple projects/workspaces open at a time, even some ‘unnamed’/temporary workspaces (which are auto-saved into ~/.config/sublime-text/Local/Auto Save Session.sublime_session), therefore sometimes I forget where a particular project is open.

Another reason for fixing this issue is that it works similarly as Goto → Goto Anything…, which is used to open any file in currently open project/workspace or any file in any project folder (except for ignored paths viafolder_exclude_patterns` in project settings). When a particular file is already open, that file is selected where it is already open. While for a project/workspace it is hard to open a project/workspace at the same place where it is already open (due to using different desktop environments, window managers or even OSes), therefore I think we should use the auto-save feature of ST by closing the particular project/workspace and open it in a new window.

Another reason is to work as the upstream PM.

Is this an issue for the tiling window manager ?

Yes and no.

ST is used on different DEs/WMs/OSes, therefore we cannot rely on any single of them.

I don’t expect PM to support any DE/WM/OS in order to select a particular project/workspace that is already open. All I want to bring back the feature of upstream PM.


Possible workaround would be to add a command to close a user-selected project:

Valentin-Guillet commented 2 years ago

Personally, I prefer the Goto behavior instead of forcing the reopening, and I will keep it as the default behavior. However, I added an option in the package settings (reopen_project_goto) that switches between the two behavior, tell me if it works as expected for you.

tukusejssirs commented 2 years ago

Thanks, @Val95240, reopen_project_goto set to false indeed works as expected! :pray: