Skip to content
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

WIP: slint-lsp open to open the preview standalone #7576

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ogoffart
Copy link
Member

@ogoffart ogoffart commented Feb 9, 2025

(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 ogoffart requested a review from hunger February 9, 2025 17:03
args: super::Cli,
path: std::path::PathBuf,
component: Option<String>,
) -> crate::common::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a fake language server?

It feels easier to extend the live-preview to request the files it did not find than to do an entire extra parsing run to find those... And that is the only functionality we really need from the LS at this point in time.

@hunger
Copy link
Member

hunger commented Feb 10, 2025

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.

@ogoffart
Copy link
Member Author

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

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