Browse Source

Adds ${filePath} support to status file formatting

main
Eric Amodio 7 years ago
parent
commit
ca089777db
2 changed files with 11 additions and 1 deletions
  1. +6
    -0
      src/git/formatters/status.ts
  2. +5
    -1
      src/git/models/status.ts

+ 6
- 0
src/git/formatters/status.ts View File

@ -7,6 +7,7 @@ import * as path from 'path';
export interface IStatusFormatOptions extends IFormatOptions {
tokenOptions?: {
file?: Strings.ITokenOptions;
filePath?: Strings.ITokenOptions;
path?: Strings.ITokenOptions;
};
}
@ -18,6 +19,11 @@ export class StatusFileFormatter extends Formatter
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() {
const directory = GitStatusFile.getFormattedDirectory(this._item, false);
return this._padOrTruncate(directory, this._options.tokenOptions!.file);

+ 5
- 1
src/git/models/status.ts View File

@ -40,7 +40,7 @@ export class GitStatusFile implements IGitStatusFile {
}
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
return GitUri.getFormattedPath(this.fileName, separator);
return GitStatusFile.getFormattedPath(this, separator);
}
getOcticon() {
@ -57,6 +57,10 @@ export class GitStatusFile implements IGitStatusFile {
? `${directory} ${Strings.pad(GlyphChars.ArrowLeft, 1, 1)} ${status.originalFileName}`
: directory;
}
static getFormattedPath(status: IGitStatusFile, separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
return GitUri.getFormattedPath(status.fileName, separator);
}
}
const statusOcticonsMap = {

Loading…
Cancel
Save