mirror of
https://github.com/dense-analysis/ale.git
synced 2026-08-30 19:36:55 +08:00
Fix markdownlint fixer and add markdownlint-cli2 (#5165)
* fix(tests): fix ale_c_build_dir_names being unset in tests (#5109) - Use ale#Set() to set the ale_c_build_dir_names variable. - Ensure SetUpLinterTest() is called before any Save commands in tests. - Add c.vim to runtime before non-linter tests are executed. - Remove workarounds in c.vim. * feat: Load Prettier from cjs also * fix: wrong command for markdownlint * feat: explicit support for markdownlint-cli2 - Add markdownlint-cli2 linter and fixer, separate from markdownilnt-cli - Rename markdownlint to markdownlint-cli - Keep markdownlint as alias for markdownlint-cli --------- Co-authored-by: w0rp <devw0rp@gmail.com> Co-authored-by: Horacio Sanson <horacio.sanson@dena.jp>
This commit is contained in:
co-authored by
w0rp
Horacio Sanson
parent
1c6e71732f
commit
eff718bee9
@@ -787,10 +787,16 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['verilog'],
|
||||
\ 'description': 'Formats verilog files using verible.',
|
||||
\ },
|
||||
\ 'markdownlint': {
|
||||
\ 'markdownlint-cli': {
|
||||
\ 'function': 'ale#fixers#markdownlint#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with markdownlint.',
|
||||
\ 'description': 'Fix markdown files with markdownlint-cli.',
|
||||
\ 'aliases': ['markdownlint'],
|
||||
\ },
|
||||
\ 'markdownlint-cli2': {
|
||||
\ 'function': 'ale#fixers#markdownlint_cli2#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with markdownlint-cli2.',
|
||||
\ },
|
||||
\ 'rumdl': {
|
||||
\ 'function': 'ale#fixers#rumdl#Fix',
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
:scriptencoding utf-8
|
||||
|
||||
call ale#Set('markdownlint_executable', 'markdownlint')
|
||||
call ale#Set('markdownlint_options', '--fix')
|
||||
call ale#Set('markdownlint_options', '')
|
||||
|
||||
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'markdownlint_executable')
|
||||
let l:options = ale#Var(a:buffer, 'markdownlint_options')
|
||||
function! ale#fixers#markdownlint#FixFor(buffer, name) abort
|
||||
let l:executable = ale#Var(a:buffer, a:name . '_executable')
|
||||
let l:options = ale#Var(a:buffer, a:name . '_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . l:options,
|
||||
\ . ' --fix'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||
return ale#fixers#markdownlint#FixFor(a:buffer, 'markdownlint')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
:scriptencoding utf-8
|
||||
" Author: Horacio Sanson
|
||||
" Description: Fixes Markdown files with markdownlint-cli2
|
||||
|
||||
call ale#Set('markdownlint_cli2_executable', 'markdownlint-cli2')
|
||||
call ale#Set('markdownlint_cli2_options', '')
|
||||
|
||||
function! ale#fixers#markdownlint_cli2#Fix(buffer) abort
|
||||
return ale#fixers#markdownlint#FixFor(a:buffer, 'markdownlint_cli2')
|
||||
endfunction
|
||||
@@ -1,6 +1,23 @@
|
||||
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
||||
" Description: Adds support for markdownlint
|
||||
|
||||
function! ale#handlers#markdownlint#GetExecutable(buffer, name) abort
|
||||
return ale#Var(a:buffer, 'markdown_' . a:name . '_executable')
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#markdownlint#GetCommand(buffer, name) abort
|
||||
let l:executable = ale#handlers#markdownlint#GetExecutable(
|
||||
\ a:buffer,
|
||||
\ a:name,
|
||||
\)
|
||||
let l:options = ale#Var(
|
||||
\ a:buffer,
|
||||
\ 'markdown_' . a:name . '_options',
|
||||
\)
|
||||
|
||||
return ale#Escape(l:executable) . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#markdownlint#Handle(buffer, lines) abort
|
||||
let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(error\|warning\)\? \?\(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$'
|
||||
let l:output=[]
|
||||
|
||||
Reference in New Issue
Block a user