-
Notifications
You must be signed in to change notification settings - Fork 307
[WIP] Popup documentation #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think the logic for nvim positioning can be cribbed pretty much wholesale from https://github.com/ncm2/float-preview.nvim/blob/c5431b6d9bd4a8002f1a3eec42e9458ef4453ff3/autoload/float_preview.vim#L122 Bonus points for attaching the popup at the selected completion item rather than the top! |
Should be easy if we can get the selected index of the popup menu, but I'm not sure if there is a way to do that. |
I don't think so either; one could listen for cursor movements and keep track of the position oneself, but that seems fraught with complications. Probably something neovim has to do using internal information, like vim does. Sounds like a reasonable feature request to expose this, though? |
I think there should be a check for empty (It's also really slow for me -- but so is |
Ah, so the preview is not triggering on every |
What would be even better is if we have a way to customize the popup that Vim show using That may be possible, actually. What if I set |
It is, but a previous request is cancelled whenever you change the currently selected item. Do you experience the slowdown when selecting different items quickly, or also when you do it slower? |
Yes; it takes a second or two to update the preview float (blocking input).
Hmm, maybe create the preview buffer before creating the float and then passing that to (Also, maybe setting |
If there's no
|
I rather meant not calling Then we can use that window (already correctly positioned) and set the content ourselves. Ideally, we should just be able to use a buffer for a completion item's 'info' field. Might be worth creating an issue at Vim for this, or do you think this would be out of scope? (Of course, creating a buffer for each completion item is extremely unnecessary. If something like this would be implemented in Vim, we should have a way to provide this buffer on-demand. This would immediately also implement the |
I think I have it almost working now, but for two issues:
Maybe I should open a PR about it so we can discuss there? |
Sounds good; the thing is that I'm not really familiar with nvim's API. Most of my knowledge comes from just reading |
Not required for this but how would function overload pop up work? |
@prabirshrestha |
vim-lsp is already taken so can't create it. I created one in discord instead. Here is the invitation link that lasts for 1 day. https://discord.gg/zpvutT |
@prabirshrestha I think you can ask github to transfer the organization since the current owner is not doing anything with it -- if you want. |
@clason We had asked that before, they do have private repos that are active. |
Ah, OK, that's all right then. Thanks for letting me know! |
Do you need an organisation for gitter? I think you can create |
@prabirshrestha Any update on gitter? |
@thomasfaingnaert Yes, that should work -- the (short-lived) chatroom I mentioned was called |
I actually own this org https://github.com/vimlsp. The one without dash. So finally was able to create this. https://gitter.im/vimlsp/community. Let me know if you want to create specific rooms. In the meantime I created https://gitter.im/vimlsp/setup for those that want to ask how to setup servers. |
@thomasfaingnaert any updates on this? |
@thomasfaingnaert any updated on this? Would be also good to fix merge conflicts. |
@prabirshrestha I haven't had the time to work on this, unfortunately. I'll try to pick this up again in the summer. |
@thomasfaingnaert do you have the branch with |
In the meantime |
I don't think I have that branch still around, unfortunately. IIRC, there was not much to it: store the completion items in a list, and update the current completion item in that list on |
autoload/lsp/ui/vim/output.vim
Outdated
for l:entry in a:data | ||
call s:append(l:entry, a:lines, a:syntax_lines) | ||
call lsp#ui#vim#output#append(entry, a:lines, a:syntax_lines) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vint] reported by reviewdog 🐶
Make the scope explicit like l:entry
(see Anti-pattern of vimrc (Scope of identifier))
@thomasfaingnaert no worries. Just wanted to know if there was support so I can review. For now will review the current one with latest fix and merge and can support Thanks for this PR. |
* Show documentation in Vim popup * Use timer * Reuse logic from output.vim * Change default text * Rename functions * Refactor * Use v:event * Add comment * Remove log * Refactor * Implement documentation in Neovim * Cleanup Neovim popup * Let Neovim float take all available space * Extract get_size_info * Reuse sizing logic from output.vim * Fix Neovim positioning being reset * Update autoload/lsp/ui/vim/documentation.vim Co-Authored-By: Christian Clason <christian.clason@uni-due.de> * Make vint happy * Retrigger Travis CI * add g:lsp_documentation_float flag * fix lint issues Co-authored-by: Christian Clason <christian.clason@uni-due.de> Co-authored-by: Prabir Shrestha <mail@prabir.me>
Uses the hover logic to display documentation in the popup/floating window (like
completeopt+=popup
, but with Markdown capabilities).Vim:

Neovim:

TODO:
completeopt+=popup
positioning logic for Vim (?)