-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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': {}, | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |