mirror of
https://github.com/amix/vimrc
synced 2025-06-30 20:05:01 +08:00
Updated plugins
This commit is contained in:
@ -132,7 +132,9 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
|
||||
if empty(l:match[2]) && empty(l:match[3])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
if !empty(l:match[1]) && !empty(l:output)
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
endif
|
||||
elseif empty(l:match[3])
|
||||
" Add symbols to 'cannot find symbol' errors.
|
||||
if l:output[-1].text is# 'error: cannot find symbol'
|
||||
|
35
sources_non_forked/ale/ale_linters/yaml/circleci.vim
Normal file
35
sources_non_forked/ale/ale_linters/yaml/circleci.vim
Normal file
@ -0,0 +1,35 @@
|
||||
function! ale_linters#yaml#circleci#Handle(buffer, lines) abort
|
||||
let l:match_index = -1
|
||||
let l:output = []
|
||||
|
||||
for l:index in range(len(a:lines))
|
||||
let l:line = a:lines[l:index]
|
||||
|
||||
if l:line =~? 'Error: ERROR IN CONFIG FILE:'
|
||||
let l:match_index = l:index + 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if l:match_index > 0
|
||||
return [{
|
||||
\ 'type': 'E',
|
||||
\ 'lnum': 1,
|
||||
\ 'text': a:lines[l:match_index],
|
||||
\ 'detail': join(a:lines[l:match_index :], "\n"),
|
||||
\}]
|
||||
endif
|
||||
|
||||
return []
|
||||
endfunction
|
||||
|
||||
" The circleci validate requires network requests, so we'll only run it when
|
||||
" files are saved to prevent the server from being hammered.
|
||||
call ale#linter#Define('yaml', {
|
||||
\ 'name': 'circleci',
|
||||
\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''},
|
||||
\ 'command': 'circleci config validate - < %s',
|
||||
\ 'callback': 'ale_linters#yaml#circleci#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
@ -269,13 +269,19 @@ function! s:ReplaceCompletionOptions(source) abort
|
||||
let b:ale_old_completeopt = &l:completeopt
|
||||
endif
|
||||
|
||||
if &l:completeopt =~# 'preview'
|
||||
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
|
||||
elseif &l:completeopt =~# 'popup'
|
||||
let &l:completeopt = 'menu,menuone,popup,noselect,noinsert'
|
||||
else
|
||||
let &l:completeopt = 'menu,menuone,noselect,noinsert'
|
||||
endif
|
||||
let l:opt_list = split(&l:completeopt, ',')
|
||||
" The menu and noinsert options must be set, or automatic completion
|
||||
" will be annoying.
|
||||
let l:new_opt_list = ['menu', 'menuone', 'noinsert']
|
||||
|
||||
" Permit some other completion options, provided users have set them.
|
||||
for l:opt in ['preview', 'popup', 'noselect']
|
||||
if index(l:opt_list, l:opt) >= 0
|
||||
call add(l:new_opt_list, l:opt)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let &l:completeopt = join(l:new_opt_list, ',')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -259,9 +259,7 @@ function! ale#debugging#InfoToClipboard() abort
|
||||
return
|
||||
endif
|
||||
|
||||
redir => l:output
|
||||
silent call ale#debugging#Info()
|
||||
redir END
|
||||
let l:output = execute('call ale#debugging#Info()')
|
||||
|
||||
let @+ = l:output
|
||||
call s:Echo('ALEInfo copied to your clipboard')
|
||||
@ -270,9 +268,7 @@ endfunction
|
||||
function! ale#debugging#InfoToFile(filename) abort
|
||||
let l:expanded_filename = expand(a:filename)
|
||||
|
||||
redir => l:output
|
||||
silent call ale#debugging#Info()
|
||||
redir END
|
||||
let l:output = execute('call ale#debugging#Info()')
|
||||
|
||||
call writefile(split(l:output, "\n"), l:expanded_filename)
|
||||
call s:Echo('ALEInfo written to ' . l:expanded_filename)
|
||||
|
@ -4,9 +4,7 @@
|
||||
function! ale#filetypes#LoadExtensionMap() abort
|
||||
" Output includes:
|
||||
" '*.erl setf erlang'
|
||||
redir => l:output
|
||||
silent exec 'autocmd'
|
||||
redir end
|
||||
let l:output = execute('exec "autocmd"')
|
||||
|
||||
let l:map = {}
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
" Description: Functions for working with eslint, for checking or fixing files.
|
||||
|
||||
let s:executables = [
|
||||
\ '.yarn/sdks/eslint/bin/eslint.js',
|
||||
\ 'node_modules/.bin/eslint_d',
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\ '.yarn/sdks/eslint/bin/eslint',
|
||||
\]
|
||||
let s:sep = has('win32') ? '\' : '/'
|
||||
|
||||
@ -52,14 +52,20 @@ function! ale#handlers#eslint#GetCwd(buffer) abort
|
||||
let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables)
|
||||
|
||||
if !empty(l:executable)
|
||||
let l:nmi = strridx(l:executable, 'node_modules')
|
||||
let l:project_dir = l:executable[0:l:nmi - 2]
|
||||
let l:modules_index = strridx(l:executable, 'node_modules')
|
||||
let l:modules_root = l:modules_index > -1 ? l:executable[0:l:modules_index - 2] : ''
|
||||
|
||||
let l:sdks_index = strridx(l:executable, ale#path#Simplify('.yarn/sdks'))
|
||||
let l:sdks_root = l:sdks_index > -1 ? l:executable[0:l:sdks_index - 2] : ''
|
||||
else
|
||||
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules')
|
||||
let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
|
||||
let l:modules_root = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
|
||||
|
||||
let l:sdks_dir = ale#path#FindNearestDirectory(a:buffer, ale#path#Simplify('.yarn/sdks'))
|
||||
let l:sdks_root = !empty(l:sdks_dir) ? fnamemodify(l:sdks_dir, ':h:h:h') : ''
|
||||
endif
|
||||
|
||||
return !empty(l:project_dir) ? l:project_dir : ''
|
||||
return strlen(l:modules_root) > strlen(l:sdks_root) ? l:modules_root : l:sdks_root
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#eslint#GetCommand(buffer) abort
|
||||
|
@ -52,9 +52,7 @@ endif
|
||||
function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort
|
||||
let l:verbose = &verbose
|
||||
set verbose=0
|
||||
redir => l:output
|
||||
0verbose silent highlight SignColumn
|
||||
redir end
|
||||
let l:output = execute('highlight SignColumn', 'silent')
|
||||
let &verbose = l:verbose
|
||||
|
||||
let l:highlight_syntax = join(split(l:output)[2:])
|
||||
@ -171,10 +169,10 @@ endfunction
|
||||
|
||||
" Read sign data for a buffer to a list of lines.
|
||||
function! ale#sign#ReadSigns(buffer) abort
|
||||
redir => l:output
|
||||
silent execute 'sign place ' . s:GroupCmd() . s:PriorityCmd()
|
||||
\ . ' buffer=' . a:buffer
|
||||
redir end
|
||||
let l:output = execute(
|
||||
\ 'sign place ' . s:GroupCmd() . s:PriorityCmd()
|
||||
\ . ' buffer=' . a:buffer
|
||||
\ )
|
||||
|
||||
return split(l:output, "\n")
|
||||
endfunction
|
||||
|
@ -568,6 +568,7 @@ Notes:
|
||||
* XML
|
||||
* `xmllint`
|
||||
* YAML
|
||||
* `circleci`!!
|
||||
* `prettier`
|
||||
* `spectral`
|
||||
* `swaglint`
|
||||
|
@ -1,6 +1,28 @@
|
||||
===============================================================================
|
||||
ALE YAML Integration *ale-yaml-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
circleci *ale-yaml-circleci*
|
||||
|
||||
Website: https://circleci.com/docs/2.0/local-cli
|
||||
|
||||
|
||||
Installation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Follow the instructions on the website, and make sure to test that you can
|
||||
validate configuration files with: >
|
||||
|
||||
circleci config validate - < .circleci/config.yml
|
||||
<
|
||||
|
||||
As long as the validator runs correctly, you should be able to see errors when
|
||||
you save the configuration file. The validator doesn't run as you type because
|
||||
it sends network requests, and running too often would overload the circleci
|
||||
servers.
|
||||
|
||||
|
||||
===============================================================================
|
||||
prettier *ale-yaml-prettier*
|
||||
|
||||
@ -15,11 +37,13 @@ Install prettier either globally or locally: >
|
||||
npm install prettier -g # global
|
||||
npm install prettier # local
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
spectral *ale-yaml-spectral*
|
||||
|
||||
Website: https://github.com/stoplightio/spectral
|
||||
|
||||
|
||||
Installation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@ -80,6 +104,7 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global*
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
yamlfix *ale-yaml-yamlfix*
|
||||
|
||||
@ -118,6 +143,7 @@ g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global*
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
yamllint *ale-yaml-yamllint*
|
||||
|
||||
|
@ -561,7 +561,6 @@ vimrc, and your issues should go away. >
|
||||
|
||||
set completeopt=menu,menuone,preview,noselect,noinsert
|
||||
<
|
||||
|
||||
Or alternatively, if you want to show documentation in popups: >
|
||||
|
||||
set completeopt=menu,menuone,popup,noselect,noinsert
|
||||
@ -3083,6 +3082,7 @@ documented in additional help files.
|
||||
xml.....................................|ale-xml-options|
|
||||
xmllint...............................|ale-xml-xmllint|
|
||||
yaml....................................|ale-yaml-options|
|
||||
circleci..............................|ale-yaml-circleci|
|
||||
prettier..............................|ale-yaml-prettier|
|
||||
spectral..............................|ale-yaml-spectral|
|
||||
swaglint..............................|ale-yaml-swaglint|
|
||||
@ -3734,6 +3734,21 @@ ale#fix#registry#Add(name, func, filetypes, desc, [aliases])
|
||||
ALE will search for fixers in the registry first by `name`, then by their
|
||||
`aliases`.
|
||||
|
||||
For example to register a custom fixer for `luafmt`: >
|
||||
|
||||
function! FormatLua(buffer) abort
|
||||
return {
|
||||
\ 'command': 'luafmt --stdin'
|
||||
\}
|
||||
endfunction
|
||||
|
||||
execute ale#fix#registry#Add('luafmt', 'FormatLua', ['lua'], 'luafmt for lua')
|
||||
|
||||
" You can now use it in g:ale_fixers
|
||||
let g:ale_fixers = {
|
||||
\ 'lua': ['luafmt']
|
||||
}
|
||||
<
|
||||
|
||||
ale#linter#Define(filetype, linter) *ale#linter#Define()*
|
||||
|
||||
|
@ -577,6 +577,7 @@ formatting.
|
||||
* XML
|
||||
* [xmllint](http://xmlsoft.org/xmllint.html)
|
||||
* YAML
|
||||
* [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk:
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
* [spectral](https://github.com/stoplightio/spectral)
|
||||
* [swaglint](https://github.com/byCedric/swaglint)
|
||||
|
Reference in New Issue
Block a user