Search code examples
sublimetext

What's the difference between a project and a workspace in sublime?


I think both are doing the same! When should I use aworkspace and when a project, and what are the differences?


Solution

  • Projects in Sublime are contained in sublime-project files, and allow you to:

    • Control what folders are present in the project
    • Per folder control of what files and folders from within are rejected from the project or included in the project
    • Can contain settings that apply only to files open in that window
    • Can contain build systems that apply only from within that window
    • Persist the window layouts, open files, undo buffers, selected items in panels, and so on in an associated sublime-workspace file (or files; you can have more than one sublime-workspace associated with a particular project.

    Workspaces in Sublime are are stored in sublime-workspace files, and:

    • Contain anonymous project data as in a sublime-project file, except that your only access is to the list of folders open; the ability to control the contents of them or to use project specific settings and build systems is not present. This information is considered Anonymous because it's not persisted to disk, and is not editable (except in adding or removing folders using menu items)
    • Persist the window layouts, Open files, undo buffers, selected items in panels, and so on.

    A sublime-project always has one or more sublime-workspace files associated with it, whereas it is possible to have a sublime-workspace file that is not associated with a project if you desire.

    Generally speaking, if you're working with source control (e.g. git), then you would include a sublime-project file in the repository but not a sublime-workspace file. This is because anything you do will modify the workspace file as well, making life painful when it comes to checking things in.

    So, overall, the tradeoff between using Projects or just Workspaces revolves around what you're doing. If you're just opening folders and want to persist that window, but you don't have any need for the more advanced abilities that Projects provide, there's no reason to use them.