mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Adds ${filePath} support to status file formatting
This commit is contained in:
@@ -7,6 +7,7 @@ import * as path from 'path';
|
|||||||
export interface IStatusFormatOptions extends IFormatOptions {
|
export interface IStatusFormatOptions extends IFormatOptions {
|
||||||
tokenOptions?: {
|
tokenOptions?: {
|
||||||
file?: Strings.ITokenOptions;
|
file?: Strings.ITokenOptions;
|
||||||
|
filePath?: Strings.ITokenOptions;
|
||||||
path?: Strings.ITokenOptions;
|
path?: Strings.ITokenOptions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -18,6 +19,11 @@ export class StatusFileFormatter extends Formatter<IGitStatusFile, IStatusFormat
|
|||||||
return this._padOrTruncate(file, this._options.tokenOptions!.file);
|
return this._padOrTruncate(file, this._options.tokenOptions!.file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get filePath() {
|
||||||
|
const filePath = GitStatusFile.getFormattedPath(this._item);
|
||||||
|
return this._padOrTruncate(filePath, this._options.tokenOptions!.filePath);
|
||||||
|
}
|
||||||
|
|
||||||
get path() {
|
get path() {
|
||||||
const directory = GitStatusFile.getFormattedDirectory(this._item, false);
|
const directory = GitStatusFile.getFormattedDirectory(this._item, false);
|
||||||
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
|
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class GitStatusFile implements IGitStatusFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||||
return GitUri.getFormattedPath(this.fileName, separator);
|
return GitStatusFile.getFormattedPath(this, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOcticon() {
|
getOcticon() {
|
||||||
@@ -57,6 +57,10 @@ export class GitStatusFile implements IGitStatusFile {
|
|||||||
? `${directory} ${Strings.pad(GlyphChars.ArrowLeft, 1, 1)} ${status.originalFileName}`
|
? `${directory} ${Strings.pad(GlyphChars.ArrowLeft, 1, 1)} ${status.originalFileName}`
|
||||||
: directory;
|
: directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getFormattedPath(status: IGitStatusFile, separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||||
|
return GitUri.getFormattedPath(status.fileName, separator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusOcticonsMap = {
|
const statusOcticonsMap = {
|
||||||
|
|||||||
Reference in New Issue
Block a user