Support for multi-root workspaces #26
Open
+6
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when working with multiple project folders opened in a single vscode window (multi-root workspace), the extension always executes lazygit command with working directory set to the first project workspace root, with no way of opening lazygit for other workspaces.
Proposed change tries to address that by checking currently opened document uri and matching it with window workspaces, falling back to the current logic (first workspace/os homedir) when no document is opened or when document doesn't match any workspace root.
While testing, I've noticed a single potentially unwanted behaviour - since we keep the reference to the opened lazygit terminal window, in a scenario where we open lazygit for workspace X, then open a document from workspace Y without closing the lazygit window, command will focus already opened lazygit window for "incorrect" workspace, instead of opening second window with lazygit for the active workspace.
This could be further improved but I think it may be a pretty opinionated behaviour and changing it will require some pretty heavier modifications to the code (we would need to keep track of all opened windows with their working directories) - that's why I didn't want to make that change without your opinion.
Thanks for the extension, works really nicely!