opened
chunhaow
username_0
On the 13th line of index.js, it has
`regex = regex.slice(2, regex.length)`
This will remove the leading "\\" from the vimtex#re#deoplete, which will cause the issue that autocompletion is triggered by everything I typed. However, it should only be triggered after the backslash.

Comment out this line will solve the problem.
Autocompletion regex issue
issue
created
lervag
username_1
These are the offending lines:

https://github.com/neoclide/coc-vimtex/blob/master/src/index.js#L8-L14

I'm curious what the intention of this slicing was? I've personally not really had any issues with coc-vimtex myself, so this does not seem like an important bug.
comment
created
chunhaow
username_0
Hi @username_1 , below is how I encountered this issue:

I installed vimtex, coc.nvim, and coc-vimtex on vim. The default behavior is that autocompletion is triggered on whatever I typed (not only the commands with leading "\"). This is annoying, imagining autocompletion popups on every word you typed. This is like the identifier-based autocompletion in YouCompleteMe (which can be turned off by "let g:ycm_min_num_of_chars_for_completion = 99"). I wanted to turn off this behavior and wanted the autocompletion only to be triggered by commends with leading "\". In coc.nvim it has a similar setting "suggest.minTriggerInputLength": 99, but this won't work as the popup still shows on whatever you typed. Then I realized in the conversion from vimtex#re#deoplete regex to js regex, the leading "\\" in the regex pattern was removed by the "slicing" function, which caused the problem -- anything can trigger autocompletion.

I am not sure what's the purpose of the slicing line. After commenting it out, everything works perfectly.
comment
created
lervag
username_1
I think you are right, and can confirm that removing the line seems to fix things.
comment
created
chunhaow
username_0
Thank you so much for looking into this. Let's wait for this to be fixed.
comment
closed
chemzqm
username_2
issue
created
lervag
username_1
Thanks, @username_2. Do you by any chance know what that slicing was there initially?
comment
created
chemzqm
username_2
The trigger pattern used to check input, it's checking text before cursor now.
comment