Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using 'update_capabilities' function in neovim 7.2 is a breaking change #36

Open
Issafalcon opened this issue Oct 15, 2022 · 5 comments

Comments

@Issafalcon
Copy link

Hi!

Firstly, thanks to all your hard work making these cmp plugins. They are a huge boost to developer workflow in Neovim!

So, I just did PackerSync (because it's the weekend) and got the latest updates. I am still on neovim 0.7.2, but I imagine this works fine on 0.8.0.

Before updating my config to use the new default_capabilities function, I get this error:

E5113: Error while calling lua chunk: ...pack/packer/start/cmp-nvim-lsp/lua/cmp_nvim_lsp/init.lua:51: attempt to call field 'deprecate' (a nil value)
stack traceback:
        ...pack/packer/start/cmp-nvim-lsp/lua/cmp_nvim_lsp/init.lua:51: in function 'update_capabilities'

It might be worth mentioning this in a breaking changes section somewhere, or using a backwards compatible way of telling the use that this function is deprecated.

@gennaro-tedesco
Copy link

gennaro-tedesco commented Oct 15, 2022

Maybe worth synchronising the documentation with nvim-lspconfig: on their wiki you can still find update_capabilities(...) instead of the new function; moreover, in their docs, it was mentioned somewhere (I cannot find it at the moment, but I had it in my config - now removed) that one should:

capabilities.textDocument.completion.completionItem.snippetSupport = true

due to this. I am not sure whether it is still needed or redundant.

@3719e04
Copy link

3719e04 commented Oct 15, 2022

Maybe worth synchronising the documentation with nvim-lspconfig: on their wiki you can still find update_capabilities(...) instead of the new function; moreover, in their docs, it was mentioned somewhere (I cannot find it at the moment, but I had it in my config - now removed) that one should:

capabilities.textDocument.completion.completionItem.snippetSupport = true

due to this. I am not sure whether it is still needed or redundant.

Updated.

Granddave added a commit to Granddave/dotfiles that referenced this issue Oct 18, 2022
@TamaMcGlinn
Copy link

capabilities.textDocument.completion.completionItem.snippetSupport = true

This is redundant now; default_capabilities sets snippetSupport to true by default. If you want it false,
pass a dict to default_capabilities with false at the key snippetSupport. See cmp-nvim-lsp/lua/cmp_nvim_lsp/init.lua line 45:

          snippetSupport = if_nil(override.snippetSupport, true),

TamaMcGlinn added a commit to TamaMcGlinn/vimrc that referenced this issue Oct 18, 2022
minghongx added a commit to minghongx/nvim that referenced this issue Oct 19, 2022
@alvaroaleman
Copy link

This breaks gopls for me, it seems the capabilities are now bools when they were strings before:

[Error - Received] 12:52:59.139 PM #1 JSON RPC parse error: json: cannot unmarshal object into Go struct field PCompletionListPCompletion.capabilities.textDocument.completion.completionList.itemDefaults of type []string
echo '{"rootPath":"\/Users\/aaleman\/git\/go\/1.17.0\/pkg\/mod\/github.com\/stretchr\/testify@v1.7.1","processId":33408,"clientInfo":{"name":"Neovim","version":"0.8.0"},"initializationOptions":{},"trace":"off","capabilities":{"callHierarchy":{"dynamicRegistration":false},"window":{"showDocument":{"support":false},"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}}},"workspace":{"configuration":true,"applyEdit":true,"workspaceFolders":true,"symbol":{"dynamicRegistration":false,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalWorkspaceSymbolSupport":true},"workspaceEdit":{"resourceOperations":["rename","create","delete"]}},"textDocument":{"typeDefinition":{"linkSupport":true},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"dynamicRegistration":false,"willSave":false,"willSaveWaitUntil":false,"didSave":true},"definition":{"linkSupport":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"documentationFormat":["markdown","plaintext"],"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true},"completionList":{"itemDefaults":{"insertTextMode":false,"commitCharacters":true,"editRange":true,"insertTextFormat":true,"data":true}},"contextSupport":true,"insertTextMode":1,"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"declaration":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"references":{"dynamicRegistration":false},"implementation":{"linkSupport":true},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"rename":{"dynamicRegistration":false,"prepareSupport":true},"codeAction":{"dynamicRegistration":false,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","Empty","QuickFix","Refactor","RefactorExtract","RefactorInline","RefactorRewrite","Source","SourceOrganizeImports","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]}}}},"workspaceFolders":[{"name":"\/Users\/aaleman\/git\/go\/1.17.0\/pkg\/mod\/github.com\/stretchr\/testify@v1.7.1","uri":"file:\/\/\/Users\/aaleman\/git\/go\/1.17.0\/pkg\/mod\/github.com\/stretchr\/testify@v1.7.1"}],"rootUri":"file:\/\/\/Users\/aaleman\/git\/go\/1.17.0\/pkg\/mod\/github.com\/stretchr\/testify@v1.7.1"}'|jq .capabilities.textDocument.completion.completionList.itemDefaults
{
  "insertTextMode": false,
  "commitCharacters": true,
  "editRange": true,
  "insertTextFormat": true,
  "data": true
}

@hrsh7th
Copy link
Owner

hrsh7th commented Nov 16, 2022

This is not related to your problem.
Your problem is already solve on latest master. Please upgrade.

Pegasust added a commit to Pegasust/dotfiles that referenced this issue Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants