diff options
author | Macuyler Dunn <dev@macuyler.com> | 2024-05-08 21:58:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 10:58:16 +0900 |
commit | c88bddfa83dbb96c2f57426794ed98a0e181ea7e (patch) | |
tree | dda6b9d509cde8fb4287c3774cef5cee5fffd0cc /ale_linters/dart/analysis_server.vim | |
parent | 70eeae54fbd5c2e254604d543674f02d42c0ccdd (diff) | |
download | ale-c88bddfa83dbb96c2f57426794ed98a0e181ea7e.zip |
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.
https://github.com/dart-lang/sdk/commit/c224cc2e0d4cd8fc536c21ee963a0254d18a27bb
* 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.
Diffstat (limited to 'ale_linters/dart/analysis_server.vim')
-rw-r--r-- | ale_linters/dart/analysis_server.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ale_linters/dart/analysis_server.vim b/ale_linters/dart/analysis_server.vim index a6870da9..12a5d590 100644 --- a/ale_linters/dart/analysis_server.vim +++ b/ale_linters/dart/analysis_server.vim @@ -1,6 +1,7 @@ " Author: Nelson Yeung <nelsyeung@gmail.com> " 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', { |