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: Nelson Yeung <nelsyeung@gmail.com>
2 " Description: Check Dart files with dart analysis server LSP
4 call ale#Set('dart_analysis_server_enable_language_server', 1)
5 call ale#Set('dart_analysis_server_executable', 'dart')
7 function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
8 " Note: pub only looks for pubspec.yaml, there's no point in adding
9 " support for pubspec.yml
10 let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
12 return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.'
15 function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
16 let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server')
17 let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
18 let l:dart = resolve(exepath(l:executable))
20 \ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
23 " Enable new language-server command
24 if l:language_server == 1
25 let l:output = '%e language-server --protocol=lsp'
31 call ale#linter#Define('dart', {
32 \ 'name': 'analysis_server',
34 \ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')},
35 \ 'command': function('ale_linters#dart#analysis_server#GetCommand'),
36 \ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'),