-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support multi-select in Source Control view #7900
Conversation
For now, only tested with "@theia/git" on UBUNTU 18.04 |
@lmcbout please validated against VS Code, if it behaves different then it is a bug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't get far with the review...perhaps the comment is helpful.
return; | ||
} | ||
const groupId = parentNode.groupId; | ||
const groupId = this.getGroupIdForFileNode(node); | ||
const group = repository.provider.groups.find(g => g.id === groupId)!; | ||
return group.resources.find(r => String(r.sourceUri) === node.sourceUri)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getGroupForFileNode(...) may return ''
. Do we always find a defined group for that id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getGroupIdForFileNode should never actually return '' as that would mean we have an invalid model. I have changed it to throw an Error instead (and also moved to the node's namespace so it can be reused in one more place).
@akosyakov The behavior between Theia and VSCODE is different. Theia with Chrome browser Then open context menu and select "Open" (No other options like in VSCODE) VSCODE |
Try the multi-selection using old builtin (version 1.39.1) not version 1.44.2 which does not work. Using the multi selection and using the arrow key to select when the view is in a tree mode, then it does not allow to open multi-selction files, |
3b5b85e
to
ad11de8
Compare
I have pushed the following changes:
|
Since it is supposed to work with native Theia "@Theia/git"
--> There is no "Open..." anywhere :( |
Yes, you're right. Its 'isVisible' method is no longer needed and should have been removed. I've pushed a new commit with this action now back. |
Tested with native Theia "@Theia/git" Second: When I single click, it opens the diff editor (OK) but when selecting a list of files, I can only select "Open file", there is no option to open each file in a diff editor. It would be appreciated. |
@lmcbout thanks for testing this again.
That is because you have selected the folder. If a folder is selected then the action applies to all the files in the folder. If you also selected some of the files in the folder then those are simply removed as duplicates. This is working the same as vs-code. This can be confusing, I know, which is one of the reasons why in the original version of the PR I did not allow actions on mixed files and folders.
We would have to add a new command to add 'open in a diff editor' to the context menu. I would think this should be a separate PR if this is agreed. |
Testing With @theia/git
Testing with open-vsx GIT and Git-UI version 1.39.1
|
Would it be fine to address issues with editors tabs separately? Please file an issue for it. |
I have confirmed that everything reported under this section happens on the master branch. It is unrelated to the changes in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on UBUNTU 18.04 with Chrome and electron
Mainly look at the execution, did not concentrate on code itself
Multi-selection works as long as the selected files are "Modified" files. If one of the file is a new file ("A"), then an error occurs and is tracked in issue #7961
Approved on my side, but I would like someone else try it on a different platform to confim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used it a bit and it seems to work.
Signed-off-by: Nigel Westbury <[email protected]>
fixes #7659
What it does
Adds support for multi-selection in the Source Control view. When multiple rows are selected, the args to the context menu will include the entire selection, but only if all the nodes in the selection are in the same group and all are files or all folders.
This is different from how vs-code works because vs-code does not have file-specific items in the context menu. Vs-code will execute the inline actions against all selected items. With this PR the inline actions only operate on the file or folder associated with the inline action, even when there is a multi-selection. This makes it consistent with the existing Theia behavior when a file is selected but an inline action is pressed for a different file. In that situation the inline action applies to the file next to the action, and the selection is left alone on the other file.
This works will with the Theia native git package. It also works with the vs-code builtin but not so well. If testing with vscode-git-1.3.0.1.vsix there is no support for vs-code's new folder actions, so those are missing. (But that is the case without this PR too). Also notice that to make multi-selection you must press up-arrow or down-arrow while holding shift. Using the mouse will work but if the second selection is a modified file (M indicator) then vscode-git-1.3.0.1.vsix results in the second range selection to be selected singularly, cancelling the range that had just been set as the selection. I have not been able to test with git-1.39.1-prel.vsix.
How to test
Test with both the Theia git extension and the vs-code git builtin. Ensure that all works well with the Theia git extension. Ensure that no existing functionality is broken when using any supported git builtin.
Review checklist
Reminder for reviewers