tintinweb / vscode-interactive-graphviz

Interactive Graphviz Dot Preview for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.graphviz-interactive-preview
GNU General Public License v3.0
143 stars 22 forks source link

Make preserve focus accessible in the API #131

Closed bigbug closed 1 year ago

bigbug commented 1 year ago

See comment in #126

Trass3r commented 1 year ago

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?

tintinweb commented 1 year ago

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}.