mirror of
1
0
Fork 0

Updated Vim plugins

This commit is contained in:
Amir 2022-08-08 15:45:34 +02:00
parent a716fe1777
commit b41536726f
90 changed files with 2201 additions and 0 deletions

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Ada files.
call ale#handlers#cspell#DefineLinter('ada')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for ASCIIDoc files.
call ale#handlers#cspell#DefineLinter('asciidoc')

View 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',
\})

View 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',
\ })

View 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,
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C files.
call ale#handlers#cspell#DefineLinter('c')

View 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',
\})

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C++ files.
call ale#handlers#cspell#DefineLinter('cpp')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C# files.
call ale#handlers#cspell#DefineLinter('cs')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for CSS files.
call ale#handlers#cspell#DefineLinter('css')

View 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'),
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Elixir files.
call ale#handlers#cspell#DefineLinter('elixir')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Go files.
call ale#handlers#cspell#DefineLinter('go')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Haskell files.
call ale#handlers#cspell#DefineLinter('haskell')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for help files.
call ale#handlers#cspell#DefineLinter('help')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for HTML files.
call ale#handlers#cspell#DefineLinter('html')

View 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'),
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Java files.
call ale#handlers#cspell#DefineLinter('java')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JavaScript files.
call ale#handlers#cspell#DefineLinter('javascript')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JSON files.
call ale#handlers#cspell#DefineLinter('json')

View 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'),
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Lua files.
call ale#handlers#cspell#DefineLinter('lua')

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Markdown files.
call ale#handlers#cspell#DefineLinter('markdown')

View 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',
\})

View 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,
\ })

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for PHP files.
call ale#handlers#cspell#DefineLinter('php')

View 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'),
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for PowerShell files.
call ale#handlers#cspell#DefineLinter('powershell')

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Python files.
call ale#handlers#cspell#DefineLinter('python')

View 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',
\})

View File

@ -0,0 +1,4 @@
scriptencoding utf-8
" Description: cspell support for rego files.
call ale#handlers#cspell#DefineLinter('rego')

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for ReStructuredText files.
call ale#handlers#cspell#DefineLinter('rst')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Ruby files.
call ale#handlers#cspell#DefineLinter('ruby')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Rust files.
call ale#handlers#cspell#DefineLinter('rust')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Scala files.
call ale#handlers#cspell#DefineLinter('scala')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for shell scripts.
call ale#handlers#cspell#DefineLinter('sh')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Swift files.
call ale#handlers#cspell#DefineLinter('swift')

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for TeX files.
call ale#handlers#cspell#DefineLinter('tex')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for TeXInfo files.
call ale#handlers#cspell#DefineLinter('texinfo')

View 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')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for TypeScript files.
call ale#handlers#cspell#DefineLinter('typescript')

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Vue files.
call ale#handlers#cspell#DefineLinter('vue')

View 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'),
\})

View 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',
\})

View File

@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for XHTML files.
call ale#handlers#cspell#DefineLinter('xhtml')

View 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',
\})

View 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')},
\})

View File

@ -0,0 +1,133 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: Rename file support for tsserver
let s:filerename_map = {}
" Used to get the rename map in tests.
function! ale#filerename#GetMap() abort
return deepcopy(s:filerename_map)
endfunction
" Used to set the rename map in tests.
function! ale#filerename#SetMap(map) abort
let s:filerename_map = a:map
endfunction
function! ale#filerename#ClearLSPData() abort
let s:filerename_map = {}
endfunction
function! s:message(message) abort
call ale#util#Execute('echom ' . string(a:message))
endfunction
function! ale#filerename#HandleTSServerResponse(conn_id, response) abort
if get(a:response, 'command', '') isnot# 'getEditsForFileRename'
return
endif
if !has_key(s:filerename_map, a:response.request_seq)
return
endif
let l:options = remove(s:filerename_map, a:response.request_seq)
let l:old_name = l:options.old_name
let l:new_name = l:options.new_name
if get(a:response, 'success', v:false) is v:false
let l:message = get(a:response, 'message', 'unknown')
call s:message('Error renaming file "' . l:old_name . '" to "' . l:new_name
\ . '". Reason: ' . l:message)
return
endif
let l:changes = a:response.body
if empty(l:changes)
call s:message('No changes while renaming "' . l:old_name . '" to "' . l:new_name . '"')
else
call ale#code_action#HandleCodeAction(
\ {
\ 'description': 'filerename',
\ 'changes': l:changes,
\ },
\ {
\ 'should_save': 1,
\ },
\)
endif
silent! noautocmd execute 'saveas ' . l:new_name
call delete(l:old_name)
endfunction
function! s:OnReady(options, linter, lsp_details) abort
let l:id = a:lsp_details.connection_id
if !ale#lsp#HasCapability(l:id, 'filerename')
return
endif
let l:buffer = a:lsp_details.buffer
let l:Callback = function('ale#filerename#HandleTSServerResponse')
call ale#lsp#RegisterCallback(l:id, l:Callback)
let l:message = ale#lsp#tsserver_message#GetEditsForFileRename(
\ a:options.old_name,
\ a:options.new_name,
\)
let l:request_id = ale#lsp#Send(l:id, l:message)
let s:filerename_map[l:request_id] = a:options
endfunction
function! s:ExecuteFileRename(linter, options) abort
let l:buffer = bufnr('')
let l:Callback = function('s:OnReady', [a:options])
call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback)
endfunction
function! ale#filerename#Execute() abort
let l:lsp_linters = []
for l:linter in ale#linter#Get(&filetype)
if l:linter.lsp is# 'tsserver'
call add(l:lsp_linters, l:linter)
endif
endfor
if empty(l:lsp_linters)
call s:message('No active tsserver LSPs')
return
endif
let l:buffer = bufnr('')
let l:old_name = expand('#' . l:buffer . ':p')
let l:new_name = ale#util#Input('New file name: ', l:old_name, 'file')
if l:old_name is# l:new_name
call s:message('New file name matches old file name')
return
endif
if empty(l:new_name)
call s:message('New name cannot be empty!')
return
endif
for l:lsp_linter in l:lsp_linters
call s:ExecuteFileRename(l:lsp_linter, {
\ 'old_name': l:old_name,
\ 'new_name': l:new_name,
\})
endfor
endfunction

View File

@ -0,0 +1,12 @@
" Author: Alex McKinney <alexmckinney01@gmail.com>
" Description: Run buf format.
call ale#Set('proto_buf_format_executable', 'buf')
function! ale#fixers#buf_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'proto_buf_format_executable')
return {
\ 'command': ale#Escape(l:executable) . ' format %t',
\}
endfunction

View File

@ -0,0 +1,14 @@
call ale#Set('crystal_format_executable', 'crystal')
call ale#Set('crystal_format_options', '')
function! ale#fixers#crystal#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'crystal_format_executable')
let l:options = ale#Var(a:buffer, 'crystal_format_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' tool format'
\ . ale#Pad(l:options)
\ . ' -'
\}
endfunction

View File

@ -0,0 +1,29 @@
call ale#Set('dprint_executable', 'dprint')
call ale#Set('dprint_executable_override', 0)
call ale#Set('dprint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('dprint_options', '')
call ale#Set('dprint_config', 'dprint.json')
function! ale#fixers#dprint#Fix(buffer) abort
let l:executable = ale#path#FindExecutable(a:buffer, 'dprint', ['dprint'])
let l:executable_override = ale#Var(a:buffer, 'dprint_executable_override')
if !executable(l:executable) && !l:executable_override
return 0
endif
let l:options = ale#Var(a:buffer, 'dprint_options')
let l:config = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'dprint_config'))
if !empty(l:config)
let l:options = l:options . ' -c ' . ale#Escape(l:config)
endif
let l:options = l:options . ' --stdin %s'
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt '
\ . l:options
\}
endfunction

View File

@ -0,0 +1,16 @@
" Author: Albert Peschar <albert@peschar.net>
" Description: Fix files with dune format.
call ale#Set('ocaml_dune_executable', 'dune')
call ale#Set('ocaml_dune_options', '')
function! ale#fixers#dune#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'ocaml_dune_executable')
let l:options = ale#Var(a:buffer, 'ocaml_dune_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@ -0,0 +1,17 @@
" Author: David Houston <houstdav000>
" Description: A stricter gofmt implementation.
call ale#Set('go_gofumpt_executable', 'gofumpt')
call ale#Set('go_gofumpt_options', '')
function! ale#fixers#gofumpt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_gofumpt_executable')
let l:options = ale#Var(a:buffer, 'go_gofumpt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . ' -w -- %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,15 @@
" Description: Fixer for rego files
call ale#Set('opa_fmt_executable', 'opa')
call ale#Set('opa_fmt_options', '')
function! ale#fixers#opafmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'opa_fmt_executable')
let l:options = ale#Var(a:buffer, 'opa_fmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@ -0,0 +1,17 @@
" Author: Zhuoyun Wei <wzyboy@wzyboy.org>
" Description: Fixer for Packer HCL files
call ale#Set('packer_fmt_executable', 'packer')
call ale#Set('packer_fmt_options', '')
function! ale#fixers#packer#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'packer_fmt_executable')
let l:options = ale#Var(a:buffer, 'packer_fmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction

