Open knuesel opened 3 days ago
Separating preview thread and LSP thread in different processes will double the memory usage on compilation. Tinymist has already integrated typst-preview since v0.11.12, which hasn't been used yet though.
To test it, you can check:
cargo run --bin tinymist -- preview main.typ
For minimal LSP, we can do some LSP wrapping on the preview server rather than publishing another binary. Some idea on server mode:
lsp
: regular lsp.preview
: starts a preview server compatible with typst-preview
.preview-lsp
(not implemented yet): starts a simple preview server, also accepting standard LSP messages.syntax-lsp
(not implemented yet): starts a syntax-only lsp server. you can have a better battery life. This is suitable for taking lecture notes in your class.Note: we are encountering some bug in v0.11.12. If you are still on v0.11.11, please wait for v0.11.13 to have a stable release that fixes this bug.
I managed to preview a file with cargo run --bin tinymist -- preview main.typ
but it doesn't seem to work as an LSP server for helix. I guess that's expected?
Your ideas for minimal LSP sound great :)
Motivation
Making "onType" browser preview and jump-to-source work in Helix and other editors that don't support VS Code extensions.
Currently I use https://github.com/tmistele/typst-lsp: a fork of typst-lsp that opens its own window to draw the preview, and also uses LSP to jump in the source when clicking somewhere in the preview. But it's rather experimental, the GUI is not very functional and it's not actively developed.
Description
Examples/Questions
I think it would make sense to have these settings separate from
exportPdf
(I would like to use both the live preview in the browser and compile to PDF on save).Question: should this be implemented in the tinymist server, or as a new minimal LSP server just for preview? I guess in the tinymist server would be easier to use for most people. On the other hand a minimal LSP server would be nicer for those who only want the preview.