mirror of
https://github.com/dense-analysis/ale.git
synced 2026-04-28 10:05:31 +08:00
c59c0d1a57
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* feat: put in the main linter files * feat: add to registry * docs: add rumdl to docs * tests: vader tests * edit: actually split the options into two * style: make rumdl fixer test mimic markdownlint * fix: stupidity overwhelming * fix: actually let's look for pyproject too copied from tombi * i'm a buffoon fix wrong indentation * alignment ci is made for people like me * missed toc entry
49 lines
1.6 KiB
VimL
49 lines
1.6 KiB
VimL
" Author: Evan Chen <evan@evanchen.cc>
|
|
" Description: Fast Markdown linter and formatter written in Rust
|
|
|
|
|
|
call ale#Set('markdown_rumdl_executable', 'rumdl')
|
|
call ale#Set('markdown_rumdl_options', '')
|
|
|
|
function! ale_linters#markdown#rumdl#GetProjectRoot(buffer) abort
|
|
let l:dotconfig = ale#path#FindNearestFile(a:buffer, '.rumdl.toml')
|
|
let l:config = ale#path#FindNearestFile(a:buffer, 'rumdl.toml')
|
|
|
|
if !empty(l:dotconfig) && !empty(l:config)
|
|
let l:nearest = len(l:dotconfig) >= len(l:config) ? l:dotconfig : l:config
|
|
|
|
return fnamemodify(l:nearest, ':h')
|
|
elseif !empty(l:dotconfig)
|
|
return fnamemodify(l:dotconfig, ':h')
|
|
elseif !empty(l:config)
|
|
return fnamemodify(l:config, ':h')
|
|
endif
|
|
|
|
" Try to find nearest pyproject.toml
|
|
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
|
|
|
|
if !empty(l:pyproject_file)
|
|
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
|
|
endif
|
|
|
|
" Try to find nearest `git` directory
|
|
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
|
|
|
|
if !empty(l:gitdir)
|
|
return fnamemodify(l:gitdir . '/', ':p:h:h')
|
|
endif
|
|
|
|
return fnamemodify(bufname(a:buffer), ':p:h')
|
|
endfunction
|
|
|
|
call ale#linter#Define('markdown', {
|
|
\ 'name': 'rumdl',
|
|
\ 'lsp': 'stdio',
|
|
\ 'executable': {b -> ale#Var(b, 'markdown_rumdl_executable')},
|
|
\ 'command': {b -> ale#Escape(ale#Var(b, 'markdown_rumdl_executable'))
|
|
\ . ' server --stdio'
|
|
\ . ale#Pad(ale#Var(b, 'markdown_rumdl_options'))},
|
|
\ 'project_root': function('ale_linters#markdown#rumdl#GetProjectRoot'),
|
|
\ 'language': 'markdown',
|
|
\})
|