Ver código fonte

Adds config setting to control quickpick closing

main
Eric Amodio 7 anos atrás
pai
commit
d9e638df01
3 arquivos alterados com 22 adições e 5 exclusões
  1. +5
    -0
      package.json
  2. +14
    -5
      src/commands/quickPicks.ts
  3. +3
    -0
      src/configuration.ts

+ 5
- 0
package.json Ver arquivo

@ -299,6 +299,11 @@
],
"description": "Specifies how much (if any) output will be sent to the GitLens output channel"
},
"gitlens.advanced.quickPick.closeOnFocusOut": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to close the QuickPick menu when focus is lost"
},
"gitlens.advanced.toggleWhitespace.enabled": {
"type": "boolean",
"default": false,

+ 14
- 5
src/commands/quickPicks.ts Ver arquivo

@ -1,12 +1,17 @@
'use strict';
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 { GitCommit, GitUri, IGitLog } from '../gitProvider';
import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem } from './quickPickItems';
import * as moment from 'moment';
import * as path from 'path';
function getQuickPickIgnoreFocusOut() {
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
}
export class CommitQuickPick {
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, {
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);
}
}
@ -79,7 +85,8 @@ export class CommitFilesQuickPick {
return await window.showQuickPick(items, {
matchOnDescription: 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);
}
}
@ -116,7 +123,8 @@ export class FileCommitsQuickPick {
return await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${Iterables.first(log.commits.values()).fileName}`
placeHolder: `${Iterables.first(log.commits.values()).fileName}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions);
}
}
@ -141,7 +149,8 @@ export class RepoCommitsQuickPick {
return await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: 'Search by commit message, filename, or sha'
placeHolder: 'Search by commit message, filename, or sha',
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions);
}
}

+ 3
- 0
src/configuration.ts Ver arquivo

@ -109,6 +109,9 @@ export interface IAdvancedConfig {
output: {
level: OutputLevel;
};
quickPick: {
closeOnFocusOut: boolean;
};
toggleWhitespace: {
enabled: boolean;
};

Carregando…
Cancelar
Salvar