summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/gleam/gleamlsp.vim18
-rw-r--r--doc/ale-gleam.txt23
-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_gleam_gleamlsp.vader15
-rw-r--r--test/test-files/gleam/gleam.toml0
7 files changed, 62 insertions, 0 deletions
diff --git a/ale_linters/gleam/gleamlsp.vim b/ale_linters/gleam/gleamlsp.vim
new file mode 100644
index 00000000..f32d1434
--- /dev/null
+++ b/ale_linters/gleam/gleamlsp.vim
@@ -0,0 +1,18 @@
+" Author: Jonathan Palardt https://github.com/jpalardy
+" Description: Support for Gleam Language Server
+
+call ale#Set('gleam_gleamlsp_executable', 'gleam')
+
+function! ale_linters#gleam#gleamlsp#GetProjectRoot(buffer) abort
+ let l:gleam_toml = ale#path#FindNearestFile(a:buffer, 'gleam.toml')
+
+ return !empty(l:gleam_toml) ? fnamemodify(l:gleam_toml, ':p:h') : ''
+endfunction
+
+call ale#linter#Define('gleam', {
+\ 'name': 'gleamlsp',
+\ 'lsp': 'stdio',
+\ 'executable': {buffer -> ale#Var(buffer, 'gleam_gleamlsp_executable')},
+\ 'command': '%e lsp',
+\ 'project_root': function('ale_linters#gleam#gleamlsp#GetProjectRoot'),
+\})
diff --git a/doc/ale-gleam.txt b/doc/ale-gleam.txt
new file mode 100644
index 00000000..3ca199b6
--- /dev/null
+++ b/doc/ale-gleam.txt
@@ -0,0 +1,23 @@
+===============================================================================
+ALE Gleam Integration *ale-gleam-options*
+ *ale-integration-gleam*
+
+===============================================================================
+Integration Information
+
+ Currently, the only supported linter for gleam is gleamlsp.
+
+
+===============================================================================
+gleamlsp *ale-gleam-gleamlsp*
+
+g:ale_gleam_gleamlsp_executable *g:ale_gleam_gleamlsp_executable*
+ *b:ale_gleam_gleamlsp_executable*
+ Type: |String|
+ Default: `'gleam'`
+
+ This variable can be modified to change the executable path for `gleamlsp`.
+
+
+===============================================================================
+ 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 aa49a1b1..3b16cf2c 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -202,6 +202,8 @@ Notes:
* `fusion-lint`
* Git Commit Messages
* `gitlint`
+* Gleam
+ * `gleamlsp`
* GLSL
* `glslang`
* `glslls`
diff --git a/doc/ale.txt b/doc/ale.txt
index 5f7999b8..aedc2bc2 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -3031,6 +3031,8 @@ documented in additional help files.
fusion-lint...........................|ale-fuse-fusionlint|
git commit..............................|ale-gitcommit-options|
gitlint...............................|ale-gitcommit-gitlint|
+ gleam...................................|ale-gleam-options|
+ gleamlsp..............................|ale-gleam-gleamlsp|
glsl....................................|ale-glsl-options|
glslang...............................|ale-glsl-glslang|
glslls................................|ale-glsl-glslls|
diff --git a/supported-tools.md b/supported-tools.md
index 6431cfe6..3fd729d6 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -211,6 +211,8 @@ formatting.
* [fusion-lint](https://github.com/RyanSquared/fusionscript)
* Git Commit Messages
* [gitlint](https://github.com/jorisroovers/gitlint)
+* Gleam
+ * [gleamlsp](https://github.com/gleam-lang/gleam)
* GLSL
* [glslang](https://github.com/KhronosGroup/glslang)
* [glslls](https://github.com/svenstaro/glsl-language-server)
diff --git a/test/linter/test_gleam_gleamlsp.vader b/test/linter/test_gleam_gleamlsp.vader
new file mode 100644
index 00000000..a054db6b
--- /dev/null
+++ b/test/linter/test_gleam_gleamlsp.vader
@@ -0,0 +1,15 @@
+Before:
+ call ale#assert#SetUpLinterTest('gleam', 'gleamlsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default executable path should be correct):
+ AssertLinter 'gleam', ale#Escape('gleam') . ' lsp'
+
+Execute(The project root should be detected correctly):
+ AssertLSPProject ''
+
+ call ale#test#SetFilename('../test-files/gleam/gleam.toml')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/gleam')
diff --git a/test/test-files/gleam/gleam.toml b/test/test-files/gleam/gleam.toml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/gleam/gleam.toml