mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Changes the file sort in the custom view
This commit is contained in:
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Adds `gitlens.gitExplorer.enabled` setting to specify whether or not to show the `GitLens` custom view - closes [#144](https://github.com/eamodio/vscode-gitlens/issues/144)
|
- Adds `gitlens.gitExplorer.enabled` setting to specify whether or not to show the `GitLens` custom view - closes [#144](https://github.com/eamodio/vscode-gitlens/issues/144)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Changes the sorting (now alphabetical) of files shown in the `GitLens` custom view
|
||||||
- Changes the default of the `gitlens.gitExplorer.commitFormat` setting to add parentheses around the commit id
|
- Changes the default of the `gitlens.gitExplorer.commitFormat` setting to add parentheses around the commit id
|
||||||
- Removes many menu items from `editor/title` & `editor/title/context` by default -- can be re-enabled via the `gitlens.advanced.menus` setting
|
- Removes many menu items from `editor/title` & `editor/title/context` by default -- can be re-enabled via the `gitlens.advanced.menus` setting
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,7 @@ export class CommitFileNode extends ExplorerNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const label = (this.displayAs & CommitFileNodeDisplayAs.CommitLabel)
|
const item = new TreeItem(this.label, TreeItemCollapsibleState.None);
|
||||||
? CommitFormatter.fromTemplate(this.getCommitTemplate(), this.commit, {
|
|
||||||
truncateMessageAtNewLine: true,
|
|
||||||
dataFormat: this.git.config.defaultDateFormat
|
|
||||||
} as ICommitFormatOptions)
|
|
||||||
: StatusFileFormatter.fromTemplate(this.getCommitFileTemplate(), this.status);
|
|
||||||
|
|
||||||
const item = new TreeItem(label, TreeItemCollapsibleState.None);
|
|
||||||
item.contextValue = this.resourceType;
|
item.contextValue = this.resourceType;
|
||||||
|
|
||||||
const icon = (this.displayAs & CommitFileNodeDisplayAs.CommitIcon)
|
const icon = (this.displayAs & CommitFileNodeDisplayAs.CommitIcon)
|
||||||
@@ -63,9 +56,25 @@ export class CommitFileNode extends ExplorerNode {
|
|||||||
|
|
||||||
item.command = this.getCommand();
|
item.command = this.getCommand();
|
||||||
|
|
||||||
|
// Only cache the label for a single refresh
|
||||||
|
this._label = undefined;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _label: string | undefined;
|
||||||
|
get label() {
|
||||||
|
if (this._label === undefined) {
|
||||||
|
this._label = (this.displayAs & CommitFileNodeDisplayAs.CommitLabel)
|
||||||
|
? CommitFormatter.fromTemplate(this.getCommitTemplate(), this.commit, {
|
||||||
|
truncateMessageAtNewLine: true,
|
||||||
|
dataFormat: this.git.config.defaultDateFormat
|
||||||
|
} as ICommitFormatOptions)
|
||||||
|
: StatusFileFormatter.fromTemplate(this.getCommitFileTemplate(), this.status);
|
||||||
|
}
|
||||||
|
return this._label;
|
||||||
|
}
|
||||||
|
|
||||||
protected getCommitTemplate() {
|
protected getCommitTemplate() {
|
||||||
return this.git.config.gitExplorer.commitFormat;
|
return this.git.config.gitExplorer.commitFormat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ export class CommitNode extends ExplorerNode {
|
|||||||
const commit = Iterables.first(log.commits.values());
|
const commit = Iterables.first(log.commits.values());
|
||||||
if (commit === undefined) return [];
|
if (commit === undefined) return [];
|
||||||
|
|
||||||
return [...Iterables.map(commit.fileStatuses, s => new CommitFileNode(s, commit, this.context, this.git, CommitFileNodeDisplayAs.File, this.branch))];
|
const children = [...Iterables.map(commit.fileStatuses, s => new CommitFileNode(s, commit, this.context, this.git, CommitFileNodeDisplayAs.File, this.branch))];
|
||||||
|
children.sort((a, b) => a.label!.localeCompare(b.label!));
|
||||||
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTreeItem(): TreeItem {
|
getTreeItem(): TreeItem {
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ export class StashNode extends ExplorerNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return statuses.map(s => new StashFileNode(s, this.commit, this.context, this.git));
|
const children = statuses.map(s => new StashFileNode(s, this.commit, this.context, this.git));
|
||||||
|
children.sort((a, b) => a.label!.localeCompare(b.label!));
|
||||||
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTreeItem(): TreeItem {
|
getTreeItem(): TreeItem {
|
||||||
|
|||||||
Reference in New Issue
Block a user