mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Fixes issue with . showing in the path of quick picks
This commit is contained in:
@@ -124,7 +124,7 @@ export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPick
|
|||||||
item = {
|
item = {
|
||||||
...{
|
...{
|
||||||
label: `$(file-symlink-file) Open File`,
|
label: `$(file-symlink-file) Open File`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} \u00a0\u2022\u00a0 ${path.dirname(commit.fileName)}`
|
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.getFormattedPath()}`
|
||||||
},
|
},
|
||||||
...item
|
...item
|
||||||
};
|
};
|
||||||
@@ -145,10 +145,15 @@ const statusOcticons = [
|
|||||||
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
|
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
|
||||||
|
|
||||||
constructor(status: GitFileStatusItem, item?: PartialQuickPickItem) {
|
constructor(status: GitFileStatusItem, item?: PartialQuickPickItem) {
|
||||||
|
let directory = path.dirname(status.fileName);
|
||||||
|
if (!directory || directory === '.') {
|
||||||
|
directory = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
item = {
|
item = {
|
||||||
...{
|
...{
|
||||||
label: `${status.staged ? '$(check)' : '\u00a0\u00a0\u00a0'}\u00a0${statusOcticons[status.status]}\u00a0\u00a0\u00a0${path.basename(status.fileName)}`,
|
label: `${status.staged ? '$(check)' : '\u00a0\u00a0\u00a0'}\u00a0${statusOcticons[status.status]}\u00a0\u00a0\u00a0${path.basename(status.fileName)}`,
|
||||||
description: path.dirname(status.fileName)
|
description: directory
|
||||||
},
|
},
|
||||||
...item
|
...item
|
||||||
};
|
};
|
||||||
@@ -180,8 +185,14 @@ export class FileQuickPickItem implements QuickPickItem {
|
|||||||
uri: GitUri;
|
uri: GitUri;
|
||||||
|
|
||||||
constructor(commit: GitCommit, public fileName: string) {
|
constructor(commit: GitCommit, public fileName: string) {
|
||||||
this.label = path.basename(fileName);
|
this.label = `$(info) ${path.basename(fileName)}`;
|
||||||
this.description = path.dirname(fileName);
|
|
||||||
|
let directory = path.dirname(fileName);
|
||||||
|
if (!directory || directory === '.') {
|
||||||
|
directory = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.description = directory;
|
||||||
|
|
||||||
this.sha = commit.sha;
|
this.sha = commit.sha;
|
||||||
this.uri = GitUri.fromUri(Uri.file(path.resolve(commit.repoPath, fileName)));
|
this.uri = GitUri.fromUri(Uri.file(path.resolve(commit.repoPath, fileName)));
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class CommitQuickPick {
|
|||||||
|
|
||||||
return await window.showQuickPick(items, {
|
return await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
placeHolder: `${path.basename(commit.fileName)} \u00a0\u2022\u00a0 ${path.dirname(commit.fileName)} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
placeHolder: `${commit.getFormattedPath()} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
}
|
}
|
||||||
@@ -153,12 +153,12 @@ export class FileCommitsQuickPick {
|
|||||||
items.splice(0, 0, goBackCommand);
|
items.splice(0, 0, goBackCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileName = Iterables.first(log.commits.values()).fileName;
|
const commit = Iterables.first(log.commits.values());
|
||||||
|
|
||||||
return await window.showQuickPick(items, {
|
return await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
placeHolder: `${path.basename(fileName)} \u00a0\u2022\u00a0 ${path.dirname(fileName)}`,
|
placeHolder: commit.getFormattedPath(),
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,13 @@ export class GitCommit implements IGitCommit {
|
|||||||
get uri(): Uri {
|
get uri(): Uri {
|
||||||
return Uri.file(path.join(this.repoPath, this.originalFileName || this.fileName));
|
return Uri.file(path.join(this.repoPath, this.originalFileName || this.fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||||
|
const directory = path.dirname(this.fileName);
|
||||||
|
return (!directory || directory === '.')
|
||||||
|
? path.basename(this.fileName)
|
||||||
|
: `${path.basename(this.fileName)}${separator}${directory}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGitCommitLine {
|
export interface IGitCommitLine {
|
||||||
|
|||||||
Reference in New Issue
Block a user