|
@ -20,7 +20,7 @@ export enum ReferencesQuickPickIncludes { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface ReferencesQuickPickOptions { |
|
|
export interface ReferencesQuickPickOptions { |
|
|
allowEnteringRefs?: boolean; |
|
|
|
|
|
|
|
|
allowEnteringRefs?: boolean | { ranges?: boolean }; |
|
|
autoPick?: boolean; |
|
|
autoPick?: boolean; |
|
|
picked?: string; |
|
|
picked?: string; |
|
|
filter?: { branches?(b: GitBranch): boolean; tags?(t: GitTag): boolean }; |
|
|
filter?: { branches?(b: GitBranch): boolean; tags?(t: GitTag): boolean }; |
|
@ -41,9 +41,10 @@ export namespace ReferencePicker { |
|
|
quickpick.ignoreFocusOut = getQuickPickIgnoreFocusOut(); |
|
|
quickpick.ignoreFocusOut = getQuickPickIgnoreFocusOut(); |
|
|
|
|
|
|
|
|
quickpick.title = title; |
|
|
quickpick.title = title; |
|
|
quickpick.placeholder = options.allowEnteringRefs |
|
|
|
|
|
? `${placeHolder}${GlyphChars.Space.repeat(3)}(or enter a reference using #)` |
|
|
|
|
|
: placeHolder; |
|
|
|
|
|
|
|
|
quickpick.placeholder = |
|
|
|
|
|
options.allowEnteringRefs != null |
|
|
|
|
|
? `${placeHolder}${GlyphChars.Space.repeat(3)}(or enter a reference using #)` |
|
|
|
|
|
: placeHolder; |
|
|
quickpick.matchOnDescription = true; |
|
|
quickpick.matchOnDescription = true; |
|
|
|
|
|
|
|
|
const disposables: Disposable[] = []; |
|
|
const disposables: Disposable[] = []; |
|
@ -87,7 +88,13 @@ export namespace ReferencePicker { |
|
|
|
|
|
|
|
|
quickpick.show(); |
|
|
quickpick.show(); |
|
|
|
|
|
|
|
|
const getValidateGitReference = getValidateGitReferenceFn((await Container.git.getRepository(repoPath))!); |
|
|
|
|
|
|
|
|
const getValidateGitReference = getValidateGitReferenceFn((await Container.git.getRepository(repoPath))!, { |
|
|
|
|
|
ranges: |
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
|
|
|
|
options?.allowEnteringRefs && typeof options.allowEnteringRefs !== 'boolean' |
|
|
|
|
|
? options.allowEnteringRefs.ranges |
|
|
|
|
|
: undefined, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
quickpick.items = await items; |
|
|
quickpick.items = await items; |
|
|
|
|
|
|
|
@ -105,6 +112,7 @@ export namespace ReferencePicker { |
|
|
resolve(quickpick.activeItems[0]); |
|
|
resolve(quickpick.activeItems[0]); |
|
|
}), |
|
|
}), |
|
|
quickpick.onDidChangeValue(async e => { |
|
|
quickpick.onDidChangeValue(async e => { |
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
|
if (options.allowEnteringRefs) { |
|
|
if (options.allowEnteringRefs) { |
|
|
if (!(await getValidateGitReference(quickpick, e))) { |
|
|
if (!(await getValidateGitReference(quickpick, e))) { |
|
|
quickpick.items = await items; |
|
|
quickpick.items = await items; |
|
|