View File

@ -0,0 +1,25 @@
" Author: Michael Dyrynda <michael@dyrynda.com.au>
" Description: Fixing files with Laravel Pint.
call ale#Set('php_pint_executable', 'pint')
call ale#Set('php_pint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('php_pint_options', '')
function! ale#fixers#pint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'php_pint', [
\ 'vendor/bin/pint',
\ 'pint'
\])
endfunction
function! ale#fixers#pint#Fix(buffer) abort
let l:executable = ale#fixers#pint#GetExecutable(a:buffer)
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . ale#Var(a:buffer, 'php_pint_options')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,41 @@
" Author: infokiller <joweill@icloud.com>
" Description: Tidy imports using pyflyby's tidy-import script
" https://github.com/deshaw/pyflyby
call ale#Set('python_pyflyby_executable', 'tidy-imports')
call ale#Set('python_pyflyby_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyflyby_options', '')
call ale#Set('python_pyflyby_auto_pipenv', 0)
call ale#Set('python_pyflyby_auto_poetry', 0)
function! ale#fixers#pyflyby#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflyby_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports'])
endfunction
function! ale#fixers#pyflyby#Fix(buffer) abort
" let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'tidy-imports'])
endif
let l:options = ale#Var(a:buffer, 'python_pyflyby_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
return {'command': join(l:cmd, ' ')}
endfunction

View File

@ -0,0 +1,17 @@
" Author: David Houston <houstdav000>
" Description: Provide statix fix as a fixer for simple Nix antipatterns.
call ale#Set('nix_statix_fix_executable', 'statix')
call ale#Set('nix_statix_fix_options', '')
function! ale#fixers#statix#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'nix_statix_fix_executable')
let l:options = ale#Var(a:buffer, 'nix_statix_fix_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad('fix')
\ . ale#Pad('--stdin')
\ . ale#Pad(l:options),
\}
endfunction

View File

@ -0,0 +1,14 @@
scriptencoding utf-8
" Author: Arash Mousavi <arash-m>
" Description: Official formatter for Zig.
call ale#Set('zig_zigfmt_executable', 'zig')
function! ale#fixers#zigfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'zig_zigfmt_executable')
return {
\ 'command': ale#Escape(l:executable) . ' fmt %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,36 @@
function! ale#handlers#actionlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'yaml_actionlint_options')
" automatically add --no-color option if not defined
if l:options !~# '--no-color'
let l:options .= ' --no-color'
endif
" automatically add --oneline option if not defined
if l:options !~# '--oneline'
let l:options .= ' --oneline'
endif
return '%e ' . l:options . ' %t'
endfunction
function! ale#handlers#actionlint#Handle(buffer, lines) abort
" Matches patterns line the following:
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3],
\ 'code': l:match[4],
\ 'type': 'E',
\}
call add(l:output, l:item)
endfor
return l:output
endfunction

View File

@ -0,0 +1,54 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: Define a handler function for cspell's output
function! ale#handlers#cspell#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer,
\ 'cspell', [
\ 'node_modules/.bin/cspell',
\ 'node_modules/cspell/bin.js',
\ ]
\)
endfunction
function! ale#handlers#cspell#GetCommand(buffer) abort
let l:executable = ale#handlers#cspell#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'cspell_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ' lint --no-color --no-progress --no-summary'
\ . ale#Pad(l:options)
\ . ' -- stdin'
endfunction
function! ale#handlers#cspell#Handle(buffer, lines) abort
" Look for lines like the following:
"
" /home/user/repos/ale/README.md:723:48 - Unknown word (stylelint)
let l:pattern = '\v^.*:(\d+):(\d+) - (.*)$'
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,
\ 'text': l:match[3],
\ 'type': 'W',
\})
endfor
return l:output
endfunction
function! ale#handlers#cspell#DefineLinter(filetype) abort
call ale#Set('cspell_executable', 'cspell')
call ale#Set('cspell_options', '')
call ale#Set('cspell_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define(a:filetype, {
\ 'name': 'cspell',
\ 'executable': function('ale#handlers#cspell#GetExecutable'),
\ 'command': function('ale#handlers#cspell#GetCommand'),
\ 'callback': 'ale#handlers#cspell#Handle',
\})
endfunction

