Browse Source

Adds create tag to Tags node

main
Eric Amodio 4 years ago
parent
commit
93e0055d89
3 changed files with 17 additions and 4 deletions
  1. +10
    -0
      package.json
  2. +4
    -0
      src/views/nodes/tagsNode.ts
  3. +3
    -4
      src/views/viewCommands.ts

+ 10
- 0
package.json View File

@ -7551,6 +7551,16 @@
"group": "1_gitlens_actions@2"
},
{
"command": "gitlens.views.createTag",
"when": "!gitlens:readonly && viewItem =~ /gitlens:tags\\b/",
"group": "inline@1"
},
{
"command": "gitlens.views.createTag",
"when": "!gitlens:readonly && viewItem =~ /gitlens:tags\\b/",
"group": "1_gitlens_actions@1"
},
{
"command": "gitlens.views.switchToTag",
"when": "!gitlens:readonly && viewItem =~ /gitlens:tag\\b/",
"group": "inline@10"

+ 4
- 0
src/views/nodes/tagsNode.ts View File

@ -28,6 +28,10 @@ export class TagsNode extends ViewNode {
return TagsNode.getId(this.repo.path);
}
get repoPath(): string {
return this.repo.path;
}
async getChildren(): Promise<ViewNode[]> {
if (this._children == null) {
const tags = await this.repo.getTags({ sort: true });

+ 3
- 4
src/views/viewCommands.ts View File

@ -42,6 +42,7 @@ import {
StashNode,
StatusFileNode,
TagNode,
TagsNode,
ViewNode,
ViewRefFileNode,
ViewRefNode,
@ -288,10 +289,8 @@ export class ViewCommands {
}
@debug()
private createTag(node?: ViewRefNode) {
if (node != null && !(node instanceof ViewRefNode)) return Promise.resolve();
return GitActions.Tag.create(node?.repoPath, node?.ref);
private createTag(node?: ViewRefNode | TagsNode) {
return GitActions.Tag.create(node?.repoPath, node instanceof ViewRefNode ? node?.ref : undefined);
}
@debug()

Loading…
Cancel
Save