'listen' has some code in it to try to not re-set a map for an existing mapping, by checking the 'desc' of the table returned from 'get_map'. Since 'desc' was never included in the table returned from 'get_map', I'm assuming my changes here were always the intention.
This change seems to fix an issue I was seeing (with cmp-nvim-ultisnips at least) where every time I'd enter and leave Insert mode, seemingly another <Tab> handler was getting registered, overtime causing <Tab> in Insert mode to get slower and slower.
Ever since neovim introduced the nvim_ui_pum_set_bounds() call, GUI clients
have gained the ability to inform neovim of the current bounds of an
external popup menu provided by ext_popupmenu.
Since external popup menus are allowed to be any size in pixels which may
or may not line up cleanly on the grid, nvim allows for fractional
coordinates to be reported. This also will mean that in the event of this,
we'll end up with a cmp.WindowStyle with a float value for width/height -
which is incompatible with vim.api.nvim_open_win() and will cause us to hit
errors with GUI clients using this API call.
So, fix this by simply rounding up the width/height.
* 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