Preview icon disappears when clicking outside the document
supersurviveur opened this issue · comments
Describe the bug
When I click outside the typst document (but keeping it open), the preview icon in the top right-hand corner disappears.
Typst-preview-icon.mp4
To Reproduce
- Open a typst document
- Click outside the document (in the terminal or in the directory tree)
Expected behavior
The preview icon should remain visible as long as the document is open, even if the user clicks outside the document.
Package/Software version:
Version : 1.87.0 (user setup)
Validation : 019f4d1419fbc8219a181fab7892ebccf7ee29a2
Date : 2024-02-27T23:41:44.469Z
Electron : 27.3.2
ElectronBuildId : 26836302
Chromium : 118.0.5993.159
Node.js : 18.17.1
V8 : 11.8.172.18-electron.0
Système d’exploitation : Windows_NT x64 10.0.22631
typst-preview extension version: v0.10.8
Typst LSP seems to use "when": "editorLangId == typst"
in the package.json
file instead of "when": "resourceLangId == typst && editorTextFocus"
https://github.com/nvarner/typst-lsp/blob/master/editors/vscode/package.json#L314-L319
typst-preview/addons/vscode/package.json
Lines 94 to 99 in 64fc121
But it is a bit meaningless if you are try to preview an extension console, since typst-preview will start a preview on the focused editor. Please correct me if there are reasonable use cases.
Typst LSP seems to start rendering in the right place, even after clicking on the terminal. VSCode should be able to know that the document is loaded, even if the focus is in the terminal or the file tree, and i think it's possible to launch the preview on the document. This can be useful especially when opening a file, as the document doesn't take the focus.
maybe we can try disable editorTextFocus
and see if it works when editor is not focused. Like focusing on debug/output panel or terminal
It also doesn't work in the output panel for Typst LSP.