Closed otto-dev closed 3 years ago
Hey @otto-dev! Thanks for the question. This is actually already doable via coc-metals
utilizing code actions.
The mapping I'm using can be found here:
Amazing! Thanks for the instructions, and the link for finding out more.
Sorry to get back to this, but I can't get it to work. Any hints how I could work on fixing this? Is this an upstream issue?
Okay, for others, this works for me:
nmap <Space>a <Plug>(coc-codeaction-cursor)
This works for selections:
xmap <Space>a <Plug>(coc-codeaction-selected)
~Issue: When I use Scala 3
sources, there is a only 1-2 second window a few seconds after vim
startup where I can trigger the Insert type annotation
code action, which executes correctly. Then it stops working.~ Actually, this appear to only work for primitive types. Upstream issue: https://github.com/scalameta/metals/issues/2875
Okay, for others, this works for me:
nmap <Space>a <Plug>(coc-codeaction-cursor)
This works for selections:
xmap <Space>a <Plug>(coc-codeaction-selected)
Glad you got it to work. Yea there are multiple different ways to trigger this.
Actually, this appear to only work for primitive types. Upstream issue: scalameta/metals#2875
Answered over there.
I don't think this is possible yet using
coc-metals
, but please correct me if I'm wrong. Metals provides a command to insert the inferred type for a variable: https://scalameta.org/metals/docs/integrations/new-editor.html#insert-inferred-type-of-a-valueIs it possible to utilize this using
coc-metals
, or could it be made possible?