Change:
} const target = this._model.nextOrPreviousReference(source, fwd); const editorFocus = this._editor.hasTextFocus(); <ins> const previewEditorFocus = this._widget.isPreviewEditorFocused(); </ins> await this._widget.setSelection(target); await this._gotoReference(target); if (editorFocus) { this._editor.focus(); <ins> } else if (this._widget && previewEditorFocus) { this._widget.focusOnPreviewEditor(); </ins> } }

Discussion:
I love the peek window. It's pretty much the best thing ever. I would love it ever so slightly more if VSCode would auto-focus it and insert the cursor where it belongs. e.g. if I clicked "peek definition", the cursor should be on the definition of what I peeked. This idea seems so obvious I can't believe it's not part of the default implementation, but I know you guys have your reasons for doing things. If there is such a reason, could this at least be made a setting? Thanks guys!
Fiar request. The reasoning for focusing the tree of the left that you might wanna quickly skim through all references/definitions/etc to get fast overview. That's also the reason for changing the peek editor when the focus changes in the list. We could add a command that allows to toggle between the selected reference/def and the peek view and then remember where you have been last
Ah, I understand. Speaking to my own use case, I use peek definition at least 98% of the time that I use the peek window, so at least 98% of the time there's only one file in the tree, and highlighting the tree doesn't make much sense. (I think it's a bit of a UX problem with the "peek all references" - it feels a little too much information in too constrained a space, so I normally do a global search instead - but that's an alternate request.) Your toggle command sounds great to me. I would also love if there was a keyboard shortcut to focus back on the original text document.
maybe the focus should be on the peek editor directly if there is only one entry in the list, that would be very helpful.
Is there any progress being made on this?
Not entirely sure whether it's appropriate to add this here, but I'd also suggest two other things for the peek window that're in the same vein: the "Keep peek editors open even when double clicking their content or when hitting escape" into two. The two aren't really equivalent, especially since double-clicking selects entire words and I'd for example like to be able to that, but still be able to close the window with Esc. 'd suggest changing the tab order of the peek window for the editor to follow the list. That way, when the peek window is opened you can select the appropriate file and Tab into it instead of Shift+Tabbing.

Any push on this? this is a must have. I seriously don't know how people have gone without this.
This is an open source project, this issue is marked as 'help wanted', so how about you?
I'll give it a try, looking for a way to automatically focus on peek window when there is only one entry in the list, according to suggestion. Do you guys think it's a good solution?
I'd say a command to move focus between them and then a setting to define is focused by default is the better solution. That makes the behaviour predictable, e.g I often press Enter when having just one reference I wouldn't want a new line then
fyi - this is the place (and sample) for adding commands that use the peek view widget:
Besides, we still need a setting to define which component will receive focus by default when Peek Window is shown.
Sorry. I'm so far away from having time to learn how to contribute. I'd like to, but I'm still in college working on several other things at the moment. Also, wouldn't even know where to start learning how to build vscode extensions and stuff.
Hi, I'm a heavy user of peek editor. But I accidentally minimize the peek editor window , which means when I click peek definition or declaration or references, there will be just file along with its path that include the definition will display in the first row , and the editor window (which should be the second row) will not. I have tried many ways to get it back to view, but nothing works. And I search all the settings related to peek, but none of them are about how adjust the size of peek editor. Have you ever encountered the same issue? Thanks for your time to view my question.
fyi - I have change the setting to: