* fix(api): consider multibyte characters in get_screen_cursor (cmdline)
* style: format with stylua
* test: tell luacheck that it is intended unreachable code
Although I have `showbreak` set for normal editing I would rather not see that in documentation. RFC.
Setting to `NONE` as per `:h showbreak`:
```
A window-local value overrules a global value. If the global value is
set and you want no value in the current window use NONE:
:setlocal showbreak=NONE
```
`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