Skip to content

Allow extension authors to set the title of a QuickPick/InputBox in Options#119144

Merged
TylerLeonhardt merged 2 commits into
mainfrom
TylerLeonhardt/issue77423
Mar 18, 2021
Merged

Allow extension authors to set the title of a QuickPick/InputBox in Options#119144
TylerLeonhardt merged 2 commits into
mainfrom
TylerLeonhardt/issue77423

Conversation

@TylerLeonhardt

Copy link
Copy Markdown
Member

This PR fixes #77423

        await window.showQuickPick(['eins', 'zwei', 'drei'], {
		title: 'Hallo',
		placeHolder: 'eins, zwei or drei',
		onDidSelectItem: (item: any) => window.showInformationMessage(`Focus ${++i}: ${item}`)
	}

// and

        await window.showInputBox({
		title: 'Hallo',
		value: 'abcdef',
		valueSelection: [2, 4],
		placeHolder: 'For example: fedcba. But not: 123',
		validateInput: (text: any) => {
			window.showInformationMessage(`Validating: ${text}`);
			return text === '123' ? 'Not 123!' : null;
		}
	});

image

naturally if you don't specify a title, then no title bar shows up.

I was looking for an opportunity to write tests for this where I call the showInputBox or whatever and then check if the created input box behind the scenes has the title set... but that looks pretty convoluted so I'm not sure that test is worth it. Please let me know if there's a good way to write a test for this.

@TylerLeonhardt
TylerLeonhardt requested a review from chrmarti March 17, 2021 00:13
Comment thread src/vs/workbench/api/common/extHostQuickOpen.ts Outdated
@TylerLeonhardt
TylerLeonhardt force-pushed the TylerLeonhardt/issue77423 branch 2 times, most recently from f7a272c to 877c45a Compare March 17, 2021 17:43

@chrmarti chrmarti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread src/vs/workbench/api/common/extHostQuickOpen.ts Outdated
Comment thread src/vs/workbench/api/common/extHost.protocol.ts
Comment thread src/vs/workbench/api/common/extHostQuickOpen.ts Outdated
@TylerLeonhardt
TylerLeonhardt force-pushed the TylerLeonhardt/issue77423 branch from 877c45a to d8ede3b Compare March 18, 2021 17:34
@TylerLeonhardt
TylerLeonhardt merged commit 89d8eed into main Mar 18, 2021
@TylerLeonhardt
TylerLeonhardt deleted the TylerLeonhardt/issue77423 branch March 18, 2021 20:06
@github-actions github-actions Bot locked and limited conversation to collaborators May 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add title property to QuickPickOptions/InputBoxOptions (showQuickPick)

3 participants