Allowing parameter names in callback declarations
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).
I added labels based on improving the VSCode help overlay only;-)
What we can do in the LSP with these names:
- [x] Show them in the tooltip (hover)
- [x] pre-complete their name when auto-completing a callback. (eg, complete to
foobar(name1, name2) => {$1}instead offoobar => {$1}currently - [x] implements the
textDocument/signatureHelprequest (also for function)
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
- [x] Give name to the arguments in the builtin callbacks
- [ ] Give names to the argument in the widget style (and make sure they are consistant accross styles)
Some ideas:
- [ ] Give a warning when the name of an argument in a callback is the same as another argument in another position.