Valentin-Guillet / ProjectManager

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

Creating a new project from currently open window with open files does not save/copy the session files #5

Closed tukusejssirs closed 2 years ago

tukusejssirs commented 2 years ago

I consider this a major bug, as I lost some files when creating a project.


What did I do?

  1. I added some folders to a new, empty window (workspace).
  2. I open some files from the added folders.
  3. I edited some files from the added folders, but I didn’t save them.
  4. I also created some new files, but I didn’t save them.
  5. I wanted to save the current window (workspace) as a new project, so I went and selected Add New Project from PM’s overlay.

What happened?

As soon as I entered the name of the new project and pressed Enter, visually, all open files were closed, however, ST asked me if I want save the unsaved files (each unsaved file triggered a separate modal window).

What did I expect?

Save behaviour (apart from the project name input and folders creation) as the behaviour of the built-in ST command to save a project (ProjectSave Project As…, that is, the current window (workspace) would be basically moved to a new location and the project/workspace would become a named project/workspace.


Some side notes:

Valentin-Guillet commented 2 years ago

Sorry if you lost some files ! I totally agree with you, the behavior of the Add New Project command is not very intuitive and can be misleading. The current behavior is exactly the same as in the upstream repository, since I did not change it from randy3k's code. And I'd like to create new commands as you suggested, I think it is very sensible and would be a great improvement.

Unfortunately, this does not seem possible right now with Sublime Text. The API does not allow to manage views, windows and the creation of workspaces, thus the best we can do is to create a new workspace from scratch. I tried a lot of different approaches, such as copying old workspaces, or creating the project in a new window and reopening each tab within this window, but I could not find a reliable way to achieve that. I think it really is a shame, but Sublime Text still remains quite obscure and they don't seem to want users to interact with the workspace system from the API.

I think your right about the name of the command though, and I'm gonna rename it as you suggested.

tukusejssirs commented 2 years ago

The current behavior is exactly the same as in the upstream repository, since I did not change it from randy3k's code.

Could we at least first open a new window instead of closing the current and opening a new one?

Unfortunately, this does not seem possible right now with Sublime Text.

When about calling save_project_and_workspace_as (ProjectSave Project As…) directly with project path and filename? Is that possible?

Valentin-Guillet commented 2 years ago

Could we at least first open a new window instead of closing the current and opening a new one?

Yeah definitely a good idea, I modified it !

When about calling save_project_and_workspace_as (Project → Save Project As…) directly with project path and filename?

I looked at that for some time, and I could not find a way to give arguments to this command. And there does not seem to exist the corresponding command save_project_and_workspace taking args neither. I might have missed the correct name, but I could not find it in the documentation nor anywhere on forums. If you have any idea at some point or see this issue raised anywhere else, feel free to mention it here !

tukusejssirs commented 2 years ago

Yeah definitely a good idea, I modified it !

Thanks! :pray:

If you have any idea at some point or see this issue raised anywhere else, feel free to mention it here !

Currently, I have no idea right now, but I definitely keep you posted when I find something.