Coc-go: Difference between revisions

From wikinotes
No edit summary
 
Line 21: Line 21:
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Configuration -->
</blockquote><!-- Configuration -->
= Usage =
<blockquote>
<syntaxhighlight lang="vim">
exec "normal \<Plug>(coc-rename)"  " refactor-rename
</syntaxhighlight>
</blockquote><!-- Usage -->


= Troubleshooting =
= Troubleshooting =

Latest revision as of 17:54, 26 June 2022

neovim LSP server for golang, uses gopls under the hood (although I did not need to install it).

Documentation

github https://github.com/josa42/coc-go
gopls troubleshooting https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capturing-logs

Configuration

autoimport, autoformat on save

autocmd BufWritePre *.go
  \ :silent call CocAction('runCommand', 'editor.action.organizeImport')
  \ | :silent call CocAction('runCommand', 'editor.action.formatDocument')

Usage

exec "normal \<Plug>(coc-rename)"  " refactor-rename

Troubleshooting

Hangs on setting up workspace: loading packages...

I believe this is caused by my settings detecting a go project,
before actually entering a go srcfile itself.
solve by restarting coc.

:CocRestart