ray-x/cmp-treesitter

Broken completions with quotes and comments

msva opened this issue · 0 comments

msva commented

Hi there!

I'm experiencing some strange issue with cmp-treesitter with [quotes] autopairing:

  1. when I trying to complete some substring inside quotes (and it finds corresponding node for completion, and it is also inside quotes), cmp-treesitter suggest that quoted node as completion (dunno why TS doesn't cut quotes when collecting nodes 🤷).
    This causes situation that completed string have two closing quotes (which causes syntax errors).

This is demonstration:

asciicast

Is it possible to maybe somehow ask cmp-treesitter to cut quotes before passing node to cmp?
Or, maybe, it is possible to somehow ask cmp (or cmp-treesitter?) to take closing quote into account (like it does with middle-word/fuzzy completions)?

  1. something similar happens when I trying to comple some "common" comments (like luacheck (linter) directives).

a. I start comment block
b. I type lua as start of word-to-be-completed
c. I see -- luacheck: ... as treesitter completion
d. I select it and I see it inserted one more -- (so there is double commented string, which, by the way, doesn't count as valid luacheck directive).

Here is a demonstration:

asciicast

So, it seems, in that situation it doesn't even count "left" part of completeion...

Can that things be fixed?

Or it is all on cmp itself behalf, and cmp-treesitter have nothing to do here?