]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/elm/ls.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / elm / ls.vim
1 " Author: antew - https://github.com/antew
2 " Description: elm-language-server integration for elm (diagnostics, formatting, and more)
3
4 call ale#Set('elm_ls_executable', 'elm-language-server')
5 call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
6
7 " elm-language-server will search for local and global binaries, if empty
8 call ale#Set('elm_ls_elm_path', '')
9 call ale#Set('elm_ls_elm_format_path', '')
10 call ale#Set('elm_ls_elm_test_path', '')
11 call ale#Set('elm_ls_elm_analyse_trigger', 'change')
12
13 function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
14     let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
15
16     return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
17 endfunction
18
19 function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort
20     return {
21     \   'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
22     \   'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
23     \   'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
24     \   'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
25     \}
26 endfunction
27
28 call ale#linter#Define('elm', {
29 \   'name': 'ls',
30 \   'aliases': ['elm_ls'],
31 \   'lsp': 'stdio',
32 \   'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
33 \       'node_modules/.bin/elm-language-server',
34 \       'node_modules/.bin/elm-lsp',
35 \       'elm-lsp'
36 \   ])},
37 \   'command': '%e --stdio',
38 \   'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
39 \   'language': 'elm',
40 \   'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions')
41 \})