timbrel / GitSavvy

Full git and GitHub integration with Sublime Text
MIT License
1.9k stars 136 forks source link

Add "copy URL to remote" option for gitlab/github #1854

Open tcannonfodder opened 8 months ago

tcannonfodder commented 8 months ago

It would be great to be able to copy the URL that "open file on remote" generates, rather than opening a full browser window. That would make it easier to collaborate with team members/stash the URL somewhere else when doing a code review.

kaste commented 8 months ago

Sounds reasonable. Wouldn't know where to put this command though; maybe we can just add it to the Command Palette? You can try an implementation for GitHub as the current command is

    {
        "caption": "github: open file on remote",
        "command": "gs_github_open_file_on_remote",
        "args": { "preselect": true }
    },

we add maybe

    {
        "caption": "github: copy url to file to clipboard",   // better description?
        "command": "gs_github_copy_file_url",
        "args": { "preselect": true }
    },

(The original command is a bit a misnomer as it should be "open file in the browser" or something like that.) Obviously both commands share the same code so there is some refactoring necessary that extracts these bits so it can be shared between both commands. 🤷‍♀️