Commit 0b6654d3de changed the `README.md`
to use `default_capabilities()` instead of `update_capabilities()`. This
commit replicates that change to `doc/cmp.txt` and `utils/vimrc.vim` for
consistency.
`get_captures_at_position` has been renamed to `get_captures_at_pos`: neovim/neovim#20331.
Fallback to `get_captures_at_position` in case `get_captures_at_pos` is `nil`.
* fix(context): `in_treesitter_capture`
`in_treesitter_capture` used to compare a node:type() with what should
be a capture, returning always a falsy value.
The example https://github.com/hrsh7th/nvim-cmp/wiki/Advanced-techniques#disabling-completion-in-certain-contexts-such-as-comments
did not work as expected, being in_treesitter_capture("comment") always
not true.
Now it works as expected.
* feat(context): `in...capture`, `in...group` table
`in_treesitter_capture` and `in_syntax_group` can take a list of string
as argument.
* refactor(context): in...capture use vim.treesitter
Use vim.treesitter.get_captures_at_cursor()
* fix(context): get_captures_at_cursor -> ..._at_pos
get_captures_at_cursor() sometimes fails. Do it explicitly with
get_captures_at_pos(buf, row, col)
* refactor(context): vim.fn -> vim.api
Get row and col using vim.api and not vim.fn in in_syntax_group, as done
in in_treesitter_capture
* feat: add `source.filter` config
This allows the user to specify a `filter` function for each source,
like this:
```lua
-- don't show entries with kind "Text" from the "nvim_lsp" source
sources = {
{
name = "nvim_lsp",
filter = function(entry, ctx)
local kind = types.lsp.CompletionItemKind[entry:get_kind()]
if kind == "Text" then
return true
end
},
}
```
By utilizing the `ctx` parameter, the user can also ignore certain
entries in certain contexts.
* fixup! feat: add `source.filter` config
* fixup! feat: add `source.filter` config
The dictionary returned by `pum_getpos()` uses `scrollbar` not
`scrollable` to indicate whether the scrollbar is visible or not.
In addition, the padding on the left side of the popup menu isn't
included in the output of `pum_getpos()`, meaning that both `col` and
`width` (as understood by nvim-cmp) are off by one when the cursor isn't
at column `0`.
These two issues were causing the documentation window and popup menu to
overlap.