summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorPeter Benjamin <petermbenjamin@gmail.com>2023-08-01 13:23:02 -0700
committerGitHub <noreply@github.com>2023-08-01 21:23:02 +0100
commit18cd44c57dc3fcebbb83a50e86dd0e8c751be2f2 (patch)
treec3e6f0d149e696384d7bfc7fa112cfdb33962527 /ale_linters
parent1174b3b81ef6d376401e46b490448d619fac9335 (diff)
downloadale-18cd44c57dc3fcebbb83a50e86dd0e8c751be2f2.zip
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>
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/markdown/marksman.vim35
1 files changed, 35 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': {},
+\})