View File

@ -0,0 +1,30 @@
" Author: rhysd <https://github.com/rhysd>
" Description: Handle errors for naga-cli.
function! ale#handlers#naga#Handle(buffer, lines) abort
let l:errors = []
let l:current_error = v:null
for l:line in a:lines
if l:line =~# '^error: '
let l:text = l:line[7:]
let l:current_error = { 'text': l:text, 'type': 'E' }
continue
endif
if l:current_error isnot v:null
let l:matches = matchlist(l:line, '\v:(\d+):(\d+)$')
if !empty(l:matches)
let l:current_error.lnum = str2nr(l:matches[1])
let l:current_error.col = str2nr(l:matches[2])
call add(l:errors, l:current_error)
let l:current_error = v:null
continue
endif
endif
endfor
return l:errors
endfunction

View File

@ -0,0 +1,73 @@
scriptencoding utf-8LE
" Description: This file defines a handler function for linting OpenSCAD files
" with SCA2D
function! ale#handlers#openscad#SCA2D_callback(buffer, lines) abort
" Example output::
" foo.scad:3:1: W2001: Variable `unused` overwritten within scope.
" foo.scad:1:1: F0001: Cannot read file due to syntax error:
" - No terminal matches '}' in the current parser context, at line 1 col 36
let l:filename_re = '^\([^:]*\):'
let l:linenum_re = '\([0-9]*\):'
let l:colnum_re = '\([0-9]*\):'
let l:err_id = '\([IWEFU][0-9]\+\):'
let l:err_msg = '\(.*\)'
let l:pattern = filename_re .
\ linenum_re .
\ colnum_re .
\ ' ' .
\ err_id .
\ ' ' .
\ err_msg
let l:result = []
let l:idx = 0
for l:line in a:lines
let l:matches = matchlist(line, pattern)
if len(matches) > 0
" option: Info, Warning, Error, Fatal, Unknown
if index(['I', 'W'], matches[4][0]) >= 0
let l:type = 'W'
else
let l:type = 'E'
endif
let l:lnum = matches[2]
let l:col = matches[3]
let l:text = matches[5]
" Better locations for some syntax errors
if matches[4][0] is# 'F'
let l:syntax_error_re = '^\(.*\), at line \([0-9]\+\) col \([0-9]\+\)$'
let l:next_line = a:lines[idx+1]
let l:syn_err_matches = matchlist(l:next_line, l:syntax_error_re)
if len(syn_err_matches) > 0
let l:text = l:text . l:syn_err_matches[1]
let l:lnum = l:syn_err_matches[2]
let l:col = l:syn_err_matches[3]
else
let l:text = l:next_line
endif
endif
let l:element = {
\ 'lnum': str2nr(l:lnum),
\ 'col': str2nr(l:col),
\ 'text': l:text,
\ 'detail': l:matches[4] . ': ' . l:text,
\ 'filename': fnamemodify(matches[1], ':p'),
\ 'type': l:type
\ }
call add(l:result, l:element)
endif
let l:idx += 1
endfor
return result
endfun

View File

@ -0,0 +1,24 @@
scriptencoding utf-8
" Author: David Houston
" Description: This file defines a handler function for statix's errorformat
" output.
function! ale#handlers#statix#Handle(buffer, lines) abort
" Look for lines like the following.
"
" flake.nix>46:13:W:3:This assignment is better written with `inherit`
let l:pattern = '\v^.*\>(\d+):(\d+):([A-Z]):(\d+):(.*)$'
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': l:match[3],
\ 'code': l:match[4],
\ 'text': l:match[5],
\})
endfor
return l:output
endfunction

View File

@ -0,0 +1,110 @@
" Author: yoshi1123 <yoshi1@tutanota.com>
" Description: Functions for working with jdt:// URIs.
function! s:OpenJDTLink(root, uri, line, column, options, result) abort
if has_key(a:result, 'error')
" no-custom-checks
echoerr a:result.error.message
return
endif
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
" no-custom-checks
echoerr 'File content not found'
endif
" disable autocmd when opening buffer
autocmd! AleURISchemes
call ale#util#Open(a:uri, a:line, a:column, a:options)
autocmd AleURISchemes BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('<amatch>'))
if !empty(getbufvar(bufnr(''), 'ale_lsp_root', ''))
return
endif
let b:ale_lsp_root = a:root
set filetype=java
call setline(1, split(l:contents, '\n'))
call cursor(a:line, a:column)
normal! zz
setlocal buftype=nofile nomodified nomodifiable readonly
endfunction
" Load new buffer with jdt:// contents and jump to line and column.
function! ale#uri#jdt#OpenJDTLink(encoded_uri, line, column, options, conn_id) abort
let l:found_eclipselsp = v:false
for l:linter in ale#linter#Get('java')
if l:linter.name is# 'eclipselsp'
let l:found_eclipselsp = v:true
endif
endfor
if !l:found_eclipselsp
throw 'eclipselsp not running'
endif
let l:root = a:conn_id[stridx(a:conn_id, ':')+1:]
let l:uri = a:encoded_uri
call ale#lsp_linter#SendRequest(
\ bufnr(''),
\ 'eclipselsp',
\ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}],
\ function('s:OpenJDTLink', [l:root, l:uri, a:line, a:column, a:options])
\)
endfunction
function! s:ReadClassFileContents(uri, result) abort
if has_key(a:result, 'error')
" no-custom-checks
echoerr a:result.error.message
return
endif
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
" no-custom-checks
echoerr 'File content not found'
endif
call setline(1, split(l:contents, '\n'))
setlocal buftype=nofile nomodified nomodifiable readonly
endfunction
" Read jdt:// contents, as part of current project, into current buffer.
function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort
if !empty(getbufvar(bufnr(''), 'ale_lsp_root', ''))
return
endif
let l:linter_map = ale#lsp_linter#GetLSPLinterMap()
for l:conn_id in keys(l:linter_map)
if l:linter_map[l:conn_id] is# 'eclipselsp'
let l:root = l:conn_id[stridx(l:conn_id, ':')+1:]
endif
endfor
if l:root is# v:null
throw 'eclipselsp not running'
endif
let l:uri = a:encoded_uri
let b:ale_lsp_root = l:root
set filetype=java
call ale#lsp_linter#SendRequest(
\ bufnr(''),
\ 'eclipselsp',
\ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}],
\ function('s:ReadClassFileContents', [l:uri])
\)
endfunction

View File

@ -0,0 +1,26 @@
===============================================================================
ALE AVRA Integration *ale-avra-options*
===============================================================================
avra *ale-avra-avra*
g:ale_avra_avra_executable *g:ale_avra_avra_executable*
*b:ale_avra_avra_executable*
Type: |String|
Default `'avra'`
This variable can be changed to use different executable for AVRA.
g:ale_avra_avra_options *g:ale_avra_avra_options*
*b:ale_avra_avra_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to AVRA.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,31 @@
===============================================================================
ALE BitBake Integration *ale-bitbake-options*
===============================================================================
oelint-adv *ale-bitbake-oelint_adv*
g:ale_bitbake_oelint_adv_executable *g:ale_bitbake_oelint_adv_executable*
Type: |String|
Default: `'oelint-adv'`
This variable can be changed to use a different executable for oelint-adv.
g:ale_bitbake_oelint_adv_options *g:ale_bitbake_oelint_adv_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to oelint-adv.
g:ale_bitbake_oelint_adv_config *g:ale_bitbake_oelint_adv_config*
Type: |String|
Default: `'.oelint.cfg'`
This variable can be set to use a different config file.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,15 @@
===============================================================================
ALE Cairo Integration *ale-cairo-options*
===============================================================================
starknet *ale-cairo-starknet*
g:ale_cairo_starknet_executable *g:ale_cairo_starknet_executable*
*b:ale_cairo_starknet_executable*
Default: `'starknet-compile'`
Overrides the starknet-compile binary after installing the cairo-language.
For more information read 'https://starknet.io/docs/quickstart.html'

View File

