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.23k stars 583 forks source link

Allowing parameter names in callback declarations #6527

Open Enyium opened 4 days ago

Enyium commented 4 days ago

Currently, you have to specify parameter names in callbacks as comments:

callback move-list-item(/*up:*/ bool);

This isn't satisfying. #5859 created an experimental feature that allows you to write:

callback move-list-item(up: bool);

However, @ogoffart wrote in the PR:

I rather keep that experimental.

Please make this a regular feature!

What's missing is just that the parameter name is also shown in VS Code when you hover over the callback's name at a call site. Currently, even when using SLINT_ENABLE_EXPERIMENTAL_FEATURES=1, VS Code just shows the help overlay callback move-list-item(bool). It would be very useful if it showed callback move-list-item(up: bool).

hunger commented 2 days ago

I added labels based on improving the VSCode help overlay only;-)

ogoffart commented 2 days ago

What we can do in the LSP with these names:

Anyway, before stabilization, we also need to consider whether it is compatible with all the change we could want to do in the future, like named argument calling and stuff.

Also need to be done

Some ideas: