summaryrefslogtreecommitdiff
path: root/ale_linters/gleam/gleamlsp.vim
diff options
context:
space:
mode:
authorJonathan Palardy <jonathan.palardy@gmail.com>2024-01-14 03:43:59 -0800
committerGitHub <noreply@github.com>2024-01-14 20:43:59 +0900
commitebc6718c0a31c609a1b6500bfdca2aae16ce4721 (patch)
tree77901f463badc3ce85f9e468df2dcf6633f48315 /ale_linters/gleam/gleamlsp.vim
parent32e6fc5975aacd83ae15958b52311b08a094883a (diff)
downloadale-ebc6718c0a31c609a1b6500bfdca2aae16ce4721.zip
Support gleamlsp language server for gleam (#4696)
Diffstat (limited to 'ale_linters/gleam/gleamlsp.vim')
-rw-r--r--ale_linters/gleam/gleamlsp.vim18
1 files changed, 18 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'),
+\})