Skip to content
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

Option to select first completion provided by ALE (without inserting) #3433

Closed
MeTheFlea opened this issue Nov 11, 2020 · 4 comments
Closed
Assignees

Comments

@MeTheFlea
Copy link

Is there a way to auto select the first option in the completion menu whenever :ALEComplete is used? I have set completeopt=menu,menuone,preview,noinsert in my .vimrc but every time the menu opens I have no entry selected.

I saw commit 25b572b fixed an issue with automatically inserting the completion text by forcing the selection away from the first match but after I reverted this commit locally I got exactly the behaviour I wanted (without knowing the full consequences of such a change).

Is there a supported way of getting this same behaviour?

@w0rp w0rp added this to To Do in On the Radar via automation Nov 21, 2020
@w0rp w0rp self-assigned this Nov 21, 2020
@w0rp
Copy link
Member

w0rp commented Nov 21, 2020

I think this is worth doing when you request completion result manually. I added that fix to prevent a selection from being made as you type with automatic completion. We can send a different key sequence to open the completion menu when you manually request completion results, from the one we send when they are shown automatically.

rouge8 added a commit to rouge8/ale that referenced this issue Feb 3, 2021
This patch removes `noselect` from the default `completeopts`. This
should no longer be necessary thanks to
25b572b, because the `<C-p>` added to
the map will deselect the first entry.

Combined with something like this in your `~/.vimrc`:

```
function! RemapAleCompletion()
  iunmap <Plug>(ale_show_completion_menu)
  inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
endfunction

augroup remap_ale_completion
  autocmd!
  autocmd VimEnter * call RemapAleCompletion()
augroup END
```

This can address dense-analysis#3433.
@rouge8
Copy link

rouge8 commented Feb 4, 2021

@MeTheFlea i think #3573 might fix this for you?

rouge8 added a commit to rouge8/ale that referenced this issue Feb 6, 2021
This patch removes `noselect` from the default `completeopts`. This
should no longer be necessary thanks to
25b572b, because the `<C-p>` added to
the map will deselect the first entry.

Combined with something like this in your `~/.vimrc`:

```
function! RemapAleCompletion()
  iunmap <Plug>(ale_show_completion_menu)
  inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
endfunction

augroup remap_ale_completion
  autocmd!
  autocmd VimEnter * call RemapAleCompletion()
augroup END
```

This can address dense-analysis#3433.
rouge8 added a commit to rouge8/ale that referenced this issue Feb 21, 2021
This patch removes `noselect` from the default `completeopts`. This
should no longer be necessary thanks to
25b572b, because the `<C-p>` added to
the map will deselect the first entry.

Combined with something like this in your `~/.vimrc`:

```
function! RemapAleCompletion()
  iunmap <Plug>(ale_show_completion_menu)
  inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
endfunction

augroup remap_ale_completion
  autocmd!
  autocmd VimEnter * call RemapAleCompletion()
augroup END
```

This can address dense-analysis#3433.
rouge8 added a commit to rouge8/ale that referenced this issue Mar 6, 2021
This patch removes `noselect` from the default `completeopts`. This
should no longer be necessary thanks to
25b572b, because the `<C-p>` added to
the map will deselect the first entry.

Combined with something like this in your `~/.vimrc`:

```
function! RemapAleCompletion()
  iunmap <Plug>(ale_show_completion_menu)
  inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
endfunction

augroup remap_ale_completion
  autocmd!
  autocmd VimEnter * call RemapAleCompletion()
augroup END
```

This can address dense-analysis#3433.
@w0rp w0rp closed this as completed in e785196 Jun 19, 2021
On the Radar automation moved this from To Do to Done Jun 19, 2021
@w0rp
Copy link
Member

w0rp commented Jun 19, 2021

@rouge8 @MeTheFlea I've pushed a commit now which only sets noselect in the options if you've configured Vim that way.

@rouge8
Copy link

rouge8 commented Jun 19, 2021

Thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants