sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
814 stars 40 forks source link

`close_project` corrupts project workspace #6515

Open Ben-Fields opened 1 month ago

Ben-Fields commented 1 month ago

Description of the bug

In trying to workaround #5701, I discovered that Sublime may remove the value of the "project": key in a project's *.sublime-workspace file. As a result, from the user's perspective, opening the project will not display the associated project folders in the side bar. Additionally, "Project>Edit Project" is greyed out, because there is no longer an association to the project file.

Steps to reproduce

  1. Open Sublime Text. Ensure the setting "hot_exit" is enabled.
  2. Open a project, MyProject.
  3. Close Sublime Text.
  4. Open Sublime Text with subl --command close_project
  5. Observe that the project's open folders disappear, but the open files of the project workspace remain.
  6. Re-opening the project by any method does not return its open folders.

Expected behavior

The project is closed, but may be re-opened later without issue.

Actual behavior

The project cannot be opened.

Sublime Text build number

4169

Operating system & version

Windows 10

(Linux) Desktop environment and/or window manager

No response

Additional information

To work around, either delete MyProject.sublime-workspace for a fresh workspace or:

  1. With "hot_exit" enabled, the saved state from "hot_exit" will overwrite the *.sublime-workspace file of any open project, so make sure you close the project before modifying its *.sublime-workspace file.
  2. Using a different editor, open MyProject.sublime-workspace and manually replace "project": "" with "project": "MyProject.sublime-project".

OpenGL context information

No response