You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to handle focused items in vscode.window.showQuickPick? #540
I would like to replicate the behavior of Go to Symbol command, where I give a list if items and the user can use UP/DOWN keys to navigate between them. Each now focused item, it scrolls the editor to the position where that piece of code is located. My intention is to use the line number to navigate.
I was thinking to use vscode.window.showQuickPick, but didn' find how to do this (no event, for instance).
Thanks in advance.
Copied from original issue: Microsoft/vscode-extensionbuilders#122
I'm not aware of a way to do that [navigate as a user highlights but does not select] in QuickPick - we obviously event for theme previews so it's possible. Adding Benjamin Pasero (@bpasero) but I think this is something for us to look at adding vs something we have.
Benjamin Pasero (@bpasero) how do I do it without interfere in the original DocumentSymbolProvider already associated to each document?
I could implement a registerDocumentSymbolProvider and fill the SymbolInformation array with my items. But only when I call Go to Symbol command, my items appeared. And so, for files like .ts, .json, which already have their symbols, it merged. In the screenshot below, the first 3 items are mine, the other 3 are symbols automatically generated for this .json file
If I could cancel the other symbols, it could help, but I guess this is not the way. At least, it doesn't appears correct to use the Go to Symbol command.
The result of document symbol providers are always merged because the document symbol feature is there provide a full outline of all symbols in a document.
Alessandro Fragnani (@alefragnani) It seems we don't have the right API for you. What is your exact use-case and what do you want to do with apis (DocumentSymbol and quick pick)?
Johannes Rieken (@jrieken) I would like to add an enhancement to my Bookmarks extension, listing the lines where the bookmarks are, with a preview of the line, and when the user hits UP/DOWN for each item, the editor would scroll to that line. In the screenshot above, the first 3 items that are the bookmarks (line number and preview).
This detect user focusing items when moving up/down behavior is the reason why I asked to replicate Go To Symbol command 😄
Alessandro Fragnani (@alefragnani) Thanks for clarifying. The document symbol provider doesn't seem like the right vehicle for this, despite its auto-revel behaviour. Being pinged on focus is a valid request. I will give it some though...
Activity
jrieken commentedon Nov 24, 2015
From Sean McBreen (@seanmcbreen) on November 18, 2015 4:49
I'm not aware of a way to do that [navigate as a user highlights but does not select] in QuickPick - we obviously event for theme previews so it's possible. Adding Benjamin Pasero (@bpasero) but I think this is something for us to look at adding vs something we have.
jrieken commentedon Nov 24, 2015
From Benjamin Pasero (@bpasero) on November 18, 2015 8:26
Alessandro Fragnani (@alefragnani) you will need to implement registerDocumentSymbolProvider !
jrieken commentedon Nov 24, 2015
From Alessandro Fragnani (@alefragnani) on November 21, 2015 3:23
Benjamin Pasero (@bpasero) how do I do it without interfere in the original
DocumentSymbolProvideralready associated to each document?I could implement a
registerDocumentSymbolProviderand fill theSymbolInformationarray with my items. But only when I call Go to Symbol command, my items appeared. And so, for files like.ts,.json, which already have their symbols, it merged. In the screenshot below, the first 3 items are mine, the other 3 are symbols automatically generated for this.jsonfileIf I could cancel the other symbols, it could help, but I guess this is not the way. At least, it doesn't appears correct to use the Go to Symbol command.
Thanks for your help
jrieken commentedon Nov 24, 2015
From Benjamin Pasero (@bpasero) on November 21, 2015 7:29
Johannes Rieken (@jrieken) is the one to answer
jrieken commentedon Nov 24, 2015
The result of document symbol providers are always merged because the document symbol feature is there provide a full outline of all symbols in a document.
Alessandro Fragnani (@alefragnani) It seems we don't have the right API for you. What is your exact use-case and what do you want to do with apis (DocumentSymbol and quick pick)?
jrieken commentedon Nov 24, 2015
From Alessandro Fragnani (@alefragnani) on November 24, 2015 9:46
Johannes Rieken (@jrieken) I would like to add an enhancement to my Bookmarks extension, listing the lines where the bookmarks are, with a preview of the line, and when the user hits UP/DOWN for each item, the editor would scroll to that line. In the screenshot above, the first 3 items that are the bookmarks (line number and preview).
This detect user focusing items when moving up/down behavior is the reason why I asked to replicate Go To Symbol command 😄
jrieken commentedon Nov 24, 2015
Alessandro Fragnani (@alefragnani) Thanks for clarifying. The document symbol provider doesn't seem like the right vehicle for this, despite its auto-revel behaviour. Being pinged on focus is a valid request. I will give it some though...
jrieken commentedon Dec 23, 2015
Could be as simple as having a function in the
QuickPickOptions, like sojrieken commentedon Jan 5, 2016
this will be handled by #1795