Skip to content

Commit

Permalink
Updated Vim plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
amix committed Aug 8, 2022
1 parent a716fe1 commit b415367
Show file tree
Hide file tree
Showing 90 changed files with 2,201 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/ada/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Ada files.

call ale#handlers#cspell#DefineLinter('ada')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/asciidoc/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for ASCIIDoc files.

call ale#handlers#cspell#DefineLinter('asciidoc')
36 changes: 36 additions & 0 deletions sources_non_forked/ale/ale_linters/avra/avra.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 47 additions & 0 deletions sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions sources_non_forked/ale/ale_linters/c/cpplint.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/c/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C files.

call ale#handlers#cspell#DefineLinter('c')
37 changes: 37 additions & 0 deletions sources_non_forked/ale/ale_linters/cairo/starknet.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 43 additions & 0 deletions sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/cpp/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C++ files.

call ale#handlers#cspell#DefineLinter('cpp')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/cs/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C# files.

call ale#handlers#cspell#DefineLinter('cs')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/css/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for CSS files.

call ale#handlers#cspell#DefineLinter('css')
16 changes: 16 additions & 0 deletions sources_non_forked/ale/ale_linters/css/vscodecss.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/elixir/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Elixir files.

call ale#handlers#cspell#DefineLinter('elixir')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/go/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Go files.

call ale#handlers#cspell#DefineLinter('go')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/haskell/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Haskell files.

call ale#handlers#cspell#DefineLinter('haskell')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/help/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for help files.

call ale#handlers#cspell#DefineLinter('help')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/html/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for HTML files.

call ale#handlers#cspell#DefineLinter('html')
16 changes: 16 additions & 0 deletions sources_non_forked/ale/ale_linters/html/vscodehtml.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/java/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Java files.

call ale#handlers#cspell#DefineLinter('java')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/javascript/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JavaScript files.

call ale#handlers#cspell#DefineLinter('javascript')
5 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/json/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JSON files.

call ale#handlers#cspell#DefineLinter('json')
16 changes: 16 additions & 0 deletions sources_non_forked/ale/ale_linters/json/vscodejson.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/lua/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Lua files.

call ale#handlers#cspell#DefineLinter('lua')
46 changes: 46 additions & 0 deletions sources_non_forked/ale/ale_linters/lua/selene.vim
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions sources_non_forked/ale/ale_linters/markdown/cspell.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Markdown files.

call ale#handlers#cspell#DefineLinter('markdown')
Loading

0 comments on commit b415367

Please sign in to comment.