2018-03-31 10:55:20 -04:00
|
|
|
" 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 = ''
|
2018-08-25 12:13:42 -04:00
|
|
|
|
2018-03-31 10:55:20 -04:00
|
|
|
if l:logfile isnot# ''
|
|
|
|
let l:logfile_args = ' --verbose -l ' . l:logfile
|
|
|
|
endif
|
2018-08-25 12:13:42 -04:00
|
|
|
|
|
|
|
return '%e' . l:logfile_args . ' --stdin'
|
2018-03-31 10:55:20 -04:00
|
|
|
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',
|
2018-08-25 12:13:42 -04:00
|
|
|
\ 'executable_callback': ale#VarFunc('glsl_glslls_executable'),
|
2018-03-31 10:55:20 -04:00
|
|
|
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
|
|
|
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
|
|
|
\})
|