Skip to content
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

Git: Investigate using vscode.open and vscode.diff as commands in scm #110397

Closed
joaomoreno opened this issue Nov 11, 2020 · 4 comments · Fixed by #110733
Closed

Git: Investigate using vscode.open and vscode.diff as commands in scm #110397

joaomoreno opened this issue Nov 11, 2020 · 4 comments · Fixed by #110733
Assignees
Labels
feature-request Request for new features or functionality git GIT issues insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes on-testplan scm General SCM compound issues
Milestone

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Nov 11, 2020

Currently SCM has a custom mechanism for opening resources: SCM providers provide a command for each resource (git provides git.openResource) and it does some magic behind the scenes to be sure that command gets passed the right Resource when invoked. But this custom approach can never align with all the UI gestures and settings related to editor opening actions (preview, to side, etc).

We should investigate whether its feasible for git to simply provide vscode.open and vscode.diff as the Resource opening commands. That way the core can gives us all the preview, open to side, features.

Related:

@joaomoreno joaomoreno added feature-request Request for new features or functionality git GIT issues labels Nov 11, 2020
@joaomoreno joaomoreno self-assigned this Nov 11, 2020
@joaomoreno joaomoreno modified the milestones: November 2020, Backlog Nov 11, 2020
@joaomoreno joaomoreno removed their assignment Nov 12, 2020
@joaomoreno joaomoreno added the scm General SCM compound issues label Nov 12, 2020
@bpasero
Copy link
Member

bpasero commented Nov 12, 2020

I landed my changes, if an extension is using vscode.open or vscode.diff for TreeItem, we pass over the context of the list.

To adopt this in SCM, we need something similar like this code right before we invoke the command of a SCM tree item:

let args = command.arguments || [];
if (command.id === API_OPEN_EDITOR_COMMAND_ID || command.id === API_OPEN_DIFF_EDITOR_COMMAND_ID) {
// Some commands owned by us should receive the
// `IOpenEvent` as context to open properly
args = [...args, e];
}
this.commandService.executeCommand(command.id, ...args);

The fact that this is currently hardcoded inside treeView is a bit of a hack, but I am open for ideas how to make this cleaner once we use it in more places.

@joaomoreno
Copy link
Member Author

Thanks @bpasero, looks awesome!

@joaomoreno joaomoreno modified the milestones: Backlog, November 2020 Nov 13, 2020
@joaomoreno
Copy link
Member Author

@bpasero Check it out:

ed4d86e#diff-a29d112f7e1fecae5536543510588375d7283d06e96a4cf64325e8b600f30356R1940-R1941

It is mostly working with some very weird behavior, on which I will need your help next week:

image

@joaomoreno joaomoreno self-assigned this Nov 13, 2020
@joaomoreno
Copy link
Member Author

joaomoreno commented Nov 13, 2020

@eamodio Let me know if you'd like a tour of these changes, since they are deep.

joaomoreno added a commit that referenced this issue Nov 16, 2020
…experience (#110733)

* wip: try to use vscode.open and vscode.diff in git/scm

related to #110397

* 💄

* revert change to commands.converter.toInternal

* complete usage os vscode.open and vscode.diff in git extension
meganrogge pushed a commit that referenced this issue Nov 18, 2020
…experience (#110733)

* wip: try to use vscode.open and vscode.diff in git/scm

related to #110397

* 💄

* revert change to commands.converter.toInternal

* complete usage os vscode.open and vscode.diff in git extension
@joaomoreno joaomoreno added the on-release-notes Issue/pull request mentioned in release notes label Dec 7, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality git GIT issues insiders-released Patch has been released in VS Code Insiders on-release-notes Issue/pull request mentioned in release notes on-testplan scm General SCM compound issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@joaomoreno @bpasero and others