visual-studio-codevscode-extensions

How to set an item the default in VS Code quick picker?


I'm creating an extension ATM and would like to set a default for the VS Code quick picker I'm working on to highlight an item. VS Code itself has something like this in the "Format document with..." picker, where the one previously selected is highlighted with "(default)".

enter image description here


Solution

  • I think this doesn't actually use any kind of built-in "default item" functionality (which doesn't exist as far as I know) - rather it's just a QuickPickItem with its description set to "(default)". You would also have to make sure to sort the default item to the top in the array of items you call showQuickPick() with.