coc-java icon indicating copy to clipboard operation
coc-java copied to clipboard

Line length of the eclipse formatter not working.

Open Tacsiazuma opened this issue 6 years ago • 1 comments

I use

nmap <leader>f  <Plug>(coc-format)<CR>

to format my files. I have checkstyle configured so the max line length is 120. After I format a .java file I saw that sometimes this line length is not being respected. Lets say an annotation at the beginning of the class:

 @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)

This line is 121 character long, even after formatting it therefore checkstyle fails.

I tried editing the formatter settings (inside the created file after the 'java.open.formatter.settings') but that didn't helped.

 <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="119"/>

Tacsiazuma avatar Sep 02 '20 12:09 Tacsiazuma

Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

chemzqm avatar Sep 10 '20 14:09 chemzqm

You may need to configure java.format.settings.url by :CocCommand java.open.formatter.settings

chemzqm avatar Jan 29 '23 09:01 chemzqm