All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Andreww Hayworth <ahayworth@gmail.com>
2 " Description: Integrate ALE with ink-language-server
4 call ale#Set('ink_ls_executable', 'ink-language-server')
5 call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('ink_ls_initialization_options', {})
8 function! ale_linters#ink#ls#GetExecutable(buffer) abort
9 return ale#path#FindExecutable(a:buffer, 'ink_ls', [
10 \ 'ink-language-server',
11 \ 'node_modules/.bin/ink-language-server',
15 function! ale_linters#ink#ls#GetCommand(buffer) abort
16 let l:executable = ale_linters#ink#ls#GetExecutable(a:buffer)
18 return ale#Escape(l:executable) . ' --stdio'
21 function! ale_linters#ink#ls#FindProjectRoot(buffer) abort
22 let l:main_file = get(ale#Var(a:buffer, 'ink_ls_initialization_options'), 'mainStoryPath', 'main.ink')
23 let l:config = ale#path#ResolveLocalPath(a:buffer, l:main_file, expand('#' . a:buffer . ':p'))
25 return ale#path#Dirname(l:config)
28 call ale#linter#Define('ink', {
29 \ 'name': 'ink-language-server',
31 \ 'executable': function('ale_linters#ink#ls#GetExecutable'),
32 \ 'command': function('ale_linters#ink#ls#GetCommand'),
33 \ 'project_root': function('ale_linters#ink#ls#FindProjectRoot'),
34 \ 'initialization_options': {b -> ale#Var(b, 'ink_ls_initialization_options')},