mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Only strip newlines for echo, otherwise full messages (#4964)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Updates `ale#lsp#response#ReadDiagnostics` to always store the full, unaltered diagnostic message from the LSP in question. The current process is to replace all newline characters with whitespace (' '), which then leads to broken formatting when viewing complex output from an LSP with `:ALEDetail` and other commands.
* Updates `ale#cursor#TruncatedEcho` to replace newline characters with a space ' ' instead of an empty string '' to retain the previous style of formatting for echoed messages.
Fixes: #2356
Fixes: #3068
Fixes: #2301
This commit is contained in:
@@ -93,6 +93,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
|
|||||||
if !empty(l:loc)
|
if !empty(l:loc)
|
||||||
let l:format = ale#Var(l:buffer, 'echo_msg_format')
|
let l:format = ale#Var(l:buffer, 'echo_msg_format')
|
||||||
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
|
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
|
||||||
|
|
||||||
call ale#cursor#TruncatedEcho(l:msg)
|
call ale#cursor#TruncatedEcho(l:msg)
|
||||||
let l:info.echoed = 1
|
let l:info.echoed = 1
|
||||||
elseif get(l:info, 'echoed')
|
elseif get(l:info, 'echoed')
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(diagnostics) abort
|
|||||||
for l:diagnostic in a:diagnostics
|
for l:diagnostic in a:diagnostics
|
||||||
let l:severity = get(l:diagnostic, 'severity', 0)
|
let l:severity = get(l:diagnostic, 'severity', 0)
|
||||||
let l:loclist_item = {
|
let l:loclist_item = {
|
||||||
\ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'),
|
\ 'text': l:diagnostic.message,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'lnum': l:diagnostic.range.start.line + 1,
|
\ 'lnum': l:diagnostic.range.start.line + 1,
|
||||||
\ 'col': l:diagnostic.range.start.character + 1,
|
\ 'col': l:diagnostic.range.start.character + 1,
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ Execute(ale#lsp#response#ReadDiagnostics() should include sources in detail):
|
|||||||
\ }
|
\ }
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
Execute(ale#lsp#response#ReadDiagnostics() should keep detail with line breaks but replace with spaces in text):
|
Execute(ale#lsp#response#ReadDiagnostics() should keep line breaks in text):
|
||||||
AssertEqual [
|
AssertEqual [
|
||||||
\ {
|
\ {
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'cannot borrow `cap` as mutable more than once at a time mutable borrow starts here in previous iteration of loop',
|
\ 'text': "cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop",
|
||||||
\ 'detail': "[rustc] cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop",
|
\ 'detail': "[rustc] cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop",
|
||||||
\ 'lnum': 10,
|
\ 'lnum': 10,
|
||||||
\ 'col': 15,
|
\ 'col': 15,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Before:
|
|||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'code': 'semi',
|
\ 'code': 'semi',
|
||||||
\ 'text': "Missing semicolon.\r",
|
\ 'text': "Missing\nsemicolon.\r",
|
||||||
\ 'detail': "Every statement should end with a semicolon\nsecond line",
|
\ 'detail': "Every statement should end with a semicolon\nsecond line",
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
|
|||||||
Reference in New Issue
Block a user