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

Announcement: Breaking changes #38

Open
afonsocarlos opened this issue Oct 15, 2022 · 11 comments
Open

Announcement: Breaking changes #38

afonsocarlos opened this issue Oct 15, 2022 · 11 comments

Comments

@afonsocarlos
Copy link
Contributor

It would be nice if there was an issue such as in hrsh7th/nvim-cmp#231 for breaking changes announcements

@afonsocarlos
Copy link
Contributor Author

afonsocarlos commented Oct 15, 2022

cmp_nvim_lsp.update_capabilities is deprecated #36

  local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

↓↓↓

  local capabilities = require("cmp_nvim_lsp").default_capabilities()

minhyeoky added a commit to minhyeoky/dotfiles that referenced this issue Oct 15, 2022
@jason-shen
Copy link

this still seems breaking the cmp

@jacksonludwig
Copy link

this still seems breaking the cmp

I don't have any issue on 0.8.

@jason-shen
Copy link

i just upgrade to 0.8 this seem to break all my typescript lsp lol

wookayin added a commit to wookayin/dotfiles that referenced this issue Oct 15, 2022
Today's crazy update on cmp-nvim-lsp makes nvim-cmp completely broken
on 'stable' versions of neovim. Pin at the correctly working version.

Ref hrsh7th/cmp-nvim-lsp#38
@ptrhvns
Copy link

ptrhvns commented Oct 15, 2022

After upgrading today to the latest Neovim version (v0.9.0-dev nightly), and the latest plugins (managed by packer.nvim), including to the latest cmp-nvim-lsp version; and after changing update_capabilities to default_capabilities, my TypeScript completions stopped working. I noticed that this only happened when the Neovim filetype was set to typescriptreact, file extension .tsx. If the filetype was set to typescript, file extension .ts, then things seemed to work as normal. I realized that I had only specified require('cmp').setup.filetype("typescript", ...) in my Neovim config. That used to work for typescriptreact files, but stopped for some reason. After I added a new line with require('cmp').setup.filetype("typescriptreact", ...), my completions started working again.

jonhoo added a commit to jonhoo/configs that referenced this issue Oct 15, 2022
@Diegovsky
Copy link

I love having random breaking changes for no reason at all

alkaloidbit added a commit to alkaloidbit/vim-config that referenced this issue Oct 15, 2022
cmp_nvim_lsp.update_capabilities is deprecated

hrsh7th/cmp-nvim-lsp#38
Arjun31415 added a commit to Arjun31415/nvim-config that referenced this issue Oct 16, 2022
marcfyk added a commit to marcfyk/dotfiles that referenced this issue Oct 16, 2022
marcfyk added a commit to marcfyk/dotfiles that referenced this issue Oct 16, 2022
@tjkirch
Copy link

tjkirch commented Oct 16, 2022

I think a big part of the benefit of an announcements thread like this is being able to subscribe and hear when you need to look into changes. If it turns into a support thread, fewer people will subscribe and get that valuable information. May I suggest that the thread be locked so that only contributors can post changes, and other questions or problems be raised in new issues? Similar to the pinned nvim-cmp issue that was linked above.

askoufis added a commit to askoufis/dotfiles that referenced this issue Oct 16, 2022
wongjiahau added a commit to wongjiahau/.config that referenced this issue Oct 17, 2022
Kibadda added a commit to Kibadda/dotfiles.old that referenced this issue Oct 17, 2022
Springok added a commit to Springok/wconfig that referenced this issue Oct 17, 2022
lyang added a commit to lyang/my-dev-env that referenced this issue Oct 17, 2022
groner added a commit to groner/nvim-config that referenced this issue Oct 17, 2022
hurricanehrndz added a commit to hurricanehrndz/cfg that referenced this issue Oct 18, 2022
suicide added a commit to suicide/nvim-conf that referenced this issue Oct 18, 2022
MrPickles added a commit to MrPickles/dotfiles that referenced this issue Oct 19, 2022
ephoris added a commit to ephoris/dotfiles that referenced this issue Oct 20, 2022
craftzdog added a commit to craftzdog/dotfiles-public that referenced this issue Oct 20, 2022
JannoTjarks added a commit to JannoTjarks/dotfiles that referenced this issue Oct 20, 2022
nettleton added a commit to nettleton/dotfiles that referenced this issue Nov 5, 2022
Anthony-Fiddes added a commit to Anthony-Fiddes/dotfiles that referenced this issue Nov 14, 2022
jack828 added a commit to jack828/dotfiles that referenced this issue Nov 15, 2022
bnapalm pushed a commit to bnapalm/dotfiles that referenced this issue Nov 18, 2022
bookest added a commit to bookest/nix-config that referenced this issue Nov 24, 2022
psliwka added a commit to psliwka/dotfiles that referenced this issue Nov 30, 2022
fnichol added a commit to fnichol/dotneovim that referenced this issue Dec 6, 2022
Lazerbeak12345 added a commit to Lazerbeak12345/Lazerbeak12345 that referenced this issue Dec 8, 2022
ruanpetterson added a commit to ruanpetterson/dotfiles that referenced this issue Jan 16, 2023
ruanpetterson added a commit to ruanpetterson/dotfiles that referenced this issue Jan 16, 2023
michelesr added a commit to michelesr/nvim-config that referenced this issue Feb 26, 2023
sankantsu added a commit to sankantsu/dotfiles that referenced this issue Jun 4, 2023
ciderale added a commit to ciderale/home-flake that referenced this issue Jun 13, 2023
@justbenuk
Copy link

