nvim-treesitter / completion-treesitter

Treesitter source for completion-nvim and more
161 stars 5 forks source link

completions appearing only after sourcing vimrc twice #14

Open dhananjayraut opened 3 years ago

dhananjayraut commented 3 years ago

when using this plugin as a completion source completions do not appear as soon as I open a file but rather I have to source my $VIMRC again for them to work as expected.

small init.vim to reproduce:

call plug#begin(stdpath('data') . '/plugged')
    Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
    Plug 'nvim-treesitter/completion-treesitter'
    Plug 'nvim-lua/completion-nvim'
call plug#end()
set completeopt=menuone,noinsert,noselect
let g:completion_enable_auto_popup = 1
let g:completion_chain_complete_list = {
\    'default': {
\        'default': [
\                    {'complete_items': ['ts']}],
\        }
\    }
autocmd BufEnter * lua require'completion'.on_attach()

after installing plugin install cpp support using :TSInstall cpp

open testfile.cpp

void function_name()
{
    int variable = 0;
    return
}

demo:

vigoux commented 3 years ago

Hi, I am not sure the issue comes from here, did you try with any other source ?

dhananjayraut commented 3 years ago

yes all the other sources listed in my init.vim work as expected as soon as I open a files, but the suggestions from completion-treesitter only appear after sourcing $VIMRC again.
do you see anything wrong with the sample init.vim I posted? does it work of for you as expected?

dhananjayraut commented 3 years ago

also now I notice that :checkhealth is giving an error (ERROR: ts is not a valid completion source (in filetype default)) but if do :checkhealth after sourcing my init.vim second time the error disappears.
after seeing the error I tried using ts as completion source only for specific filetype (e.g. cpp) but the behavior is same.

vigoux commented 3 years ago

To be honest, I don't know.. completion-nvim is close to be deprecated now, as no development is done... If you'd like to solve this bug, feel free to create a PR, but I really don't have any solution.