-
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.
Update dart analysis_server command (#4761)
* Update dart analysis_server command In 2021 the dart team added a new sub-command `language-server` to replace the original `./snapshots/analysis_server.dart.snapshot --lsp` convention for starting the language server. dart-lang/sdk@c224cc2 * Add ale_dart_analysis_server_enable_language_server option This allows users to opt-in to the new `dart language-server` command. * Enable ale_dart_analysis_server_enable_language_server option by default * Update doc/ale-dart.txt Include the dart version number where the `dart language-server` command was added.
- Loading branch information
Showing
3 changed files
with
30 additions
and
3 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
" Author: Nelson Yeung <[email protected]> | ||
" Description: Check Dart files with dart analysis server LSP | ||
|
||
call ale#Set('dart_analysis_server_enable_language_server', 1) | ||
call ale#Set('dart_analysis_server_executable', 'dart') | ||
|
||
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort | ||
|
@@ -12,12 +13,19 @@ function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort | |
endfunction | ||
|
||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort | ||
let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server') | ||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable') | ||
let l:dart = resolve(exepath(l:executable)) | ||
|
||
return '%e ' | ||
let l:output = '%e ' | ||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot' | ||
\ . ' --lsp' | ||
|
||
" Enable new language-server command | ||
if l:language_server == 1 | ||
let l:output = '%e language-server --protocol=lsp' | ||
endif | ||
|
||
return l:output | ||
endfunction | ||
|
||
call ale#linter#Define('dart', { | ||
|
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