mirror of
https://github.com/amix/vimrc
synced 2025-07-01 12:45:00 +08:00
Updated Vim plugins
This commit is contained in:
5
sources_non_forked/ale/ale_linters/ada/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/ada/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Ada files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('ada')
|
5
sources_non_forked/ale/ale_linters/asciidoc/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/asciidoc/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for ASCIIDoc files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('asciidoc')
|
36
sources_non_forked/ale/ale_linters/avra/avra.vim
Normal file
36
sources_non_forked/ale/ale_linters/avra/avra.vim
Normal file
@ -0,0 +1,36 @@
|
||||
" Author: Utkarsh Verma <utkarshverma@protonmail.com>
|
||||
" Description: AVRA linter for avra syntax.
|
||||
|
||||
call ale#Set('avra_avra_executable', 'avra')
|
||||
call ale#Set('avra_avra_options', '')
|
||||
|
||||
function! ale_linters#avra#avra#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options'))
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#avra#avra#Handle(buffer, lines) abort
|
||||
" Note that we treat 'fatal' as errors.
|
||||
let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('avra', {
|
||||
\ 'name': 'avra',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')},
|
||||
\ 'command': function('ale_linters#avra#avra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#avra#avra#Handle',
|
||||
\})
|
47
sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim
Normal file
47
sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim
Normal file
@ -0,0 +1,47 @@
|
||||
" Author: offa
|
||||
" Description: oelint-adv for BitBake files
|
||||
|
||||
call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
|
||||
call ale#Set('bitbake_oelint_adv_options', '')
|
||||
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||
|
||||
return ((!empty(l:config_file))
|
||||
\ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' '
|
||||
\ : '')
|
||||
\ . '%e --quiet '
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] is# 'error'
|
||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': StripAnsiCodes(l:match[5]),
|
||||
\ 'code': l:match[4]
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! StripAnsiCodes(line) abort
|
||||
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bitbake', {
|
||||
\ 'name': 'oelint_adv',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#bitbake#oelint_adv#Command'),
|
||||
\ 'callback': 'ale_linters#bitbake#oelint_adv#Handle',
|
||||
\ })
|
20
sources_non_forked/ale/ale_linters/c/cpplint.vim
Normal file
20
sources_non_forked/ale/ale_linters/c/cpplint.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" Author: Justin Huang <justin.y.huang@live.com>
|
||||
" Description: cpplint for c files
|
||||
|
||||
call ale#Set('c_cpplint_executable', 'cpplint')
|
||||
call ale#Set('c_cpplint_options', '')
|
||||
|
||||
function! ale_linters#c#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'c_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#c#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/c/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/c/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('c')
|
37
sources_non_forked/ale/ale_linters/cairo/starknet.vim
Normal file
37
sources_non_forked/ale/ale_linters/cairo/starknet.vim
Normal file
@ -0,0 +1,37 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report starknet-compile errors in cairo code
|
||||
|
||||
call ale#Set('cairo_starknet_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_starknet_options', '')
|
||||
|
||||
function! ale_linters#cairo#starknet#Handle(buffer, lines) abort
|
||||
" Error always on the first line
|
||||
" e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths:
|
||||
let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#starknet#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'starknet',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')},
|
||||
\ 'command': function('ale_linters#cairo#starknet#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#starknet#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
43
sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim
Normal file
43
sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim
Normal file
@ -0,0 +1,43 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: cmake-lint for cmake files
|
||||
|
||||
let g:ale_cmake_cmake_lint_executable =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint')
|
||||
|
||||
let g:ale_cmake_cmake_lint_options =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmake_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\d+)\]\s(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': 'W',
|
||||
\ 'code': l:match[3],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmake_lint',
|
||||
\ 'executable': function('ale_linters#cmake#cmake_lint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmake_lint#Command'),
|
||||
\ 'callback': 'ale_linters#cmake#cmake_lint#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/cpp/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/cpp/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C++ files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cpp')
|
5
sources_non_forked/ale/ale_linters/cs/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/cs/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C# files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cs')
|
5
sources_non_forked/ale/ale_linters/css/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/css/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for CSS files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('css')
|
16
sources_non_forked/ale/ale_linters/css/vscodecss.vim
Normal file
16
sources_non_forked/ale/ale_linters/css/vscodecss.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode css language server
|
||||
|
||||
function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'vscodecss',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-css-language-server',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/elixir/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/elixir/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Elixir files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('elixir')
|
5
sources_non_forked/ale/ale_linters/go/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/go/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Go files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('go')
|
5
sources_non_forked/ale/ale_linters/haskell/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/haskell/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Haskell files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('haskell')
|
5
sources_non_forked/ale/ale_linters/help/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/help/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for help files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('help')
|
5
sources_non_forked/ale/ale_linters/html/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/html/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for HTML files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('html')
|
16
sources_non_forked/ale/ale_linters/html/vscodehtml.vim
Normal file
16
sources_non_forked/ale/ale_linters/html/vscodehtml.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode html language server
|
||||
|
||||
function! ale_linters#html#vscodehtml#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'vscodehtml',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-html-language-server',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/java/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/java/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Java files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('java')
|
5
sources_non_forked/ale/ale_linters/javascript/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/javascript/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for JavaScript files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('javascript')
|
5
sources_non_forked/ale/ale_linters/json/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/json/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for JSON files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('json')
|
16
sources_non_forked/ale/ale_linters/json/vscodejson.vim
Normal file
16
sources_non_forked/ale/ale_linters/json/vscodejson.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode json language server
|
||||
|
||||
function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'vscodejson',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-json-language-server',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/lua/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/lua/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Lua files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('lua')
|
46
sources_non_forked/ale/ale_linters/lua/selene.vim
Normal file
46
sources_non_forked/ale/ale_linters/lua/selene.vim
Normal file
@ -0,0 +1,46 @@
|
||||
call ale#Set('lua_selene_executable', 'selene')
|
||||
call ale#Set('lua_selene_options', '')
|
||||
|
||||
function! ale_linters#lua#selene#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options'))
|
||||
\ . ' --display-style=json -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#lua#selene#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
" as of version 0.17.0, selene has no way to suppress summary
|
||||
" information when outputting json, so stop processing when we hit it
|
||||
" (PR for this here: https://github.com/Kampfkarren/selene/pull/356)
|
||||
if l:line is# 'Results:'
|
||||
break
|
||||
endif
|
||||
|
||||
let l:json = json_decode(l:line)
|
||||
let l:lint = {
|
||||
\ 'lnum': l:json.primary_label.span.start_line + 1,
|
||||
\ 'end_lnum': l:json.primary_label.span.end_line + 1,
|
||||
\ 'col': l:json.primary_label.span.start_column + 1,
|
||||
\ 'end_col': l:json.primary_label.span.end_column,
|
||||
\ 'text': l:json.message,
|
||||
\ 'code': l:json.code,
|
||||
\ 'type': l:json.severity is# 'Warning' ? 'W' : 'E',
|
||||
\}
|
||||
|
||||
if has_key(l:json, 'notes') && len(l:json.notes) > 0
|
||||
let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n")
|
||||
endif
|
||||
|
||||
call add(l:output, l:lint)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('lua', {
|
||||
\ 'name': 'selene',
|
||||
\ 'executable': {b -> ale#Var(b, 'lua_selene_executable')},
|
||||
\ 'command': function('ale_linters#lua#selene#GetCommand'),
|
||||
\ 'callback': 'ale_linters#lua#selene#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/markdown/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/markdown/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Markdown files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('markdown')
|
18
sources_non_forked/ale/ale_linters/nix/statix.vim
Normal file
18
sources_non_forked/ale/ale_linters/nix/statix.vim
Normal file
@ -0,0 +1,18 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: statix analysis and suggestions for Nix files
|
||||
|
||||
call ale#Set('nix_statix_check_executable', 'statix')
|
||||
call ale#Set('nix_statix_check_options', '')
|
||||
|
||||
function! ale_linters#nix#statix#GetCommand(buffer) abort
|
||||
return '%e check -o errfmt --stdin'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'nix_statix_check_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nix', {
|
||||
\ 'name': 'statix',
|
||||
\ 'executable': {b -> ale#Var(b, 'nix_statix_check_executable')},
|
||||
\ 'command': function('ale_linters#nix#statix#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#statix#Handle',
|
||||
\})
|
24
sources_non_forked/ale/ale_linters/openscad/sca2d.vim
Normal file
24
sources_non_forked/ale/ale_linters/openscad/sca2d.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Description: SCA2D linter for OpenSCAD files
|
||||
|
||||
call ale#Set('openscad_sca2d_executable', 'sca2d')
|
||||
call ale#Set('openscad_sca2d_options', '')
|
||||
|
||||
function! ale_linters#openscad#sca2d#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'openscad_sca2d_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#openscad#sca2d#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#openscad#sca2d#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'openscad_sca2d_options')
|
||||
|
||||
return ale#Escape(l:executable) . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('openscad', {
|
||||
\ 'name': 'SCA2D',
|
||||
\ 'aliases': ['sca2d'],
|
||||
\ 'executable': function('ale_linters#openscad#sca2d#GetExecutable'),
|
||||
\ 'command': function('ale_linters#openscad#sca2d#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#openscad#SCA2D_callback',
|
||||
\ 'lint_file': 1,
|
||||
\ })
|
5
sources_non_forked/ale/ale_linters/php/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/php/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for PHP files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('php')
|
23
sources_non_forked/ale/ale_linters/php/phpactor.vim
Normal file
23
sources_non_forked/ale/ale_linters/php/phpactor.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Arizard <https://github.com/Arizard>
|
||||
" Description: PHPactor integration for ALE
|
||||
|
||||
" Copied from langserver.vim
|
||||
function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort
|
||||
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
|
||||
|
||||
if (!empty(l:composer_path))
|
||||
return fnamemodify(l:composer_path, ':h')
|
||||
endif
|
||||
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpactor',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'phpactor',
|
||||
\ 'command': '%e language-server',
|
||||
\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/powershell/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/powershell/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for PowerShell files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('powershell')
|
23
sources_non_forked/ale/ale_linters/proto/buf_lint.vim
Normal file
23
sources_non_forked/ale/ale_linters/proto/buf_lint.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Alex McKinney <alexmckinney01@gmail.com>
|
||||
" Description: Run buf lint.
|
||||
|
||||
call ale#Set('proto_buf_lint_executable', 'buf')
|
||||
call ale#Set('proto_buf_lint_config', '')
|
||||
|
||||
function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
|
||||
let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
|
||||
|
||||
return '%e lint'
|
||||
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
|
||||
\ . ' %s#include_package_files=true'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('proto', {
|
||||
\ 'name': 'buf_lint',
|
||||
\ 'aliases': ['buf-lint'],
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'proto_buf_lint_executable')},
|
||||
\ 'command': function('ale_linters#proto#buf_lint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/python/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/python/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Python files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('python')
|
75
sources_non_forked/ale/ale_linters/python/unimport.vim
Normal file
75
sources_non_forked/ale/ale_linters/python/unimport.vim
Normal file
@ -0,0 +1,75 @@
|
||||
" Author: Author: Jon Parise <jon@indelible.org>
|
||||
|
||||
call ale#Set('python_unimport_executable', 'unimport')
|
||||
call ale#Set('python_unimport_options', '')
|
||||
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_unimport_auto_pipenv', 0)
|
||||
call ale#Set('python_unimport_auto_poetry', 0)
|
||||
|
||||
function! ale_linters#python#unimport#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_unimport_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#unimport#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run unimport'
|
||||
\ : ''
|
||||
|
||||
return '%e' . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_unimport_options'))
|
||||
\ . ' --check'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#unimport#GetCwd(buffer) abort
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root)
|
||||
\ ? l:project_root
|
||||
\ : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#unimport#Handle(buffer, lines) abort
|
||||
let l:output = ale#python#HandleTraceback(a:lines, 10)
|
||||
|
||||
if !empty(l:output)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
" Matches lines like:
|
||||
"
|
||||
" urllib.parse at path/to/file.py:9
|
||||
let l:pattern = '\v(.+) at [^:]+:(\d+)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'unused: ' . l:match[1],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'unimport',
|
||||
\ 'executable': function('ale_linters#python#unimport#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#unimport#GetCwd'),
|
||||
\ 'command': function('ale_linters#python#unimport#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#unimport#Handle',
|
||||
\})
|
4
sources_non_forked/ale/ale_linters/rego/cspell.vim
Normal file
4
sources_non_forked/ale/ale_linters/rego/cspell.vim
Normal file
@ -0,0 +1,4 @@
|
||||
scriptencoding utf-8
|
||||
" Description: cspell support for rego files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('rego')
|
56
sources_non_forked/ale/ale_linters/rego/opacheck.vim
Normal file
56
sources_non_forked/ale/ale_linters/rego/opacheck.vim
Normal file
@ -0,0 +1,56 @@
|
||||
" Description: opa check for rego files
|
||||
|
||||
call ale#Set('rego_opacheck_executable', 'opa')
|
||||
call ale#Set('rego_opacheck_options', '')
|
||||
|
||||
function! ale_linters#rego#opacheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'rego_opacheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rego#opacheck#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'rego_opacheck_options')
|
||||
|
||||
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
|
||||
\ . ' check %s --format json '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'errors': []})
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:file = expand('#' . a:buffer . ':p')
|
||||
|
||||
for l:error in l:errors['errors']
|
||||
if has_key(l:error, 'location')
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:error['location']['file']),
|
||||
\ 'lnum': l:error['location']['row'],
|
||||
\ 'col': l:error['location']['col'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'code': l:error['code'],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'filename': l:file,
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:error['message'],
|
||||
\ 'code': l:error['code'],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rego', {
|
||||
\ 'name': 'opacheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale_linters#rego#opacheck#GetExecutable'),
|
||||
\ 'command': function('ale_linters#rego#opacheck#GetCommand'),
|
||||
\ 'callback': 'ale_linters#rego#opacheck#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/rst/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/rst/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for ReStructuredText files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('rst')
|
5
sources_non_forked/ale/ale_linters/ruby/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/ruby/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Ruby files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('ruby')
|
5
sources_non_forked/ale/ale_linters/rust/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/rust/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Rust files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('rust')
|
5
sources_non_forked/ale/ale_linters/scala/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/scala/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Scala files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('scala')
|
5
sources_non_forked/ale/ale_linters/sh/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/sh/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for shell scripts.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('sh')
|
5
sources_non_forked/ale/ale_linters/swift/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/swift/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Swift files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('swift')
|
41
sources_non_forked/ale/ale_linters/terraform/checkov.vim
Normal file
41
sources_non_forked/ale/ale_linters/terraform/checkov.vim
Normal file
@ -0,0 +1,41 @@
|
||||
" Author: Thyme-87 <thyme-87@posteo.me>
|
||||
" Description: use checkov for providing warnings via ale
|
||||
|
||||
call ale#Set('terraform_checkov_executable', 'checkov')
|
||||
call ale#Set('terraform_checkov_options', '')
|
||||
|
||||
function! ale_linters#terraform#checkov#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'terraform_checkov_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#checkov#GetCommand(buffer) abort
|
||||
return '%e ' . '-f %t -o json --quiet ' . ale#Var(a:buffer, 'terraform_checkov_options')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#checkov#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:results = get(get(ale#util#FuzzyJSONDecode(a:lines, {}), 'results', []), 'failed_checks', [])
|
||||
|
||||
for l:violation in l:results
|
||||
call add(l:output, {
|
||||
\ 'filename': l:violation['file_path'],
|
||||
\ 'lnum': l:violation['file_line_range'][0],
|
||||
\ 'end_lnum': l:violation['file_line_range'][1],
|
||||
\ 'text': l:violation['check_name'] . ' [' . l:violation['check_id'] . ']',
|
||||
\ 'detail': l:violation['check_id'] . ': ' . l:violation['check_name'] . "\n" .
|
||||
\ 'For more information, see: '. l:violation['guideline'],
|
||||
\ 'type': 'W',
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'checkov',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': function('ale_linters#terraform#checkov#GetExecutable'),
|
||||
\ 'command': function('ale_linters#terraform#checkov#GetCommand'),
|
||||
\ 'callback': 'ale_linters#terraform#checkov#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/tex/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/tex/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for TeX files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('tex')
|
5
sources_non_forked/ale/ale_linters/texinfo/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/texinfo/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for TeXInfo files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('texinfo')
|
5
sources_non_forked/ale/ale_linters/text/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/text/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for general text files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('text')
|
5
sources_non_forked/ale/ale_linters/typescript/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/typescript/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for TypeScript files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('typescript')
|
5
sources_non_forked/ale/ale_linters/vue/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/vue/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Vue files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('vue')
|
80
sources_non_forked/ale/ale_linters/vue/volar.vim
Normal file
80
sources_non_forked/ale/ale_linters/vue/volar.vim
Normal file
@ -0,0 +1,80 @@
|
||||
" Author: Arnold Chand <creativenull@outlook.com>
|
||||
" Description: Volar Language Server integration for ALE adopted from
|
||||
" nvim-lspconfig and volar/packages/shared/src/types.ts
|
||||
|
||||
call ale#Set('vue_volar_executable', 'volar-server')
|
||||
call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('vue_volar_init_options', {
|
||||
\ 'documentFeatures': {
|
||||
\ 'documentColor': v:false,
|
||||
\ 'documentFormatting': {
|
||||
\ 'defaultPrintWidth': 100,
|
||||
\ },
|
||||
\ 'documentSymbol': v:true,
|
||||
\ 'foldingRange': v:true,
|
||||
\ 'linkedEditingRange': v:true,
|
||||
\ 'selectionRange': v:true,
|
||||
\ },
|
||||
\ 'languageFeatures': {
|
||||
\ 'callHierarchy': v:true,
|
||||
\ 'codeAction': v:true,
|
||||
\ 'codeLens': v:true,
|
||||
\ 'completion': {
|
||||
\ 'defaultAttrNameCase': 'kebabCase',
|
||||
\ 'defaultTagNameCase': 'both',
|
||||
\ 'getDocumentNameCaseRequest': v:false,
|
||||
\ 'getDocumentSelectionRequest': v:false,
|
||||
\ },
|
||||
\ 'definition': v:true,
|
||||
\ 'diagnostics': v:true,
|
||||
\ 'documentHighlight': v:true,
|
||||
\ 'documentLink': v:true,
|
||||
\ 'hover': v:true,
|
||||
\ 'references': v:true,
|
||||
\ 'rename': v:true,
|
||||
\ 'renameFileRefactoring': v:true,
|
||||
\ 'schemaRequestService': v:true,
|
||||
\ 'semanticTokens': v:false,
|
||||
\ 'signatureHelp': v:true,
|
||||
\ 'typeDefinition': v:true,
|
||||
\ 'workspaceSymbol': v:false,
|
||||
\ },
|
||||
\ 'typescript': {
|
||||
\ 'serverPath': '',
|
||||
\ 'localizedPath': v:null,
|
||||
\ },
|
||||
\})
|
||||
|
||||
function! ale_linters#vue#volar#GetProjectRoot(buffer) abort
|
||||
let l:project_roots = ['package.json', 'vite.config.js', '.git', bufname(a:buffer)]
|
||||
|
||||
for l:project_root in l:project_roots
|
||||
let l:nearest_filepath = ale#path#FindNearestFile(a:buffer, l:project_root)
|
||||
|
||||
if !empty(l:nearest_filepath)
|
||||
return fnamemodify(l:nearest_filepath, ':h')
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vue#volar#GetInitializationOptions(buffer) abort
|
||||
let l:tsserver_path = ale#path#FindNearestExecutable(a:buffer, [
|
||||
\ 'node_modules/typescript/lib/tsserverlibrary.js'
|
||||
\ ])
|
||||
let l:init_options = ale#Var(a:buffer, 'vue_volar_init_options')
|
||||
let l:init_options.typescript.serverPath = l:tsserver_path
|
||||
|
||||
return l:init_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('vue', {
|
||||
\ 'name': 'volar',
|
||||
\ 'language': 'vue',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/volar-server'])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'),
|
||||
\})
|
12
sources_non_forked/ale/ale_linters/wgsl/naga.vim
Normal file
12
sources_non_forked/ale/ale_linters/wgsl/naga.vim
Normal file
@ -0,0 +1,12 @@
|
||||
" Author: rhysd <https://github.com/rhysd>
|
||||
" Description: naga-cli linter for WGSL syntax.
|
||||
|
||||
call ale#Set('wgsl_naga_executable', 'naga')
|
||||
|
||||
call ale#linter#Define('wgsl', {
|
||||
\ 'name': 'naga',
|
||||
\ 'executable': {b -> ale#Var(b, 'wgsl_naga_executable')},
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': {b -> '%e --stdin-file-path %s'},
|
||||
\ 'callback': 'ale#handlers#naga#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/xhtml/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/xhtml/cspell.vim
Normal file
@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for XHTML files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('xhtml')
|
11
sources_non_forked/ale/ale_linters/yaml/actionlint.vim
Normal file
11
sources_non_forked/ale/ale_linters/yaml/actionlint.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Author: bretello <bretello@distruzione.org>
|
||||
|
||||
call ale#Set('yaml_actionlint_executable', 'actionlint')
|
||||
call ale#Set('yaml_actionlint_options', '')
|
||||
|
||||
call ale#linter#Define('yaml', {
|
||||
\ 'name': 'actionlint',
|
||||
\ 'executable': {b -> ale#Var(b, 'yaml_actionlint_executable')},
|
||||
\ 'command': function('ale#handlers#actionlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#actionlint#Handle',
|
||||
\})
|
34
sources_non_forked/ale/ale_linters/yaml/ls.vim
Normal file
34
sources_non_forked/ale/ale_linters/yaml/ls.vim
Normal file
@ -0,0 +1,34 @@
|
||||
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
||||
" Description: YAML Language Server https://github.com/redhat-developer/yaml-language-server
|
||||
|
||||
call ale#Set('yaml_ls_executable', 'yaml-language-server')
|
||||
call ale#Set('yaml_ls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('yaml_ls_config', {})
|
||||
|
||||
function! ale_linters#yaml#ls#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'yaml_ls', [
|
||||
\ 'node_modules/.bin/yaml-language-server',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#yaml#ls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#yaml#ls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' --stdio'
|
||||
endfunction
|
||||
|
||||
" Just use the current file
|
||||
function! ale_linters#yaml#ls#FindProjectRoot(buffer) abort
|
||||
let l:project_file = expand('#' . a:buffer . ':p')
|
||||
|
||||
return fnamemodify(l:project_file, ':h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('yaml', {
|
||||
\ 'name': 'yaml-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#yaml#ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#yaml#ls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#yaml#ls#FindProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'yaml_ls_config')},
|
||||
\})
|
Reference in New Issue
Block a user