How do I get coc to fix the current file?
bag-man opened this issue ยท 6 comments
bag-man commented
If I enable "tslint.autoFixOnSave": true
in my coc-settings.json
, the plugin will autofix my current file on save. However this can cause some problems on occasion, so I would rather run the autofix manually.
However I can't seem to figure out what command I should run. If I run :CocAction
I can see Fix all auto-fixable tslint failures [tsserver]
, so it is a command that can be ran, but I have to select it in the menu.
Thanks!
zachkirsch commented
+1
chemzqm commented
Read vim help
zachkirsch commented
Thank you for that incredibly helpful reply @chemzqm!
shivangp76 commented
Any update on this?
chemzqm commented
You can invoke codeAction by title
giovannibenussi commented
I was able to make it work by running :CocCommand eslint.executeAutofix
. I added the following code to my vimrc file to assign it a custom mapping:
nmap <leader><leader>f :CocCommand eslint.executeAutofix<cr>