瀏覽代碼

Fixes #2136 stops selecting search mode value

main
Eric Amodio 2 年之前
父節點
當前提交
97f6487a06
共有 5 個檔案被更改,包括 19 行新增4 行删除
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      src/commands/git/search.ts
  3. +13
    -4
      src/commands/gitCommands.ts
  4. +3
    -0
      src/commands/quickCommand.steps.ts
  5. +1
    -0
      src/commands/quickCommand.ts

+ 1
- 0
CHANGELOG.md 查看文件

@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#2136](https://github.com/gitkraken/vscode-gitlens/issues/2136) - Search & Compare quickpick shouldn't select the mode text when opening
- Fixes [#1896](https://github.com/gitkraken/vscode-gitlens/issues/1896) - Cannot read property 'fsPath' of undefined
- Fixes [#1550](https://github.com/gitkraken/vscode-gitlens/issues/1550) - Push button in commit widget does not trigger "Push force" when ALT is pressed.
- Fixes [#1991](https://github.com/gitkraken/vscode-gitlens/issues/1991) - Git lens status bar entry has an incomprehensible accessibility label

+ 1
- 0
src/commands/git/search.ts 查看文件

@ -315,6 +315,7 @@ export class SearchGitCommand extends QuickCommand {
additionalButtons: [matchCaseButton, matchAllButton, matchRegexButton],
items: items,
value: state.pattern,
selectValueWhenShown: false,
onDidAccept: (quickpick): boolean => {
const pick = quickpick.selectedItems[0];
if (!searchOperators.has(pick.item)) return true;

+ 13
- 4
src/commands/gitCommands.ts 查看文件

@ -771,16 +771,25 @@ export class GitCommandsCommand extends Command {
// Needs to be after we reset the command
quickpick.buttons = this.getButtons(step, commandsStep.command);
if (step.value != null) {
const selectValueWhenShown = step.selectValueWhenShown ?? true;
if (step.value != null && selectValueWhenShown) {
quickpick.value = step.value;
}
quickpick.show();
// Manually trigger `onDidChangeValue`, because the QuickPick seems to fail to call it properly
if (step.value != null) {
if (step.value != null && !selectValueWhenShown) {
quickpick.value = step.value;
}
// Manually trigger `onDidChangeValue`, because the QuickPick fails to call it if the value is set before it is shown
if (step.value != null && selectValueWhenShown) {
// HACK: This is fragile!
(quickpick as any)._onDidChangeValueEmitter.fire(quickpick.value);
try {
(quickpick as any)._onDidChangeValueEmitter.fire(quickpick.value);
} catch {
debugger;
}
}
});
} finally {

+ 3
- 0
src/commands/quickCommand.steps.ts 查看文件

@ -688,6 +688,7 @@ export async function* pickBranchOrTagStep<
matchOnDescription: true,
matchOnDetail: true,
value: value,
selectValueWhenShown: true,
items:
branchesAndOrTags.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
@ -802,6 +803,7 @@ export async function* pickBranchOrTagStepMultiRepo<
matchOnDescription: true,
matchOnDetail: true,
value: value ?? (GitReference.isRevision(state.reference) ? state.reference.ref : undefined),
selectValueWhenShown: true,
items:
branchesAndOrTags.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
@ -923,6 +925,7 @@ export async function* pickCommitStep<
matchOnDescription: true,
matchOnDetail: true,
value: typeof picked === 'string' && log?.count === 0 ? picked : undefined,
selectValueWhenShown: true,
items: showInSideBarCommand != null ? [showInSideBarCommand, ...getItems(log)] : getItems(log),
onDidLoadMore: async quickpick => {
quickpick.keepScrollPosition = true;

+ 1
- 0
src/commands/quickCommand.ts 查看文件

@ -54,6 +54,7 @@ export interface QuickPickStep {
selectedItems?: QuickPickItem[];
title?: string;
value?: string;
selectValueWhenShown?: boolean;
onDidAccept?(quickpick: QuickPick<T>): boolean | Promise<boolean>;
onDidChangeValue?(quickpick: QuickPick<T>): boolean | Promise<boolean>;

Loading…
取消
儲存