carlitux / deoplete-ternjs

deoplete.nvim source for javascript
MIT License
277 stars 24 forks source link

Show function signature/tern Type in popupmenu #11

Closed ClaudiaJ closed 8 years ago

ClaudiaJ commented 8 years ago

Similar to how tern_for_vim does here, turned on by setting g:tern_show_signature_in_pum, and disabled by default.

This option shows the function signature / TernType in the popup menu.

carlitux commented 8 years ago

could you upload screenshoots please

ClaudiaJ commented 8 years ago

Screenshots

deoplete-ternjs: deoplete-ternjs

tern_for_vim with option off: tern_for_vim with option off

tern_for_vim with option on: tern_for_vim with option on

carlitux commented 8 years ago

Done, please test it!

ClaudiaJ commented 8 years ago

Your implementation of the flag g:tern_show_signature_in_pum looks like it's backwards.

if vim.eval('exists("g:tern_show_signature_in_pum")'):
    self._tern_show_signature = vim.eval('g:tern_show_signature_in_pum') == '0'

Test case: let g:tern_show_signature_in_pum = 1:

Test case: let Test case:let g:tern_show_signature_in_pum = 0`:

Test case: unlet g:tern_show_signature_in_pum:

The implementation in tern_for_vim defaults the option to 0 if it is not defined by the user, then if it equals 0 at runtime, returns the generic type, else returns function signature instead.

carlitux commented 8 years ago

I think is better the full one. If it starts annoying users I will put default to 0

On Thu, Mar 17, 2016, 8:16 PM Claudia Hardman notifications@github.com wrote:

Your implementation of the flag g:tern_show_signature_in_pum looks like it's backwards.

if vim.eval('exists("g:tern_show_signature_in_pum")'): self._tern_show_signature = vim.eval('g:tern_show_signature_in_pum') == '0'

Test case: let g:tern_show_signature_in_pum = 1:

  • Exists evaluates true, flag value != 0, thus feature is disabled.

Test case: let Test case:let g:tern_show_signature_in_pum = 0`:

  • Exists evaluates true, flag == 0, thus feature is enabled.

Test case: unlet g:tern_show_signature_in_pum:

  • Exists evaluates false, feature defaults to enabled on line 64

The implementation in tern_for_vim defaults the option to 0 https://github.com/ternjs/tern_for_vim/blob/a26106b42f41edcd8bcd40d750f30339ec37f41c/autoload/tern.vim#L102-L104 if it is not defined by the user, then if it equals 0 at runtime https://github.com/ternjs/tern_for_vim/blob/e044f14efa3f5a88f7ef1acfe551b0a904605a44/script/tern.py#L241-L252, returns the generic type, else returns function signature instead.

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/carlitux/deoplete-ternjs/issues/11#issuecomment-198141783

ClaudiaJ commented 8 years ago

Your call, though it could be misleading that setting the flag to 1 still disables the option.

Other than the noted difference, it does appear to work just as well as does tern_for_vim :)

carlitux commented 8 years ago

Oh, yeah I will fix it... Thanks!

On Thu, Mar 17, 2016, 8:27 PM Claudia Hardman notifications@github.com wrote:

Your call, though it could be misleading that setting the flag to 1 still disables the option.

Other than the noted difference, it does appear to work just as well as does tern_for_vim :)

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/carlitux/deoplete-ternjs/issues/11#issuecomment-198143434

carlitux commented 8 years ago

Done