Quramy / tsuquyomi

A Vim plugin for TypeScript
http://www.vim.org/scripts/script.php?script_id=5151
1.39k stars 72 forks source link

No preview window during complete #38

Open jomifo opened 9 years ago

jomifo commented 9 years ago

I have set completeopt+=preview, but the preview window does not open when doing omni-completion.

Quramy commented 9 years ago

The preview window is only shown when you complete method arguments.

I'll append this to documents.

jomifo commented 8 years ago

Any way for the preview window to open/populate after or during completing if a method/function? That would be more useful and efficient to see the function signature before having to invoke completion on arguments that you may not know of.

NevilleS commented 8 years ago

Can you clarify when the preview window is supposed to show, maybe with an example?

I've yet to ever see it pop up, and it definitely would be helpful to see method signatures as you completing them. I suspect it's a bug that it's not showing at all for me, though...

NevilleS commented 8 years ago

Hi @Quramy, what do you mean by "...preview window is only shown when you complete method arguments"?

For example, if I type the following, should I see the preview window when completion is started for when the cursor is after a?

let someFn = (name: string, count: number): string => { ... }

someFn(a
NevilleS commented 8 years ago

Ah, I think I see now. The completion logic in YouCompleteMe.vim is competing with Tsuquyomi, so the preview window logic is never run. If I remove YouCompleteMe and invoke completion when typing out the arguments (like in my example), the preview window is shown with the method signature.

Never mind, thanks! At this point I'd like to find a way to get the two plugins working better together...

jomifo commented 8 years ago

@Quramy Actually, I've discovered this functionality doesn't work when completeopt also has the 'longest' option with preview. I would like to be able to use preview, longest, and menu together.

ulitiy commented 7 years ago

I can't make the preview window work at all. Can you explain what "...preview window is only shown when you complete method arguments" actually mean? When I try ctrl+x, ctrl+o I just get the normal autocomplete popup instead of any signature. tween.to( here I hit buttons and the popup shows. completeopt+=menu,preview is present. What is a preview window anyways, does it show in console vim or only gvim? How does it look?

I'm also using syntastic, maybe it breaks something? With syntastic disabled the window doesn't pop up either.

nickspoons commented 7 years ago

It is now possible to open the signatureHelp preview window manually, using :TsuSignatureHelp.

The signatureHelp tsserver endpoint only works when the cursor is after the opening parenthesis of a method call, which is why this functionality is a bit tricky to trigger using omnicomplete - it doesn't get displayed when you request completion on the method name, but when you request completion of the arguments. Note that the closing parenthesis is not required, so you can request signatureHelp when the cursor (|) is at the end of a line like this:

this.http.post(|

This should be easier now using :TsuSignatureHelp or <Plug>(TsuquyomiSignatureHelp) instead of omnicompletion. I use these mappings:

map <Buffer> <C-\> <Plug>(TsuquyomiSignatureHelp)
" Call the normal mode mapping from insert mode
imap <Buffer> <C-\> <C-o><C-\>