Closed hultberg closed 6 years ago
Hi @hultberg
This originally was the case before autocompletion was implemented in the Serenata server. It was dropped as I was trying to follow the LSP specification as closely as possible and, at the time, there was no way for a server to indicate where the cursor should go in an autocompletion suggestion. Though when I was almost finished, I noticed a newer version of the specification was released that allows adding a marker to the insertion text to indicate where the cursor should go (or rather: to indicate the tab stops, the same way as you can do in Atom snippets).
If you take a look the FunctionAutocompletionProvider in Serenata, you'll see that there is a $0
between the parantheses here. The client (Atom) will then pick that up and place the cursor there. So in theory, all you would need to do is use the passed $function
array to see if the function has any (required) parameters and, if not, use ()$0
instead of ($0)
. This would also need to be updated for the NonStaticMethodAutocompletionProvider and the StaticMethodAutocompletionProvider in the same way as well as some new tests would be necessary for that corner case.
In any case, thanks for considering to contribute :-).
Closing as this was implemented with https://gitlab.com/Serenata/Serenata/merge_requests/76
Yes, thanks for the PR! I've just updated both the server and this package and it should now be live for everyone.
Currently, when confirming a selection from the autocomplete, the cursor is moved inside the parentheses of the function/method:
However, I would love for the autocompletion to move the cursor at the end when the function/method has no arguments as there is nothing to write at that position. I was looking forward to make an PR, but found as I'm not familiar with how the autocompletion work, I don't know if this is something serenata is doing or if its atom. @Gert-dev, can you point me in the right direction? :-)