Sublime Forum

Why is a sublime-workspace file automatically created when I open my sublime-project?

#1

I’ve noticed that a sublime-workspace file is automatically created when I open my sublime-project. It just remains empty {} across multiple opens or quits of sublime. What is the purpose of this automatically created file, and what are the conditions under which it gets populated? I mainly ask because I had noticed that another sublime-workspace file that I had explicitly created was keeping a log of search queries and filenames for the workspace, and I do not need or want this degree of logging. I am wondering if this automatically created file will eventually start logging such information. Thank you.

0 Likes

#2

You can read about workspaces here: https://sublime-text-unofficial-documentation.readthedocs.io/en/latest/file_management/projects.html#workspaces

0 Likes

#3

Thank you for the link. This documentation indicates that workspaces are explicitly created by the user, but it does not explain why a workspace file is being automatically created by sublime alongside a project file (same directory) when I open the project. I’m also still not sure if/when sublime will start autopopulating filenames etc to this automatically created workspace file. In my case, this automatically created file has appeared to be empty, but in fact, as I am writing this, I have again checked this automatically created workspace file and see that it has been autopopulated with filenames and all sorts of other information. Is there any way to prevent this behavior? It seems the user can explicitly create a workspace if they want one.

This creates a problem for me because I edit my project on different computers. I keep the project folders in sync via a cloud folder that contains the sublime-project. This is fine because the sublime-project only lists the folder names which do not contain sensitive information. However, filenames may contain sensitive information that should not be uploaded to a cloud. I would like to prevent the workspace file from auto-logging these filenames and other potentially sensitive information that then might get uploaded to the cloud by virtue of the workspace file being automatically created in the same directory as the sublime-project.

0 Likes

#4

For the time being, I am keeping my sublime-project on local disk (not in a cloud folder).

Also, do the settings "remember_workspace" or "hot_exit" have any relevance here for possibly preventing this behavior?

0 Likes

#5

Workspace files get automatically created when closing a project, so that when you open it back up your session is restored. I’m not certain if disabling hot exit would prevent it from being created, or just prevent unsaved files from being written to it (my guess would be the latter). Most cloud sync services have ways of excluding certain kinds of files from being synced, or alternatively you could save your project outside of a synchronized folder.

1 Like

#6

Good tips and helpful info! Thanks for taking the time to reply.

0 Likes

#7

It looks like you could make a good use out of Syncthing (https://syncthing.net/)

0 Likes

#8

just out of curiosity, why did sublime go with the approach of a project -vs- workspace file?

why not just one .sublime file that has project info, and then some workspace info saved; it’s all just json anyways. really all i want in a project file is to open up right where i left off; does it really take 2 files to do that effectively?

(p.s., i could just be being very naive and not realizing the purpose)

0 Likes

#9

A sublime-project file can be shared between users and committed into version control systems. The workspace data includes which files are opened, the contents of unsaved files and generally anything you don’t or shouldn’t share.

0 Likes

#10

fair enough; but is the former (.sublime-project) really used that often / necessary? should multi-user collaboration assume everyone’s using the same text editor?

just seems weird the .sublime-workspace requires a .sublime-project file, given that typically my .sublime-workspace file has the only info i care about (settings and screen layout), while the .sublime-project file is almost always empty

(but maybe im not a prototypical user)

anyways thanks for the reply; sounds like there’s some purpose to having both. regardless sublime text is still the greatest tool of the decade

0 Likes

#11

This is actually the opposite.

Any time you do Project > Save Project As... you get a sublime-project file that holds the names of the folders in your project, the exclusion filters, and optionally project specific settings and build systems. You ALSO get a sublime-workspace file that tracks the window layout, search history, list of open tabs, unsaved content, and other things required to bring this window back to the exact state it was in when you closed it.

Thus you get a file that you check into source control that contains information that hardly, if ever, changes, and the version that keeps your state that you don’t check into source control because literally anything you do causes the file to change, which would likely cause you to either go insane or be stalked by your coworkers with a sack of oranges.

On the flip side, Project > Save Workspace As... saves only the sublime-workspace file and skips the sublime-project file altogether. Now you can close and recall the window with impunity without requiring the sublime-project file.

Indeed, if you only ever open files and have no need for project specific settings, build systems or to customize what files and folders are excluded from the side bar for the folders you’ve opened, the sublime-workspace file may be all you need.

This is also flexible enough that a single sublime-project file can be referenced by multiple sublime-workspace files, allowing you to have several windows on the same project, sharing the same settings and folders and differing only in the layout of the windows and the tabs that are open.

It’s probably also worth mentioning that neither file needs to be stored in any specific location. It’s common to put them inside the folder for your project, but you don’t have to; you could have some folder somewhere that contains just the project and workspace files.

This allows the ultimate flexibility to either share your configuration with other people on the project should they want it, or leave it out if you want the project clean.

We can leave the discussion for why all of my team projects are cluttered up with files specific to Visual Studio Code when I don’t use it for another day. :wink:

This video goes into details on all of the above, should you or anyone find that interesting:

2 Likes

#12

thank you for the info; apologies i didn’t do my homework before making that comment :slight_smile: the video was helpful

0 Likes

#13

Hey there, I have been struggling to figure out the behaviour of the workspace file. I’ve read through the official and unofficial docs for its and feel that I have an understanding for what it is used for. However what I don’t understand is that I seem completely unable to create a fresh clean one in any way. No matter how I make a workspace it is always populated with a whole bunch of stuff from various files I have worked on. Is there some sort of global workspace which is inherited?

0 Likes