Fix #1240 - Parse line and column numbers for fatal embertemplatelint errors
This commit is contained in:
parent
0ad2547997
commit
cc8e5502c8
2 changed files with 6 additions and 11 deletions
|
@ -22,15 +22,13 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||||
for l:error in get(values(l:json), 0, [])
|
for l:error in get(values(l:json), 0, [])
|
||||||
if has_key(l:error, 'fatal')
|
if has_key(l:error, 'fatal')
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'lnum': get(l:error, 'line', 1),
|
||||||
\ 'lnum': 1,
|
\ 'col': get(l:error, 'column', 1),
|
||||||
\ 'col': 1,
|
|
||||||
\ 'text': l:error.message,
|
\ 'text': l:error.message,
|
||||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||||
\})
|
\})
|
||||||
else
|
else
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:error.line,
|
\ 'lnum': l:error.line,
|
||||||
\ 'col': l:error.column,
|
\ 'col': l:error.column,
|
||||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||||
|
|
|
@ -32,14 +32,12 @@ Execute(The ember-template-lint handler should parse lines correctly):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 347,
|
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'col': 10,
|
\ 'col': 10,
|
||||||
\ 'text': 'bare-strings: Non-translated string used',
|
\ 'text': 'bare-strings: Non-translated string used',
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 347,
|
|
||||||
\ 'lnum': 3,
|
\ 'lnum': 3,
|
||||||
\ 'col': 6,
|
\ 'col': 6,
|
||||||
\ 'text': 'invalid-interactive: Interaction added to non-interactive element',
|
\ 'text': 'invalid-interactive: Interaction added to non-interactive element',
|
||||||
|
@ -55,8 +53,8 @@ Execute(The ember-template-lint handler should handle template parsing error cor
|
||||||
\ "fatal": true,
|
\ "fatal": true,
|
||||||
\ "moduleId": "app/templates/application",
|
\ "moduleId": "app/templates/application",
|
||||||
\ "message": "Parse error on line 5 ...",
|
\ "message": "Parse error on line 5 ...",
|
||||||
\ "line": 1,
|
\ "line": 5,
|
||||||
\ "column": 1,
|
\ "column": 3,
|
||||||
\ "source": "Error: Parse error on line 5 ...",
|
\ "source": "Error: Parse error on line 5 ...",
|
||||||
\ "severity": 2
|
\ "severity": 2
|
||||||
\ }
|
\ }
|
||||||
|
@ -66,9 +64,8 @@ Execute(The ember-template-lint handler should handle template parsing error cor
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 347,
|
\ 'lnum': 5,
|
||||||
\ 'lnum': 1,
|
\ 'col': 3,
|
||||||
\ 'col': 1,
|
|
||||||
\ 'text': 'Parse error on line 5 ...',
|
\ 'text': 'Parse error on line 5 ...',
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ },
|
\ },
|
||||||
|
|
Reference in a new issue