mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 17:25:33 -05:00
Changes to use enum for glyphs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { DocumentSchemes } from '../constants';
|
||||
import { DocumentSchemes, GlyphChars } from '../constants';
|
||||
import { GitService, IGitStatusFile } from '../gitService';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -62,7 +63,7 @@ export class GitUri extends Uri {
|
||||
return Uri.file(this.sha ? this.path : this.fsPath);
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
let directory = path.dirname(this.fsPath);
|
||||
if (this.repoPath) {
|
||||
directory = path.relative(this.repoPath, directory);
|
||||
@@ -108,7 +109,7 @@ export class GitUri extends Uri {
|
||||
return (!directory || directory === '.') ? '' : directory;
|
||||
}
|
||||
|
||||
static getFormattedPath(fileNameOrUri: string | Uri, separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
static getFormattedPath(fileNameOrUri: string | Uri, separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
let fileName: string;
|
||||
if (fileNameOrUri instanceof Uri) {
|
||||
if (fileNameOrUri instanceof GitUri) return fileNameOrUri.getFormattedPath(separator);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { GlyphChars } from '../../constants';
|
||||
import { Git } from '../git';
|
||||
import { GitUri } from '../gitUri';
|
||||
import * as path from 'path';
|
||||
@@ -22,7 +24,6 @@ export type GitCommitType = 'blame' | 'branch' | 'file' | 'stash';
|
||||
export class GitCommit {
|
||||
|
||||
type: GitCommitType;
|
||||
// lines: GitCommitLine[];
|
||||
originalFileName?: string;
|
||||
previousSha?: string;
|
||||
previousFileName?: string;
|
||||
@@ -37,7 +38,6 @@ export class GitCommit {
|
||||
public author: string,
|
||||
public date: Date,
|
||||
public message: string,
|
||||
// lines?: GitCommitLine[],
|
||||
originalFileName?: string,
|
||||
previousSha?: string,
|
||||
previousFileName?: string
|
||||
@@ -45,7 +45,6 @@ export class GitCommit {
|
||||
this.type = type;
|
||||
this.fileName = this.fileName && this.fileName.replace(/, ?$/, '');
|
||||
|
||||
// this.lines = lines || [];
|
||||
this.originalFileName = originalFileName;
|
||||
this.previousSha = previousSha;
|
||||
this.previousFileName = previousFileName;
|
||||
@@ -74,7 +73,7 @@ export class GitCommit {
|
||||
return Uri.file(path.resolve(this.repoPath, this.originalFileName || this.fileName));
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
return GitUri.getFormattedPath(this.fileName, separator);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { GlyphChars } from '../../constants';
|
||||
import { GitUri } from '../gitUri';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -37,7 +39,7 @@ export class GitStatusFile implements IGitStatusFile {
|
||||
return GitStatusFile.getFormattedDirectory(this, includeOriginal);
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
return GitUri.getFormattedPath(this.fileName, separator);
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ export class GitStatusFile implements IGitStatusFile {
|
||||
static getFormattedDirectory(status: IGitStatusFile, includeOriginal: boolean = false): string {
|
||||
const directory = GitUri.getDirectory(status.fileName);
|
||||
return (includeOriginal && status.status === 'R' && status.originalFileName)
|
||||
? `${directory} \u00a0\u2190\u00a0 ${status.originalFileName}`
|
||||
? `${directory} ${Strings.pad(GlyphChars.ArrowLeft, 1, 1)} ${status.originalFileName}`
|
||||
: directory;
|
||||
}
|
||||
}
|
||||
@@ -68,6 +70,6 @@ const statusOcticonsMap = {
|
||||
U: '$(question)'
|
||||
};
|
||||
|
||||
export function getGitStatusIcon(status: GitStatusFileStatus, missing: string = '\u00a0\u00a0\u00a0\u00a0'): string {
|
||||
export function getGitStatusIcon(status: GitStatusFileStatus, missing: string = GlyphChars.Space.repeat(4)): string {
|
||||
return statusOcticonsMap[status] || missing;
|
||||
}
|
||||
Reference in New Issue
Block a user