Copy or open a GitHub permalink to the lines you have selected in VS Code, pinned to a commit that is actually on GitHub.
Pinpoint exists for one job: you are looking at some code and want to send someone a link to exactly that. Links that use a branch name drift as the branch moves on, and links to a commit that has not been pushed yet just 404. Pinpoint picks the commit for you and tells you when what you see is not what GitHub will show.
Select some lines (or just put the cursor on one), then either:
- right-click and choose Copy GitHub Link to Selection or Open Selection on GitHub,
- run the same commands from the Command Palette under the Pinpoint: prefix, or
- use the keybindings:
| Command | macOS | Windows / Linux |
|---|---|---|
| Copy GitHub Link to Selection | ⌘ ⇧ ⌥ L |
Ctrl+Shift+Alt+L |
| Open Selection on GitHub | ⌘ ⇧ ⌥ O |
Ctrl+Shift+Alt+O |
The result is a link like https://github.com/acme/widgets/blob/3f2a9c1…/src/app.ts#L42-L57. Copying shows a short confirmation in the status bar. Opening launches your default browser.
- HEAD, if it has been pushed. Pinpoint checks whether any branch on the remote contains the current commit.
- Otherwise, the last pushed commit (the merge base with the branch you track, or the remote's default branch) as long as the selected lines are identical there. Unpushed commits that touch other files or other parts of the file do not get in the way.
- Otherwise, you get asked. If the selected lines exist only in unpushed commits, or have uncommitted edits, Pinpoint says so and offers Push and Retry or Copy Anyway (which links to the nearest pushed commit, where the lines may look different).
The comparison is done on the actual text of the selected lines, so a link is only produced silently when GitHub will show exactly what you are looking at.
By default Pinpoint uses the remote your current branch tracks, then origin, then the first remote that points at GitHub. If the commit is only on one of your remotes (for example on your fork rather than upstream), that remote is used. Set pinpoint.remote to force a specific remote.
Remotes on github.com, *.github.com and *.ghe.com are recognised out of the box, including SSH remotes, ssh.github.com:443 and github.com-<account> style SSH aliases. For GitHub Enterprise Server, add the hostname to pinpoint.githubHosts.
| Setting | Default | Description |
|---|---|---|
pinpoint.remote |
"" |
Name of the remote to link to. Empty picks one automatically as described above. |
pinpoint.includeColumns |
false |
Add column positions (#L10C5-L12C20) so GitHub highlights the exact characters instead of whole lines. |
pinpoint.githubHosts |
[] |
Additional hostnames to treat as GitHub, for GitHub Enterprise Server. |
Pinpoint is not on the Marketplace yet. Build a .vsix and install it:
npm install
npm run package
code --install-extension pinpoint-0.1.0.vsixnpm install
npm run compile # or: npm run watch
npm run test:unit # pure-Node tests for URL parsing, link building and selection handling
npm run test:integration # downloads VS Code and runs the extension against a throw-away Git repositoryPress F5 in VS Code to launch an Extension Development Host with the extension loaded.
MIT