Procházet zdrojové kódy

Fixes issue with . showing in the path of quick picks

main
Eric Amodio před 7 roky
rodič
revize
05ff9804bc
3 změnil soubory, kde provedl 25 přidání a 7 odebrání
  1. +15
    -4
      src/commands/quickPickItems.ts
  2. +3
    -3
      src/commands/quickPicks.ts
  3. +7
    -0
      src/git/gitEnrichment.ts

+ 15
- 4
src/commands/quickPickItems.ts Zobrazit soubor

@ -124,7 +124,7 @@ export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPick
item = {
...{
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
};
@ -145,10 +145,15 @@ const statusOcticons = [
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
constructor(status: GitFileStatusItem, item?: PartialQuickPickItem) {
let directory = path.dirname(status.fileName);
if (!directory || directory === '.') {
directory = undefined;
}
item = {
...{
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
};
@ -180,8 +185,14 @@ export class FileQuickPickItem implements QuickPickItem {
uri: GitUri;
constructor(commit: GitCommit, public fileName: string) {
this.label = path.basename(fileName);
this.description = path.dirname(fileName);
this.label = `$(info) ${path.basename(fileName)}`;
let directory = path.dirname(fileName);
if (!directory || directory === '.') {
directory = undefined;
}
this.description = directory;
this.sha = commit.sha;
this.uri = GitUri.fromUri(Uri.file(path.resolve(commit.repoPath, fileName)));

+ 3
- 3
src/commands/quickPicks.ts Zobrazit soubor

@ -80,7 +80,7 @@ export class CommitQuickPick {
return await window.showQuickPick(items, {
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()
} as QuickPickOptions);
}
@ -153,12 +153,12 @@ export class FileCommitsQuickPick {
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, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${path.basename(fileName)} \u00a0\u2022\u00a0 ${path.dirname(fileName)}`,
placeHolder: commit.getFormattedPath(),
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions);
}

+ 7
- 0
src/git/gitEnrichment.ts Zobrazit soubor

@ -92,6 +92,13 @@ export class GitCommit implements IGitCommit {
get uri(): Uri {
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 {

Načítá se…
Zrušit
Uložit