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

Language server ignores SLINT_ENABLE_EXPERIMENTAL_FEATURES #5974

Open
Enyium opened this issue Aug 28, 2024 · 10 comments
Open

Language server ignores SLINT_ENABLE_EXPERIMENTAL_FEATURES #5974

Enyium opened this issue Aug 28, 2024 · 10 comments
Labels
a:lsp slint-lsp and formating (mO,bT) needs info Further information from the reporter is requested

Comments

@Enyium
Copy link
Contributor

Enyium commented Aug 28, 2024

I'm on Windows 10 and set the environment variable SLINT_ENABLE_EXPERIMENTAL_FEATURES globally to 1. But even though I terminated and restarted VS Code, the changed keyword still gives me an error (for changed-callbacks). Running $env:SLINT_ENABLE_EXPERIMENTAL_FEATURES in the VS Code PowerShell console confirms that the value is 1. cargo run also works without problems.

It would also be nice, if there'd be a non-global project-only way of ungating the feature; if possible via the file .vscode/settings.json.

@slint-ui slint-ui deleted a comment Aug 28, 2024
@slint-ui slint-ui deleted a comment Aug 28, 2024
@ogoffart
Copy link
Member

The language server doesn't ignore the SLINT_ENABLE_EXPERIMENTAL_FEATURES.
What error do you get exactly?

@Enyium
Copy link
Contributor Author

Enyium commented Aug 28, 2024

In a component:

    changed current-item => {
        root.old-item = current-item;
    }

changed has wavy red underlining:

Change callbacks are experimental and not yet implemented in this version of Slint

I have this extension installed: https://marketplace.visualstudio.com/items?itemName=Slint.slint.

@hunger
Copy link
Member

hunger commented Aug 28, 2024

Did you log out and back in again? Better yet: Reboot.

In my experience just restarting an application is not enough to get fresh env vars on Windows (and most unixes for that matter).

@Enyium
Copy link
Contributor Author

Enyium commented Aug 28, 2024

In my experience just restarting an application is not enough to get fresh env vars on Windows

In my experience, it is. It's about whether the process is a child process of another process. If it's not, it gets an up-to-date set of env vars from the OS. Only some software seems to be proactive: Directory Opus seems to read the set of env vars from the OS before starting a child process.

Did you log out and back in again? Better yet: Reboot.

In the meantime I rebooted, and the error is still there.

@ogoffart
Copy link
Member

the slint-lsp process should be a child process of vscode.
I must admit i haven't tried Windows, but it does work on Linux.
Is there something we should do to re-read the env variables?

That said, we could make it an actual settings or enable it by default in the nightly extension.

@ogoffart ogoffart added need triaging Issue that the owner of the area still need to triage needs info Further information from the reporter is requested a:lsp slint-lsp and formating (mO,bT) and removed need triaging Issue that the owner of the area still need to triage labels Sep 6, 2024
@ogoffart
Copy link
Member

Were you able to check why the slint-lsp process doesn't see the SLINT_ENABLE_EXPERIMENTAL_FEATURES env variable in your case?

@Enyium
Copy link
Contributor Author

Enyium commented Sep 13, 2024

With System Informer, I detected the process of the VS Code window, then found the only child process of the subtree with slint in the name C:\Users\...\.vscode\extensions\slint.slint-1.7.2\bin\slint-lsp-x86_64-pc-windows-msvc.exe and looked at its env vars (through the process's property dialog in "Environment" tab).

There, I could see the process's env vars under the groups "Process", "User" and "System". Neither me nor ChatGPT know of a way to find out what group an env var belongs to. And since having SLINT_ENABLE_EXPERIMENTAL_FEATURES=1 defined for the system as well as for the user only displays it in the group "System" in the System Informer process property dialog, I think it simply compares the values to the system and user env vars.

Anyways, the slint....exe process does have its SLINT_ENABLE_EXPERIMENTAL_FEATURES env var set to 1, and still generates errors for changed-callbacks.

BTW: These changed-callback errors supersede other error messages since I started to use changed-callbacks in my project, deferring the other errors to build time through cargo run, and making .slint files permanently red.

@hunger
Copy link
Member

hunger commented Sep 16, 2024

I am pretty sure we build support for experimental features into the LSP at all times, so I fully expect the 1.7.2 LSP to support this. You could try the nightly extension, that works for me... but as I said, that should not be necessary.

I have no real idea what might be going wrong here right now :-(

@Enyium
Copy link
Contributor Author

Enyium commented Sep 16, 2024

With the nightly extension, it works (I don't get the errors anymore). Does this mean that it's only a matter of time until it also works with the regular extension? My regular extension is at v1.7.2.

Note that I may have to edit the file (like add a space) after opening the project before the error appears.

@hunger
Copy link
Member

hunger commented Sep 16, 2024

The changed callback is planned to become stable in 1.8, so the next stable release will just work without the need to enable experimental features at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:lsp slint-lsp and formating (mO,bT) needs info Further information from the reporter is requested
Projects
None yet
Development

No branches or pull requests

3 participants