Skip to content

Commit 9b1a1f4

Browse files
author
Ziya SARIKAYA
committed
code refactoring
1 parent 79fd1b0 commit 9b1a1f4

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
"search.exclude": {
77
"out": true
88
}
9+
,
10+
"typescript.check.workspaceVersion": false
911
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Open in GitHub / Bitbucket / VisualStudio.com !",
44
"description": "Jump to a source code line in Github / Bitbucket / VisualStudio.com !",
55
"icon": "images/icon_200.png",
6-
"version": "1.2.1",
6+
"version": "1.2.3",
77
"publisher": "ziyasal",
88
"license": "SEE LICENSE IN LICENSE.md",
99
"galleryBanner": {

src/extension.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var findParentDir = require('find-parent-dir');
1717

1818
const gitProvider = require('./gitProvider');
1919

20-
function getGitHubLink(cb, fileFsPath, line) {
20+
function getGitProviderLink(cb, fileFsPath, line) {
2121
var cwd = workspace.rootPath;
2222
var repoDir = findParentDir.sync(workspace.rootPath, '.git') || cwd;
2323

@@ -49,46 +49,47 @@ function getGitHubLink(cb, fileFsPath, line) {
4949
});
5050
}
5151

52-
function getGitHubLinkForFile(fileFsPath, cb) {
53-
getGitHubLink(cb, fileFsPath);
52+
function getGitProviderLinkForFile(fileFsPath, cb) {
53+
getGitProviderLink(cb, fileFsPath);
5454
}
5555

56-
function getGitHubLinkForCurrentEditorLine(cb) {
56+
function getGitProviderLinkForCurrentEditorLine(cb) {
5757
var editor = Window.activeTextEditor;
5858
if (editor) {
5959
var lineIndex = editor.selection.active.line + 1;
6060
var fileFsPath = editor.document.uri.fsPath;
61-
getGitHubLink(cb, fileFsPath, lineIndex);
61+
getGitProviderLink(cb, fileFsPath, lineIndex);
6262
}
6363
}
6464

65-
function getGitHubLinkForRepo(cb) {
66-
getGitHubLink(cb);
65+
function getGitProviderLinkForRepo(cb) {
66+
getGitProviderLink(cb);
6767
}
6868

6969
function branchOnCallingContext(args, cb) {
7070
if (args && args.fsPath) {
71-
getGitHubLinkForFile(args.fsPath, cb);
71+
getGitProviderLinkForFile(args.fsPath, cb);
7272
}
7373
else if (Window.activeTextEditor) {
74-
getGitHubLinkForCurrentEditorLine(cb);
74+
getGitProviderLinkForCurrentEditorLine(cb);
7575
}
7676
else {
77-
getGitHubLinkForRepo(cb);
77+
getGitProviderLinkForRepo(cb);
7878
}
7979
}
8080

81-
function openInGitHub(args) {
81+
function openInGitProvider(args) {
8282
branchOnCallingContext(args, open);
8383
}
8484

85-
function copyGitHubLinkToClipboard(args) {
85+
function copyGitProviderLinkToClipboard(args) {
8686
branchOnCallingContext(args, copy);
8787
}
8888

89+
//TODO: rename openInGitHub to openInGitProvider
8990
function activate(context) {
90-
context.subscriptions.push(commands.registerCommand('extension.openInGitHub', openInGitHub));
91-
context.subscriptions.push(commands.registerCommand('extension.copyGitHubLinkToClipboard', copyGitHubLinkToClipboard));
91+
context.subscriptions.push(commands.registerCommand('extension.openInGitHub', openInGitProvider));
92+
context.subscriptions.push(commands.registerCommand('extension.copyGitHubLinkToClipboard', copyGitProviderLinkToClipboard));
9293
}
9394

9495
exports.activate = activate;

0 commit comments

Comments
 (0)