Vscode-gitlens: "Open File on Remote" does not open Command Palette to select branch to open file on

Created on 13 Jul 2020  路  9Comments  路  Source: eamodio/vscode-gitlens


  • GitLens Version: 10.2.2
  • VSCode Version: 1.47 (and several versions before)
  • OS Version: OS X Catalina 10.15.5

Description:

In the majority of cases whenever i want to open a file on remote (via tab context menu), a new browser tab is opened, navigating to the file hosted on the remote repository against the branch i am working on. However, in-between this process the VS Code Command Palette does not open at all, which should expose a list of selectable branches.

However, it should instead display the VS Code Command Palette, exposing the list of selectable branch names, which then when selected, opens a new browser tab and then navigates to the remotely hosted file against the selected branch. Sometimes this actually works, but in most cases, the command palette does not open..

Am i missing something here? Is there a particular condition to which the command palette does open? If so what is that condition? Or is this a bug?

Steps to Reproduce:

  1. Right-click on any tab of an open file to open the context menu for the file
  2. Select the context menu option "Open File on Remote"

EXPECT --> The VS Code _Command Palette_ to open, displaying selectable branch names to open the file against (see GIF below).

2020-07-13 12 10 54

ACTUAL --> The VS Code _Command Palette_ does not open, and instead the file opens up in a browser against the current working branch.

2020-07-13 17 22 48

UPDATE 馃憠 : I figured out the scenario / pattern as to how to expose the VS Code _Command Palette_ to be able to select the branch of choice to open the target file against. And that is, it will only open the _Command Palette_ if your current working branch is not pushed up (i.e. current branch not available remotely). That makes sense.

However, i would prefer it if there was a configurable option for GitLens to always open the _Command Palette_ to list the branches to which i want to open the file against when i click on _Open File on Remote_.

needs verification pending stable release feature

Most helpful comment

@eamodio Oh i see. I misread your initial comment, and realise they're just new commands!

Yes, I believe these new commands are certainly enough, as i really like the alternative command _Copy Remote File URL From..._ , it really speeds my process up when sending file reference links to the desired branch without having a new browser tab automatically open the file, amongst all the other tabs i have open 馃憤

Just for reference to others, I also attach a GIF demo of this command. Also to note, the command is only accessible via the Command Palette Cmd + Shift + P (not via the context menu)

gitlens_copy-file-on-remote-from

Works perfectly 馃憣

All 9 comments

Any plans for adding this config?

I would also love this feature - I always want to open the file on master, not my working branch.

I use this, for example, when I am referencing a code file to someone.

I would also love this feature - I always want to open the file on master, not my working branch.

I use this, for example, when I am referencing a code file to someone.

@TylerYep That is also the most common use-case for me too.

To send a reference link to someone else, of the code file sitting on the _master_ branch.

I added 2 new commands:

  • _Open File on Remote From..._ command (gitlens.openFileOnRemoteFrom) to open a file or revision on a specific branch or tag on the remote provider
  • _Copy Remote File Url From..._ command (gitlens.copyRemoteFileUrlFrom) to copy the url of a file or revision on a specific branch or tag the remote provider

Can you please verify this fix in tomorrow's insiders edition? Be sure to disable/uninstall the stable version of GitLens first.

You can install the insiders edition from here.

@eamodio thanks for looking into this!

I've tried the today's Insiders edition, and noticed you've included a new very convenient context menu option; _Open File on Remote From..._, and i found this very handy, as it will list all available branches to select from (see GIF below for reference) 馃憤

gitlens_open-file-on-remote-from

@eamodio Also, as you've instructed, i'll test the two new configuration settings tomorrow, re-downloading and installing the Insiders Edition again, as today's Insiders Edition does not recognise the new configuration settings.

I suspect that i'll set the new configuration settings values like so (using branch name: master for example), within the _User Settings JSON_ file:

{
  "gitlens.openFileOnRemoteFrom": "master",
  "gitlens.copyRemoteFileUrlFrom": "master",
}

@Sayvai thanks for verifying. Although there are only those new commands, which show up in the menus and command palette, not any new configuration settings.

Are the new commands enough?

@eamodio Oh i see. I misread your initial comment, and realise they're just new commands!

Yes, I believe these new commands are certainly enough, as i really like the alternative command _Copy Remote File URL From..._ , it really speeds my process up when sending file reference links to the desired branch without having a new browser tab automatically open the file, amongst all the other tabs i have open 馃憤

Just for reference to others, I also attach a GIF demo of this command. Also to note, the command is only accessible via the Command Palette Cmd + Shift + P (not via the context menu)

gitlens_copy-file-on-remote-from

Works perfectly 馃憣

@eamodio which stable version of the GitLens extension do you expect this to go in?

And are you able to give an estimate of when? 馃槵

Was this page helpful?
0 / 5 - 0 ratings