Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bugthesystem/vscode-open-in-github

Extension for Visual Studio Code which can be used to jump to a source code line in Github, Bitbucket, GitLab and Visualstudio.com
https://github.com/bugthesystem/vscode-open-in-github

bitbucket extension github open-in-bitbucket open-in-github open-in-visualstudio-com vscode

Last synced: 6 days ago
JSON representation

Extension for Visual Studio Code which can be used to jump to a source code line in Github, Bitbucket, GitLab and Visualstudio.com

Awesome Lists containing this project

README

        

![vscode-open-in-github](images/icon_200.png?raw=true "Open in GitHub / GitLab / Gitea / Bitbucket / visualstudio.com")

**Supports :** GitHub, GitLab, Gitea, Bitbucket, and Visualstudio.com.

> Extension for Visual Studio Code which can be used to jump to a source code line in GitHub, GitLab, Gitea, Bitbucket and Visualstudio.com

[![Build Status](https://travis-ci.org/ziyasal/vscode-open-in-github.svg?branch=master)](https://travis-ci.org/ziyasal/vscode-open-in-github) [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)

## Install

**Tested with VsCode 0.10.1**

Press F1 and narrow down the list commands by typing `extension`. Pick `Extensions: Install Extension`.

![installation](screenshots/install.png?raw=true "installation")

Simply pick the `Open in GitHub / Bitbucket` extension from the list

## Install Manual

### Mac & Linux

```sh
cd $HOME/.vscode/extensions
git clone https://github.com/ziyasal/vscode-open-in-github.git
cd vscode-open-in-github
npm install
```

### Windows

```sh
cd %USERPROFILE%\.vscode\extensions
git clone https://github.com/ziyasal/vscode-open-in-github.git
cd vscode-open-in-github
npm install
```

## Usage

### Command

Press F1 and type `Open in GitHub`.

![open](screenshots/open-in-github.png?raw=true "Open function")

Press F1 and type `Copy GitHub link to clipboard`.

![copy](screenshots/copy.png?raw=true "Copy function")

(The URL for GitHub will also include line ranges if there are lines selected in the editor)

Press F1 and type `Open Pull Request`.

![copy](screenshots/pull-req-cmd.png?raw=true "Copy function")

### Keybord Shortcut

Press Ctrl+L G to activate.
Press Ctrl+L C to copy active line link to clipboard.

### Context menu

Right click on explorer item and choose `Open in GitHub` or `Copy GitHub link to clipboard`.

![context](screenshots/context-menu.png?raw=true "Context menu options")

### Configure custom github domain

Add following line into workspace settings;

```js
{
"openInGitHub.gitHubDomain": "your custom github domain here",
"openInGitHub.requireSelectionForLines": false, // If enabled, the copied or opened URL won't include line number(s) unless there's an active selection
"openInGitHub.useCommitSHAInURL": false,
"openInGitHub.providerType": "gitlab", // github, gitlab, gitea, bitbucket, ...
"openInGitHub.providerProtocol": "https" // https, http. Useful for custom domains that don't support https. Defaults to https.
}
```

Custom Settings

```js
{
"openInGitHub.providerType": "custom", // important, otherwise the following settings will not be read
"openInGitHub.customProviderPath": "https://your-git-repo-hosting-domain:port/path-to-the-repo",
"openInGitHub.customBlobPath": "+", // for example, this is `blob` in gitlab
"openInGitHub.customLinePrefix": "#", // for example, this is `#L12` instead of just `#12` in most git hosting service
"openInGitHub.defaultPullRequestBranch": "master", // for example, this could be `development`
// optional
"openInGitHub.alwaysOpenInDefaultBranch": true // if you always work on your local branch, and checking it online will always get 404
}
```

Have fun..

## Debug Travis CI locally

```bash
cd $your_vscode_open_in_github_local_directory_path

BUILD_ID="build-$RANDOM" && \
LATEST_GARNET_TAG_ID="1515445631-7dfb2e1" && \
MAPPED_DOCKER_PATH=/home/travis/vscode-open-in-github && \
docker run \
-name $BUILD_ID
-v $(pwd):$MAPPED_DOCKER_PATH \
-dit "travisci/ci-garnet:packer-$LATEST_GARNET_TAG_ID" /sbin/init && \
docker exec -it $BUILDID bash -l
# to rerun last command: look for the last container with docker ps

su - travis # to use nvm and npm

cd /vscode-open-in-github

# replicate steps in either A) .travis.yml B) worker log in Travis CI
```

Reference: [Stackoverflow](https://stackoverflow.com/questions/21053657/how-to-run-travis-ci-locally)

## Known Limitations
- Extension doesn't currently works with Git worktrees

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
Brady Holt](https://www.geekytidbits.com)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=bradymholt "Code") [📖](https://github.com/ziyasal/vscode-open-in-github/commits?author=bradymholt "Documentation") [⚠️](https://github.com/ziyasal/vscode-open-in-github/commits?author=bradymholt "Tests") | [
Grzegorz Dziadkiewicz](https://github.com/gdziadkiewicz)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=gdziadkiewicz "Code") [📖](https://github.com/ziyasal/vscode-open-in-github/commits?author=gdziadkiewicz "Documentation") [⚠️](https://github.com/ziyasal/vscode-open-in-github/commits?author=gdziadkiewicz "Tests") | [
Yuichi Tanikawa](http://itiut.hatenablog.com/)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=itiut "Code") [📖](https://github.com/ziyasal/vscode-open-in-github/commits?author=itiut "Documentation") [⚠️](https://github.com/ziyasal/vscode-open-in-github/commits?author=itiut "Tests") | [
Suan Yeo](http://suanaikyeo.com)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=suan "Code") | [
Benjamin Pasero](http://code.visualstudio.com)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=bpasero "Code") | [
Stuart Leeks](http://blogs.msdn.com/stuartleeks)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=stuartleeks "Code") | [
Marvin Hagemeister](https://marvinhagemeister.github.io)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=marvinhagemeister "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [
linarnan](https://github.com/linarnan)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=linarnan "Code") [⚠️](https://github.com/ziyasal/vscode-open-in-github/commits?author=linarnan "Tests") | [
Dan Seethaler](https://github.com/danseethaler)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=danseethaler "Code") [⚠️](https://github.com/ziyasal/vscode-open-in-github/commits?author=danseethaler "Tests") | [
John Arthur](https://github.com/johnpaularthur)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=johnpaularthur "Code") | [
Eduardo Diaz](https://github.com/ziluvatar)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=ziluvatar "Code") | [
Tom Esterez](https://github.com/testerez)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=testerez "Code") | [
Anthony Brown](https://github.com/antxxxx)
[💻](https://github.com/ziyasal/vscode-open-in-github/commits?author=antxxxx "Code") |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

## License

MIT © [Ziya SARIKAYA @ziyasal](https://github.com/ziyasal) & Contributors