cmp_nvim_lsp.update_capabilities is deprecated #36

  local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

↓↓↓

  local capabilities = require("cmp_nvim_lsp").default_capabilities()

This worked for me and removed the warning

@cdimitroulas
Copy link

cmp_nvim_lsp.update_capabilities is deprecated #36

 local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

↓↓↓

local capabilities = require("cmp_nvim_lsp").default_capabilities()

This solution doesn't work for me. It provides an incomplete list of capabilities which causes problems with some LSPs like tsserver.

This works better:

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion = require('cmp_nvim_lsp').default_capabilities().textDocument.completion

@wookayin
Copy link
Contributor

wookayin commented Nov 16, 2023

I would suggest, one should actually do in your config like:

  local capabilities = vim.tbl_deep_extend("force",
    vim.lsp.protocol.make_client_capabilities(),
    require('cmp_nvim_lsp').default_capabilities()
  )

This will be a more general approach. No need to rely on the implementation detail that cmp_nvim_lsp.default_capabilities() will return a single-field table textDocument = { completion = ... }.

Explanation: cmp_nvim_lsp.default_capabilities(capablities) does not "extend" capabilities; it just returns a table that is needed by cmp_nvim_lsp. So any existing fields in capabilities will be lost as @cdimitroulas said. This is because why one would need to merge tables with tbl_deep_extend.

vim.lsp.protocol.make_client_capabilities().textDocument.completion
-- As of neovim 0.10 nightly
{
  completionItem = {
    commitCharactersSupport = false,
    deprecatedSupport = false,
    documentationFormat = { "markdown", "plaintext" },
    preselectSupport = false,
    snippetSupport = false
  },
  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 }
  },
  contextSupport = false,
  dynamicRegistration = false
}
require('cmp_nvim_lsp').default_capabilities()
{
  textDocument = {
    completion = {
      completionItem = {
        commitCharactersSupport = true,
        deprecatedSupport = true,
        insertReplaceSupport = true,
        insertTextModeSupport = {
          valueSet = { 1, 2 }
        },
        labelDetailsSupport = true,
        preselectSupport = true,
        resolveSupport = {
          properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextF
ormat", "insertTextMode" }
        },
        snippetSupport = true,
        tagSupport = {
          valueSet = { 1 }
        }
      },
      completionList = {
        itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
      },
      contextSupport = true,
      dynamicRegistration = false,
      insertTextMode = 1
    }
  }
}

See also #42 and #44

sitedyno added a commit to sitedyno/nvim-config that referenced this issue Nov 16, 2023
* Fixes some completion snippets not working properly, especially
  functions w/o arguments would not complete the empty parenthesis.
* Thanks @wookayin via hrsh7th/cmp-nvim-lsp#38 (comment)
@catgoose
Copy link

  local capabilities = vim.tbl_deep_extend("force",
    vim.lsp.protocol.make_client_capabilities(),
    require('cmp_nvim_lsp').default_capabilities()
  )

When I do this the lua lsp complains about setting capabilities.offsetEncoding:

Lua Diagnostics.: Fields cannot be injected into the reference of `lsp.ClientCapabilities` for `offsetEncoding`. To do so, use `---@class` for `capabilities`. [inject-field]

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

10 participants