alaviss / nim.nvim

Nim plugin for NeoVim
ISC License
200 stars 24 forks source link

Function signature in preview window #27

Open rakoo opened 4 years ago

rakoo commented 4 years ago

I'm using your plugin and it's very practical !

I'm also using the advised autocomplete plugin and I have the full documentation in the preview window, however I don't have the signature and I don't know what arguments are needed. The autocomplete menu only appears while I'm completing; as soon as there's the opening parenthesis the menu disappears and I don't remember what the signature is.

Is it possible to add this in the preview window ?

alaviss commented 4 years ago

Sure, I'm also looking for ways to do parameter expansion, but it appears to me that there isn't any established standard for this in neovim.

I'm gonna see how to best add the function signature though.

rakoo commented 4 years ago

By "parameter expansion", do you mean prefilling the parameters ?

alaviss commented 4 years ago

Yea. I know that there are snippets engine, but they're too specialized and I don't see a good way to hook in with external data.

polypus74 commented 4 years ago

I came to issues to post exactly this. Any progress on this front?

More generally, would be great if the type of symbol under cursor could be displayed. Either continuously or with keybinding, maybe making it an option. This could show function types as well and so fix this issue.

alaviss commented 4 years ago

I came to issues to post exactly this. Any progress on this front?

I'm quite busy right now so I couldn't work on this atm. I planned to use nimsuggest's con feature for this, which get the called function type from anywhere in the function. However it's really unreliable so I'd have to fix that first before the feature can land in nim.nvim

More generally, would be great if the type of symbol under cursor could be displayed. Either continuously or with keybinding, maybe making it an option. This could show function types as well and so fix this issue.

The plugin provides a :NimTypeOf command that display the type of the symbol underneath the cursor (it can be functions or anything else). You can easily bind this into a key of your choice. See ftplugin/nim.vim for other commands of interest as well.