hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.9k stars 394 forks source link

fix: remove usages from vim.lsp.util.parse_snippet #1734

Closed MariaSolOs closed 11 months ago

MariaSolOs commented 11 months ago

This function is now deprecated.

MariaSolOs commented 11 months ago

@hrsh7th I would really appreciate a look at this. The warning that these usages generate in nightly neovim are quite disruptive.

k1ng440 commented 11 months ago

@hrsh7th Please review this. Thank you

Shougo commented 11 months ago

He seems busy...

mehalter commented 11 months ago

Yeah it's also only been a couple days. It is open source software and they are maintaining this software for free and for the good of the community. It's probably better for people to not constantly ping them so frequently. If this PR is necessary for your set up, use that fork and branch in the meantime.

hrsh7th commented 11 months ago

I'm not sure if "just deleting the existing process" is a reasonable solution, but if we don't merge it, there will likely be a big problem with the ecosystem, so let's merge it.

google translated

MariaSolOs commented 11 months ago

@hrsh7th thank you for the review! That being said, I wish to provide some further context around the deprecation.

I'm not sure if "just deleting the existing process" is a reasonable solution, but if we don't merge it, there will likely be a big problem with the ecosystem, so let's merge it.

I was personally against the rapid changes around parse_snippet. However neovim is working really hard on building a better LSP API, and parse_snippet is an ill-designed function. Despite me being very annoyed at my completion configuration suddenly breaking like this, I agree with the rest of the core maintainers that this is the right thing to do.

The issue with this utility function is that it "parses" and formats using undefined heuristics. Its main purpose is to provide the word to use in vim completion items, but there are snippets with no good word replacement (e.g. postfix/multi-line snippets). This is a result of the lack of a 1:1 mapping between vim <-> LSP completion concepts, but from my experience this is a problem all editors that implement the LSP protocol encounter.

Neovim is doing its best to refactor these LSP APIs into robust editor interfaces that are fully compliant with the protocol while still retaining the magical features that neovim allows you to use. IMO we're doing a great job so far, and although this was a band-aid that really hurt ripping, I promise you that it will be worth it.