From 07bd24d0fd767e9c584a45d43f23e8d5956665fe Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Sat, 5 Nov 2022 03:47:59 -0400 Subject: [PATCH] omni: racket should complete at end of keywords (#4352) Consider a file like ``` #lang racket (require racket/gui) ``` Type `Go(eventspace-`. Pressing to trigger omnicomplete should suggest ``` eventspace-handler-thread eventspace-shutdown? eventspace-event-evt ``` It does not (instead producing "top-level" completions, as if `(eventspace-` wasn't even there). Debugging, place the cursor on a space _after_. Now `ale#completion#OmniFunc(1, '')` correctly returns `1`, but when given `(0, 'eventspace-')` it returns either the empty list or generic completion results as described above. I'm not entirely sure of the mechanism, but it seems that `b:ale_completion_info.prefix` is the key, and that this is set by `ale#completion#GetPrefix`. Calling `ale#completion#GetPrefix('racket', line('.'), col('.'))` returned `''`! Now, it returns `eventspace-` and the completions work correctly again. Ref #4293, #4186, #3870 --- autoload/ale/completion.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index 920c03cc..c05ca53d 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -130,6 +130,7 @@ let s:should_complete_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', \ 'clojure': s:lisp_regex, \ 'lisp': s:lisp_regex, +\ 'racket': '\k\+$', \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', \ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$',