Skip to content

Support non-latin characters #130

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

Closed
h3xOo opened this issue Oct 17, 2024 · 1 comment
Closed

Support non-latin characters #130

h3xOo opened this issue Oct 17, 2024 · 1 comment
Labels
feature New feature or request sources Specific source provider or the system as a whole
Milestone

Comments

@h3xOo
Copy link

h3xOo commented Oct 17, 2024

Nvim-cmp's buffer source (only this one matters imo), you could configure like this

  { name = "buffer", option = { keyword_pattern = [[\k\+]] } },

And this regex captured non latin characters for completion. I tried playing with opts.trigger.completion.keyword_regex, but I couldn't make it work.

@Saghen Saghen changed the title FR: Support non-latin characters Support non-latin characters Oct 24, 2024
@Saghen Saghen added feature New feature or request sources Specific source provider or the system as a whole labels Oct 24, 2024
@fmoralesc
Copy link

fmoralesc commented Nov 11, 2024

I found it that changing REGEX in lua/blink/cmp/fuzz/lib.rs to r"\w{2,32}" seems to fix completions for non-ascii words. in the buffer. Originally, the get_words function would split aaaaaa aaaaáaaa into {'aaaaaa', 'aaaa', aaa} (skipping over á), now it splits it as {'aaaaaa', 'aaaaáaaa'}.

Is there a reason why this approach would not work? (Is it too expensive to use unicode aware regexes?)

EDIT: r"[\w-]{2,32}" works better if you want to complete things with hyphens too (turns out I am working on a spanish language typst document where a bunch of terms include hyphens, so that was needed).

@Saghen Saghen added this to the Sources v2 milestone Nov 28, 2024
@Saghen Saghen closed this as completed in 51d5f59 Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sources Specific source provider or the system as a whole
Projects
None yet
Development

No branches or pull requests

3 participants