Skip to content

Commit

Permalink
omni: racket should complete at end of keywords
Browse files Browse the repository at this point in the history
Consider a file like
```
 #lang racket
(require racket/gui)
```
Type `Go(eventspace-`.

Pressing <C-x><C-o> 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 dense-analysis#4293, dense-analysis#4186, dense-analysis#3870
  • Loading branch information
benknoble committed Nov 3, 2022
1 parent 483d056 commit 9a5cccd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions autoload/ale/completion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ let s:should_complete_map = {
\ '<default>': '\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]*$|\.$|::$|-\>$',
Expand Down

0 comments on commit 9a5cccd

Please sign in to comment.