Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Proposed Value Selection API on Quick Pick #234771

Closed
2 tasks done
TylerLeonhardt opened this issue Nov 27, 2024 · 0 comments
Closed
2 tasks done

Test: Proposed Value Selection API on Quick Pick #234771

TylerLeonhardt opened this issue Nov 27, 2024 · 0 comments

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Nov 27, 2024

Refs: #233274

Complexity: 3

Create Issue


This iteration we added proposed API to allow value selection in a QuickPick. "Value selection" allows you to have part of the input box selected.

 declare module 'vscode' {
 	export interface QuickPick<T> {
 		/**
 		 * Selection range in the input value. Defined as tuple of two number where the
 		 * first is the inclusive start index and the second the exclusive end index. When
 		 * `undefined` the whole pre-filled value will be selected, when empty (start equals end)
 		 * only the cursor will be set, otherwise the defined range will be selected.
 		 *
 		 * This property does not get updated when the user types or makes a selection,
 		 * but it can be updated by the extension.
 		 */
 		valueSelection: readonly [number, number] | undefined;
 	}
 }

Prereqs

  • Have an extension (don't have one? create one!)
  • Add the proposed API in the package.json:
    "enabledApiProposals": ["valueSelectionInQuickPick"],
  • Run npx @vscode/dts dev to get the proposed API file

Use the window.createQuickPick() API

Use the vscode.window.createQuickPick() to create a quick pick where you can use valueSelection.

Things to try out:

  • Updating the value selection before showing the quickpick
  • Updating the value selection after showing the quickpick

Have fun with it!

@TylerLeonhardt TylerLeonhardt added this to the November 2024 milestone Nov 27, 2024
@chrmarti chrmarti removed their assignment Dec 3, 2024
@osortega osortega removed their assignment Dec 3, 2024
@osortega osortega closed this as completed Dec 4, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants