summaryrefslogtreecommitdiff
path: root/ale_linters/glsl/glslls.vim
blob: b62844c70f882eefa77759551e6823aa3944b02f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
" Description: A language server for glsl

call ale#Set('glsl_glslls_executable', 'glslls')
call ale#Set('glsl_glslls_logfile', '')

function! ale_linters#glsl#glslls#GetCommand(buffer) abort
    let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile')
    let l:logfile_args = ''

    if l:logfile isnot# ''
        let l:logfile_args = ' --verbose -l ' . l:logfile
    endif

    return '%e' . l:logfile_args . ' --stdin'
endfunction

function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
    let l:project_root = ale#c#FindProjectRoot(a:buffer)

    return !empty(l:project_root) ? fnamemodify(l:project_root, ':h:h') : ''
endfunction

call ale#linter#Define('glsl', {
\   'name': 'glslls',
\   'lsp': 'stdio',
\   'executable': {b -> ale#Var(b, 'glsl_glslls_executable')},
\   'command': function('ale_linters#glsl#glslls#GetCommand'),
\   'project_root': function('ale_linters#glsl#glslls#GetProjectRoot'),
\})