slint icon indicating copy to clipboard operation
slint copied to clipboard

WIP: `slint-lsp open` to open the preview standalone

Open ogoffart opened this issue 10 months ago • 3 comments

(Currently just a prototype WIP)

The idea is that you can do slint-lsp open foo.slint and that opens the preview window, from which you can also edit the .slint file by changing property or drag and drop, but this is not connected to an editor.

It could also refresh by a file system watcher (not implemented yet)

The usecase is:

  • Easier to try the live preview for us developer as we can open it without having to use an editor
  • could also help making automated testing
  • maybe useful for user as well who have an editor that don't support LSP and want to use the live preview feature (although they'd have to save files)
  • a starting point for a future shell for a standalone tool.

ogoffart avatar Feb 09 '25 17:02 ogoffart

Seems rather too complicated to me. The only thing the live preview needs the LS for is the discovery of files and it could pretty easily report files it did not find, so that this is not needed anymore. Parsing the entire project just for that one extra time seems a bit much.

It also needs the "editor" to update the text... which should not take too long, so you can probably do that synchronously just fine.

hunger avatar Feb 10 '25 09:02 hunger

Why do we need a fake language server?

Because we need to first parse all the files in the LSP thread to fill up the document cache to be able to send all the files to the preview. This is indeed not ideal, and i'd much prefer if the preview was able to pull the files itself.

But this is just a quick and dirty test. I didn't want to spend too much time on it. I don't intend to merge this.

Parsing the entire project just for that one extra time seems a bit much.

100% agree

ogoffart avatar Feb 10 '25 09:02 ogoffart

I took the liberty of rebasing this as I need it to debug something.

tronical avatar May 16 '25 12:05 tronical