Open knuesel opened 3 weeks ago
I came up with a hack to get this feature working before helix supports custom lsp commands:
We can have a small proxy between helix and tinymist
which inserts the preview commands into the LSP. For now I made a proof of concept that can start and view the preview, but forward/backward sync is not available. I'll probably look at that tomorrow.
https://gitlab.com/TheZoq2/tinypp
https://github.com/user-attachments/assets/493c87f0-39a3-433c-9ec5-93e397ec1b33
Got sync from the document to the editor working by translating the scroll events into window/showDocument
requests.
I also tried adding an additional request on hover to sync from editor to document, but that seems to silently fail and I can't find exactly what I need to send
From reading the source code, it seems like something along the lines of
{"jsonrpc":"2.0","method":"workspace/executeCommand","params":{"command":"tinymist.scrollPreview","arguments":["primary",{"character":0,"event":"panelScrollTo","filepath":""/home/frans/Documents/rust/tinymist-preview-proxy/test.typp","line":10}]},"id":"1_scroll"}
But it fails silently. @Myriad-Dreamin is there something I'm missing with that command?
Motivation
Having instant preview work in Helix.
Description
The live preview would be configured from the Helix side using the
initialize
request. I guess this could work similarly to how it works in this fork of typst-lsp: https://github.com/tmistele/typst-lsp(This feature is a follow-up of https://github.com/Myriad-Dreamin/tinymist/issues/357 to discuss specifically the support for editors like Helix that have limited LSP support.)