Commit Graph

74 Commits

Author SHA1 Message Date
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
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
b7b2c12610 - fix ci
- fix #1780
2024-03-22 16:59:37 +09:00
Trildar
43b460a2bd Favor existing values in completion_item over resovled_completion_item (#1725) 2024-03-22 03:06:56 +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
Maria José Solano
51260c02a8 fix: remove usages from vim.lsp.util.parse_snippet (#1734) 2023-10-25 10:54:30 +09:00
hrsh7th
3b9f28061a add context check for invalid detection 2023-08-10 16:55:01 +09:00
hrsh7th
6c84bc75c6 implement is_invalid detection 2023-08-10 16:52:10 +09:00
Folke Lemaitre
6f118169af fix(async): properly trigger callbacks when canceling and fix delays in throttle.sync (#1611) 2023-06-09 19:08:28 +09:00
hrsh7th
b43bfaf322 fix(entry): fix matches highlight information
fixes #1426
2023-05-28 22:47:11 +09:00
hrsh7th
3874e09e80 fix(entry): remove offset + 1 for tailwindcss 2023-05-28 22:33:20 +09:00
Hawtian Wang
a0225043ab fix entry highlight in complete-menu (#1593) 2023-05-26 15:16:03 +09:00
Folke Lemaitre
abb5c7519d feat: cmp async (#1583) 2023-05-26 02:46:53 +09:00
Konstantin Labun
8b76965ed0 fix 1533, add regression test (#1558) 2023-05-05 14:26:55 +09:00
hrsh7th
9b0bc5f9cd Revert #1534 temporaly 2023-05-04 00:01:00 +09:00
Konstantin Labun
5547295bd0 fix: #1533 (#1534) 2023-05-01 23:23:02 +09:00
musjj
227306a339 fix: de-duplicate completion correctly (#1466) 2023-02-27 15:39:25 +09:00
NAKAI Tsuyoshi
339186c979 fix CI (#1462) 2023-02-27 15:28:01 +09:00
hrsh7th
0c6a89af9a Improve perf 2023-02-18 16:46:02 +09:00
hrsh7th
aae0c3e4e7 Implement middle fuzzy matching
Fixes #1422
2023-02-11 22:52:28 +09:00
Marcus Caisey
d09b0c396a convert encoding of range instead of start / end (#1364) 2022-12-23 16:43:55 +09:00
hrsh7th
93f385c176 Fix #1327 2022-11-28 00:24:10 +09:00
hrsh7th
31a145c866 Fix #1249 2022-11-24 01:22:34 +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
hrsh7th
69476c9e06 ci 2022-10-15 15:16:27 +09:00
lvimuser
0e436ee23a fix(entry/get_replace_range): workaround for end char matching cursor position (#1177)
fixes #1156
2022-10-07 18:04:07 +09:00
NEX
da2d88ec1a ADD: formatting.expandable_indicator to show the expandable indicator (#1207)
* ADD: formatting.expandable_indicator to show the `expandable` indicator

* UPDATA: doc/cmp.txt  lua/cmp/entry.lua  lua/cmp/typed/cmp.lua
2022-10-02 22:39:52 +09:00
yuys13
2427d06b65 Format by stylua (#1195) 2022-09-27 12:27:31 +09:00
hrsh7th
dd4173fcee Optimize performance more 2022-09-25 21:56:35 +09:00
hrsh7th
e1f31778a8 Optimize performance 2022-09-25 21:24:27 +09:00
lvimuser
27bc575d1e fix(entry/get_replace_range): handle TextEdit.range (#1140)
fixes cmp.mapping.confirm when ConfirmBehavior is set to Replace
2022-08-20 19:52:35 +09:00
Josh Bode
706371f130 add check for nil on documentation.value (#1091) 2022-07-25 12:47:47 +09:00
hrsh7th
bf5593df8e Improve typings 2022-07-24 12:44:53 +09:00
Daan Goossens
33588ca253 fix: #1030 (#1062) 2022-07-24 12:14:42 +09:00
Zach Birenbaum
ad31a2b0e3 (feat) Custom item kinds (#1003) 2022-07-24 12:12:34 +09:00
hrsh7th
dc3113a79f Add sort (required nvim-treesitter) 2022-03-30 20:41:32 +09:00
Eric
dd6e4d96f9 use only the first filetype when formatting (#857) 2022-03-28 18:22:45 +09:00
hrsh7th
71d7f46b93 Try to fix col adjustment (#843)
* Try to fix col adjuastment

* Improve duplicated text handling
2022-03-17 15:53:10 +09:00
hrsh7th
13d64460cb Fix entry:get_word()'s cache condition 2022-02-15 20:34:21 +09:00
hrsh7th
4f5cc6a9c8 Fix #801
Fix #615
Fix #798
2022-02-15 20:20:57 +09:00
hrsh7th
4bc038f72d fmt 2022-02-13 18:53:30 +09:00
hrsh7th
c07350181f Implement matching config.
Fix #796
2022-02-13 16:44:45 +09:00
hrsh7th
1797f9e1ac fmt&lint 2022-01-20 17:26:05 +09:00
hrsh7th
8fc8d31cf4 Support import completion 2022-01-18 19:32:51 +09:00
hrsh7th
440897ef58 Fix #741 2022-01-16 00:55:01 +09:00
hrsh7th
a4f83fd839 Fix #589 2022-01-08 13:33:53 +09:00
ap29600
eca04af4f8 handle nil value accessing CompletionItemKind (#690)
this prevents error messages from polluting the screen while using [ols](https://github.com/DanielGavin/ols) for autocompletion.
2021-12-31 01:07:02 +09:00
hrsh7th
d0f2ce460b Fix #615 2021-12-30 22:24:40 +09:00