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
QuickPickOptions.onDidSelectItem hides the PickList when another document is loaded in the view #7019
Defines a onDidSelectItem function that will open and show a text document, like this:
letoptions=<vscode.QuickPickOptions>{placeHolder: 'Type a line number or a piece of code to navigate to',matchOnDescription: true,onDidSelectItem: item=>{if(item.detail.toString().toLowerCase()==vscode.window.activeTextEditor.document.uri.fsPath.toLowerCase()){revealLine(parseInt(item.label)-1);}else{// here is the problemleturiDocument: vscode.Uri=vscode.Uri.file(item.detail.toString());vscode.workspace.openTextDocument(uriDocument).then(doc=>{vscode.window.showTextDocument(doc).then(editor=>{// any code can be added here//revealLine(parseInt(item.label) - 1);});});}}};
Shows a vscode.window.showQuickPick, with that vscode.QuickPickOptions, like this:
vscode.window.showQuickPick(items,options).then(selection=>{// do anything});
Whenever the else code block in onDidSelectItem function is reached (wich will load another document) the PickList disappears. (no matter the code added inside showTextDocument, even nothing).
I don't know if this is the expected behavior or not, but it would good that the PickList remains visible. With that, I could have a preview of other documents.
Alessandro Fragnani (@alefragnani) Can you try this with the preserveFocus when calling showTextDocument? It should not move focus away from the quick pick widget so that it stays open.
By the way, Is there an API to show items in the pick list, just like the Go to Symbol, where you have some kind of groups of items (that appears when you type '@:' in the pick list)?
Currently, I'm using the QuickPickItem.detail property to show the file name of the item in the pick list, but the Go to Symbol grouping approach is much better, because it does not repeat that info for every item in the pick list.
Unsure - I don't like that fact the separator/group must be repeated on each item. Tho I also don't like the idea of a complex data structure. For now, I would opt to keep this simple
The way it works currently with string array as pick items is easy and would probably not allow for more complex things like groups and separators. For sure I would not just copy the internal API we have and make it public.
I didn't mean to expose that API, but only use the separator attribute idea. Sorry about the misundertandig.
I didn't look at the source to see how that API is related to the published API, so I don't know hard would be to publish a separator/grouping attribute and use it as in Benjamin Pasero (@bpasero) example (whiltespace picker). But since the same idea appears in other pickers too, like Go to Symbol, Open Recent, it's something that I was expecting to be able to use. Specially because it keeps the UI cleaner.
Alessandro Fragnani (@alefragnani) if you preserveFocus when opening an editor you can get this to work already today without the new ignoreFocusOut option
I think the issue remained open not based in the original post (about preserve focus) but because of expose grouping API. It lost the June tag/milestone and only last week new comments were added.
Would be valid to re-open (add a new issue) for that grouping feature in Pick List?
Activity
jrieken commentedon May 30, 2016
Today, quick pick closes on focus lost. We should add an option to prevent that.
jrieken commentedon May 30, 2016
Benjamin Pasero (@bpasero) Andre Weinand (@weinand) This might also be useful for the process picker work
bpasero commentedon May 30, 2016
Johannes Rieken (@jrieken) Andre Weinand (@weinand) this is already an option for the picker, see https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts#L389
weinand commentedon May 30, 2016
Johannes Rieken (@jrieken) Then this only needs to be surfaced in vscode.d.ts.
jrieken commentedon May 30, 2016
Alessandro Fragnani (@alefragnani) Can you try this with the
preserveFocuswhen callingshowTextDocument? It should not move focus away from the quick pick widget so that it stays open.alefragnani commentedon May 30, 2016
Johannes Rieken (@jrieken) It works perfectly, thanks 👍
By the way, Is there an API to show items in the pick list, just like the Go to Symbol, where you have some kind of groups of items (that appears when you type '@:' in the pick list)?
Currently, I'm using the
QuickPickItem.detailproperty to show the file name of the item in the pick list, but the Go to Symbol grouping approach is much better, because it does not repeat that info for every item in the pick list.Thanks in advance
bpasero commentedon May 30, 2016
This is something we do support from within code but not exposed as API. The related option for a picker entry is in https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/services/quickopen/common/quickOpenService.ts#L18
We use it e.g. if you click on the whitespace picker in the status bar.
alefragnani commentedon May 30, 2016
Benjamin Pasero (@bpasero), That´s exactly what I mean. Any chances in exposing this API?
jrieken commentedon May 31, 2016
Unsure - I don't like that fact the separator/group must be repeated on each item. Tho I also don't like the idea of a complex data structure. For now, I would opt to keep this simple
bpasero commentedon May 31, 2016
The way it works currently with string array as pick items is easy and would probably not allow for more complex things like groups and separators. For sure I would not just copy the internal API we have and make it public.
alefragnani commentedon May 31, 2016
I didn't mean to expose that API, but only use the
separatorattribute idea. Sorry about the misundertandig.I didn't look at the source to see how that API is related to the published API, so I don't know hard would be to publish a
separator/groupingattribute and use it as in Benjamin Pasero (@bpasero) example (whiltespace picker). But since the same idea appears in other pickers too, like Go to Symbol, Open Recent, it's something that I was expecting to be able to use. Specially because it keeps the UI cleaner.Johannes Rieken (@jrieken) I totally agree about keep this simple 👍
Thanks
3 remaining items
jrieken commentedon Jun 28, 2016
Backlog or No milestone is the same to me
alefragnani commentedon Jun 28, 2016
Ah, ok.. Thanks 👍
jrieken commentedon Aug 25, 2016
We did add
ignoreFocusOutflags for quick pick and inputbpasero commentedon Sep 2, 2016
Marking as verification-found due to #11442
bpasero commentedon Sep 2, 2016
Alessandro Fragnani (@alefragnani) if you
preserveFocuswhen opening an editor you can get this to work already today without the newignoreFocusOutoptionalefragnani commentedon Sep 2, 2016
Benjamin Pasero (@bpasero) yes, I'm already using it as Johannes Rieken (@jrieken) suggested in May 👍
I think the issue remained open not based in the original post (about preserve focus) but because of expose grouping API. It lost the June tag/milestone and only last week new comments were added.
Would be valid to re-open (add a new issue) for that grouping feature in Pick List?
jrieken commentedon Sep 2, 2016
Let's track the grouping in a new item.