Skip to content

Commit 6837414

Browse files
committed
Adds more details to remotes in custom view
1 parent ea6fdba commit 6837414

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
3232
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
3333

3434
- `Remotes` node — provides a list of remotes
35+
- Indicates the direction of the remote (fetch, push, both), remote service (if applicable), and repository path
3536
- Expand each remote to see its list of branches
3637
- Expand each branch to easily see its revision (commit) history
3738
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
145145
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
146146

147147
- `Remotes` node — provides a list of remotes
148+
- Indicates the direction of the remote (fetch, push, both), remote service (if applicable), and repository path
148149
- Expand each remote to see its list of branches
149150
- Expand each branch to easily see its revision (commit) history
150151
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export type GlyphChars = '\u21a9' |
7777
'\u2937' |
7878
'\u2190' |
7979
'\u2194' |
80+
'\u2192' |
8081
'\u21e8' |
8182
'\u2191' |
8283
'\u2713' |
@@ -91,6 +92,7 @@ export const GlyphChars = {
9192
ArrowDropRight: '\u2937' as GlyphChars,
9293
ArrowLeft: '\u2190' as GlyphChars,
9394
ArrowLeftRight: '\u2194' as GlyphChars,
95+
ArrowRight: '\u2192' as GlyphChars,
9496
ArrowRightHollow: '\u21e8' as GlyphChars,
9597
ArrowUp: '\u2191' as GlyphChars,
9698
Check: '\u2713' as GlyphChars,

src/views/remoteNode.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Iterables } from '../system';
33
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
44
import { BranchHistoryNode } from './branchHistoryNode';
5+
import { GlyphChars } from '../constants';
56
import { ExplorerNode, ResourceType } from './explorerNode';
67
import { GitRemote, GitService, GitUri } from '../gitService';
78

@@ -22,7 +23,26 @@ export class RemoteNode extends ExplorerNode {
2223
}
2324

2425
getTreeItem(): TreeItem {
25-
const item = new TreeItem(this.remote.name, TreeItemCollapsibleState.Collapsed);
26+
const fetch = this.remote.types.includes('push');
27+
const push = this.remote.types.includes('push');
28+
29+
let separator;
30+
if (fetch && push) {
31+
separator = GlyphChars.ArrowLeftRight;
32+
}
33+
else if (fetch) {
34+
separator = GlyphChars.ArrowLeft;
35+
}
36+
else if (push) {
37+
separator = GlyphChars.ArrowRight;
38+
}
39+
else {
40+
separator = GlyphChars.Dash;
41+
}
42+
43+
const label = `${this.remote.name} ${GlyphChars.Space}${separator}${GlyphChars.Space} ${(this.remote.provider !== undefined) ? this.remote.provider.name : this.remote.domain} ${GlyphChars.Space}${GlyphChars.Dot}${GlyphChars.Space} ${this.remote.path}`;
44+
45+
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
2646
item.contextValue = this.resourceType;
2747

2848
// item.iconPath = {

0 commit comments

Comments
 (0)