emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.75k stars 868 forks source link

signature help with lv is nor word wrapping too long documentation lines (seen with java doc) #1216

Open jtl5770 opened 4 years ago

jtl5770 commented 4 years ago

The signature help using lv is pretty neat, unfortunately it doesn't work too well with java doc as the content often has long lines which are not word wrapped, but truncated which is hard to follow. And if I turn on word wrapping in that buffer, the nice ascii graphics with the "header line" and the vertical line on the left is being broken.

To Reproduce Use it on a signature with java-doc whose contents is longer than fits a line.

Expected behavior I would expect lines either being broken and wrapped unconditionally, or and option to do so and by doing that, the arrangement and display of the help should not be broken

Which Language Server did you use eclipse for java

OS Linux

jtl5770 commented 4 years ago

But it still leaves the question how automatically enable visual line mode to break long lines into words...

Seems it's in fundamental mode, so I don't want to just add it to this mode's hook...

yyoncho commented 4 years ago

What do you mean by visual line mode? You want toggle-truncate-lines to be set to wrap?

jtl5770 commented 4 years ago

Actually what ever happens when you use select "Word Wrap (Visual Line Mode)" from the "Options->Line Wrapping in this Buffer" Menu. I assume it is the same as M-x visual-line-mode:

Not just wrap a line at whatever character is at the end of the line length (and having those ugly continuation arrows). Visual line mode makes sure to wrap at word boundaries (and also takes care of cursor movement to not see only one, continued line - not important for our case here).

yyoncho commented 4 years ago

@abo-abo we are using lv package for displaying signature help Screenshot

What do you think about having visual-line-mode enabled by default in lv window as suggested by @jtl5770 ? I could patch it on lsp-mode side(or eventually duplicate the lv implementation?) but IMO it will be useful for other packages using lv too. WDYT?

jtl5770 commented 4 years ago

Screenshot from 2019-12-12 12-50-26 Hi @yyoncho - besides the fact of the non wrapping lines, I assume there is another problem with the formatting of the signature help (see screenshot). I would assume that

yyoncho commented 4 years ago

@jtl5770 can you provide the log for this call? I think I have seen similar issues in the past and back then it was caused by markdown-mode.

yyoncho commented 4 years ago

Here it is how it looks on my side

Screenshot

jtl5770 commented 4 years ago

sorry to ask something most probably obvious: How do I provide a log?

yyoncho commented 4 years ago

@jtl5770 (setq lsp-print-io t) and then lsp-workspace-show-log.

jtl5770 commented 4 years ago

io.log

hope this helps....

jtl5770 commented 4 years ago

@yyoncho - maybe you can save the hassle... I realized I had openjdk-1.8 installed. I switched to some more reasonable openjdk-11 and the formatting of the javadocs looks like your example. Maybe there is no need to support archaic versions here...

abo-abo commented 4 years ago

@yyoncho I've just added lv-window-hook. You can set it up to turn on visual-line-mode.

yyoncho commented 4 years ago

@abo-abo thank you!

@jtl5770 here it is the code to use to enable visual-line-mode:

(add-hook 'lv-window-hook 'visual-line-mode)
jtl5770 commented 4 years ago

@yyoncho: well, updated everything from MELPA - but it simply doesn't work. I added to the hook as described, no effect...

jtl5770 commented 4 years ago

@yyoncho - I tried again in the hope I made something wrong the first time.. but no: visual-line-hook is added to lv-window-hook, but no effect.

I tried with melpa up to date as of today, with Java. E.g. using completion on a method showed the signature help for the arguments with lines not wrapped, and by that mostly useless to really read the documentation. Are you sure this is worling? Where could I look for mistakes on my side?

Regards, jtl