1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 15:04:59 +08:00

Updated plugins

This commit is contained in:
Amir
2020-04-25 21:56:16 -04:00
parent d98c510eee
commit fef069af24
114 changed files with 4018 additions and 988 deletions

View File

@ -29,6 +29,6 @@ call ale#linter#Define('clojure', {
\ 'name': 'clj-kondo',
\ 'output_stream': 'stdout',
\ 'executable': 'clj-kondo',
\ 'command': 'clj-kondo --lint %t',
\ 'command': 'clj-kondo --cache --lint %t',
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
\})

View File

@ -174,6 +174,7 @@ endfunction
call ale#linter#Define('kotlin', {
\ 'name': 'kotlinc',
\ 'executable': 'kotlinc',
\ 'output_stream': 'stderr',
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
\ 'lint_file': 1,

View File

@ -32,6 +32,8 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
\)
endif
endfor
return ''
endfunction
function! ale_linters#scala#metals#GetCommand(buffer) abort

View File

@ -0,0 +1,25 @@
" Author: OJFord <dev@ojford.com>
" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp)
call ale#Set('terraform_langserver_executable', 'terraform-lsp')
call ale#Set('terraform_langserver_options', '')
function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options'))
endfunction
function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
endfunction
call ale#linter#Define('terraform', {
\ 'name': 'terraform_lsp',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')},
\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'),
\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'),
\ 'language': 'terraform',
\})

View File

@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
" %Warning-UNUSED: test.v:4: Signal is not used: dout
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
" Since version 4.032 (04/2020) verilator linter messages also contain the column number,
" and look like:
" %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
"
" to stay compatible with old versions of the tool, the column number is
" optional in the researched pattern
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:line = l:match[3] + 0
let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
let l:text = l:match[4]
let l:item = {
\ 'lnum': str2nr(l:match[3]),
\ 'text': l:match[5],
\ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
\}
if !empty(l:match[4])
let l:item.col = str2nr(l:match[4])
endif
let l:file = l:match[2]
if l:file =~# '_verilator_linted.v'
call add(l:output, {
\ 'lnum': l:line,
\ 'text': l:text,
\ 'type': l:type,
\})
call add(l:output, l:item)
endif
endfor

View File

@ -0,0 +1,61 @@
" Author: Jeffrey Lau - https://github.com/zoonfafer
" Description: Vim Language Server integration for ALE
call ale#Set('vim_vimls_executable', 'vim-language-server')
call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('vim_vimls_config', {})
function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort
let l:trigger_file_candidates = [
\ '.vimrc',
\ 'init.vim',
\]
for l:candidate in l:trigger_file_candidates
let l:trigger_file = fnamemodify(bufname(a:buffer), ':t')
if l:trigger_file is# l:candidate
return fnamemodify(
\ bufname(a:buffer),
\ ':h',
\)
endif
endfor
let l:trigger_dir_candidates = [
\ 'autoload',
\ 'plugin',
\ '.git',
\]
let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h'))
for l:path in l:path_upwards
for l:candidate in l:trigger_dir_candidates
let l:trigger_dir = ale#path#Simplify(
\ l:path . '/' . l:candidate,
\)
if isdirectory(l:trigger_dir)
return fnamemodify(
\ l:trigger_dir,
\ ':p:h:h',
\)
endif
endfor
endfor
return ''
endfunction
call ale#linter#Define('vim', {
\ 'name': 'vimls',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')},
\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [
\ 'node_modules/.bin/vim-language-server',
\ ])},
\ 'command': '%e --stdio',
\ 'language': 'vim',
\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'),
\})