Commit Graph

19 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
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
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
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
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
PlankCipher
51f1e11a89 fix(ghost_text): ephemeral causes a false positive of no inline support (#1645) 2023-08-12 11:55:52 +09:00
hrsh7th
3874e09e80 fix(entry): remove offset + 1 for tailwindcss 2023-05-28 22:33:20 +09:00
hrsh7th
1088b3743b Add extmark inline feature detection 2023-05-27 23:06:46 +09:00
Anshuman Medhi
950d0e3a93 ghost text inline (#1588) 2023-05-26 00:02:26 +09:00
François Fleur
d153771162 fix(ghost_text): safely apply virtual_text highlight (#1563) 2023-05-12 15:42:39 +09:00
hrsh7th
0c6a89af9a Improve perf 2023-02-18 16:46:02 +09:00
hrsh7th
796f925915 Fix #703 2022-01-07 00:38:42 +09:00
hrsh7th
753f5b7c92 Fix #516 (#517)
* Fix #516

* Fix

* Fix and tests

* fmt lint
2021-11-14 02:47:31 +09:00
Javier Lopez
9734453d77 fix(ghost_text): generate it using chars instead of bytes (#471)
Previously if the completion entry text had a multibyte character the
ghostly text renderd improperly, for example:

The cursor position is "|"

1. In this case the ghost text was spliting a multibyte character.

entry: comunicación
prev:  comunicacio|<b3>n
now:   comunicacio|n

2. In this case the multibyte character was before meking the index
   wrong, therefore presenting an extra character of the entry as ghost text.

entry: árbol
prev:  arbol|l
now:   arbol|

With this changes the calculation for the bytes to show is done based on
characters avoiding both of the issues above.
2021-11-05 11:49:42 +09:00
hrsh7th
0f28030aef Improve macro & dot-repeat support (#363)
* manual support dot-repeat

* cmdwin and terminal

* cmdline only

* Fix

* fix

* Improve

* Fix test

* Support macro

* disable cmdline for now

* Simplify

* fmt

* consume once

* Ignore = type

* cmdline

* Remove cmdline features
2021-10-16 23:37:32 +09:00
hrsh7th
ada9ddeff7 Use floating window for completion menus (#224)
* WIP

* WIP

* Fix #226

* Insert text

* Emulate vim native

* テキトウ

* Tekito

* Move scrollbar impl

* aaa

* Ignore unexpected event

* fix

* fix scroll

* Refactor (conflict...)

* Fix bug

* Positive integer

* Refactor a bit

* Fix for pumheight=0

* fx

* Improve matching highlight

* Improve colorscheme handling

* fmt

* Add cmp.visible

* Fix pum pos

* ABBR_MARGIN

* Fix cel calculation

* up

* refactor

* fix

* a

* a

* compat

* Remove current completion state

* Fix ghost text

* Add feature toggle

* highlight customization

* Update

* Add breaking change announcement

* Add README.md

* Remove unused function

* extmark ephemeral ghost text

* Support native comp

* Fix docs  pos

* a

* Remove if native menu visible

* theme async

* Improvement idea: option to disables insert on select item (#240)

* use ghost text instead of insertion on prev/next item

* add disables_insert_on_selection option

* move disable_insert_on_select option as argumet on

* update README

* use an enum behavior to disable insert on select

* Adopt contribution

* Preselect

* Improve

* Change configuration option

* a

* Improve

* Improve

* Implement proper <C-e> behavior to native/custom

* Support <C-c> maybe

* Improve docs view

* Improve

* Avoid syntax leak

* TODO: refactor

* Fix

* Revert win pos

* fmt

* ghost text remaining

* Don't use italic by default

* bottom

* dedup by label

* Ignore events

* up

* Hacky native view partial support

* up

* perf

* improve

* more cache

* fmt

* Fix format option

* fmt

* recheck

* Fix

* Improve

* Improve

* compat

* implement redraw

* improve

* up

* fmt/lint

* immediate ghost text

* source timeout

* up

* Support multibyte

* disable highlight

* up

* improve

* fmt

* fmt

* fix

* fix

* up

* up

* Use screenpos

* Add undojoin check

* Fix height

* matcher bug

* Fix dot-repeat

* Remove undojoin

* macro

* Support dot-repeat

* MacroSafe

* Default item count is 200

* fmt

Co-authored-by: Eric Puentes <eric.puentes@mercadolibre.com.co>
2021-10-08 18:27:33 +09:00