Merge pull request #2825 from thindil/master

Added support for Ada Language Server
This commit is contained in:
Horacio Sanson 2021-01-23 09:41:02 +09:00 committed by GitHub
commit 5200e6c734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 0 deletions

26
ale_linters/ada/adals.vim Normal file
View file

@ -0,0 +1,26 @@
" Author: Bartek Jasicki http://github.com/thindil
" Description: Support for Ada Language Server
call ale#Set('ada_adals_executable', 'ada_language_server')
call ale#Set('ada_adals_project', 'default.gpr')
call ale#Set('ada_adals_encoding', 'utf-8')
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
return {
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
\}
endfunction
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction
call ale#linter#Define('ada', {
\ 'name': 'adals',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
\})

View file

@ -32,5 +32,35 @@ g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options*
This variable can be set to pass extra options to the gnatpp fixer.
===============================================================================
ada-language-server *ale-ada-language-server*
g:ale_ada_adals_executable *g:ale_ada_adals_executable*
*b:ale_ada_adals_executable*
Type: |String|
Default: `'ada_language_server'`
This variable can be changed to use a different executable for Ada Language
Server.
g:ale_ada_adals_project *g:ale_ada_adals_project*
*b:ale_ada_adals_project*
Type: |String|
Default: `'default.gpr'`
This variable can be changed to use a different GPR file for
Ada Language Server.
g:ale_ada_adals_encoding *g:ale_ada_adals_encoding*
*b:ale_ada_adals_encoding*
Type: |String|
Default: `'utf-8'`
This variable can be changed to use a different file encoding for
Ada Language Server.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -13,6 +13,7 @@ Notes:
`!!` These linters check only files on disk. See |ale-lint-file-linters|
* Ada
* `ada_language_server`
* `gcc`
* `gnatpp`
* Ansible

View file

@ -2596,6 +2596,7 @@ documented in additional help files.
ada.....................................|ale-ada-options|
gcc...................................|ale-ada-gcc|
gnatpp................................|ale-ada-gnatpp|
ada-language-server...................|ale-ada-language-server|
ansible.................................|ale-ansible-options|
ansible-lint..........................|ale-ansible-ansible-lint|
asciidoc................................|ale-asciidoc-options|

View file

@ -22,6 +22,7 @@ formatting.
---
* Ada
* [ada_language_server](https://github.com/AdaCore/ada_language_server)
* [gcc](https://gcc.gnu.org)
* [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk:
* Ansible

View file

@ -0,0 +1,17 @@
Before:
call ale#assert#SetUpLinterTest('ada', 'adals')
After:
call ale#assert#TearDownLinterTest()
Execute(Sets adals executable):
let g:ale_ada_adals_executable = '/path/to /Ada'
AssertLinter '/path/to /Ada', ale#Escape('/path/to /Ada')
Execute(Sets adals encoding):
let b:ale_ada_adals_encoding = 'iso-8859-1'
AssertLSPConfig {'ada.defaultCharset': 'iso-8859-1', 'ada.projectFile': 'default.gpr'}
Execute(Sets adals project):
let g:ale_ada_adals_project = 'myproject.gpr'
AssertLSPConfig {'ada.defaultCharset': 'utf-8', 'ada.projectFile': 'myproject.gpr'}