From 87217ae347f71836c2e47b84dfbf26b1f2630d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Gonz=C3=A1lez=20Rus?= Date: Thu, 22 Mar 2018 11:40:47 +0100 Subject: fix: Handle ranges for the remark linter #1207 --- ale_linters/markdown/remark_lint.vim | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ale_linters/markdown') diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim index 5b3b3d47..98dd0d7b 100644 --- a/ale_linters/markdown/remark_lint.vim +++ b/ale_linters/markdown/remark_lint.vim @@ -1,18 +1,24 @@ -" Author rhysd https://rhysd.github.io/ +" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr) " Description: remark-lint for Markdown files function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint' - let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$' + " matches: ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint', + let l:pattern = '^ \+\(\d\+\):\(\d\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { + let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \ 'text': l:match[4], - \}) + \ 'type': l:match[6] is# 'error' ? 'E' : 'W', + \ 'text': l:match[7], + \} + if l:match[3] isnot# '' + let l:item.end_lnum = l:match[4] + 0 + let l:item.end_col = l:match[5] + 0 + endif + call add(l:output, l:item) endfor return l:output -- cgit v1.2.3