slint-ui / slint

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

flatpak zed and vscode report `slint::include_modules!();` rust-analyzer: failed to load file `UNRESOLVED_ENV_VAR` #5793

Closed xiaguangbo closed 3 months ago

xiaguangbo commented 3 months ago

err form slint::include_modules!(); only flatpak platform have this question. if install form .deb``.rpm``.tar.gz will normal.

ogoffart commented 3 months ago

thanks for filing a bug report, but i'm going to need more info. What error are you seeing exactly.

xiaguangbo commented 3 months ago

@ogoffart screenshot-2024-08-08-07-19-28

xiaguangbo commented 3 months ago

cargo build is can work, only editer software show err.

ogoffart commented 3 months ago

the include_modules uses an environment variable which is set through the slint-build crate that must be set in the build.rs. Do you call slint_build::compile in your build.rs. Maybe that is failing. There is perhaps logs from rust analyzer somewhere.

xiaguangbo commented 3 months ago

@ogoffart I don't know why it's right again. this my build.rs:

fn main() {
    embuild::espidf::sysenv::output();

    slint_build::compile_with_config(
        "ui/appwindow.slint",
        slint_build::CompilerConfiguration::new()
            .embed_resources(slint_build::EmbedResourcesKind::EmbedForSoftwareRenderer),
    )
    .unwrap();
}
ogoffart commented 3 months ago

right, so this should export the env variable used by the include_modules macro. run-analyzer should have run the build script. It is possible that it fails though. Maybe rust-analyzer has a log with the result of the build script.

xiaguangbo commented 3 months ago

@ogoffart thanks!

Enyium commented 2 months ago

Running the VS Code command palette command "Developer: Reload Window" fixed this for me.