mirror of
https://github.com/dense-analysis/ale.git
synced 2026-08-12 10:52:32 +08:00
feat(markdown): add marksman lsp (#4565)
* feat(markdown): add marksman lsp * docs: add marksman docs * test(markdown): add marksman test Co-authored-by: Peter Benjamin <peter.benjamin@peter.benjamin-FVFHP2WSQ05Q>
This commit is contained in:
co-authored by
Peter Benjamin
parent
1174b3b81e
commit
18cd44c57d
@@ -0,0 +1,35 @@
|
|||||||
|
" Author: Peter Benjamin <petermbenjamin@gmail.com>
|
||||||
|
" Description: Write Markdown with code assist and intelligence in the comfort of your favourite editor.
|
||||||
|
|
||||||
|
call ale#Set('markdown_marksman_executable', 'marksman')
|
||||||
|
|
||||||
|
function! ale_linters#markdown#marksman#GetCommand(buffer) abort
|
||||||
|
return '%e server'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#markdown#marksman#GetProjectRoot(buffer) abort
|
||||||
|
" Find nearest .marksman.toml
|
||||||
|
let l:marksman_toml = ale#path#FindNearestFile(a:buffer, '.marksman.toml')
|
||||||
|
|
||||||
|
if !empty(l:marksman_toml)
|
||||||
|
return fnamemodify(l:marksman_toml, ':h')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Find nearest .git/ directory
|
||||||
|
let l:project_root = finddir('.git/..', expand('#' . a:buffer . '...').';')
|
||||||
|
|
||||||
|
if !empty(l:project_root)
|
||||||
|
return l:project_root
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('markdown', {
|
||||||
|
\ 'name': 'marksman',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'markdown_marksman_executable')},
|
||||||
|
\ 'command': function('ale_linters#markdown#marksman#GetCommand'),
|
||||||
|
\ 'project_root': function('ale_linters#markdown#marksman#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': {},
|
||||||
|
\})
|
||||||
@@ -34,6 +34,17 @@ g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
|
|||||||
This variable can be set to pass additional options to markdownlint.
|
This variable can be set to pass additional options to markdownlint.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
marksman *ale-markdown-marksman*
|
||||||
|
|
||||||
|
g:ale_markdown_marksman_executable *g:ale_markdown_marksman_executable*
|
||||||
|
*b:ale_markdown_marksman_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'marksman'`
|
||||||
|
|
||||||
|
Override the invoked `marksman` binary.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
mdl *ale-markdown-mdl*
|
mdl *ale-markdown-mdl*
|
||||||
|
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ Notes:
|
|||||||
* `cspell`
|
* `cspell`
|
||||||
* `languagetool`!!
|
* `languagetool`!!
|
||||||
* `markdownlint`!!
|
* `markdownlint`!!
|
||||||
|
* `marksman`
|
||||||
* `mdl`
|
* `mdl`
|
||||||
* `pandoc`
|
* `pandoc`
|
||||||
* `prettier`
|
* `prettier`
|
||||||
|
|||||||
@@ -3123,6 +3123,7 @@ documented in additional help files.
|
|||||||
cspell................................|ale-markdown-cspell|
|
cspell................................|ale-markdown-cspell|
|
||||||
dprint................................|ale-markdown-dprint|
|
dprint................................|ale-markdown-dprint|
|
||||||
markdownlint..........................|ale-markdown-markdownlint|
|
markdownlint..........................|ale-markdown-markdownlint|
|
||||||
|
marksman..............................|ale-markdown-marksman|
|
||||||
mdl...................................|ale-markdown-mdl|
|
mdl...................................|ale-markdown-mdl|
|
||||||
pandoc................................|ale-markdown-pandoc|
|
pandoc................................|ale-markdown-pandoc|
|
||||||
prettier..............................|ale-markdown-prettier|
|
prettier..............................|ale-markdown-prettier|
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ formatting.
|
|||||||
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
|
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
|
||||||
* [languagetool](https://languagetool.org/) :floppy_disk:
|
* [languagetool](https://languagetool.org/) :floppy_disk:
|
||||||
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
|
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
|
||||||
|
* [marksman](https://github.com/artempyanykh/marksman)
|
||||||
* [mdl](https://github.com/mivok/markdownlint)
|
* [mdl](https://github.com/mivok/markdownlint)
|
||||||
* [pandoc](https://pandoc.org)
|
* [pandoc](https://pandoc.org)
|
||||||
* [prettier](https://github.com/prettier/prettier)
|
* [prettier](https://github.com/prettier/prettier)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('markdown', 'marksman')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'marksman', ale#Escape('marksman') . ' server'
|
||||||
Reference in New Issue
Block a user