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: Finalization of keepScrollPosition: boolean in quickpick API #137740

Closed
2 tasks done
TylerLeonhardt opened this issue Nov 23, 2021 · 2 comments
Closed
2 tasks done

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Nov 23, 2021

Refs: #132068

Complexity: 3

Create Issue


This iteration we added a new property on the QuickPick object that allows you to control whether or not the scroll position (cursorTop) in the quickpick moves back to the top of the list.

  • Create a new extension
  • Get the latest vscode.d.ts: npx vscode-dts main
  • using the QuickPick object you get back from the window.createQuickPick() API, play with the new keepScrollPosition: boolean

Usecases:

Useful stuff

	"enabledApiProposals": [
		"quickPickSeparators"
	],

Note the name of the proposed API is gathered from the file name in the vscode-dts folder

@dbaeumer
Copy link
Member

Nice work! All cases worked as expected for me.

@dbaeumer dbaeumer removed their assignment Nov 30, 2021
@roblourens
Copy link
Member

roblourens commented Dec 2, 2021

Edit - never mind, I was thinking the selected item was going to be maintained. The scroll position is maintained.

I must be doing it wrong, the most basic case isn't working for me:

vscode.commands.registerCommand('extension.helloWorld', async (args) => {
	const quick = vscode.window.createQuickPick();
	quick.keepScrollPosition = true;

	const items: vscode.QuickPickItem[] = [
		{ label: 'Hello', description: 'World 1' },
		{ label: 'Hello', description: 'World 2' },
		{ label: 'Hello', description: 'World 3' },
	];
	quick.items = items;
	setInterval(() => {
		items.push({ label: 'Hello: ' + Date.now() });
		quick.items = items;
	}, 1000);

	quick.show();
});

The scroll position is reset when the items are updated

@roblourens roblourens removed their assignment Dec 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2022
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

4 participants