summaryrefslogtreecommitdiff
path: root/ale_linters/glsl
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2017-12-01 18:36:44 +0100
committerw0rp <w0rp@users.noreply.github.com>2017-12-01 17:36:44 +0000
commit51b127a4fd8e581ab0592874db584facb70e9f79 (patch)
treece44fd01ca3448d911a52c31164b20f93bf28158 /ale_linters/glsl
parent6053f764bd6f7707af0be0f0520a691571de5705 (diff)
downloadale-51b127a4fd8e581ab0592874db584facb70e9f79.zip
Add glslls (#1179)
* Add glslls-based LSP linter * Make logfile configureable
Diffstat (limited to 'ale_linters/glsl')
-rw-r--r--ale_linters/glsl/glslls.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/ale_linters/glsl/glslls.vim b/ale_linters/glsl/glslls.vim
new file mode 100644
index 00000000..67ea379c
--- /dev/null
+++ b/ale_linters/glsl/glslls.vim
@@ -0,0 +1,38 @@
+" 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#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'glsl_glslls_executable')
+endfunction
+
+function! ale_linters#glsl#glslls#GetCommand(buffer) abort
+ let l:executable = ale_linters#glsl#glslls#GetExecutable(a:buffer)
+ 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 ale#Escape(l:executable) . l:logfile_args . ' --stdin'
+endfunction
+
+function! ale_linters#glsl#glslls#GetLanguage(buffer) abort
+ return 'glsl'
+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_callback': 'ale_linters#glsl#glslls#GetExecutable',
+\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
+\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage',
+\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
+\})