slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
15.9k stars 519 forks source link

live-preview: Allow for previewing UIs using experimental features #5506

Closed hunger closed 2 days ago

hunger commented 3 days ago

This needs an extra switch:-)

hunger commented 3 days ago

The .envrc file is gone.

ogoffart commented 2 days ago

But why is that even needed? The default should already be to read this env variable.

hunger commented 2 days ago

We enable SLINT_ENABLE_EXPERIMENTAL_FEATURES when building slint-lsp. That makes sure it can use the ComponentContainer in its UI.

This PR add code evaluating SLINT_ENABLE_EXPERIMENTAL_FEATURES when running slint-lsp. It makes sure I can preview a UI containing the ComponentContainer (aka. the experimental feature;-) in the live-preview.

The compiler actually reads that variable, but the LSP does configure the ComponentCompiler itself and needs to enable the experimental flag in the compiler configuration itself.

ogoffart commented 2 days ago

This code: https://github.com/slint-ui/slint/blob/7f05b8aa398e6de57e8ee272ba1398e9e5f9e883/internal/compiler/lib.rs#L156 should also be run when running the LSP. or why is it not enabled.

hunger commented 2 days ago

I was confused.