@ -0,0 +1,12 @@
===============================================================================
ALE Help Integration *ale-help-options*
===============================================================================
cspell *ale-help-cspell*
See |ale-cspell-options|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,25 @@
===============================================================================
ALE OpenSCAD Integration *ale-openscad-options*
===============================================================================
sca2d *ale-openscad-sca2d*
g:ale_openscad_sca2d_executable *g:ale_openscad_sca2d_executable*
*b:ale_openscad_sca2d_executable*
Type: |String|
Default: `'sca2d'`
See |ale-integrations-local-executables|
g:ale_openscad_sca2d_options *g:ale_openscad_sca2d_options*
*b:ale_openscad_sca2d_options*
Type: |String|
Default: `''`
This variable can be set to pass options to sca2d.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,24 @@
===============================================================================
ALE Packer Integration *ale-packer-options*
===============================================================================
packer-fmt-fixer *ale-packer-fmt-fixer*
g:ale_packer_fmt_executable *g:ale_packer_fmt_executable*
*b:ale_packer_fmt_executable*
Type: |String|
Default: `'packer'`
This variable can be changed to use a different executable for packer.
g:ale_packer_fmt_options *g:ale_packer_fmt_options*
*b:ale_packer_fmt_options*
Type: |String|
Default: `''`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,50 @@
===============================================================================
ALE Rego Integration *ale-rego-options*
===============================================================================
cspell *ale-rego-cspell*
See |ale-cspell-options|
===============================================================================
opacheck *ale-rego-opa-check*
g:ale_rego_opacheck_executable *g:rego_opacheck_executable*
*b:rego_opacheck_executable*
Type: |String|
Default: `'opa'`
This variable can be changed to use a different executable for opa.
g:rego_opacheck_options *g:rego_opacheck_options*
*b:rego_opacheck_options*
Type: |String|
Default: `''`
This variable can be changed to pass custom CLI flags to opa check.
===============================================================================
opafmt *ale-rego-opa-fmt-fixer*
g:ale_opa_fmt_executable *g:ale_opa_fmt_executable*
*b:ale_opa_fmt_executable*
Type: |String|
Default: `'opa'`
This variable can be changed to use a different executable for opa.
g:ale_opa_fmt_options *g:ale_opa_fmt_options*
*b:ale_opa_fmt_options*
Type: |String|
Default: `''`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,12 @@
===============================================================================
ALE TOML Integration *ale-toml-options*
===============================================================================
dprint *ale-toml-dprint*
See |ale-dprint-options| and https://dprint.dev/plugins/toml
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,17 @@
===============================================================================
ALE WGSL Integration *ale-wgsl-options*
===============================================================================
naga *ale-wgsl-naga*
g:ale_wgsl_naga_executable *g:ale_wgsl_naga_executable*
*b:ale_wgsl_naga_executable*
Type: |String|
Default: `'naga'`
The executable that will be run for the `naga` linter.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: ctrlpvim # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -0,0 +1 @@
github: junegunn

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013-2021 Junegunn Choi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,58 @@
" =============================================================================
" Filename: autoload/lightline/colorscheme/rosepine.vim
" Author: sheruost
" License: MIT License
" Last Change: 2022/05/09 23:27:50.
" =============================================================================
" Reference: https://rosepinetheme.com/palette
if lightline#colorscheme#background() ==# 'light'
" Rosé Pine Dawn
let s:base = [ '#faf4ed', 255 ]
let s:surface = [ '#fffaf3', 255 ]
let s:overlay = [ '#f2e9e1', 254 ]
let s:highlight_m = [ '#dfdad9', 145 ]
let s:muted = [ '#9893a5', 103 ]
let s:subtle = [ '#797593', 102 ]
let s:iris = [ '#907aa9', 139 ]
let s:pine = [ '#286983', 24 ]
let s:foam = [ '#56949f', 67 ]
let s:rose = [ '#d7827e', 174 ]
let s:love = [ '#b4637a', 132 ]
else
" Rosé Pine
let s:base = [ '#191724', 233 ]
let s:surface = [ '#1f1d2e', 234 ]
let s:overlay = [ '#26233a', 235 ]
let s:highlight_m = [ '#403d52', 59 ]
let s:muted = [ '#6e6a86', 60 ]
let s:subtle = [ '#908caa', 103 ]
let s:iris = [ '#c4a7e7', 182 ]
let s:pine = [ '#31748f', 30 ]
let s:foam = [ '#9ccfd8', 152 ]
let s:rose = [ '#ebbcba', 217 ]
let s:love = [ '#eb6f92', 204 ]
endif
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:base, s:pine ], [ s:subtle, s:surface ] ]
let s:p.normal.right = [ [ s:overlay, s:subtle ], [ s:muted, s:overlay ], [ s:highlight_m, s:surface ] ]
let s:p.inactive.right = [ [ s:base, s:surface ], [ s:overlay, s:base ] ]
let s:p.inactive.left = [ [ s:overlay, s:base ], [ s:surface, s:base ] ]
let s:p.insert.left = [ [ s:base, s:foam ], [ s:subtle, s:surface ] ]
let s:p.replace.left = [ [ s:base, s:love ], [ s:subtle, s:surface ] ]
let s:p.visual.left = [ [ s:base, s:iris ], [ s:subtle, s:surface ] ]
let s:p.normal.middle = [ [ s:overlay, s:base ] ]
let s:p.inactive.middle = [ [ s:surface, s:base ] ]
let s:p.tabline.left = [ [ s:subtle, s:base ] ]
let s:p.tabline.tabsel = [ [ s:pine, s:base ] ]
let s:p.tabline.middle = [ [ s:surface, s:base ] ]
let s:p.tabline.right = copy(s:p.normal.right)
let s:p.normal.error = [ [ s:love, s:base ] ]
let s:p.normal.warning = [ [ s:rose, s:surface ] ]
let g:lightline#colorscheme#rosepine#palette = lightline#colorscheme#flatten(s:p)

