Open in Browser
Quickly open files from your Git repository in the browser with a single click. Supports GitHub, GitLab, Bitbucket, and custom Git hosting.
Features
- 🚀 One-click access to files in your browser.
- 🔄 Automatically detects the current Git branch.
- 🔗 Works with SSH and HTTPS remotes.
- 🏗️ Supports custom URL templates for any Git provider.
- 🛠️ Set a specific Git provider per repository.
- 🌐 Works with GitHub (Cloud & Enterprise), GitLab (Cloud & Self-hosted), and Bitbucket (Cloud & Server).
Usage
- Right-click any file in the Explorer and select Open in Browser.
- Use the Command Palette (Ctrl+Shift+P) and type Open in Browser.
Configuration
Setting a Provider per Repository
To set a Git provider for a specific repository, run the following command from the Command Palette:
Open in Browser: Set Provider for this Repository
This allows you to work with multiple repositories from different providers in the same workspace.
Custom URL Templates
For custom providers, you can define a URL template in your VSCode settings (settings.json
):
{
"openInBrowser.customUrlTemplate": "https://example.com/{repo}/blob/{branch}/{file}"
}
Placeholders:
{repo}
: The repository name (e.g., user/repo
).
{branch}
: The current branch name.
{file}
: The file path relative to the repository root.
Troubleshooting
- Ensure your repository has a remote named
origin
.
- If you encounter issues, check the debug console for logs.
Contributing
Contributions are welcome! Please fork the repository and create a pull request.
License
MIT © [Wojciech Jurkowianiec]