-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve multi workspace handling #62
Conversation
This should improve the interaction between an autoproj workspace and additional folders and/or other workspaces. The folder packages are now added *after* the autoproj build configuration, and *before* a possible follow-up package that would not be part of the workspace. It ensures that the packages of a given workspace are grouped together, and that two open workspaces would not be interleaved.
The issue here was that the "autoproj (_WORKSPACE_NAME_)" name cannot be given after VSCode added the folder (e.g. cannot be done if the user uses "Add folder to workspace"). Create a "Add workspace" command for this.
…e's is undefined The "folders is undefined" is an artifact of VSCode API pre-multi root workspaces. We shouldn't need to deal with it. Since we have our own shim to VSCode's API, make it return an empty array when vscode's folders is undefined.
…t code Having it in the "Add package to workspace" code makes no sense. We really want to auto-add when a new folder gets added. This ensures a smooth-y transition to the Add Workspace command.
Pull Request Test Coverage Report for Build 70
💛 - Coveralls |
I handled this by: Which seems to work fine, AFAICT.
I don't think this is correct... You can rename the folder by doing: vscode.workspace.updateWorkspaceFolders(0, index, { name: 'foo', uri: folderUri }); Still, I like the idea of having the main configuration automatically added when a new pacakage is added (and removed when all packages from the workspace get removed) |
Actually, that's something I really don't want to do. |
Well, then, I don't know why, but according to the tests I did yesterday, the extension doesn't get disposed in the case where the first workspace folder is changed. The PR implements the same task management behavior - but through tasks instead of relying on the PID file - and I still get the same errors. It appeared that the dispose function was not called. |
Not file, just a Map() from workspacePath to pid. dispose() does get called but you can't do anything async in it (i.e use vscode's own terminateTask api) because apparently the extension host won't get the chance to execute that |
That would explain. |
|
Anyways:
|
There's no way to do it through the normal task-terminate mechanism, since when vscode shuts down an extension host, it does give us a way to wait on promises. We still attempt to terminate for the "normal" case, that is the case where all folders from a workspace have been removed.
7a2a6f1
to
f7ceb83
Compare
Looks good to me.. I liked the idea of creating one disposable per watch task. |
After working with vscode, I "stole" the disposable pattern in Roby itself. It's a really neat pattern. |
This pull request improves having multiple Autoproj workspaces in a single VSCode workspace. In addition, it workarounds an issue related to VSCode's handling of the very first folder in the workspace.
First the vscode issue. VSCode will restart the extension hosts if the toplevel folder in a VSCode workspace changes (because it needs to change the now-obsolete
rootPath
property). This leads to the extension attempting to start a Watch while there is already one. The first attempt was to make sure we deregister the watch task using the new Task execution APIs. This is a great addition in the first place, but proved fruitless as it seems that vscode doesn't shut down the extensions cleanly (I wouldn't get the extension'sdeactivate
function or any of thedispose
methods to be called). I then tried to use thetaskExecutions
property to find the watch task, but it is also empty - don't really know why.In fine, I tried to see a way to make sure the first folder doesn't change this much. This led me to think about a problem I recently had, to use two autoproj workspaces in the same vscode workspace (comparing code). This was hell, as the packages would be named the same.
So, I went for:
autoproj
folder added to the vscode workspace, and name it as the workspace (e.g.autoproj (squidbot)
).autoproj
folder as a guard, i.e. folders for the squidbot workspace would be placed after theautoproj (squidbot)
folder. Moreover, they would be placed before the following folder that is not part of the workspace project.Because the folder names can't be changed after they have been added, I also created a
Rock: Add Workspace
command for the initial add. The one corner case is if someone adds the autoproj folder directly.Illustration: