summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/markdown/marksman.vim35
-rw-r--r--doc/ale-markdown.txt11
-rw-r--r--doc/ale-supported-languages-and-tools.txt1
-rw-r--r--doc/ale.txt1
-rw-r--r--supported-tools.md1
-rw-r--r--test/linter/test_markdown_marksman.vader8
6 files changed, 57 insertions, 0 deletions
diff --git a/ale_linters/markdown/marksman.vim b/ale_linters/markdown/marksman.vim
new file mode 100644
index 00000000..b23f0e05
--- /dev/null
+++ b/ale_linters/markdown/marksman.vim
@@ -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': {},
+\})
diff --git a/doc/ale-markdown.txt b/doc/ale-markdown.txt
index 422828f3..693c8a44 100644
--- a/doc/ale-markdown.txt
+++ b/doc/ale-markdown.txt
@@ -35,6 +35,17 @@ g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
===============================================================================
+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*
g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable*
diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt
index 32719729..da57908a 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -364,6 +364,7 @@ Notes:
* `cspell`
* `languagetool`!!
* `markdownlint`!!
+ * `marksman`
* `mdl`
* `pandoc`
* `prettier`
diff --git a/doc/ale.txt b/doc/ale.txt
index 06c8dd16..0898db64 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -3123,6 +3123,7 @@ documented in additional help files.
cspell................................|ale-markdown-cspell|
dprint................................|ale-markdown-dprint|
markdownlint..........................|ale-markdown-markdownlint|
+ marksman..............................|ale-markdown-marksman|
mdl...................................|ale-markdown-mdl|
pandoc................................|ale-markdown-pandoc|
prettier..............................|ale-markdown-prettier|
diff --git a/supported-tools.md b/supported-tools.md
index 2cdb878f..c3c53289 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -373,6 +373,7 @@ formatting.
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [languagetool](https://languagetool.org/) :floppy_disk:
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
+ * [marksman](https://github.com/artempyanykh/marksman)
* [mdl](https://github.com/mivok/markdownlint)
* [pandoc](https://pandoc.org)
* [prettier](https://github.com/prettier/prettier)
diff --git a/test/linter/test_markdown_marksman.vader b/test/linter/test_markdown_marksman.vader
new file mode 100644
index 00000000..42f93683
--- /dev/null
+++ b/test/linter/test_markdown_marksman.vader
@@ -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'