Use message
as text
instead of title
`title` does not contain much information which forces to use :ALEDetail most of the time
This commit is contained in:
parent
089a07c6a6
commit
c3f61c391b
@ -20,21 +20,30 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
if l:report.type is? 'error'
|
if l:report.type is? 'error'
|
||||||
" General problem
|
" General problem
|
||||||
let l:details = map(copy(l:report.message), 'ale_linters#elm#make#ParseMessageItem(v:val)')
|
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
|
||||||
|
|
||||||
|
if ale_linters#elm#make#FileIsBuffer(l:report.path)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': l:report.title,
|
\ 'text': l:details,
|
||||||
\ 'detail': join(l:details, '')
|
|
||||||
\})
|
\})
|
||||||
|
else
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:report.path .' - '. l:details,
|
||||||
|
\ 'detail': l:report.path ." ----------\n\n". l:details,
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
" Compilation errors
|
" Compilation errors
|
||||||
for l:error in l:report.errors
|
for l:error in l:report.errors
|
||||||
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
||||||
|
|
||||||
for l:problem in l:error.problems
|
for l:problem in l:error.problems
|
||||||
let l:details = map(copy(l:problem.message), 'ale_linters#elm#make#ParseMessageItem(v:val)')
|
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
|
||||||
|
|
||||||
if l:file_is_buffer
|
if l:file_is_buffer
|
||||||
" Buffer module has problems
|
" Buffer module has problems
|
||||||
@ -44,8 +53,7 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
\ 'end_lnum': l:problem.region.end.line,
|
\ 'end_lnum': l:problem.region.end.line,
|
||||||
\ 'end_col': l:problem.region.end.column,
|
\ 'end_col': l:problem.region.end.column,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': l:problem.title,
|
\ 'text': l:details,
|
||||||
\ 'detail': join(l:details, '')
|
|
||||||
\})
|
\})
|
||||||
else
|
else
|
||||||
" Imported module has problems
|
" Imported module has problems
|
||||||
@ -53,8 +61,8 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': l:location .' - '. l:problem.title,
|
\ 'text': l:location .' - '. l:details,
|
||||||
\ 'detail': l:location ." -------\n\n" . join(l:details, '')
|
\ 'detail': l:location ." ----------\n\n". l:details,
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -88,6 +96,10 @@ function! ale_linters#elm#make#FileIsBuffer(path) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#ParseMessage(message) abort
|
||||||
|
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||||
if type(a:item) == type('')
|
if type(a:item) == type('')
|
||||||
return a:item
|
return a:item
|
||||||
|
@ -15,8 +15,7 @@ Execute(The elm make handler should parse general problems correctly):
|
|||||||
\ {
|
\ {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'UNKNOWN IMPORT',
|
\ 'text': "error details\n\nstyled details"
|
||||||
\ 'detail': "error details 1\n\nstyled details"
|
|
||||||
\ }
|
\ }
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#elm#make#Handle(347, [
|
\ ale_linters#elm#make#Handle(347, [
|
||||||
@ -24,7 +23,7 @@ Execute(The elm make handler should parse general problems correctly):
|
|||||||
\ "type": "error",
|
\ "type": "error",
|
||||||
\ "path": "' . b:tmp . '/Module.elm",
|
\ "path": "' . b:tmp . '/Module.elm",
|
||||||
\ "title": "UNKNOWN IMPORT",
|
\ "title": "UNKNOWN IMPORT",
|
||||||
\ "message": ["error details 1\n\n", { "string": "styled details" }]
|
\ "message": ["error details\n\n", { "string": "styled details" }]
|
||||||
\ }'
|
\ }'
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
@ -37,8 +36,7 @@ Execute(The elm make handler should parse compilation errors correctly):
|
|||||||
\ 'end_lnum': 408,
|
\ 'end_lnum': 408,
|
||||||
\ 'end_col': 18,
|
\ 'end_col': 18,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'TYPE MISMATCH',
|
\ 'text': "error details 1\n\nstyled details"
|
||||||
\ 'detail': "error details 1\n\nstyled details"
|
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 406,
|
\ 'lnum': 406,
|
||||||
@ -46,8 +44,7 @@ Execute(The elm make handler should parse compilation errors correctly):
|
|||||||
\ 'end_lnum': 407,
|
\ 'end_lnum': 407,
|
||||||
\ 'end_col': 17,
|
\ 'end_col': 17,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'TYPE MISMATCH',
|
\ 'text': "error details 2",
|
||||||
\ 'detail': "error details 2",
|
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 406,
|
\ 'lnum': 406,
|
||||||
@ -55,8 +52,7 @@ Execute(The elm make handler should parse compilation errors correctly):
|
|||||||
\ 'end_lnum': 406,
|
\ 'end_lnum': 406,
|
||||||
\ 'end_col': 93,
|
\ 'end_col': 93,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'TYPE MISMATCH',
|
\ 'text': "error details 3",
|
||||||
\ 'detail': "error details 3",
|
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#elm#make#Handle(347, [
|
\ ale_linters#elm#make#Handle(347, [
|
||||||
@ -87,18 +83,30 @@ Execute(The elm make handler should parse compilation errors correctly):
|
|||||||
\ }'
|
\ }'
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
Execute(The elm make handler should put an error on the first line for compilation errors in imported modules):
|
Execute(The elm make handler should handle errors in imported modules):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'src/Module.elm:404 - TYPE MISMATCH',
|
\ 'text': "src/Module.elm - error details\n\nstyled details",
|
||||||
\ 'detail': "src/Module.elm:404 -------\n\nerror details\n\nstyled details"
|
\ 'detail': "src/Module.elm ----------\n\nerror details\n\nstyled details"
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': "src/Module.elm:404 - error details\n\nstyled details",
|
||||||
|
\ 'detail': "src/Module.elm:404 ----------\n\nerror details\n\nstyled details"
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#elm#make#Handle(347, [
|
\ ale_linters#elm#make#Handle(347, [
|
||||||
\ '{
|
\ '{
|
||||||
|
\ "type": "error",
|
||||||
|
\ "path": "src/Module.elm",
|
||||||
|
\ "title": "UNKNOWN IMPORT",
|
||||||
|
\ "message": ["error details\n\n", { "string": "styled details" }]
|
||||||
|
\ }',
|
||||||
|
\ '{
|
||||||
\ "type": "compile-errors",
|
\ "type": "compile-errors",
|
||||||
\ "errors": [
|
\ "errors": [
|
||||||
\ {
|
\ {
|
||||||
@ -124,8 +132,7 @@ Execute(The elm make handler should put an error on the first line if a line can
|
|||||||
\ 'end_lnum': 408,
|
\ 'end_lnum': 408,
|
||||||
\ 'end_col': 18,
|
\ 'end_col': 18,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'TYPE MISMATCH',
|
\ 'text': "error details 1\n\nstyled details"
|
||||||
\ 'detail': "error details 1 styled details"
|
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
@ -143,13 +150,13 @@ Execute(The elm make handler should put an error on the first line if a line can
|
|||||||
\ "problems": [
|
\ "problems": [
|
||||||
\ {
|
\ {
|
||||||
\ "title": "TYPE MISMATCH",
|
\ "title": "TYPE MISMATCH",
|
||||||
\ "message": ["error details 1 ", { "string": "styled details" }],
|
\ "message": ["error details 1\n\n", { "string": "styled details" }],
|
||||||
\ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
|
\ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
|
||||||
\ }
|
\ }
|
||||||
\ ]
|
\ ]
|
||||||
\ }
|
\ }
|
||||||
\ ]
|
\ ]
|
||||||
\ }',
|
\ }',
|
||||||
\ "Not JSON",
|
\ 'Not JSON',
|
||||||
\ "Also not JSON",
|
\ 'Also not JSON',
|
||||||
\ ])
|
\ ])
|
||||||
|
Loading…
Reference in New Issue
Block a user