View File

@ -0,0 +1,13 @@
name: Reviewdog
on: [pull_request]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: vint
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review

View File

@ -0,0 +1,31 @@
name: Vader
on: [push, pull_request]
jobs:
vader:
name: vader
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
vimFlavor: ["vim", "nvim"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Enable Universe package repository
run: |
sudo add-apt-repository universe
sudo apt-get update
- name: Install ${{ matrix.vimFlavor }}
run: |
sudo apt-get install ${{ matrix.vimFlavor == 'nvim' && 'neovim' || 'vim' }}
- name: Review versions
run: |
${{ matrix.vimFlavor }} --version
- name: Fetch Vader and other dependencies
run: |
make build/tabular build/vim-toml build/vim-json build/vader.vim
- name: Run test suite
run: |
cd test
${{ matrix.vimFlavor == 'nvim' && 'nvim --headless' || 'vim -N' }} \
-u vimrc "+Vader! *"

View File

@ -0,0 +1,15 @@
name: Vint
on: [push]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Setup dependencies
run: pip install vim-vint
- name: Lint Vimscript
run: vint .

View File

@ -0,0 +1,5 @@
cmdargs:
severity: style_problem
color: true
env:
neovim: false

View File

@ -0,0 +1,29 @@
require 'spec_helper'
describe "Indenting" do
# Reference: https://docs.ruby-lang.org/en/master/doc/syntax/pattern_matching_rdoc.html
specify "pattern-matching with case-in" do
assert_correct_indenting 'rb', <<~EOF
case {a: a}
in {a:}
p a
end
EOF
assert_correct_indenting 'rb', <<~EOF
users = [{name: "Alice", age: 12}, {name: "Bob", age: 23}]
users.any? do |user|
user in {name: /B/, in: 20..}
end #=> true
EOF
end
specify "does not deindent while typing" do
assert_correct_indent_in_insert 'rb', <<~EOF, "index = 0", <<~RESULT
def foo
EOF
def foo
index = 0
RESULT
end
end

View File

@ -0,0 +1,195 @@
snippet scode Start basic code for assembly
.data
.text
.global main
main:
snippet scodes Start basic code for assembly with _start label
.data
.text
.globl _start
_start:
snippet lo Long
$1: .long $2
snippet wo Word
$1: .word $2
snippet by Byte
$1: .byte $2
snippet sp Space
$1: .space $2
snippet ai Ascii
$1: .ascii "$2"
snippet az Asciz
$1: .asciz "$2"
snippet ze Zero
$1: .zero "$2"
snippet qu Quad
$1: .quad "$2"
snippet si Single
$1: .single "$2"
snippet do Double
$1: .single "$2"
snippet fl Float
$1: .single "$2"
snippet oc Octa
$1: .single "$2"
snippet sh Short
$1: .single "$2"
snippet exit0 Exit without error
movl \$1, %eax
xorl %ebx, %ebx
int \$0x80
snippet exit Exit with error
mov \$1, %eax
mov $1, %ebx
int \$0x80
snippet readfstdin Read fixed length text from stdin
mov \$3, %eax
mov \$2, %ebx
mov $1, %ecx
mov $2, %edx
int \$0x80
snippet writestdout Write text to stdout
mov \$4, %eax
mov \$1, %ebx
mov $1, %ecx
mov $2, %edx
int \$0x80
snippet writestderr Write text to stderr
mov \$4, %eax
mov \$2, %ebx
mov $1, %ecx
mov $2, %edx
int \$0x80
snippet * Multiplication
mov $1, %eax
mul $2
snippet / Division
mov $1, %eax
div $2
snippet jmpl Conditional lower jump
cmp $1, $2
jl $3
snippet jmple Conditional lower or equal jump
cmp $1, $2
jle $3
snippet jmpe Conditional equal jump
cmp $1, $2
je $3
snippet jmpn Conditional not equal jump
cmp $1, $2
jn $3
snippet jmpg Conditional greater jump
cmp $1, $2
jg $3
snippet jmpge Conditional greater or equal jump
cmp $1, $2
je $3
snippet loopn Loop n times
mov $1, %ecx
et_for:
$2
loop et_for
snippet loopnn Loop n-1 times
mov $1, %ecx
dec %ecx
et_for:
$2
loop et_for
snippet loopv Loop through a vector
lea $1, %edi
xor %ecx, %ecx
et_for:
cmp %ecx, $2
je $3
$4
inc %ecx
jmp et_for
snippet mul Multiply
xor %edx, %edx
mov $1, %eax
mul $2
snippet mul64 Multiply numbers greater than 2^32
mov $1, %edx
mov $2, %eax
mul $3
snippet div Divide
xor %edx, %edx
mov $1, %eax
div $2
snippet div64 Divide numbers greater than 2^32
mov $1, %edx
mov $2, %eax
div $3
snippet pr Call printf
pushl $1
call printf
popl $2
snippet sc Call scanf
pushl $1
call scanf
popl $2
snippet mindex Current index from a matrix
xor %edx, %edx
movl $1, %eax
mull $2
addl $3, %eax
snippet ffl Call fflush
pushl \$0
call fflush
popl $1
snippet at Call atoi
pushl $1
call atoi
popl $2
snippet len Call strlen
pushl $1
call strlen
popl $2
snippet proc Basic procedure
$1:
pushl %ebp
movl %esp, %ebp
$2
popl %ebp
ret

View File

@ -0,0 +1,98 @@
snippet fn "fn"
fn ${1:function_name}(${2}) -> ${3:Nil} {
${0:${VISUAL:todo}}
}
snippet pfn "pub fn"
pub fn ${1:function_name}(${2}) -> ${3:Nil} {
${0:${VISUAL:todo}}
}
snippet test "test fn"
pub fn ${1:name}_test() {
${0}
}
snippet af "anonymous fn"
fn(${1}) { ${0:${VISUAL}} }
snippet let "let binding"
let ${1} = ${0}
snippet l "let binding"
let ${1} = ${0}
snippet as "assert binding"
assert ${1} = ${0}
snippet tr "try binding"
try ${1} = ${0}
snippet - "->"
-> ${0}
snippet case "case expression"
case ${1} {
${2} -> ${0}
}
snippet ty "type"
type ${1:Name} {
${0:$1}
}
snippet pty "pub type"
pub type ${1:Name} {
${0:$1}
}
snippet tya "type alias"
type ${1:Name} =
${0:$1}
snippet ptya "pub type alias"
pub type ${1:Name} =
${0:$1}
snippet ext "external type"
external type ${0}
snippet pext "pub external type"
pub external type ${0}
snippet exfn "external fn"
external fn ${1:function_name}(${2}) -> ${3}
= "${4}" "${0}"
snippet pexfn "pub external fn"
pub external fn ${1:function_name}(${2}) -> ${3}
= "${4}" "${0}"
snippet im "import"
import ${0:gleam/result}
snippet im. "import exposing"
import ${1:gleam/result}.{${0}}
snippet p "|>"
|> ${0}
snippet tup "tuple()"
tuple(${0:${VISUAL}})
snippet bl "block"
{
${0:${VISUAL}}
}
snippet tf "fn(Type) -> Type"
fn(${1}) -> ${0}
snippet seq "should.equal"
should.equal(${0:${VISUAL}})
snippet strue "should.be_true"
should.be_true(${0:${VISUAL}})
snippet sfalse "should.be_false"
should.be_true(${0:${VISUAL}})