Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Newlines filtered out on error messages? #781

Closed
TomMD opened this issue Apr 5, 2020 · 2 comments
Closed

Newlines filtered out on error messages? #781

TomMD opened this issue Apr 5, 2020 · 2 comments

Comments

@TomMD
Copy link

TomMD commented Apr 5, 2020

With let g:lsp_diagnostics_echo_cursor = 1 the full error message isn't visible.

For example, a multi-line message from LSP is:

/private/tmp/x/Main.hs:28:9: error:\n    • Couldn't match expected type ‘IO a0’ with actual type ‘Bool’\n    • In a stmt of a 'do' block: [ more snipped out ]

Even if I grow the command window what I see is a truncated version without newlines:

Screen Shot 2020-04-05 at 9 56 59 AM

@TomMD
Copy link
Author

TomMD commented Apr 5, 2020

OK, I see this is by design. If I change:

-        call lsp#utils#echo_with_truncation('LSP: '. substitute(l:diagnostic['message'], '\n\+', ' ', 'g'))
+        call lsp#utils#echo_with_truncation('LSP: '. l:diagnostic['message'])

and

-    if l:winwidth > 5 && l:winwidth < strdisplaywidth(l:msg)
-        let l:msg = l:msg[:l:winwidth - 5] . '...'
-    endif

Then I get almost the behavior I want. I can go down to escape the command bar but going up (k) doesn't work. Would you be up for a patch that adds some suitable global, like

let g:lsp_diagnostics_echo_cursor_full_message = 1
" Includes newline and does not truncate error messages when echoing.
" Must also have g:lsp_diagnostics_echo_cursor = 1

@TomMD
Copy link
Author

TomMD commented Apr 5, 2020

Scratch all this actually. I very much prefer what you already have via

+ let g:lsp_diagnostics_float_cursor = 1 " float the diagnostics
+ let g:lsp_diagnostics_float_delay = 300

Sorry for the noise!

@TomMD TomMD closed this as completed Apr 5, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant