Commit graph

756 commits

Author SHA1 Message Date
pynappo
ae644feb7b
Add newer fallback method for tree-sitter scopes (#2006) 2024-08-01 19:51:04 +09:00
NAKAI Tsuyoshi
d818fd0624
fix(view): check in get_selected_index (#1993) 2024-07-16 10:33:54 +09:00
NAKAI Tsuyoshi
e1757aea61
feat(view): add api get_selected_index (#1986) 2024-07-16 01:29:25 +09:00
Tristan Knight
7e348da6e5
fix(feedkeys): resolve issue with some copilot completions (#1981)
* fix(feedkeys): resolve issue with some copilot completions

* fix(feedkey): further adjustments

* fix: missed flag from testing

* fix(feedkeys): error handle and make tests pass
2024-07-14 15:04:40 +09:00
Logan Walls
a110e12d0b
enable ghost_text for multi-line completions (#1886) 2024-06-08 15:59:43 +09:00
hrsh7th
5260e5e8ec use nvim_get_option_value instead of nvim{,_buf,_win}_get_option 2024-05-17 22:56:28 +09:00
Augusto César Dias
abacd4cb7f
Move to non deprecated function calls (#1930)
* Move to non deprecated function calls

* Keeping it compatible with older versions
2024-05-17 18:49:38 +09:00
Lewis Russell
31a2939e55
fix: remove deprecated use of vim.tbl_add_reverse_lookup (#1931) 2024-05-17 15:54:23 +09:00
kjuq
2412237181
fix: cmp.close() when autocompletion = false (#1921)
cf. https://github.com/hrsh7th/nvim-cmp/pull/1920
2024-05-12 18:45:22 +09:00
kjuq
1d88772dc6
fix: unexpected behavior when autocomplete = false (#1920)
- https://github.com/hrsh7th/nvim-cmp/issues/1251
- https://github.com/hrsh7th/nvim-cmp/issues/1919
2024-05-12 17:14:05 +09:00
Ilan Schemoul
cd2cf0c124
Docs: fix README.md by adding setup for cmp-git (#1914) 2024-05-08 18:33:32 +09:00
Jaehwang Jung
8f3c541407
perf: don't eagerly load vim.snippet (#1896)
Evaluating `vim.snippet` loads many modules, which takes about 1ms.
2024-04-23 11:00:27 +09:00
hrsh7th
ce16de5665 support snippet item in ghost_text 2024-04-02 16:05:54 +09:00
hrsh7th
7240362105 support snippet item in ghost_text 2024-04-02 16:04:51 +09:00
mcauley-penney
2fb2a3cf78
docs: update and fix view documentation (#1868)
- correct view.follow_cursor to view.entries.follow_cursor
- mention that view.entries.follow_cursor is custom view only
- add missing view.entries.selection_order option
- mention the docs class in list of classes nested under view class
2024-04-01 03:26:55 +09:00
hrsh7th
b9fd19fa16 fix #1649 2024-03-31 18:22:56 +09:00
mcauley-penney
7aa3f71932
feat: add option for view to follow cursor (#1727)
* feat: add option for custom entry view to follow cursor

Creates an option to allow the custom entries
view to follow the user's cursor as they type.

To enable, set
```lua
require("cmp").setup({
  view = {
    entries = {
      follow_cursor = true
    }
  }
})
```

Original source at 7569056388

Closes #1660

Co-authored-by: lvimuser <109605931+lvimuser@users.noreply.github.com>

* doc: add view.follow_cursor option to docs

---------

Co-authored-by: lvimuser <109605931+lvimuser@users.noreply.github.com>
2024-03-31 15:46:16 +09:00
Yi Ming
97dc716fc9
feat: make winblend configurable (#1861) 2024-03-24 20:44:34 +09:00
hrsh7th
c34fa793ea re-improve resolve behavior 2024-03-24 17:45:24 +09:00
hrsh7th
6ed1c93465
follow VSCode resolve logic (#1857) 2024-03-23 00:07:35 +09:00
hrsh7th
630cdf7d54 fix #1858 2024-03-22 18:44:52 +09:00
hrsh7th
be50b23910 Format with stylua 2024-03-22 07:59:56 +00:00
hrsh7th
b7b2c12610 - fix ci
- fix #1780
2024-03-22 16:59:37 +09:00
Lyude
b356f2c80c
Allow window.documentation.max_{width, height} to be set to 0 (#1394)
To allow for using all available screen space, as we can omit a
max_height/max_width when creating a documentation popup). I've found this
to be useful with neovim-gtk's native GUI completion menus.
2024-03-22 16:38:43 +09:00
Trildar
43b460a2bd
Favor existing values in completion_item over resovled_completion_item (#1725) 2024-03-22 03:06:56 +09:00
Jongwook Choi
13451e7ee4
docs: fix invalid WindowConfig schema, should match to the docs (#1779)
Problem: `cmp.WindowConfig` was defined twice.

Solution: Introduce
  `cmp.CompletionWindowOptions` and `cmp.DocumentationWindowOptions`.
Make fields of these two class consistent with |cmp-config.window.*|
2024-03-22 03:05:55 +09:00
Micah Halter
66f0a031d9
feat: default to vim.snippet for snippet expansion if available (#1820) 2024-03-22 03:04:54 +09:00
Sam
763c720d51
fix(ghost_text): make sure to the delete the mark for the same buffer (#1826) 2024-03-22 03:03:11 +09:00
hankertrix
53d80d4d0c
fix: small windows no longer constantly throw errors (#1824)
The entries_win:open function will fail when either the width or
the height of the window is less than 1, which will result in the
nvim_win_set_cursor being passed a nil value for self.entries_win.win
instead of a number, which causes an error to constantly appear when
the window is small. Hence, a guard clause to check for whether
self.entries_win.win is nil is added to stop the error from occurring.

Also fixed the rarer 'height' must be a positive Integer error caused
by the window.update function, within the clause to draw the scrollbar
background. This error happens on small windows when pressing and
holding down the backspace key to delete a lot of characters at once.
The nvim_open_win function call to create the scrollbar
background throws the error when self.style.height is 0. Hence, an
additional check is added alongside the info.scrollable check which also
skips drawing the scrollbar thumb as it is not needed when the height is
0 and will result in a weird scrollbar thumb floating some distance
away from the text when holding down backspace to delete a lot of
characters.
2024-03-22 03:02:15 +09:00
Kyle Butt
6460f979b9
Add option for symbol matching logic. (#1515)
The no_symbol_match makes command line completion a lot less useful. It
disables any matches for file names with symbols in them. This prevents
completing things like ":b foo/bar" to ":b foo/bar.txt" or ":b foo_" to
":b baz/foo_bar.txt". Add an option `disallow_symbol_nonprefix_matching`
that prevents a match if it contains a symbol and isn't a prefix match.
Make that option the default. Add the option to documentation and tests.
Add to the examples for command line setup disabling the option.
2024-03-22 03:00:36 +09:00
Josef Litoš
a1b4ef08c2
feat: avoid global variable use (#1813) 2024-03-22 02:56:07 +09:00
Yu Zhang
04e0ca376d
fix: one more item than max_item_count is displayed (#1811) 2024-02-02 15:59:47 +09:00
Alejandro
538e37ba87
feat(ci): update luarocks-tag-release to latest version (#1776) 2023-12-14 17:06:53 +09:00
Mehdi
41d7633e41
feat: sort source entries before slicing when using max_item_count (#1765)
* feat: sort source entries beforce slicing when using max_item_count

* feat: optimize filtering by max_item_count after sort

* fix: useless check if max_item_counts map is initialized

* fix: directly use entry source object when checking max_item_count
2023-12-10 20:37:02 +09:00
GyouzaRu
5e1fa02553
Fix: Buffer is not 'modifiable' (#1677) 2023-12-10 20:22:00 +09:00
Riley Bruins
55734c8b70
feat: match default border color to standard neovim float border hl (#1689) 2023-12-10 20:20:48 +09:00
SandeshPyakurel
a70bdcfe61
Fixed typos in cmp.txt file (#1730) 2023-12-10 20:19:20 +09:00
Adam Price
c01a038469
Mark non-required setup fields as optional (#1723)
... to correct "Missing required fields" messages from lua_ls
2023-12-10 20:14:50 +09:00
hrsh7th
36eb3a6917 add test-case placeholders 2023-12-10 19:59:39 +09:00
Dan Salvato
82ba05c784
Fix fuzzy matcher adding invalid matches (#909) (#1420) 2023-12-10 19:57:59 +09:00
PlankCipher
0b751f6bee
fix(ghost_text): ephemeral-like inline ghost-text workaround (#1688)
Refs:
  - https://github.com/hrsh7th/nvim-cmp/pull/1645
  - https://github.com/neovim/neovim/issues/24797
2023-11-06 17:58:22 +09:00
Maria José Solano
51260c02a8
fix: remove usages from vim.lsp.util.parse_snippet (#1734) 2023-10-25 10:54:30 +09:00
jmp
d3a3056204
ci: fix broken tests (#1729)
feedkeys_spec.lua:
In the "backspace test spec, the backspace
setting is given an integer, but only accepts
strings. Here, I assume that 0 was intended to
set backspace to a nil value, which can be done
with the empty string. I also corrected the name
of the test spec.

core_spec.lua:
In the "textedit" test spec, the actual and
expected outputs as well as the actual and
expected end characters did not match.
2023-10-18 15:37:12 +09:00
hrsh7th
5dce1b778b Format with stylua 2023-08-26 15:31:42 +00:00
Jongwook Choi
026ef9445e
docs: Add comments and type annotations for sorting comparators (#1687) 2023-08-27 00:31:28 +09:00
PlankCipher
51f1e11a89
fix(ghost_text): ephemeral causes a false positive of no inline support (#1645) 2023-08-12 11:55:52 +09:00
Tyler Miller
969c5affa5
perf(core): simplify and improve find_line_suffix() (#1675)
Call `string.match()` once instead of calling `string.sub()` and
`string.find()` multiple times in a loop.
2023-08-12 11:52:37 +09:00
hrsh7th
992fa0dd47 Format with stylua 2023-08-12 02:51:03 +00:00
Maria José Solano
1c03ebc7dc
feat: add toggle_doc functionality (#1647)
* feat: Add toggle_doc functionality

fix: Update docs view on entry change

* Replace toggle logic by open/close

* add docs and pinned flags

* add faq for disabling docs

* chore(git): ignore .DS_Store

---------

Co-authored-by: hrsh7th <629908+hrsh7th@users.noreply.github.com>
2023-08-12 11:50:49 +09:00
hrsh7th
3b9f28061a add context check for invalid detection 2023-08-10 16:55:01 +09:00