Commit Graph

153 Commits

Author SHA1 Message Date
ColdSpirit0
1e1900b076 Preserve 'buflisted' state when applying LSP text edits (#2141) 2025-03-14 16:08:39 +09:00
Niza Toshpulatov
c27370703e Fix typos (#2135) 2025-03-01 08:51:11 +08:00
hrsh7th
1d57252744 add cmp.get_registered_sources and CmpRegisterSource /CmpUnregisterSource autocmd. 2024-12-10 12:04:15 +09:00
yioneko
1a1d7ecb73 perf: improve for source providing huge list of items (#1980)
* perf: avoid creating closure in cache.ensure and drop some cached getters

This mainly addresses the perf issue on large amount of calls to
`entry.new`. Previously every `cache.ensure` calls in the code path of
it creates an anonymous function, and it seems that luajit just could
not inline it. Function creation is not expensive in luajit, but that
overhead is noticeable if every `cache.ensure` call creates a function.
The first improvemnt is to solidate the cache callback and attach it to
the metatable of `entry`. This ensures that every created entry instance
share the same cache callback and no new functions will be frequently created,
reduces the ram usage and GC overhead.

To improve it further, some frequently accessed fields of entry like
`completion_item` and `offset` is refactored to use simple table access
instead of getter pattern. The current cached getter is implemented
using `cache.ensure`, which introduces two more levels of function calls
on each access: `cache.key` and `cache.get`. The overhead is okay if but
noticeable if entries amount is quite large: you need to call 4 functions on
a simple `completion_item` field access for each item.

All of the changes done in the commit is just constant time
optimization. But the different is huge if tested with LS providing
large amount of entries like tailwindcss.

* perf: delay fuzzy match on displayed vim item

`entry.get_vim_item` is a very heavy call, especially when user do
complex stuff on item formatting. Delay its call to window displaying to
let `performance.max_view_entries` applied to it.

* remove unneeded fill_defaults

* update gha

---------

Co-authored-by: hrsh7th <629908+hrsh7th@users.noreply.github.com>
2024-10-20 13:28:20 +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
9e49ed3fee fix confirm resolve 2023-06-23 13:29:35 +09:00
hrsh7th
69e7d280cb Format with stylua 2023-06-10 15:13:53 +00:00
fengwk
48c0bc7e73 fix: huge single line performance (#1433) (#1615) 2023-06-11 00:13:36 +09:00
EJ
a2198e3d61 fix: handle godot LSP better (#1592) 2023-06-09 02:06:37 +09:00
Folke Lemaitre
abb5c7519d feat: cmp async (#1583) 2023-05-26 02:46:53 +09:00
hrsh7th
833954209a Add test for #1552
Close #1552
2023-05-04 02:06:01 +09:00
hrsh7th
0c6a89af9a Improve perf 2023-02-18 16:46:02 +09:00
NAKAI Tsuyoshi
8bbaeda725 fix(api): consider multibyte characters in get_screen_cursor (cmdline) (#1352)
* fix(api): consider multibyte characters in get_screen_cursor (cmdline)

* style: format with stylua

* test: tell luacheck that it is intended unreachable code
2022-12-15 20:27:02 +09:00
hrsh7th
bb95d975ff Fix #1329 2022-11-27 13:11:01 +09:00
hrsh7th
4c05626ccd Improve a bit 2022-11-25 03:20:07 +09:00
hrsh7th
431f045968 Refactor a bit 2022-11-25 01:57:19 +09:00
hrsh7th
0a9ccdf122 Fix #1321
Fix #1315
2022-11-25 01:46:04 +09:00
Zhizhen He
a188be8559 Add a rule to install stylua and use the local one for other rules (#1307) 2022-11-16 14:22:24 +09:00
hrsh7th
e820335208 LSP 3.17 (#1306)
* 3.17

* PositionEncodingKind

* Implement PositionEncodingKind

* Remove luarc.json
2022-11-16 01:27:15 +09:00
stnley
69c85860d7 chore: run formatting (#1295)
Co-authored-by: stnley <michael@stnley.io>
2022-11-11 21:44:36 +09:00
hrsh7th
11839571ab Fix #1276 2022-11-10 21:58:39 +09:00
hrsh7th
e1f31778a8 Optimize performance 2022-09-25 21:24:27 +09:00
hrsh7th
828768631b Re-fix #1144 2022-08-21 02:11:49 +09:00
hrsh7th
995a2a9f65 Fix #1144 2022-08-21 01:56:04 +09:00
hrsh7th
76ba56ce96 Decrease waits 2022-07-24 13:14:01 +09:00
hrsh7th
bf5593df8e Improve typings 2022-07-24 12:44:53 +09:00
tzachar
8cab788976 add events: view_opened and view_closed (#965)
* add events: view_opened and view_closed

* fix typos

* rename view -> menu
2022-06-24 12:35:47 +09:00
MurdeRM3L0DY
0e65333c7f make debounce and throttle time configurable (#1026)
* make debounce and throttle time configurable

* fix documentation
2022-06-15 02:21:55 +09:00
hrsh7th
f81bfee109 Fix #964
Fix #963
Fix #966
2022-05-04 23:51:59 +09:00
hrsh7th
5054c14490 dev (#956)
* Adjust empty line count

* Implement vim.api.nvim_create_autocmd (#844)

* Implement vim.api.nvim_create_autocmd

* Only use vim.api.nvim_create_autocmd on nighly

* Cleanup

* cleanup

* Rename autos.lua to autocmds.lua

* Fix forgot to rename autos to autocmds

* Remove legacy autocmd

* Add descriptions on autocmds

* Update descriptions on autocmds

* Update CmpStatus command to lua API (#922)

Signed-off-by: Micah Halter <micah@balena.io>

* Move highlights to nvim_set_hl lua API (#925)

Signed-off-by: Micah Halter <micah@balena.io>

* Add default to highlight

* Refactor autocmds

* fmt

* Improve performance

* Fix bug

* Improve matching logic
Fixes https://github.com/hrsh7th/nvim-cmp/discussions/954

* Fix format

* Improve performance
Fix #825

* Fix cmdline redraw bug

* Fix event

Co-authored-by: hrsh7th <>
Co-authored-by: zer09 <zer09@users.noreply.github.com>
Co-authored-by: Micah Halter <micah@mehalter.com>
2022-05-04 01:47:01 +09:00
hrsh7th
f841fa6ced Reduce flicker 2022-05-01 03:27:16 +09:00
hrsh7th
801a9f98bb Improve macro handling 2022-04-08 22:04:08 +09:00
hrsh7th
5e794cdf5b Improve timing 2022-03-30 17:10:07 +09:00
hrsh7th
ba47440a97 Improve common string mapping instruction 2022-02-14 13:26:36 +09:00
hrsh7th
4bc038f72d fmt 2022-02-13 18:53:30 +09:00
hrsh7th
a8150a2c7d Improve complete_common_string 2022-02-13 16:47:11 +09:00
hrsh7th
c07350181f Implement matching config.
Fix #796
2022-02-13 16:44:45 +09:00
hrsh7th
070c5572ad Implement shell like common string completion.
Fix #785
2022-02-13 14:34:28 +09:00
Daniel Fortes
3a2f1bbc55 Added event_chars property to confirm_done event (#782)
* Added event_chars property to confirm_done event

Currently it seems there is no way for someone listening to the
`confirm_done` event to know exactly what character was used to commit
the completion confirmation.

This commit adds a `event_chars` property to the `confirm_done` event.
Its value is just the `chars` variable form the `core.on_keymap`
function.

* Renamed `commid_chars` to `commit_character`
2022-02-11 14:11:00 +09:00
hrsh7th
a7fea2ca9f Decrease THROTTLE_TIME 2022-02-05 14:00:06 +09:00
hrsh7th
2d67b6dd76 Fix #756 2022-01-25 10:06:36 +09:00
hrsh7th
27123b1297 Fix #754 2022-01-24 23:46:47 +09:00
hrsh7th
7a1e484806 Improve recently used 2022-01-20 17:06:48 +09:00
hrsh7th
098182e2c2 Fix #734 2022-01-15 18:56:29 +09:00
hrsh7th
614e00de24 Use utf-16 at this time 2022-01-13 23:12:18 +09:00
hrsh7th
f798855990 Fix offset encoding enum 2022-01-13 22:48:11 +09:00
hrsh7th
474e716e3d Speficy offset encoding 2022-01-13 21:46:03 +09:00
hrsh7th
21456a109e fmt/test 2022-01-10 23:01:47 +09:00
hrsh7th
dff06958a7 Fix #716 2022-01-10 22:57:58 +09:00
hrsh7th
3f7b7b258a Add complete_done event and improved the recently_used sorter.
Fix #708
2022-01-08 13:38:55 +09:00