summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Block <benjamindblock@gmail.com>2024-02-22 02:12:57 +0000
committerGitHub <noreply@github.com>2024-02-22 11:12:57 +0900
commit8b8ddea6e59eabba86f21f1eff09336d98cf928d (patch)
treef5170daed5ffbce04610b575e14f491702f17b29
parent38c31302da0414c74cabfc6fbefc5d1bf5183fc1 (diff)
downloadale-8b8ddea6e59eabba86f21f1eff09336d98cf928d.zip
Adding support for Odin language server (ols). (#4679)
-rw-r--r--ale_linters/odin/ols.vim19
-rw-r--r--doc/ale-odin.txt29
-rw-r--r--doc/ale-supported-languages-and-tools.txt2
-rw-r--r--doc/ale.txt2
-rw-r--r--supported-tools.md2
-rw-r--r--test/linter/test_odin_ols.vader16
-rw-r--r--test/test-files/odin/main.odin0
7 files changed, 70 insertions, 0 deletions
diff --git a/ale_linters/odin/ols.vim b/ale_linters/odin/ols.vim
new file mode 100644
index 00000000..242dea0e
--- /dev/null
+++ b/ale_linters/odin/ols.vim
@@ -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'),
+\})
diff --git a/doc/ale-odin.txt b/doc/ale-odin.txt
new file mode 100644
index 00000000..826411de
--- /dev/null
+++ b/doc/ale-odin.txt
@@ -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:
diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt
index 4b583d56..df84aa37 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -422,6 +422,8 @@ Notes:
* `ocamllsp`
* `ocp-indent`
* `ols`
+* Odin
+ * `ols`
* OpenApi
* `ibm_validator`
* `prettier`
diff --git a/doc/ale.txt b/doc/ale.txt
index 5254b9d6..682ce1e6 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -3224,6 +3224,8 @@ documented in additional help files.
ols...................................|ale-ocaml-ols|
ocamlformat...........................|ale-ocaml-ocamlformat|
ocp-indent............................|ale-ocaml-ocp-indent|
+ odin....................................|ale-odin-options|
+ ols...................................|ale-odin-ols|
openapi.................................|ale-openapi-options|
ibm_validator.........................|ale-openapi-ibm-validator|
prettier..............................|ale-openapi-prettier|
diff --git a/supported-tools.md b/supported-tools.md
index aa6f65dd..360fb86f 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -431,6 +431,8 @@ formatting.
* [ocamllsp](https://github.com/ocaml/ocaml-lsp)
* [ocp-indent](https://github.com/OCamlPro/ocp-indent)
* [ols](https://github.com/freebroccolo/ocaml-language-server)
+* Odin
+ * [ols](https://github.com/DanielGavin/ols)
* OpenApi
* [ibm_validator](https://github.com/IBM/openapi-validator)
* [prettier](https://github.com/prettier/prettier)
diff --git a/test/linter/test_odin_ols.vader b/test/linter/test_odin_ols.vader
new file mode 100644
index 00000000..ac7d2797
--- /dev/null
+++ b/test/linter/test_odin_ols.vader
@@ -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 '.'
diff --git a/test/test-files/odin/main.odin b/test/test-files/odin/main.odin
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/odin/main.odin