Skip to content

Commit

Permalink
Merge pull request #2 from andrei-m/rename
Browse files Browse the repository at this point in the history
Rename to "open in browser"
  • Loading branch information
andrei-m committed Feb 3, 2024
2 parents 401c051 + 5cac27b commit 32fceea
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,4 +1,4 @@
node_modules
out
.vscode-test/*
open-in-web-scm-*.vsix
open-in-browser-*.vsix
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,6 +1,6 @@
# Change Log

All notable changes to the "open-in-web-scm" extension will be documented in this file.
All notable changes to the "open-in-browser" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

Expand Down
4 changes: 3 additions & 1 deletion README.md
@@ -1,7 +1,9 @@
# open-in-web-scm
# open-in-browser

Open the current file the source control platform's web UI. This is useful for sharing perma-links with collaborators.

![example](https://raw.githubusercontent.com/andrei-m/vscode-open-in-browser/rename/docs/example.gif)

See [Installation Instructions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#packaging-extensions).

## Features
Expand Down
Binary file added docs/example.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
@@ -1,10 +1,10 @@
{
"name": "open-in-web-scm",
"displayName": "Open in Web SCM",
"description": "Create an SCM perma-link from the currently edited file.",
"name": "open-in-browser",
"displayName": "Open in Browser",
"description": "Create a web permalink from the currently edited file.",
"repository": {
"type": "git",
"url": "git@github.com:andrei-m/vscode-open-in-web-scm.git"
"url": "git@github.com:andrei-m/vscode-open-in-browser.git"
},
"version": "0.0.1",
"engines": {
Expand All @@ -18,8 +18,8 @@
"contributes": {
"commands": [
{
"command": "open-in-web-scm.openInWeb",
"title": "Open in Web SCM"
"command": "open-in-browser.open",
"title": "Open in Browser"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Expand Up @@ -4,7 +4,7 @@ import * as git from './git';
import { open } from './open';

export function activate(context: vscode.ExtensionContext) {
const disposable = vscode.commands.registerCommand('open-in-web-scm.openInWeb', () => {
const disposable = vscode.commands.registerCommand('open-in-browser.open', () => {
const editorInfo = editor.getEditorInfo();
if (editorInfo) {
git.getGitInfo().then(simpleGitInfo => {
Expand Down
16 changes: 8 additions & 8 deletions src/test/open.test.ts
Expand Up @@ -5,31 +5,31 @@ import { Selection } from '../editor';

suite('gitUrlToWebUrl', () => {
test('Github single line', () => {
const url = new UrlParsed('github.com', '/andrei-m/vscode-open-in-web-scm.git');
const url = new UrlParsed('github.com', '/andrei-m/vscode-open-in-browser.git');
const selection = new Selection('src/open.ts', 1, 1);
const webUrl = gitUrlToWebUrl(url, UrlPlatform.Github, 'deadbeef', selection);
assert.strictEqual('https://github.com/andrei-m/vscode-open-in-web-scm/blob/deadbeef/src/open.ts#L1', webUrl);
assert.strictEqual('https://github.com/andrei-m/vscode-open-in-browser/blob/deadbeef/src/open.ts#L1', webUrl);
});

test('Github multi line', () => {
const url = new UrlParsed('github.com', '/andrei-m/vscode-open-in-web-scm.git');
const url = new UrlParsed('github.com', '/andrei-m/vscode-open-in-browser.git');
const selection = new Selection('src/open.ts', 3, 5);
const webUrl = gitUrlToWebUrl(url, UrlPlatform.Github, 'deadbeef', selection);
assert.strictEqual('https://github.com/andrei-m/vscode-open-in-web-scm/blob/deadbeef/src/open.ts#L3-L5', webUrl);
assert.strictEqual('https://github.com/andrei-m/vscode-open-in-browser/blob/deadbeef/src/open.ts#L3-L5', webUrl);
});

test('Gitlab single line', () => {
const url = new UrlParsed('gitlab.com', '/andrei-m/vscode-open-in-web-scm.git');
const url = new UrlParsed('gitlab.com', '/andrei-m/vscode-open-in-browser.git');
const selection = new Selection('src/open.ts', 1, 1);
const webUrl = gitUrlToWebUrl(url, UrlPlatform.Stash, 'deadbeef', selection);
assert.strictEqual('https://gitlab.com/andrei-m/vscode-open-in-web-scm/-/blob/deadbeef/src/open.ts#L1', webUrl);
assert.strictEqual('https://gitlab.com/andrei-m/vscode-open-in-browser/-/blob/deadbeef/src/open.ts#L1', webUrl);
});

test('Gitlab multi line', () => {
const url = new UrlParsed('gitlab.com', '/andrei-m/vscode-open-in-web-scm.git');
const url = new UrlParsed('gitlab.com', '/andrei-m/vscode-open-in-browser.git');
const selection = new Selection('src/open.ts', 3, 5);
const webUrl = gitUrlToWebUrl(url, UrlPlatform.Gitlab, 'deadbeef', selection);
assert.strictEqual('https://gitlab.com/andrei-m/vscode-open-in-web-scm/-/blob/deadbeef/src/open.ts#L3-L5', webUrl);
assert.strictEqual('https://gitlab.com/andrei-m/vscode-open-in-browser/-/blob/deadbeef/src/open.ts#L3-L5', webUrl);
});

test('Stash single line', () => {
Expand Down

0 comments on commit 32fceea

Please sign in to comment.