vscode-interactive-graphviz icon indicating copy to clipboard operation
vscode-interactive-graphviz copied to clipboard

Make preserve focus accessible in the API

Open bigbug opened this issue 3 years ago • 1 comments

See comment in #126

bigbug avatar Aug 26 '22 06:08 bigbug

openAutomatically can also affect usage via API (it opens the preview again and thus gives it focus independent of the preserve setting), but I guess I'm that case there's no other way than to check the setting and not open the preview if it's active: https://github.com/Trass3r/vscode-debug-utils/commit/46076b75c8a60f791d28e78c2cd77bb1d0912761#diff-f29fe28514e2c277218bca29a44bfabdefe4b274cee42b814718ac1018879114R56 Edit: or could it be a bug, auto-open not respecting preserve focus?

Trass3r avatar Aug 26 '22 15:08 Trass3r

Hey @Trass3r,

openAutomatically can also affect usage via API (it opens the preview again and thus gives it focus independent of ... Edit: or could it be a bug, auto-open not respecting preserve focus?

This is actually a bug. We track open render panels in a Map<vscode.Uri, panel> indexed by an Uri object. However, with openAutomtically we failed to lookup the panel because the vscode.Uri objects did not match with the one indexed in the Map. I've changed it to take the vscode.Uri.toString() as an index for now. Not the most elegant solution but it is working :)

When #132 is merged and released you can now also provide the displayColumn option with your command execution. Note that preserveFocus falls back to the user's default unless you explicitly override it by setting it in displayColumn: {vscode.ViewColumn, vscode.preserveFocus=true|false}.

tintinweb avatar Sep 06 '22 10:09 tintinweb