ale
ale copied to clipboard
Add more useful information in autocompletion results
Ale is a great vim plugin and I have been happily using it for a while. I am experimenting with its code completion functionality recently. One thing I notice is that the popup menu for C-family languages does not have the function signature. The attachment is the result of code completion in a cpp file using Ale's omnifunc and clangd
as the linter:
While I can see the type of the completed keyword, I don't have any information about the function argument list. I also tried vim-lsp with clangd
and the result is shown below.
As can be seen, vim-lsp
provides the user with the complete function prototype which could be extremely useful for complicated functions. I am wondering if the same thing can be implemented in ale. If it is already part of ale, can you elaborate a bit how to enable it?
That's something that can be improved upon later.
I came across this also when testing ale, function autocomplete would be useful
That's something that can be improved upon later.
Glad you'll look into this in the future.
Honestly, that's the only feature missing
+1 would love this too, I found that when using baloons you get the signature, but this is no good to me in nvim and would like to see it as I type the (
or in the list of suggestions.
Same thing with golang. Was looking for the answer in documentation for a long time, but now I've found this issue. Super-important feature which makes completions much more useful.
Hi As a workaround / quick fix since dev is pretty slow here (tested for C code only with clangd)
you could modify the result dictionary to add the parameter list as follows in this file
+ let l:parameters = substitute(get(l:item, 'label', ''), l:word, '', 'g')
call add(l:results, {
\ 'word': l:word,
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
\ 'icase': 1,
- \ 'menu': get(l:item, 'detail', ''),
+ \ 'menu': l:parameters . ' : '. get(l:item, 'detail', ''),
Not bad for a Sunday morning fix, considering that I have no idea how vim script works nor ale.
Of course you could play with the results to tailor the output to your specific liking.
Regards,
Alfred
@w0rp, would it be reasonable if we added a config to ale that would allow people to override the logic for the autocompletion results from their .vimrc
? If so, I might take a stab at a pull request if I have time and no one is planning to work on this.
Whats the status on this feature? Any known ways to get it working manually? I have been reading through the docs for a while and have no clue how to add this. I have been using BLAS in my C code lately and trying to remember the long function signatures is a pain, especially because the :ALEHover command only works when the linter is not complaining about missing arguments.
Any news?
I recommend those who really want this give implementing it and submitting a pull request a try. I think it could be on by default, and we could add a setting to disable it.