diff --git a/README.md b/README.md index c26947c..120492e 100644 --- a/README.md +++ b/README.md @@ -693,7 +693,7 @@ See also [Explorer Settings](#explorer-settings 'Jump to the Explorer settings') | `gitlens.explorers.defaultItemLimit` | Specifies the default number of items to show in an explorer list. Use 0 to specify no limit | | `gitlens.explorers.stashFileFormat` | Specifies the format of a stashed file in the _Repositories_ and _Results_ explorers
Available tokens
${directory} - directory name
${file} - file name
${filePath} - formatted file name and path
${path} - full file path | | `gitlens.explorers.stashFormat` | Specifies the format of stashed changes in the _Repositories_ and _Results_ explorers
Available tokens
${id} - commit id
${author} - commit author
${message} - commit message
${ago} - relative commit date (e.g. 1 day ago)
${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)
${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`
${authorAgo} - commit author, relative commit date
${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`
See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting | -| `gitlens.explorers.statusFileFormat` | Specifies the format of the status of a working or committed file in the _Repositories_ and _Results_ explorers
Available tokens
${directory} - directory name
${file} - file name
${filePath} - formatted file name and path
${path} - full file path
${working} - optional indicator if the file is uncommitted | +| `gitlens.explorers.statusFileFormat` | Specifies the format of the status of a working or committed file in the _Repositories_ explorer
Available tokens
${directory} - directory name
${file} - file name
${filePath} - formatted file name and path
${path} - full file path
${working} - optional indicator if the file is uncommitted | ### Code Lens Settings diff --git a/package.json b/package.json index e7e845a..050ed11 100644 --- a/package.json +++ b/package.json @@ -476,7 +476,7 @@ "gitlens.explorers.statusFileFormat": { "type": "string", "default": "${working }${filePath}", - "description": "Specifies the format of the status of a working or committed file in the `Repositories` and `Results` explorers\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path\n ${working} - optional indicator if the file is uncommitted", + "description": "Specifies the format of the status of a working or committed file in the `Repositories` explorer\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path\n ${working} - optional indicator if the file is uncommitted", "scope": "window" }, "gitlens.repositoriesExplorer.autoRefresh": { diff --git a/src/views/explorerCommands.ts b/src/views/explorerCommands.ts index 8942a36..7ebc5ca 100644 --- a/src/views/explorerCommands.ts +++ b/src/views/explorerCommands.ts @@ -25,10 +25,10 @@ import { ExplorerRefNode, RemoteNode, RepositoryNode, + ResultsFileNode, StashFileNode, StashNode, StatusFileCommitsNode, - StatusFileNode, StatusUpstreamNode, TagNode } from './nodes'; @@ -124,7 +124,7 @@ export class ExplorerCommands implements Disposable { return node.push(); } - private async applyChanges(node: CommitFileNode | StashFileNode | StatusFileNode) { + private async applyChanges(node: CommitFileNode | StashFileNode | ResultsFileNode) { await this.openFile(node); if (node.uri.sha !== undefined && node.uri.sha !== 'HEAD') { @@ -220,7 +220,7 @@ export class ExplorerCommands implements Disposable { void commands.executeCommand(BuiltInCommands.FocusFilesExplorer); } - private openChanges(node: CommitFileNode | StashFileNode | StatusFileNode) { + private openChanges(node: CommitFileNode | StashFileNode | ResultsFileNode) { const command = node.getCommand(); if (command === undefined || command.arguments === undefined) return; @@ -229,7 +229,7 @@ export class ExplorerCommands implements Disposable { return commands.executeCommand(command.command, uri, args); } - private async openChangesWithWorking(node: CommitFileNode | StashFileNode | StatusFileNode) { + private async openChangesWithWorking(node: CommitFileNode | StashFileNode | ResultsFileNode) { const args: DiffWithWorkingCommandArgs = { showOptions: { preserveFocus: true, @@ -237,7 +237,7 @@ export class ExplorerCommands implements Disposable { } }; - if (node instanceof StatusFileNode) { + if (node instanceof ResultsFileNode) { args.commit = await Container.git.getLogCommitForFile(node.repoPath, node.uri.fsPath, { ref: node.uri.sha, firstIfNotFound: true, @@ -248,17 +248,17 @@ export class ExplorerCommands implements Disposable { return commands.executeCommand(Commands.DiffWithWorking, node.uri, args); } - private openFile(node: CommitFileNode | StashFileNode | StatusFileNode) { + private openFile(node: CommitFileNode | StashFileNode | ResultsFileNode) { return openEditor(node.uri, { preserveFocus: true, preview: false }); } private openFileRevision( - node: CommitFileNode | StashFileNode | StatusFileNode, + node: CommitFileNode | StashFileNode | ResultsFileNode, options: OpenFileRevisionCommandArgs = { showOptions: { preserveFocus: true, preview: false } } ) { let uri = options.uri; if (uri == null) { - if (node instanceof StatusFileNode) { + if (node instanceof ResultsFileNode) { uri = GitUri.toRevisionUri(node.uri); } else { diff --git a/src/views/nodes.ts b/src/views/nodes.ts index 95c293c..84d19bd 100644 --- a/src/views/nodes.ts +++ b/src/views/nodes.ts @@ -21,7 +21,7 @@ export * from './nodes/stashesNode'; export * from './nodes/stashFileNode'; export * from './nodes/stashNode'; export * from './nodes/statusFileCommitsNode'; -export * from './nodes/statusFileNode'; +export * from './nodes/resultsFileNode'; export * from './nodes/statusFilesNode'; export * from './nodes/resultsFilesNode'; export * from './nodes/statusUpstreamNode'; diff --git a/src/views/nodes/statusFileNode.ts b/src/views/nodes/resultsFileNode.ts similarity index 90% rename from src/views/nodes/statusFileNode.ts rename to src/views/nodes/resultsFileNode.ts index 2684a3d..8001fb0 100644 --- a/src/views/nodes/statusFileNode.ts +++ b/src/views/nodes/resultsFileNode.ts @@ -3,14 +3,14 @@ import * as path from 'path'; import { Command, TreeItem, TreeItemCollapsibleState } from 'vscode'; import { Commands, DiffWithCommandArgs } from '../../commands'; import { Container } from '../../container'; -import { GitFile, GitStatusFile, GitUri, IStatusFormatOptions, StatusFileFormatter } from '../../git/gitService'; +import { GitFile, GitUri, IStatusFormatOptions, StatusFileFormatter } from '../../git/gitService'; import { Explorer } from '../explorer'; import { ExplorerNode, ResourceType } from './explorerNode'; -export class StatusFileNode extends ExplorerNode { +export class ResultsFileNode extends ExplorerNode { constructor( public readonly repoPath: string, - private readonly _file: GitStatusFile, + private readonly _file: GitFile, private readonly _ref1: string, private readonly _ref2: string, parent: ExplorerNode, @@ -49,7 +49,7 @@ export class StatusFileNode extends ExplorerNode { private _label: string | undefined; get label() { if (this._label === undefined) { - this._label = StatusFileFormatter.fromTemplate(this.explorer.config.statusFileFormat, this._file, { + this._label = StatusFileFormatter.fromTemplate('${filePath}', this._file, { relativePath: this.relativePath } as IStatusFormatOptions); } diff --git a/src/views/nodes/resultsFilesNode.ts b/src/views/nodes/resultsFilesNode.ts index dbc2117..3f1b0c1 100644 --- a/src/views/nodes/resultsFilesNode.ts +++ b/src/views/nodes/resultsFilesNode.ts @@ -8,7 +8,7 @@ import { Arrays, Iterables, Strings } from '../../system'; import { Explorer } from '../explorer'; import { ExplorerNode, ResourceType } from './explorerNode'; import { FileExplorerNode, FolderNode } from './folderNode'; -import { StatusFileNode } from './statusFileNode'; +import { ResultsFileNode } from './resultsFileNode'; export interface FilesQueryResults { label: string; @@ -33,7 +33,7 @@ export class ResultsFilesNode extends ExplorerNode { let children: FileExplorerNode[] = [ ...Iterables.map( diff, - s => new StatusFileNode(this.repoPath, s, this._ref1, this._ref2, this, this.explorer) + s => new ResultsFileNode(this.repoPath, s, this._ref1, this._ref2, this, this.explorer) ) ];