1
0
mirror of https://github.com/amix/vimrc synced 2025-08-15 19:55:01 +08:00

Updated plugins

This commit is contained in:
Amir
2021-07-04 22:47:44 +02:00
parent 597b7acdc0
commit e19ae5588a
28 changed files with 297 additions and 103 deletions

View File

@ -3,7 +3,7 @@
call ale#Set('go_staticcheck_executable', 'staticcheck')
call ale#Set('go_staticcheck_options', '')
call ale#Set('go_staticcheck_lint_package', 0)
call ale#Set('go_staticcheck_lint_package', 1)
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#go#staticcheck#GetCommand(buffer) abort

View File

@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[4],
@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\})

View File

@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
if empty(l:level) && empty(l:config_file_exists)
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
endif

View File

@ -1,4 +1,5 @@
" Author: Eric Zhao <21zhaoe@protonmail.com>
" Author: ourigen <https://github.com/ourigen>
" Description: Implementation of the Language Server Protocol for R.
call ale#Set('r_languageserver_cmd', 'languageserver::run()')
@ -7,7 +8,7 @@ call ale#Set('r_languageserver_config', {})
function! ale_linters#r#languageserver#GetCommand(buffer) abort
let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd')
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string)
return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string)
endfunction
function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort

View File

@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'filename': l:match[2],
\ 'lnum': l:match[3] + 0,
\ 'col': l:match[4] + 0,
\ 'type': 'E',

View File

@ -1,34 +1,52 @@
" Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
" Description: Report solc compiler errors in Solidity code
call ale#Set('solidity_solc_executable', 'solc')
call ale#Set('solidity_solc_options', '')
function! ale_linters#solidity#solc#Handle(buffer, lines) abort
" Matches patterns like the following:
" /path/to/file/file.sol:1:10: Error: Identifier not found or not unique.
let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$'
" Error: Expected ';' but got '('
" --> /path/to/file/file.sol:1:10:)
let l:pattern = '\v(Error|Warning): (.*)$'
let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:isError = l:match[3] is? 'error'
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:isError ? 'E' : 'W',
\})
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
let l:match = matchlist(l:line, l:line_and_column_pattern)
if len(l:match) > 0
let l:index = len(l:output) - 1
let l:output[l:index]['lnum'] = l:match[1] + 0
let l:output[l:index]['col'] = l:match[2] + 0
endif
else
let l:isError = l:match[1] is? 'Error'
call add(l:output, {
\ 'lnum': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': l:isError ? 'E' : 'W',
\})
endif
endfor
return l:output
endfunction
function! ale_linters#solidity#solc#GetCommand(buffer) abort
return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
let l:executable = ale#Var(a:buffer, 'solidity_solc_executable')
return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
endfunction
call ale#linter#Define('solidity', {
\ 'name': 'solc',
\ 'executable': 'solc',
\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')},
\ 'command': function('ale_linters#solidity#solc#GetCommand'),
\ 'callback': 'ale_linters#solidity#solc#Handle',
\ 'output_stream': 'stderr',

View File

@ -29,11 +29,18 @@
call ale#Set('spec_rpmlint_executable', 'rpmlint')
call ale#Set('spec_rpmlint_options', '')
function! ale_linters#spec#rpmlint#GetCommand(buffer) abort
function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort
if ale#semver#GTE(a:version, [2, 0, 0])
" The -o/--option flag was removed in version 2.0.0
let l:version_dependent_args = ''
else
let l:version_dependent_args = ' -o "NetworkEnabled False"'
endif
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options'))
\ . ' -o "NetworkEnabled False"'
\ . ' -v'
\ . l:version_dependent_args
\ . ' %t'
endfunction
@ -73,6 +80,11 @@ endfunction
call ale#linter#Define('spec', {
\ 'name': 'rpmlint',
\ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')},
\ 'command': function('ale_linters#spec#rpmlint#GetCommand'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#Var(buffer, 'spec_rpmlint_executable'),
\ '%e --version',
\ function('ale_linters#spec#rpmlint#GetCommand'),
\ )},
\ 'callback': 'ale_linters#spec#rpmlint#Handle',
\})