From 154f269e120718ccfb81cb772d740b868d625162 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 29 Oct 2018 00:27:05 -0400 Subject: [PATCH] Adds open in remote / copy remote url to many node toolbars --- images/dark/icon-copy-remote.svg | 5 +++ images/dark/icon-link.svg | 4 ++ images/light/icon-copy-remote.svg | 5 +++ images/light/icon-link.svg | 4 ++ package.json | 91 +++++++++++++++++++++++++++++--------- src/views/nodes/lineHistoryNode.ts | 2 +- src/views/nodes/viewNode.ts | 7 +-- 7 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 images/dark/icon-copy-remote.svg create mode 100644 images/dark/icon-link.svg create mode 100644 images/light/icon-copy-remote.svg create mode 100644 images/light/icon-link.svg diff --git a/images/dark/icon-copy-remote.svg b/images/dark/icon-copy-remote.svg new file mode 100644 index 0000000..82a06e4 --- /dev/null +++ b/images/dark/icon-copy-remote.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/images/dark/icon-link.svg b/images/dark/icon-link.svg new file mode 100644 index 0000000..70763bb --- /dev/null +++ b/images/dark/icon-link.svg @@ -0,0 +1,4 @@ + + + + diff --git a/images/light/icon-copy-remote.svg b/images/light/icon-copy-remote.svg new file mode 100644 index 0000000..c0c114e --- /dev/null +++ b/images/light/icon-copy-remote.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/images/light/icon-link.svg b/images/light/icon-link.svg new file mode 100644 index 0000000..ae84094 --- /dev/null +++ b/images/light/icon-link.svg @@ -0,0 +1,4 @@ + + + + diff --git a/package.json b/package.json index d08da07..c77b09f 100644 --- a/package.json +++ b/package.json @@ -1768,7 +1768,11 @@ { "command": "gitlens.copyRemoteFileUrlToClipboard", "title": "Copy Remote File Url to Clipboard", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-copy-remote.svg", + "light": "images/light/icon-copy-remote.svg" + } }, { "command": "gitlens.copyShaToClipboard", @@ -1792,22 +1796,38 @@ { "command": "gitlens.openBranchesInRemote", "title": "Open Branches on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.openBranchInRemote", "title": "Open Branch on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.openCommitInRemote", "title": "Open Commit on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.openFileInRemote", "title": "Open File on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.openFileRevision", @@ -1817,7 +1837,11 @@ { "command": "gitlens.openRepoInRemote", "title": "Open Repository on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.openWorkingFile", @@ -1980,7 +2004,11 @@ { "command": "gitlens.views.openFileRevisionInRemote", "title": "Open Revision on Remote", - "category": "GitLens" + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } }, { "command": "gitlens.views.openChangedFiles", @@ -3206,11 +3234,21 @@ { "command": "gitlens.openBranchesInRemote", "when": "viewItem == gitlens:branches:remotes", + "group": "inline@98" + }, + { + "command": "gitlens.openBranchesInRemote", + "when": "viewItem == gitlens:branches:remotes", "group": "1_gitlens@1" }, { "command": "gitlens.openBranchInRemote", "when": "viewItem =~ /gitlens:(branch\\b(.*?:tracking|:remote))/", + "group": "inline@98" + }, + { + "command": "gitlens.openBranchInRemote", + "when": "viewItem =~ /gitlens:(branch\\b(.*?:tracking|:remote))/", "group": "1_gitlens@1" }, { @@ -3291,6 +3329,11 @@ { "command": "gitlens.openCommitInRemote", "when": "viewItem =~ /gitlens:commit\\b/ && gitlens:hasRemotes", + "group": "inline@98" + }, + { + "command": "gitlens.openCommitInRemote", + "when": "viewItem =~ /gitlens:commit\\b/ && gitlens:hasRemotes", "group": "1_gitlens@1" }, { @@ -3371,18 +3414,18 @@ }, { "command": "gitlens.views.openFile", - "when": "viewItem =~ /gitlens:(file|history-file|status:file)\\b/", - "group": "inline" + "when": "viewItem =~ /gitlens:(file|history:(file|line)|status:file)\\b/", + "group": "inline@1" }, { "command": "gitlens.views.stageFile", "when": "viewItem =~ /gitlens:file\\b.*:unstaged\\b/", - "group": "inline" + "group": "inline@1" }, { "command": "gitlens.views.unstageFile", "when": "viewItem =~ /gitlens:file\\b.*:staged\\b/", - "group": "inline" + "group": "inline@1" }, { "command": "gitlens.views.stageFile", @@ -3416,7 +3459,7 @@ }, { "command": "gitlens.views.openFile", - "when": "viewItem =~ /gitlens:(file|history-file|status:file)\\b/", + "when": "viewItem =~ /gitlens:(file|history:(file|line)|status:file)\\b/", "group": "3_gitlens@1" }, { @@ -3426,12 +3469,18 @@ }, { "command": "gitlens.openFileInRemote", + "when": "viewItem =~ /gitlens:(file(?!:(un)?staged)|history:(file|line))\\b/ && gitlens:hasRemotes", + "group": "inline@99", + "alt": "gitlens.copyRemoteFileUrlToClipboard" + }, + { + "command": "gitlens.openFileInRemote", "when": "viewItem =~ /gitlens:file\\b/ && gitlens:hasRemotes", "group": "4_gitlens@1" }, { "command": "gitlens.copyRemoteFileUrlToClipboard", - "when": "viewItem =~ /gitlens:file\\b/ && gitlens:hasRemotes", + "when": "viewItem =~ /gitlens:(file|history:(file|line)|status:file)\\b/ && gitlens:hasRemotes", "group": "5_gitlens@3" }, { @@ -3441,15 +3490,10 @@ }, { "command": "gitlens.openFileInRemote", - "when": "viewItem =~ /gitlens:(history-file|status:file)\\b/ && gitlens:hasRemotes", + "when": "viewItem =~ /gitlens:(history:(file|line)|status:file)\\b/ && gitlens:hasRemotes", "group": "3_gitlens@2" }, { - "command": "gitlens.copyRemoteFileUrlToClipboard", - "when": "viewItem =~ /gitlens:(history-file|status:file)\\b/ && gitlens:hasRemotes", - "group": "5_gitlens@3" - }, - { "command": "gitlens.views.applyChanges", "when": "viewItem =~ /gitlens:file:(commit|results)\\b/", "group": "5_gitlens_1@1" @@ -3480,13 +3524,18 @@ "group": "8_gitlens@2" }, { - "command": "gitlens.openBranchesInRemote", + "command": "gitlens.openRepoInRemote", "when": "viewItem == gitlens:remote", - "group": "1_gitlens@1" + "group": "inline@98" }, { "command": "gitlens.openRepoInRemote", "when": "viewItem == gitlens:remote", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.openBranchesInRemote", + "when": "viewItem == gitlens:remote", "group": "1_gitlens@2" }, { diff --git a/src/views/nodes/lineHistoryNode.ts b/src/views/nodes/lineHistoryNode.ts index 4f6e4ca..017d415 100644 --- a/src/views/nodes/lineHistoryNode.ts +++ b/src/views/nodes/lineHistoryNode.ts @@ -111,7 +111,7 @@ export class LineHistoryNode extends SubscribeableViewNode { })}`, TreeItemCollapsibleState.Expanded ); - item.contextValue = ResourceType.FileHistory; + item.contextValue = ResourceType.LineHistory; item.tooltip = `History of ${this.uri.getFilename()}${lines}\n${this.uri.getDirectory()}/`; item.iconPath = { diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index ef0a44e..037191e 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -5,8 +5,8 @@ import { debug, gate, logName } from '../../system'; import { RefreshReason, TreeViewNodeStateChangeEvent, View } from '../viewBase'; export enum ResourceType { - ActiveFileHistory = 'gitlens:active:history-file', - ActiveLineHistory = 'gitlens:active:history-line', + ActiveFileHistory = 'gitlens:history:active:file', + ActiveLineHistory = 'gitlens:history:active:line', Branch = 'gitlens:branch', BranchWithTracking = 'gitlens:branch:tracking', Branches = 'gitlens:branches', @@ -19,11 +19,12 @@ export enum ResourceType { CommitFile = 'gitlens:file:commit', Commits = 'gitlens:commits', ComparisonResults = 'gitlens:results:comparison', - FileHistory = 'gitlens:history-file', + FileHistory = 'gitlens:history:file', FileStaged = 'gitlens:file:staged', FileStagedAndUnstaged = 'gitlens:file:staged:unstaged', FileUnstaged = 'gitlens:file:unstaged', Folder = 'gitlens:folder', + LineHistory = 'gitlens:history:line', Message = 'gitlens:message', Pager = 'gitlens:pager', Remote = 'gitlens:remote',