slint-ui / slint

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

VScode extention failure #4464

Closed kaarelen closed 7 months ago

kaarelen commented 7 months ago

OS: rolling, arch lang: rust 1.77.0-nightly

I've just started typing in line 17 after not touching .slint files for a while(prob time is not related, not sure). After this error, extension hasn't recovered.

PS: this bug happens a lot & forces to full reload VScode. PPSS: I really like this project, hope you have bright future. Thanks.

thread 'LanguageServer' panicked at tools/lsp/language/completion.rs:637:42:
Cannot parse URL for file '"window.slint"'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 2:51:46 PM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues
[Error - 2:51:46 PM] Request textDocument/semanticTokens/full failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099
Click me ``` import { Button , ListView, Switch} from "std-widgets.slint"; // component Screenshot inherits Rectangle { // width: 64px; // height: 64px; // // background: #edba3a; // background: orange; // Image { // source: @image-url("test.png"); // width: parent.width; // height: parent.height; // } // } export component MainWindow inherits Window{ property count; property image; ca function name() { return count; } default-font-size: 24px; preferred-height: 500px; preferred-width: 500px; VerticalLayout { spacing: 4px; Text { text: "counter \{count}"; color: orange; horizontal-alignment: center; vertical-alignment: center; } Button { text: "lalal"; clicked => { count += 1; name(); } } // Image { // source: @image-url("\{image}"); // width: parent.width; // height: parent.height; // } Switch {} } } ```
hunger commented 7 months ago

I can not spot window.slint anywhere in the file you copied. Is that maybe the file name?

I wonder where the quotes come from though... I'll take a look.

ogoffart commented 7 months ago

I wonder where the quotes come from though... I'll take a look.

The quotes comes from the {:?} (the debug trait adds quotes)

This is the same panic as https://github.com/slint-ui/slint/issues/4338 which was reported fixed with the nightly extension already.

Perhaps you can try the nightly extension?

kaarelen commented 7 months ago

@hunger Exactly, "window.slint" is the name of this file, where this error occured. File does not have any quotes in name. image

kaarelen commented 7 months ago

@ogoffart works as charm, thanks!

Sorry for bothering you all with already known issue ~