zbirenbaum / copilot-cmp

Lua plugin to turn github copilot into a cmp source
MIT License
1.08k stars 39 forks source link

plugin seems to break auto intendation with nvim-autopairs #31

Closed abenz1267 closed 1 year ago

abenz1267 commented 1 year ago

check https://github.com/windwp/nvim-autopairs#you-need-to-add-mapping-cr-on-nvim-cmp-setupcheck-readmemd-on-nvim-cmp-repo.

i just noticed that this plugin seems to break that functionallity.

regards

zbirenbaum commented 1 year ago

This is a bit confusing, as autopairs doesn't do anything with indentation to my knowledge, and the link you supplied is just the autopairs readme.

For the cmp specific functionality to add parenthesis after a function, it only executes on completions tagged as kind = Method or Function by default.

If you are talking about the more general functionality to add a closing brace, quote, etc, which sometimes is duplicated, I just implemented a new option called clear_after_cursor which addresses it.

I don't know what you mean by "auto indentation" though, so I am a little lost.

abenz1267 commented 1 year ago

Tbh i'm not even sure anymore. The problem is this:

func main() {|}

If the cursor is at that position and the cmp window is open because of copilot suggestions, pressing enter without a selection results in

func main() {
|}

instead of

func main() {
        |
}

But i'm not even sure if that's related to this plugin anymore... in the sense of: it's the only source suggesting anything.

Regards

zbirenbaum commented 1 year ago

Tbh i'm not even sure anymore. The problem is this:

func main() {|}

If the cursor is at that position and the cmp window is open because of copilot suggestions, pressing enter without a selection results in

func main() {
|}

instead of

func main() {
        |
}

But i'm not even sure if that's related to this plugin anymore... in the sense of: it's the only source suggesting anything.

Regards

Can you remove the copilot source from your cmp config, then add a different one and see if it is reproducible?

pyt0xic commented 1 year ago

I also experience this issue or atleast something similar, specifically when accepting a completion, indenting is often not correct. Bodies' would often be on the same level as parentheses for example. Not sure if this is related.

mcmillion commented 1 year ago

Yep, I'm seeing this as well after recently updating plugins. I'm not using autopairs. I'm starting to think it's something interacting with treesitter, but it's only happening with copilot-cmp completions (other completions are fine)

zbirenbaum commented 1 year ago

I have reproduced it. This is likely caused by recent changes to cmp that broke other stuff too. I'll have a fix soon.

zbirenbaum commented 1 year ago

This has been fixed and I just forgot to link this issue so I'm closing it now. There are still outstanding issues related to paired characters but they aren't related to indentation and have their own issues.