|
@ -1,12 +1,17 @@ |
|
|
'use strict'; |
|
|
'use strict'; |
|
|
import { Iterables } from '../system'; |
|
|
import { Iterables } from '../system'; |
|
|
import { QuickPickOptions, Uri, window } from 'vscode'; |
|
|
|
|
|
|
|
|
import { QuickPickOptions, Uri, window, workspace } from 'vscode'; |
|
|
|
|
|
import { IAdvancedConfig } from '../configuration'; |
|
|
import { Commands } from '../constants'; |
|
|
import { Commands } from '../constants'; |
|
|
import { GitCommit, GitUri, IGitLog } from '../gitProvider'; |
|
|
import { GitCommit, GitUri, IGitLog } from '../gitProvider'; |
|
|
import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem } from './quickPickItems'; |
|
|
import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem } from './quickPickItems'; |
|
|
import * as moment from 'moment'; |
|
|
import * as moment from 'moment'; |
|
|
import * as path from 'path'; |
|
|
import * as path from 'path'; |
|
|
|
|
|
|
|
|
|
|
|
function getQuickPickIgnoreFocusOut() { |
|
|
|
|
|
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export class CommitQuickPick { |
|
|
export class CommitQuickPick { |
|
|
|
|
|
|
|
|
static async show(commit: GitCommit, workingFileName: string, uri: Uri, currentCommand?: CommandQuickPickItem, goBackCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}): Promise<CommandQuickPickItem | undefined> { |
|
|
static async show(commit: GitCommit, workingFileName: string, uri: Uri, currentCommand?: CommandQuickPickItem, goBackCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}): Promise<CommandQuickPickItem | undefined> { |
|
@ -59,7 +64,8 @@ export class CommitQuickPick { |
|
|
|
|
|
|
|
|
return await window.showQuickPick(items, { |
|
|
return await window.showQuickPick(items, { |
|
|
matchOnDescription: true, |
|
|
matchOnDescription: true, |
|
|
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}` |
|
|
|
|
|
|
|
|
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`, |
|
|
|
|
|
ignoreFocusOut: getQuickPickIgnoreFocusOut() |
|
|
} as QuickPickOptions); |
|
|
} as QuickPickOptions); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -79,7 +85,8 @@ export class CommitFilesQuickPick { |
|
|
return await window.showQuickPick(items, { |
|
|
return await window.showQuickPick(items, { |
|
|
matchOnDescription: true, |
|
|
matchOnDescription: true, |
|
|
matchOnDetail: true, |
|
|
matchOnDetail: true, |
|
|
placeHolder: `${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}` |
|
|
|
|
|
|
|
|
placeHolder: `${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`, |
|
|
|
|
|
ignoreFocusOut: getQuickPickIgnoreFocusOut() |
|
|
} as QuickPickOptions); |
|
|
} as QuickPickOptions); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -116,7 +123,8 @@ export class FileCommitsQuickPick { |
|
|
return await window.showQuickPick(items, { |
|
|
return await window.showQuickPick(items, { |
|
|
matchOnDescription: true, |
|
|
matchOnDescription: true, |
|
|
matchOnDetail: true, |
|
|
matchOnDetail: true, |
|
|
placeHolder: `${Iterables.first(log.commits.values()).fileName}` |
|
|
|
|
|
|
|
|
placeHolder: `${Iterables.first(log.commits.values()).fileName}`, |
|
|
|
|
|
ignoreFocusOut: getQuickPickIgnoreFocusOut() |
|
|
} as QuickPickOptions); |
|
|
} as QuickPickOptions); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -141,7 +149,8 @@ export class RepoCommitsQuickPick { |
|
|
return await window.showQuickPick(items, { |
|
|
return await window.showQuickPick(items, { |
|
|
matchOnDescription: true, |
|
|
matchOnDescription: true, |
|
|
matchOnDetail: true, |
|
|
matchOnDetail: true, |
|
|
placeHolder: 'Search by commit message, filename, or sha' |
|
|
|
|
|
|
|
|
placeHolder: 'Search by commit message, filename, or sha', |
|
|
|
|
|
ignoreFocusOut: getQuickPickIgnoreFocusOut() |
|
|
} as QuickPickOptions); |
|
|
} as QuickPickOptions); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |