neoclide/coc-tslint-plugin

How do I get coc to fix the current file?

bag-man opened this issue ยท 6 comments

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!

Read vim help

Thank you for that incredibly helpful reply @chemzqm!

Any update on this?

You can invoke codeAction by title

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>