summaryrefslogtreecommitdiff
path: root/ale_linters/gleam/gleamlsp.vim
blob: f32d1434551ae9bc3c1d948417346b1e016dfa43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'),
\})