8000 Figure out why "preview" in completeopt isn't working · Issue #78 · wincent/wincent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Figure out why "preview" in completeopt isn't working #78

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

Closed
wincent opened this issue Aug 21, 2019 · 5 comments
Closed

Figure out why "preview" in completeopt isn't working #78

wincent opened this issue Aug 21, 2019 · 5 comments

Comments

@wincent
Copy link
Owner
wincent commented Aug 21, 2019

Was just trying out: https://github.com/ncm2/float-preview.nvim

Which is supposed to put completion "info" in a floating window.

And deoplete supposedly passes along "info":

https://github.com/Shougo/deoplete.nvim/blob/bb2b16309b94695a3344c713282368b3329a2412/doc/deoplete.txt#L1274

So I guess LanguageClient-neovim isn't providing any? But then I see tickets like this one that suggest that it is/should:

autozimu/LanguageClient-neovim#740

So really no idea which link in the chain is failing at this point.

It's possible the TypeScript language server implementation I'm using isn't providing a "documentation" attribute: https://github.com/autozimu/LanguageClient-neovim/blob/12e65e7ce62ad769bd01a67063e82e4c01a839d6/src/types.rs#L547

Although, I believe it should be: https://github.com/theia-ide/typescript-language-server/blob/101dae4f7b598e9bafcaa8c316f21e57341e6350/server/src/completion.ts#L150

My current theory is that typescript-language-server will only return this info for a "completion resolve request", described here:

The request is sent from the client to the server to resolve additional information for a given completion item.

Supposedly LanguageClient-neovim does implement resolve requests... but maybe they're not happening.

Probably need to do some logging at various levels to find out what is going on here.

@wincent
Copy link
Owner Author
wincent commented Aug 22, 2019

A bit of logging inside float-preview.nvim shows that in float_preview#_menu_popup_changed(), v:event ends up looking like this:

{
  "col": 11,
  "row": 9,
  "scrollbar": false,
  "completed_item": {
    "word": "stringify",
    "menu": "[LC] ",
    "user_data": "{\"lspitem\":{\"label\":\"stringify\",\"kind\":2,\"sortText\":\"0\",\"insertTextFormat\":2,\"data\":{\"entryNames\":[\"stringify\"],\"file\":\"/Users/glh/code/js/packages/stable-stringify/src/__tests__/index-test.ts\",\"line\":66,\"offset\":7}}, \"snippet\":\"stringify\"}",
    "info": "",
    "kind": "Method",
    "abbr": "stringify"
  },
  "width": 25,
  "height": 3,
  "size": 3
}

Note: no "info" in "completed_item".

@wincent
Copy link
Owner Author
wincent commented Aug 22, 2019

From https://microsoft.github.io/language-server-protocol/specification#textDocument_completion

If computing full completion items is expensive, servers can additionally provide a handler for the completion item resolve request (‘completionItem/resolve’). This request is sent when a completion item is selected in the user interface. A typical use case is for example: the ‘textDocument/completion’ request doesn’t fill in the documentation property for returned completion items since it is expensive to compute. When the item is selected in the user interface then a ‘completionItem/resolve’ request is sent with the selected completion item as a parameter. The returned completion item should have the documentation property filled in.

@wincent
Copy link
Owner Author
wincent commented Aug 22, 2019

Looking in the source of deoplete I can see it calling omnifunc (which in my case is LanguageClient#complete) but never LanguageClient#completionItem_resolve, nor do I know how it would know to do that.

The resolve stuff was added in: autozimu/LanguageClient-neovim#514

@wincent
Copy link
Owner Author
wincent commented Aug 22, 2019

Filed this one over on the deoplete repo to see if they'd consider a feature request: Shougo/deoplete.nvim#1004

@wincent wincent changed the title Figure our why "preview" in completeopt isn't working Figure out why "preview" in completeopt isn't working Aug 22, 2019
@wincent
Copy link
Owner Author
wincent commented May 7, 2020

Switched to built-in LSP client in Neovim, so putting this one on ice. Will eventually get figured out there.

@wincent wincent closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0