mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Fix coc.nvim on-save recommendation to use the organizeImport code action, which properly adds missing imports.
parent
07c4bb60c0
commit
3f84d158e4
4
gopls.md
4
gopls.md
@ -150,10 +150,10 @@ Use [coc.nvim](https://github.com/neoclide/coc.nvim/), with the following `coc-s
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To get automatic formatting and imports on save, add the following line to your `init.vim`:
|
The `editor.action.organizeImport` code action will auto-format code and add missing imports. To run this automatically on save, add the following line to your `init.vim`:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
autocmd BufWritePre *.go :call CocAction("format")
|
autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user