-
Notifications
You must be signed in to change notification settings - Fork 3
Workspace
The VSCode concept of a workspace is a bit confusing.
When you open one or more files most VSCode features are available, but it does not save settings or reapply them when the files are reopened.
In addition to opening files, VSCode can open a folder and allows the user to perform various file management operations (add, delete, move, copy, rename, etc.). VSCode provides a tree view that can be used to navigate the file hierarchy.
A folder is an implicit workspace (see below) and you can configure the IDE with local settings. These settings are saved in ./.vscode/settings.json and when the folder is reopened, the settings will be reapplied.
When dealing with a single folder (see above), VSCode saves settings in a hidden folder in the root folder. VSCode also has the concept of a workspace that can define an ordered collection of folders and local settings. The workspace definition and configuration is saved as a <name>.code-workspace file (this file doesn't need to be in the folder, but could be). A workspace can contain zero or more folders.
If there are no folders in a workspace, then the definition simply contains local configuration settings. This might be useful if you want to use the IDE to work with various individual files and use custom configuration settings across the various files.
If there is exactly one folder in a workspace, then it is similar to the Folder mode (see above), but instead of a hard-coded file in a hidden folder in the root folder, the settings can be saved outside the folder and opened directly from the operating system file explorer.
VSCode documentation refers to a workspace with two or more folders as a Multi-root Workspaces. The typical use case is when you are working with multiple folders in unrelated places (e.g., code in /opt and settings in /etc).
The gemstone extension uses the multi-root workspace approach and adds a virtual file system for each SymbolDictionary in the current user's SymbolList.
A significant characteristic of a multi-root workspace is that the first folder carries special significance (presumably a carry-over from the one-folder implicit workspace model). In order to maintain the proper value of rootpath (a deprecated read-only internal variable), a change in the first folder causes the window to be reset:
If the first workspace folder is added, removed or changed, the currently executing extensions (including the one that called this method) will be terminated and restarted so that the (deprecated) rootPath property is updated to point to the first workspace folder. [emphasis added]
The handling of mule-root workspaces has serious implications for VSCode extensions (such as gemstone). Because "VS Code loads and runs extensions in a separate process," any logged-in sessions will be lost (logged out) when the extension is terminated. Thus, care should be taken to establish a primary root folder before any GemStone sessions are created and that folder should not be changed. The folder may be ignored, or may be used to store scripts.