carlitux / deoplete-ternjs

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

autocomplete menu show different result #6

Closed iamcco closed 8 years ago

iamcco commented 8 years ago

javascript code:

var obj = {
    name: 'aioiyuuko',
    showName: function() {
        console.log(this.name);
    }
};

$1
$2
$3obj.name

the $1,$2 and $3 is the position of the cursor. i type obj. at $1 i get the right result of autocomplete , but when i type obj. at $2 i just got the Omni autocomplete result, the same issue is that i type console or console. at $3 position, just get the Omni autocomplete result.

mininit.vim

" vim-plug {
    call plug#begin('~/dotfiles/nvim/plugged')

    " deoplete and sources about {
        Plug 'Shougo/deoplete.nvim'
        Plug 'carlitux/deoplete-ternjs', { 'for': 'javascript' }
    " }

    call plug#end()

" }

" plugins {

    " deoplete.nvim {
        let g:deoplete#enable_at_startup = 1
        let g:deoplete#max_list = 15
        inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
        function! s:my_cr_function()
            return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
        endfunction
        inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"
    " }
" }
carlitux commented 8 years ago

I tested and it is working for me.

min setup https://github.com/carlitux/deoplete-ternjs/blob/master/tests/ternjs-deoplete.vim and also setting :set syntax=javascript is not firing omnicomplete unless I call it.

iamcco commented 8 years ago

maybe you don't understand what i describe because my poor English.

look at the two screenshot of the cursor's position and the autocomplete menu below:

1

2

carlitux commented 8 years ago

Please update and test again, I think now is fixed. Confirm if this is working

iamcco commented 8 years ago

It works well now, thanks!