coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

Confusing completion

Open jonashaag opened this issue 2 years ago • 5 comments

(If this should be reported at some other project, eg. Treesitter, please let me know.)

Here's a really curious completion:

  • The cursor is not at a position where a completion makes sense in any case
  • The completion itself is not useful. Why would you want to complete entire multiline strings?
Screenshot 2023-06-13 at 20 20 37

jonashaag avatar Jun 13 '23 18:06 jonashaag

Why would you want to complete entire multiline strings?

The completion isn´t a multiline string, the completion is only """x""". The other things shown are the context given for the treesitter based completion.

The cursor is not at a position where a completion makes sense in any case

I'm not familiar with the treesitter based completion, but that suggestion comes from the fact that you typed a " and the suggestion contains a "

TheLeoP avatar Jul 10 '23 22:07 TheLeoP

This is a simplified example. If the strings was multiline you’d get a multiline completion.

jonashaag avatar Jul 11 '23 06:07 jonashaag

Why would you want to complete entire multiline strings?

The completion isn´t a multiline string

this is a simplified example. In my original use case I had a multi line string and I got a multi line completion.

The cursor is not at a position where a completion makes sense in any case

I'm not familiar with the treesitter based completion, but that suggestion comes from the fact that you typed a " and the suggestion contains a "

This doesn’t make sense anyways. The line is already syntactically correct and the cursor is in no position where this makes any sense.

jonashaag avatar Jul 11 '23 06:07 jonashaag

I think this is just how Treesitter based completion works. That's a place on your document where a multiline string could be inserted (I'm not sure what they are called on Python, but I know that the are used to document functions, I think), so coq suggest that kind of strings. If you are in a place where a variable could be inserted, coq treesitter completion would suggest variables.

Maybe the treesitter based completion could be worked on to handle cases like this one (?). But I don't fullly understand how it works.

TheLeoP avatar Jul 11 '23 18:07 TheLeoP

While you could insert that string there and still would have a syntactically correct line, I don't understand why it would make this suggestion. What is the trigger? The stuff before the cursor shouldn't trigger this completion because the " already has a matching partner. If you make this suggestion you might as well make this suggestion anywhere in the file.

Maybe that's out of scope for this plugin though

jonashaag avatar Jul 11 '23 19:07 jonashaag