Code Monkey home page Code Monkey logo

Comments (11)

afonsocarlos avatar afonsocarlos commented on July 30, 2024 71

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()

from cmp-nvim-lsp.

Diegovsky avatar Diegovsky commented on July 30, 2024 47

I love having random breaking changes for no reason at all

from cmp-nvim-lsp.

tjkirch avatar tjkirch commented on July 30, 2024 31

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.

from cmp-nvim-lsp.

wookayin avatar wookayin commented on July 30, 2024 9

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

from cmp-nvim-lsp.

justbenuk avatar justbenuk commented on July 30, 2024 8

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

from cmp-nvim-lsp.

cdimitroulas avatar cdimitroulas commented on July 30, 2024 2

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

from cmp-nvim-lsp.

catgoose avatar catgoose commented on July 30, 2024 1
  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]

from cmp-nvim-lsp.

jason-shen avatar jason-shen commented on July 30, 2024

this still seems breaking the cmp

from cmp-nvim-lsp.

jacksonludwig avatar jacksonludwig commented on July 30, 2024

this still seems breaking the cmp

I don't have any issue on 0.8.

from cmp-nvim-lsp.

jason-shen avatar jason-shen commented on July 30, 2024

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

from cmp-nvim-lsp.

ptrhvns avatar ptrhvns commented on July 30, 2024

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.

from cmp-nvim-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.