Skip to content

Standalone Live Preview #8538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hunger
Copy link
Member

@hunger hunger commented May 26, 2025

This is a continuation of work I started last week, cleaning up the live preview and sits on top of my PRs from Friday (which are included here again since that is how github works).

This is just a experiment I did over the WE, it is not polished (or even done:-). What it tries to do is this:

Have the LSP start the live preview by running {argv[0} live-preview --remote-controlled and communicates via stdin/stdout with that. This makes the need for quite a bit of the complexity in native.rs go away.

Next steps are:

  • Remove dead code related to starting up the preview in a thread in parallel to the LSP
  • Check out how to do the WASM side of things. It is two separate binaries anyway, so that should nto be too hard
  • Make the code conenctiong the live preview to the LSP runtime-switchable, so that I can implement a version that does filesystem acces, etc. iteself without a LSP running.
  • Turn preview.rs into a object that I can store in a local variable and get rid of the thread-local.
  • Find all the bugs:-)

After that a logical step would be to allow users to run slint-lsp live-preview {file} and then use a different conenctor to not talk to a LSP and just interact with the fielsystem directly.

hunger added 6 commits May 24, 2025 11:15
sort results based on the value the fuzzy matcher assigned to the match,
while keeping the entries with the same value sorted alphabetically.

Throw away the bottom half of the values if more than 10 results were found
or return everything.
Now that all the code in preview.rs runs in the UI thread,
we do not need to separate out some data into a threading aware
part anymore.

This leaves room for optimizations later: We can probably reduce the
state we keep now.
... which contains the code used to connect the
live preview with the outside world.

For now the outside world is the LSP, but we want
to eventually make the live preview runable without.
Run both the LSP and the Live Preview in a stand-alone
process, independent of each other. This simplifies the
threading setup a bit and points a way towards running
the live preview cleanly in a stand-alone fashion.

This si a half-way state, still TODO:

* Remove dead code related to starting up the preview in a thread
  in parallel to the LSP
* Check out how to do the WASM side of things. It is two
  separate binaries anyway, so that should nto be too hard
* Make the code conenctiong the live preview to the LSP
  runtime-switchable, so that I can implement a version
  that does filesystem acces, etc. iteself without a LSP
  running.
* Turn `preview.rs` into a object that I can store in
  a local variable and get rid of the thread-local.
* Find all the bugs:-)
@szecket szecket added rust Pull requests that update rust code and removed rust Pull requests that update rust code labels Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants