Following the example given, nvim-cmp's ability to disable itself in prompt contexts will be removed outright due to the nature of the enabled opt being a replacement rather than an addition.
To address this, it would be best to change the example technique to be an additive example, showing nvim-cmp's default function with the addition of disabling in comments. This is shown by a reply to #676 here.
At minimum, the updated code (taken from the above reply), should be:
require('cmp').setup({
enabled = function()
local context = require('cmp.config.context')
local disabled = false
disabled = disabled or (vim.bo.bt == 'prompt')
disabled = disabled or (vim.fn.reg_recording() ~= '')
disabled = disabled or (vim.fn.reg_executing() ~= '')
disabled = disabled or context.in_treesitter_capture('comment') -- Disable in comments
return not disabled
end,
})
I also feel like the docs should mention the replacement behavior, but it's more important to adjust the "Advanced techniques" part of the wiki, just in case.
If anyone knows of other parts of "Advanced techniques" that should also be updated, please feel free to post here.
Steps to reproduce
Using the above config:
Open NeoVim.
Execute :Telescope live_grep.
Begin typing.
Verify that auto-complete is active for the prompt.
Expected behavior
Autocomplete does not activate or show up in prompts such as command or Telescope.
Actual behavior
Autocomplete shows up and is active during prompts such as command or Telescope.
FAQ
Announcement
Minimal reproducible full config
Description
The "Advanced technique" part of the wiki shows various capabilities and how to do them in
nvim-cmp
. The primary one I'm talking about here is "Disabling completion in certain contexts, such as comments".Following the example given,
nvim-cmp
's ability to disable itself in prompt contexts will be removed outright due to the nature of theenabled
opt being a replacement rather than an addition.To address this, it would be best to change the example technique to be an additive example, showing
nvim-cmp
's default function with the addition of disabling in comments. This is shown by a reply to #676 here.At minimum, the updated code (taken from the above reply), should be:
I also feel like the docs should mention the replacement behavior, but it's more important to adjust the "Advanced techniques" part of the wiki, just in case.
If anyone knows of other parts of "Advanced techniques" that should also be updated, please feel free to post here.
Steps to reproduce
Using the above config:
:Telescope live_grep
.Expected behavior
Autocomplete does not activate or show up in prompts such as command or Telescope.
Actual behavior
Autocomplete shows up and is active during prompts such as command or Telescope.
Additional context
No response