Skip to content

Commit

Permalink
fix: do not publish wrong resolve support or modify document when aut…
Browse files Browse the repository at this point in the history
…ocompleting

See rust-lang/rust-analyzer#18503 and
hrsh7th/cmp-nvim-lsp#72 for more info
  • Loading branch information
SleepySwords committed Nov 24, 2024
1 parent e169cbb commit 24d9284
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 43 deletions.
52 changes: 26 additions & 26 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" },
"auto-session": { "branch": "main", "commit": "8d2eddb14ef66ed1019c92251e2d31bb7a2a2f87" },
"avante.nvim": { "branch": "main", "commit": "3ccb71d7ef21d4a0db62ec08f05bbac5763545ff" },
"bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" },
Expand All @@ -22,13 +22,13 @@
"fzf": { "branch": "master", "commit": "2b7f168571d53a19f4c60fcb6b3e20e2b688b28f" },
"fzf-lua": { "branch": "main", "commit": "9427dc65afaa7972fb20fc52280cd1449f691928" },
"gitgraph.nvim": { "branch": "main", "commit": "01e466b32c346a165135dd47d42f1244eca06572" },
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"gruvbox": { "branch": "master", "commit": "f1ecde848f0cdba877acb0c740320568252cc482" },
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
"heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" },
"hex.nvim": { "branch": "master", "commit": "fcff75fcf43b5a6c5b471eed65b3a06c412d6020" },
"kulala.nvim": { "branch": "main", "commit": "7649576ca459146658b4c415d1a320bbedc3f564" },
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
"lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" },
"lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" },
"lc3.vim": { "branch": "master", "commit": "e6bdefb842ab9fb7949a1071fb0e0e65931a64ed" },
Expand All @@ -42,41 +42,41 @@
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
"mini.nvim": { "branch": "main", "commit": "77533e69cc4fadb7f4c25f23255ae0890a058818" },
"mini.nvim": { "branch": "main", "commit": "ccfc6300a5c17387f2899f979ecc04f942bee2a0" },
"mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"neogit": { "branch": "master", "commit": "570c39181784f7a2e1bc9cedbfb11846022eea54" },
"neogit": { "branch": "master", "commit": "efd2a182024e422a4c4061683b9264c782eb684a" },
"neon": { "branch": "main", "commit": "7765aaa7d1cd3804176140644640766e4411c766" },
"neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" },
"neotest-dotnet": { "branch": "main", "commit": "03509791912eaeac9f993f7cf49e170eca06a8bc" },
"neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" },
"neotest-rust": { "branch": "main", "commit": "f2e0b3713d3559ce33be9aa32ace3a6051ec5593" },
"neotest-rust": { "branch": "main", "commit": "eec7eaf8491e619fe99e620e2da3cd31b30e406b" },
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
"nightfox.nvim": { "branch": "main", "commit": "7557f26defd093c4e9bc17f28b08403f706f5a44" },
"none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" },
"none-ls.nvim": { "branch": "main", "commit": "1f2bf17eddfdd45aed254b6922c6c68b933dba9e" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim": { "branch": "main", "commit": "a4c64d7605f6eb95674e322bbbedfaa00aab7904" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
"nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
"nvim-dap": { "branch": "master", "commit": "cc92b054720a96170eca6bd9bdedd43d2b0a7a8a" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "52638640ae309cacdaff785fdbb854437bd1ee5c" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
"nvim-lspconfig": { "branch": "master", "commit": "28b205ebe73a18f401e040585106f9bafd8ff21f" },
"nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-surround": { "branch": "main", "commit": "dca2e998ff26681ee422b92c6ed39b3d2908d8a9" },
"nvim-tree.lua": { "branch": "master", "commit": "8760d76c1d316aa46f141f3f2b80b853a2acc41e" },
"nvim-treesitter": { "branch": "master", "commit": "48fc5d1dfe3dded8028826dfee7526e26212c73b" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" },
"nvim-tree.lua": { "branch": "master", "commit": "1f3ffd6af145af2a4930a61c50f763264922c3fe" },
"nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-ufo": { "branch": "main", "commit": "c96bb3bb853ff6253fe74f057df03e61fafd2403" },
"octo.nvim": { "branch": "master", "commit": "c3faeae3f1030611d529e9242f8d9d4a4c877bc1" },
"oil.nvim": { "branch": "master", "commit": "bf81e2a79a33d829226760781eaeeb553b8d0e4e" },
"nvim-ufo": { "branch": "main", "commit": "e9886b2b3381b49cadb11ef62a8c51f662927232" },
"octo.nvim": { "branch": "master", "commit": "51f18085561805732e0306cf7300f773ec86872c" },
"oil.nvim": { "branch": "master", "commit": "99ce32f4a2ecf76263b72fcc31efb163faa1a941" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "aad7bf06b4ca0de816b919d475a75b30f5f62b61" },
"one-small-step-for-vimkind": { "branch": "main", "commit": "ad065ad2c814249cfb9e344ce5b2b35d36fbc09f" },
"one-small-step-for-vimkind": { "branch": "main", "commit": "dae43850114f1cd1715297e28c630522d5346b31" },
"onedark.vim": { "branch": "main", "commit": "390b893d361c356ac1b00778d849815f2aa44ae4" },
"onehalf": { "branch": "master", "commit": "75eb2e97acd74660779fed8380989ee7891eec56" },
"overseer.nvim": { "branch": "master", "commit": "e734140137cdd25b4c31c0fb9bf22faa9c115dcc" },
Expand All @@ -86,22 +86,22 @@
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"quicker.nvim": { "branch": "master", "commit": "11f9eb0c803bb9ced8c6043805de89c62bd04515" },
"render-markdown.nvim": { "branch": "main", "commit": "d6a82d70765aa238b7ea48d257a1d57a92501423" },
"quicker.nvim": { "branch": "master", "commit": "049d66534d3de5920663ee1b8dd0096d70f55a67" },
"render-markdown.nvim": { "branch": "main", "commit": "e1879e0ea3d5cee295b48335fc90e76ae8a63081" },
"rest.nvim": { "branch": "main", "commit": "e82dc524894b1b55bcc3296d3644f15c9e06d5ad" },
"satellite.nvim": { "branch": "main", "commit": "777ed56e1ef45ec808df701730b6597fc4fb0fbc" },
"showkeys": { "branch": "main", "commit": "38a5d15ef687da37ef0de3d6944b9eb6830982f3" },
"showkeys": { "branch": "main", "commit": "447b0bfb6a107065dcf64ceaae554e8b3f5aa23f" },
"sonokai": { "branch": "master", "commit": "3dcd97c0c5e4118bc171df6ba33800dfd9524a00" },
"statuscol.nvim": { "branch": "main", "commit": "8822f76e105549620ef9c0d96e7b95aedf14c490" },
"syntax-tree-surfer": { "branch": "master", "commit": "732ea6d0f868bcccd2f526be73afa46997d5a2fb" },
"telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"timerly": { "branch": "main", "commit": "37f865e003ceb0e729a9e4cbe2f048e00ab503fe" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" },
"tokyonight.nvim": { "branch": "main", "commit": "2e1daa1d164ad8cc3e99b44ca68e990888a66038" },
"trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
"tokyonight.nvim": { "branch": "main", "commit": "c2725eb6d086c8c9624456d734bd365194660017" },
"trouble.nvim": { "branch": "main", "commit": "3dc00c0447c016cd43e03054c3d49436a1f2076d" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"venn.nvim": { "branch": "main", "commit": "b09c2f36ddf70b498281845109bedcf08a7e0de0" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
Expand Down
15 changes: 14 additions & 1 deletion nvim/lua/completion/engine/cmp-capatibilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@ local cmp_nvim_lsp = require('cmp_nvim_lsp')

local provide_capabilities = function(opts)
opts.capabilities =
vim.tbl_extend('keep', cmp_nvim_lsp.default_capabilities(), opts.capabilities)
vim.tbl_extend('keep', cmp_nvim_lsp.default_capabilities({
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
"sortText",
"filterText",
"insertText",
"insertTextFormat",
"insertTextMode"
}
}
}), opts.capabilities)
return opts
end

Expand Down
21 changes: 10 additions & 11 deletions nvim/lua/completion/engine/nvim-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ cmp.setup({
maxwidth = 50,
})(entry, vim_item)
kind.kind = ' ' .. kind.kind .. ' '
kind.menu = ' ' .. menu_item
kind.menu = ' ' .. (menu_item or '')

return kind
end,
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<Tab>'] = cmp.mapping(function(fallback)
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { 'i', 's' }),

Expand All @@ -49,15 +49,15 @@ cmp.setup({

['<C-n>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { 'i', 's' }),

['<C-p>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
Expand All @@ -66,7 +66,7 @@ cmp.setup({
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- If you want to remove the default `<C-y>` mapping, You can specify `cmp.config.disable` value.
['<C-y>'] = cmp.config.disable, -- If you want to remove the default `<C-y>` mapping, You can specify `cmp.config.disable` value.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
Expand All @@ -83,9 +83,9 @@ cmp.setup({
{ name = 'luasnip' },
{ name = 'path' },
{
name = "lazydev",
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
}
name = 'lazydev',
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
},
-- { name = 'buffer' },
-- { name = 'cmdline' }
}),
Expand All @@ -111,4 +111,3 @@ cmp.setup({
-- { name = 'buffer' }
-- }
-- })

1 change: 0 additions & 1 deletion nvim/lua/completion/lsp_sources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ capabilities.textDocument.formatting.dynamicRegistration = false
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = { 'documentation', 'detail', 'additionalTextEdits' },
}

M.capabilities = capabilities

function M.setup()
Expand Down
11 changes: 7 additions & 4 deletions nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ return {
cmd = { 'Neogit', 'NeogitResetState' },

dependencies = {
'nvim-lua/plenary.nvim', -- required
'nvim-lua/plenary.nvim', -- required
'sindrets/diffview.nvim', -- optional - Diff integration

-- Only one of these is needed, not both.
'nvim-telescope/telescope.nvim', -- optional
'ibhagwan/fzf-lua', -- optional
'ibhagwan/fzf-lua', -- optional
},
opts = {
graph_style = 'kitty',
},
},
{
'sindrets/diffview.nvim'
'sindrets/diffview.nvim',
},
{
'isakbm/gitgraph.nvim',
Expand Down Expand Up @@ -156,7 +156,7 @@ return {
},
},

{ 'nvchad/timerly', enabled = false, cmd = 'TimerlyToggle' },
{ 'nvchad/timerly', enabled = false, cmd = 'TimerlyToggle' },

-- Discord rich presence
{
Expand All @@ -174,6 +174,9 @@ return {
rust = 'function_params',
python = 'function_params',
},
mappings = {
add_argument = { 'a', 'i' },
},
nui = function(title)
return {
win_options = {
Expand Down

0 comments on commit 24d9284

Please sign in to comment.