coc-java
coc-java copied to clipboard
How to trigger code formatting? CTRL+F "format" in the entire docs and issues and can't figure out how still.
"java.format.enabled": true,
"java.format.onType.enabled": true,
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"
I have tried all permutations of the above yet can't get autoformatting to work on typing ;/}/<return>
etc...
Furthermore is it possible to trigger formatting behavior on save? It seems more intuitive that way like prettier
plugin for js.
The answer to the question can be found in :h coc-nvim
as detailed under the quick start section of the home page for coc.nvim.
Simply add the following to your :CocConfig
to format on save:
"coc.preferences.formatOnSaveFiletypes": [
"java"
]
Should be fixed on recent version of coc-java, try upgrade coc.nvim to latest release and coc-java to version 1.14.0.
Make sure to use configuration "coc.preferences.formatOnType": true"
to enable format on type with coc.nvim.