mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-12 11:08:34 -05:00
Adds new ${directory} token
Changes ${path} token to be the full path
Adds relative formatting support
This commit is contained in:
@@ -6,7 +6,10 @@ import { GitStatusFile, IGitStatusFile, IGitStatusFileWithCommit } from '../mode
|
||||
import * as path from 'path';
|
||||
|
||||
export interface IStatusFormatOptions extends IFormatOptions {
|
||||
relativePath?: string;
|
||||
|
||||
tokenOptions?: {
|
||||
directory?: Strings.ITokenOptions;
|
||||
file?: Strings.ITokenOptions;
|
||||
filePath?: Strings.ITokenOptions;
|
||||
path?: Strings.ITokenOptions;
|
||||
@@ -15,18 +18,23 @@ export interface IStatusFormatOptions extends IFormatOptions {
|
||||
|
||||
export class StatusFileFormatter extends Formatter<IGitStatusFile, IStatusFormatOptions> {
|
||||
|
||||
get directory() {
|
||||
const directory = GitStatusFile.getFormattedDirectory(this._item, false, this._options.relativePath);
|
||||
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
|
||||
}
|
||||
|
||||
get file() {
|
||||
const file = path.basename(this._item.fileName);
|
||||
return this._padOrTruncate(file, this._options.tokenOptions!.file);
|
||||
}
|
||||
|
||||
get filePath() {
|
||||
const filePath = GitStatusFile.getFormattedPath(this._item);
|
||||
const filePath = GitStatusFile.getFormattedPath(this._item, undefined, this._options.relativePath);
|
||||
return this._padOrTruncate(filePath, this._options.tokenOptions!.filePath);
|
||||
}
|
||||
|
||||
get path() {
|
||||
const directory = GitStatusFile.getFormattedDirectory(this._item, false);
|
||||
const directory = GitStatusFile.getRelativePath(this._item, this._options.relativePath);
|
||||
return this._padOrTruncate(directory, this._options.tokenOptions!.file);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user