-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Racket omni_start_map
should be something like \k\+
#3870
Comments
I don't know what any of this is, but if you can create a pull request that fixes this without breaking any current functionality in languages like TypeScript, go for it. |
I am referring to It seems like the intent was to allow filetypes to specify patterns to find the start of a word for completion, with a default of
Unfortunately, this doesn't work for some languages. It explicitly disallows My suggestion is to use If that's no good, then I'd like to at least add |
The default `omni_start_map` is to restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in dense-analysis#3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the racket filetype searches for the start using the keyword class `\k`, which is more precise.
The default `omni_start_map` is too restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in dense-analysis#3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the default searches for the start using the keyword class `\k`, which is more precise and configurable for each filetype without modifying the source.
The default `omni_start_map` is too restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in dense-analysis#3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the racket filetype searches for the start using the keyword class `\k`, which is more precise.
I've opened 2 different pull requests:
|
The default `omni_start_map` is too restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in #3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the racket filetype searches for the start using the keyword class `\k`, which is more precise.
The default `omni_start_map` is too restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in dense-analysis#3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the racket filetype searches for the start using the keyword class `\k`, which is more precise.
The default `omni_start_map` is too restrictive for Lisps and Schemes like Racket, which permit hyphens (among other special characters). As recorded in dense-analysis#3870, trying to complete `file-name-from-path` when typing `file-name<C-x><C-o>` would give completions like `namespace` because the hyphen is ignored to find the start of the word for completion. Now the racket filetype searches for the start using the keyword class `\k`, which is more precise.
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, `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('.'))` with the cursor on a space _after_ `eventspace-` returned `''`! Now, it returns `eventspace-` and the completions work correctly again. Ref dense-analysis#4293, dense-analysis#4186, dense-analysis#3870
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
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 #4293, #4186, #3870
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
Racket, being a lisp, has far more than just alpha-numeric identifiers, which is what the default pattern matches. This means when I type
file-name
, invoking completion won't givefile-name-from-path
but completions likenamespace
—it has used only thename
part. Using\k\+
seemed to work in cases like this, but I don't have an exhaustive test.More broadly, and the reason this is an issue and not a PR, is I think the default should be
\k\+
—then it should be effectively scoped to the languagesiskeyword
setting, no?I also don't understand why
$
is included in theomni_start_map
pattern: does that only allow completions when there is nothing else on the line? Perhaps word boundaries\<\>
would be more appropriate?Looking for feedback here.
PS Why not use the lisp pattern? Well, I don't think even it covers all possible lisp or racket identifiers, and
\k\+
is so much easier to read.The text was updated successfully, but these errors were encountered: