-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
feat: allow functions in 'complete' to complete from non-keyword #17651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
As a side note, can we have an API (a function?) that can trigger completion instead of relying on |
It's possible. I'll think about it a bit. It has to be a separate PR though. |
…cters Previously, functions specified in the `'complete'` option were restricted to starting completion only from keyword characters (as introduced in PR 17065). This change removes that restriction. With this change, user-defined functions (e.g., `omnifunc`, `userfunc`) used in `'complete'` can now initiate completion even when triggered from non-keyword characters. This makes it easier to reuse existing functions alongside other sources without having to consider whether the cursor is on a keyword or non-keyword character, or worry about where the replacement should begin (i.e., the `findstart=1` return value). The logic for both the “collection” and “filtering” phases now fully respects each source’s specified start column. This also extends to fuzzy matching, making completions more predictable. Internally, this builds on previously merged infrastructure that tracks per-source metadata. This PR focuses on applying that metadata to compute the leader string and insertion text appropriately for each match. Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().
|
So if I understand this correctly, |
Yes, you're absolutely right — |
|
thanks |
|
Thanks. |
…ters
Problem: completion: can only complete from keyword characters
Solution: remove this restriction, allow completion functions when
called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword
characters (Girish Palya)
Previously, functions specified in the `'complete'` option were
restricted to starting completion only from keyword characters (as
introduced in PR 17065). This change removes that restriction.
With this change, user-defined functions (e.g., `omnifunc`, `userfunc`)
used in `'complete'` can now initiate completion even when triggered
from non-keyword characters. This makes it easier to reuse existing
functions alongside other sources without having to consider whether the
cursor is on a keyword or non-keyword character, or worry about where
the replacement should begin (i.e., the `findstart=1` return value).
The logic for both the “collection” and “filtering” phases now fully
respects each source’s specified start column. This also extends to
fuzzy matching, making completions more predictable.
Internally, this builds on previously merged infrastructure that tracks
per-source metadata. This PR focuses on applying that metadata to
compute the leader string and insertion text appropriately for each
match.
Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().
closes: vim/vim#17651
vim/vim@ba11e78
Co-authored-by: Girish Palya <girishji@gmail.com>
…ters
Problem: completion: can only complete from keyword characters
Solution: remove this restriction, allow completion functions when
called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword
characters (Girish Palya)
Previously, functions specified in the `'complete'` option were
restricted to starting completion only from keyword characters (as
introduced in PR 17065). This change removes that restriction.
With this change, user-defined functions (e.g., `omnifunc`, `userfunc`)
used in `'complete'` can now initiate completion even when triggered
from non-keyword characters. This makes it easier to reuse existing
functions alongside other sources without having to consider whether the
cursor is on a keyword or non-keyword character, or worry about where
the replacement should begin (i.e., the `findstart=1` return value).
The logic for both the “collection” and “filtering” phases now fully
respects each source’s specified start column. This also extends to
fuzzy matching, making completions more predictable.
Internally, this builds on previously merged infrastructure that tracks
per-source metadata. This PR focuses on applying that metadata to
compute the leader string and insertion text appropriately for each
match.
Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().
closes: vim/vim#17651
vim/vim@ba11e78
Co-authored-by: Girish Palya <girishji@gmail.com>
…ters (#34798) Problem: completion: can only complete from keyword characters Solution: remove this restriction, allow completion functions when called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword characters (Girish Palya) Previously, functions specified in the `'complete'` option were restricted to starting completion only from keyword characters (as introduced in PR 17065). This change removes that restriction. With this change, user-defined functions (e.g., `omnifunc`, `userfunc`) used in `'complete'` can now initiate completion even when triggered from non-keyword characters. This makes it easier to reuse existing functions alongside other sources without having to consider whether the cursor is on a keyword or non-keyword character, or worry about where the replacement should begin (i.e., the `findstart=1` return value). The logic for both the “collection” and “filtering” phases now fully respects each source’s specified start column. This also extends to fuzzy matching, making completions more predictable. Internally, this builds on previously merged infrastructure that tracks per-source metadata. This PR focuses on applying that metadata to compute the leader string and insertion text appropriately for each match. Also, a memory corruption has been fixed in prepare_cpt_compl_funcs(). closes: vim/vim#17651 vim/vim@ba11e78 Co-authored-by: Girish Palya <girishji@gmail.com>
Allow functions in 'complete' to complete from non-keyword
Previously, functions specified in the
'complete'option were restricted to starting completion only from keyword characters during<C-N>/<C-P>completion (as introduced in PR #17065). This PR lifts that restriction.With this change, user-defined functions (e.g.,
omnifunc,userfunc) used in'complete'can now initiate completion even when triggered from non-keyword characters. This makes it easier to reuse existing functions alongside other sources without having to consider whether the cursor is on a keyword or non-keyword character, or worry about where the replacement should begin (i.e., thefindstart=1return value).The logic for both the “collection” and “filtering” phases now fully respects each source’s specified start column. This also extends to fuzzy matching, making completions more predictable.
The existing behavior — where
<C-N>shows a menu of all words of at least 2 characters when triggered from a non-keyword — remains unchanged.Internally, this builds on previously merged infrastructure that tracks per-source metadata. This PR focuses on applying that metadata to compute the leader string and insertion text appropriately for each match.