-- Copied from:
--   https://github.com/hrsh7th/cmp-nvim-lsp/blob/main/lua/cmp_nvim_lsp/init.lua

local M = {}

M.default_capabilities = function()
  return {
    textDocument = {
      completion = {
        dynamicRegistration = false,
        completionItem = {
          snippetSupport = true,
          commitCharactersSupport = true,
          deprecatedSupport = true,
          preselectSupport = true,
          tagSupport = {
            valueSet = {
              1, -- Deprecated
            },
          },
          insertReplaceSupport = true,
          resolveSupport = {
            properties = {
              "documentation",
              "additionalTextEdits",
              "insertTextFormat",
              "insertTextMode",
              "command",
            },
          },
          insertTextModeSupport = {
            valueSet = {
              1, -- asIs
              2, -- adjustIndentation
            },
          },
          labelDetailsSupport = true,
        },
        contextSupport = true,
        insertTextMode = 1,
        completionList = {
          itemDefaults = {
            "commitCharacters",
            "editRange",
            "insertTextFormat",
            "insertTextMode",
            "data",
          },
        },
      },
    },
    -- Disable client-side watch-files for now, it is slow (see Neovim #23291).
    -- Remove this workaround when #23291 is resolved.
    workspace = {
      didChangeWatchedFiles = {
        dynamicRegistration = false,
      },
    },
  }
end

return M
