Skip to content

andrei-m/vscode-open-in-browser

Repository files navigation

open-in-browser

Open the current file the source control platform's web UI. This is useful for sharing perma-links with collaborators. Install via the VSCode Marketplace or see Installation Instructions.

example

Features

This extension adds 'Open in Browser' to the Command Palette. Running this command opens the default web browser to the currently edited file's URL in the web platform related to the Git origin (e.g. Github). The URL represents the current position of the cursor or the current multi-line selection.

Commonly used platforms such as Github and Gitlab are recognized automatically from the Git origin. Self-hosted web platforms such as Stash can be specified via the remote.$remoteName.url-platform git configuration setting in the edited file's repo, for example:

git config --add remote.origin.url-platform stash

The following remote.config.url-platform options are supported:

  • ado
  • github
  • gitlab
  • stash

An extension-wide setting can also be configured as a default for all repos. The priority order for remote web platform resolution is:

  1. The remote.origin.url-platform setting described above.
  2. Well-known domains guessed from the remote host (github.com, etc).
  3. The extension-wide setting.

Requirements

VSCode 1.85.0 or newer

Release Notes

0.0.2 (Latest)

Added

  • An extension-wide setting for the web platform. This is a convenience to avoid configuring many per-repo settings for repos that would otherwise be unrecognized.
  • Notifications for common error modes such as editing files that are not managed in Git

Changed

  • Web platform resolution based on the remote URL's domain is now case-insensitive.

See CHANGELOG.md for release history and work-in-progress.

Development

Compile before debugging. Debug (F5) while editing extension.ts to spawn a VSCode debug instance.

$ npm run compile

Tests run within a VSCode execution environment.

$ npm run test

About

Create a permalink from the currently edited file in VSCode

Resources

License

Stars

Watchers

Forks

Packages

No packages published