VIM version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 5 2017 04:42:50).
Operating System: macOS High Sierra
Current Filetype: markdown
Available Linters: ['mdl', 'proselint', 'redpen', 'remark-lint', 'vale', 'write-good']
Enabled Linters: ['mdl', 'proselint', 'redpen', 'remark-lint', 'vale', 'write-good']
Linter Variables:
Global Variables:
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'markdown': ['prettier'], 'javascript': ['prettier'], 'python': ['yapf']}
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - failure) mdl
(executable check - failure) proselint
(executable check - failure) redpen
(executable check - success) remark
(started) ['/bin/bash', '-c', 'remark --no-stdout --no-color ''/Users/dirk/github/Dans-labs/dariah/docs/componentsttest.md''']
(executable check - failure) vale
(executable check - failure) write-good
(executable check - failure) mdl
(executable check - failure) proselint
(executable check - failure) redpen
(finished - exit code 0) ['/bin/bash', '-c', 'remark --no-stdout --no-color ''/Users/dirk/github/Dans-labs/dariah/docs/componentsttest.md''']
<<
âš 5 warnings
<<
(executable check - failure) vale
(executable check - failure) write-good
None of the warnings ended up as signs in the gutter.
preset-lint-markdown-style-guide plugin.I have a file .remarkrc.yaml in my home directory with the contents:
plugins:
- preset-lint-markdown-style-guide
- frontmatter
settings:
verbose: true
quote: "'"
quoteSmart: true
preferUnquoted: true
The markdown file to test this on, can be as simple as
*test*
In ale-linters/markdown/remark_lint.vim the pattern that is used to extract the line/char position does not match ranges, like 9:3-10:5, only single places.
Adapt the pattern, like so:
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ '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
I have tested this, and it works.
(I have zero experience in vim-scripting, but I saw how apiblueprint/drafter.vim deals with ranges, and merged that in).
I see now that in my post I left out the adapted pattern, just before get matches. I will add that as soon I’m behind a proper computer.
the whole of my remark_lint.vim
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\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ '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)
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'end_lnum': l:match[4] + 0,
\ 'end_col': l:match[5] + 0,
\ 'type': l:match[6] is# 'error' ? 'E' : 'W',
\ 'text': l:match[7],
\})
endfor
return l:output
endfunction
call ale#linter#Define('markdown', {
\ 'name': 'remark-lint',
\ 'executable': 'remark',
\ 'command': 'remark --no-stdout --no-color %s',
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
\ 'lint_file': 1,
\ 'output_stream': 'stderr',
\})
By the way, I really like and admire the way you have done ALE. I have now three linter/formatters working, for Python, ES6, and Markdown. The fact that you install them first outside vim, and then get them working inside vim with zero config is aLesome!
Hi!
Will there be any fix soon for this issue? I can open a PR if necessary :)
Thanks!
Yeah, open a pull request with some tests for the changes to how errors are handled, and I'll have a look.
PR added (#1441) :)
Most helpful comment
By the way, I really like and admire the way you have done ALE. I have now three linter/formatters working, for Python, ES6, and Markdown. The fact that you install them first outside vim, and then get them working inside vim with zero config is aLesome!