|
7 | 7 | call ale#Set('javascript_quick_lint_js_executable', 'quick-lint-js')
|
8 | 8 | call ale#Set('javascript_quick_lint_js_use_global', get(g:, 'ale_use_global_executables', 0))
|
9 | 9 |
|
| 10 | +" TODO(strager): Make quick-lint-js-lsp the default when the bugs have been |
| 11 | +" ironed out: |
| 12 | +" https://github.com/quick-lint/quick-lint-js/issues/111 |
| 13 | +" https://github.com/quick-lint/quick-lint-js/issues/171 |
| 14 | +let s:enable_lsp_linter = v:false |
| 15 | + |
10 | 16 | if ale#Has('ale-2.4.0')
|
11 | 17 | let s:linter_command_callback_key = 'command'
|
12 | 18 | let s:linter_executable_callback_key = 'executable'
|
| 19 | + let s:linter_project_root_callback_key = 'project_root' |
13 | 20 | else
|
14 | 21 | " The _callback variants are not supported since ALE v3.0.0. For details, see
|
15 | 22 | " "Implement a uniform API for asynchronous processing for most ALE features":
|
16 | 23 | " https://github.com/dense-analysis/ale/issues/2132
|
17 | 24 | let s:linter_command_callback_key = 'command_callback'
|
18 | 25 | let s:linter_executable_callback_key = 'executable_callback'
|
| 26 | + let s:linter_project_root_callback_key = 'project_root_callback' |
19 | 27 | endif
|
20 | 28 |
|
21 |
| -call ale#linter#Define('javascript', { |
22 |
| - \ 'aliases': ['quick_lint_js', 'quicklintjs'], |
23 |
| - \ 'callback': function('quick_lint_js_ale#parse_command_output'), |
24 |
| - \ 'name': 'quick-lint-js', |
25 |
| - \ 'output_stream': 'stdout', |
26 |
| - \ 'read_buffer': 0, |
27 |
| - \ s:linter_command_callback_key: function('quick_lint_js_ale#get_command'), |
28 |
| - \ s:linter_executable_callback_key: function('quick_lint_js_ale#get_executable'), |
29 |
| -\ }) |
| 29 | +if s:enable_lsp_linter |
| 30 | + call ale#linter#Define('javascript', { |
| 31 | + \ 'aliases': ['quick-lint-js-lsp', 'quick_lint_js', 'quicklintjs'], |
| 32 | + \ 'lsp': 'stdio', |
| 33 | + \ 'name': 'quick-lint-js', |
| 34 | + \ s:linter_command_callback_key: function('quick_lint_js_ale#get_lsp_command'), |
| 35 | + \ s:linter_executable_callback_key: function('quick_lint_js_ale#get_executable'), |
| 36 | + \ s:linter_project_root_callback_key: function('quick_lint_js_ale#get_lsp_project_root'), |
| 37 | + \ }) |
| 38 | +else |
| 39 | + call ale#linter#Define('javascript', { |
| 40 | + \ 'aliases': ['quick-lint-js-cli', 'quick_lint_js', 'quicklintjs'], |
| 41 | + \ 'callback': function('quick_lint_js_ale#parse_command_output'), |
| 42 | + \ 'name': 'quick-lint-js', |
| 43 | + \ 'output_stream': 'stdout', |
| 44 | + \ 'read_buffer': 0, |
| 45 | + \ s:linter_command_callback_key: function('quick_lint_js_ale#get_command'), |
| 46 | + \ s:linter_executable_callback_key: function('quick_lint_js_ale#get_executable'), |
| 47 | + \ }) |
| 48 | +endif |
30 | 49 |
|
31 | 50 | " quick-lint-js finds bugs in JavaScript programs.
|
32 | 51 | " Copyright (C) 2020 Matthew Glazar
|
|
0 commit comments