Adding support for Odin language server (ols). (#4679)

This commit is contained in:
Benjamin Block 2024-02-22 02:12:57 +00:00 committed by GitHub
parent 38c31302da
commit 8b8ddea6e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 70 additions and 0 deletions

19
ale_linters/odin/ols.vim Normal file
View File

@ -0,0 +1,19 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Odin.
function! ale_linters#odin#ols#GetProjectRoot(buffer) abort
return fnamemodify('', ':h')
endfunction
call ale#Set('odin_ols_executable', 'ols')
call ale#Set('odin_ols_config', {})
call ale#linter#Define('odin', {
\ 'name': 'ols',
\ 'lsp': 'stdio',
\ 'language': 'odin',
\ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')},
\ 'executable': {b -> ale#Var(b, 'odin_ols_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'),
\})

29
doc/ale-odin.txt Normal file
View File

@ -0,0 +1,29 @@
===============================================================================
ALE Odin Integration *ale-odin-options*
*ale-integration-odin*
===============================================================================
Integration Information
Currently, the only supported linter for Odin is ols.
===============================================================================
ols *ale-odin-ols*
g:ale_odin_ols_executable *g:ale_odin_ols_executable*
*b:ale_odin_ols_executable*
Type: |String|
Default: `'ols'`
This variable can be modified to change the executable path for `ols`.
g:ale_odin_ols_config *g:ale_odin_ols_config*
*b:ale_odin_ols_config*
Type: |Dictionary|
Default: `{}`
Dictionary with configuration settings for ols.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -422,6 +422,8 @@ Notes:
* `ocamllsp` * `ocamllsp`
* `ocp-indent` * `ocp-indent`
* `ols` * `ols`
* Odin
* `ols`
* OpenApi * OpenApi
* `ibm_validator` * `ibm_validator`
* `prettier` * `prettier`

View File

@ -3224,6 +3224,8 @@ documented in additional help files.
ols...................................|ale-ocaml-ols| ols...................................|ale-ocaml-ols|
ocamlformat...........................|ale-ocaml-ocamlformat| ocamlformat...........................|ale-ocaml-ocamlformat|
ocp-indent............................|ale-ocaml-ocp-indent| ocp-indent............................|ale-ocaml-ocp-indent|
odin....................................|ale-odin-options|
ols...................................|ale-odin-ols|
openapi.................................|ale-openapi-options| openapi.................................|ale-openapi-options|
ibm_validator.........................|ale-openapi-ibm-validator| ibm_validator.........................|ale-openapi-ibm-validator|
prettier..............................|ale-openapi-prettier| prettier..............................|ale-openapi-prettier|

View File

@ -431,6 +431,8 @@ formatting.
* [ocamllsp](https://github.com/ocaml/ocaml-lsp) * [ocamllsp](https://github.com/ocaml/ocaml-lsp)
* [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ocp-indent](https://github.com/OCamlPro/ocp-indent)
* [ols](https://github.com/freebroccolo/ocaml-language-server) * [ols](https://github.com/freebroccolo/ocaml-language-server)
* Odin
* [ols](https://github.com/DanielGavin/ols)
* OpenApi * OpenApi
* [ibm_validator](https://github.com/IBM/openapi-validator) * [ibm_validator](https://github.com/IBM/openapi-validator)
* [prettier](https://github.com/prettier/prettier) * [prettier](https://github.com/prettier/prettier)

View File

@ -0,0 +1,16 @@
Before:
call ale#assert#SetUpLinterTest('odin', 'ols')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'ols', ale#Escape('ols')
Execute(The LSP values should be set correctly):
call ale#test#SetFilename('../test-files/odin/main.odin')
AssertLSPLanguage 'odin'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject '.'

View File