Add promQL support

This commit is contained in:
sfigato 2021-07-19 21:02:39 +02:00
parent 777215e213
commit 0040059b60
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
3 changed files with 21 additions and 0 deletions

View File

@ -23,6 +23,7 @@ let g:ale_linters = {
\ 'scss': ['eslint'], \ 'scss': ['eslint'],
\ 'elm': ['elm_ls'], \ 'elm': ['elm_ls'],
\ 'sql': ['sql-lint'], \ 'sql': ['sql-lint'],
\ 'promql': ['promql-langserver'],
\} \}
let g:ale_fixers = { let g:ale_fixers = {
@ -58,6 +59,11 @@ function! s:getValaProjectRoot(buffer) abort
return '' return ''
endfunction endfunction
function! s:curPath(buffer) abort
let l:cur_path = fnamemodify(a:buffer, ':p:h')
return l:cur_path
endfunction
packloadall packloadall
call ale#linter#Define('vala', { call ale#linter#Define('vala', {
@ -70,6 +76,16 @@ call ale#linter#Define('vala', {
\ 'callback': 'ale#handlers#unix#HandleAsWarning', \ 'callback': 'ale#handlers#unix#HandleAsWarning',
\}) \})
call ale#linter#Define('promql', {
\ 'name': 'promql-langserver',
\ 'lsp': 'stdio',
\ 'output_stream': 'both',
\ 'executable': '/usr/local/bin/promql-langserver',
\ 'command': '%e',
\ 'project_root': function('s:curPath'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
let g:ale_rust_rls_config = { let g:ale_rust_rls_config = {
\ 'rust': { \ 'rust': {
\ 'clippy_preference': 'on' \ 'clippy_preference': 'on'

View File

@ -15,6 +15,7 @@ let g:LanguageClient_serverCommands = {
\ 'elm': ['/usr/bin/elm-language-server'], \ 'elm': ['/usr/bin/elm-language-server'],
\ 'python': ['/usr/bin/pyls'], \ 'python': ['/usr/bin/pyls'],
\ 'go': ['/usr/bin/gopls'], \ 'go': ['/usr/bin/gopls'],
\ 'promql': ['/usr/local/bin/promql-langserver']
\ } \ }
let g:LanguageClient_rootMarkers = { let g:LanguageClient_rootMarkers = {

4
ftdetect/promql.vim Normal file
View File

@ -0,0 +1,4 @@
augroup promql
au!
autocmd BufReadCmd,BufRead *.promql,*.pql set ft=promql syntax=yaml et ts=2 sts=0 sw=0
augroup END