mirror of
https://github.com/amix/vimrc
synced 2025-07-14 15:34:59 +08:00
😼 Update plugins
This commit is contained in:
@ -1001,12 +1001,11 @@ endfunction
|
||||
|
||||
function! ale#completion#HandleUserData(completed_item) abort
|
||||
let l:user_data_json = get(a:completed_item, 'user_data', '')
|
||||
let l:user_data = !empty(l:user_data_json)
|
||||
\ ? ale#util#FuzzyJSONDecode(l:user_data_json, v:null)
|
||||
\ : v:null
|
||||
let l:user_data = type(l:user_data_json) is v:t_dict
|
||||
\ ? l:user_data_json
|
||||
\ : ale#util#FuzzyJSONDecode(l:user_data_json, {})
|
||||
|
||||
if type(l:user_data) isnot v:t_dict
|
||||
\|| get(l:user_data, '_ale_completion_item', 0) isnot 1
|
||||
if !has_key(l:user_data, '_ale_completion_item')
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -246,6 +246,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
\ 'description': 'Fix Go files imports with goimports.',
|
||||
\ },
|
||||
\ 'golines': {
|
||||
\ 'function': 'ale#fixers#golines#Fix',
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
\ 'description': 'Fix Go file long lines with golines',
|
||||
\ },
|
||||
\ 'gomod': {
|
||||
\ 'function': 'ale#fixers#gomod#Fix',
|
||||
\ 'suggested_filetypes': ['gomod'],
|
||||
@ -301,6 +306,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with stylish-haskell.',
|
||||
\ },
|
||||
\ 'purs-tidy': {
|
||||
\ 'function': 'ale#fixers#purs_tidy#Fix',
|
||||
\ 'suggested_filetypes': ['purescript'],
|
||||
\ 'description': 'Format PureScript files with purs-tidy.',
|
||||
\ },
|
||||
\ 'purty': {
|
||||
\ 'function': 'ale#fixers#purty#Fix',
|
||||
\ 'suggested_filetypes': ['purescript'],
|
||||
@ -386,6 +396,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dart format.',
|
||||
\ },
|
||||
\ 'dotnet-format': {
|
||||
\ 'function': 'ale#fixers#dotnet_format#Fix',
|
||||
\ 'suggested_filetypes': ['cs'],
|
||||
\ 'description': 'Fix C# files with dotnet format.',
|
||||
\ },
|
||||
\ 'xmllint': {
|
||||
\ 'function': 'ale#fixers#xmllint#Fix',
|
||||
\ 'suggested_filetypes': ['xml'],
|
||||
|
@ -1,14 +1,11 @@
|
||||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall’s built-in formatter
|
||||
"
|
||||
function! ale#fixers#dhall_format#Fix(buffer) abort
|
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
|
||||
let l:command = l:executable
|
||||
\ . ' format'
|
||||
\ . ' --inplace %t'
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': l:executable
|
||||
\ . ' format'
|
||||
\}
|
||||
endfunction
|
||||
|
@ -1,18 +1,14 @@
|
||||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall’s package freezing
|
||||
|
||||
call ale#Set('dhall_freeze_options', '')
|
||||
|
||||
function! ale#fixers#dhall_freeze#Freeze(buffer) abort
|
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
|
||||
let l:command = l:executable
|
||||
\ . ' freeze'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
|
||||
\ . ' --inplace %t'
|
||||
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': l:executable
|
||||
\ . ' freeze'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
|
||||
\}
|
||||
endfunction
|
||||
|
@ -1,14 +1,11 @@
|
||||
" Author: toastal <toastal@protonmail.com>
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Dhall’s built-in linter/formatter
|
||||
|
||||
function! ale#fixers#dhall_lint#Fix(buffer) abort
|
||||
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
|
||||
let l:command = l:executable
|
||||
\ . ' lint'
|
||||
\ . ' --inplace %t'
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': l:executable
|
||||
\ . ' lint'
|
||||
\}
|
||||
endfunction
|
||||
|
18
sources_non_forked/ale/autoload/ale/fixers/dotnet_format.vim
Normal file
18
sources_non_forked/ale/autoload/ale/fixers/dotnet_format.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: ghsang <gwonhyuksang@gmail.com>
|
||||
" Description: Integration of dotnet format with ALE.
|
||||
|
||||
call ale#Set('cs_dotnet_format_executable', 'dotnet')
|
||||
call ale#Set('cs_dotnet_format_options', '')
|
||||
|
||||
function! ale#fixers#dotnet_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --folder --include %t "$(dirname %t)"',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
21
sources_non_forked/ale/autoload/ale/fixers/golines.vim
Normal file
21
sources_non_forked/ale/autoload/ale/fixers/golines.vim
Normal file
@ -0,0 +1,21 @@
|
||||
" Author Pig Frown <pigfrown@protonmail.com>
|
||||
" Description: Fix Go files long lines with golines"
|
||||
|
||||
call ale#Set('go_golines_executable', 'golines')
|
||||
|
||||
call ale#Set('go_golines_options', '')
|
||||
|
||||
function! ale#fixers#golines#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'go_golines_executable')
|
||||
let l:options = ale#Var(a:buffer, 'go_golines_options')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': l:env . ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
@ -5,6 +5,7 @@ call ale#Set('python_isort_executable', 'isort')
|
||||
call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_isort_options', '')
|
||||
call ale#Set('python_isort_auto_pipenv', 0)
|
||||
call ale#Set('python_isort_auto_poetry', 0)
|
||||
|
||||
function! ale#fixers#isort#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv'))
|
||||
@ -12,24 +13,34 @@ function! ale#fixers#isort#GetExecutable(buffer) abort
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_isort_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#isort#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'python_isort_options')
|
||||
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run isort'
|
||||
\ : ''
|
||||
let l:cmd = [ale#Escape(l:executable)]
|
||||
|
||||
if !executable(l:executable) && l:executable isnot# 'pipenv'
|
||||
return 0
|
||||
if l:executable =~? 'pipenv\|poetry$'
|
||||
call extend(l:cmd, ['run', 'isort'])
|
||||
endif
|
||||
|
||||
call add(l:cmd, '--filename %s')
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_isort_options')
|
||||
|
||||
if !empty(l:options)
|
||||
call add(l:cmd, l:options)
|
||||
endif
|
||||
|
||||
call add(l:cmd, '-')
|
||||
|
||||
return {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad('--filename %s')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
|
||||
\ 'command': join(l:cmd, ' ')
|
||||
\}
|
||||
endfunction
|
||||
|
24
sources_non_forked/ale/autoload/ale/fixers/purs_tidy.vim
Normal file
24
sources_non_forked/ale/autoload/ale/fixers/purs_tidy.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Author: toastal <toastal@posteo.net>
|
||||
" Description: Integration of purs-tidy with ALE.
|
||||
|
||||
call ale#Set('purescript_tidy_executable', 'purs-tidy')
|
||||
call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('purescript_tidy_options', '')
|
||||
|
||||
function! ale#fixers#purs_tidy#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [
|
||||
\ 'node_modules/purescript-tidy/bin/index.js',
|
||||
\ 'node_modules/.bin/purs-tidy',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#purs_tidy#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'purescript_tidy_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . ale#Pad(l:options)
|
||||
\}
|
||||
endfunction
|
@ -43,21 +43,25 @@ endfunction
|
||||
function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
"test.cpp:974:6: error: Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
|
||||
"test.cpp:974:6: error:inconclusive Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
|
||||
" n[3]=3;
|
||||
" ^
|
||||
let l:pattern = '\v^(\f+):(\d+):(\d+): (\w+): (.*) \[(\w+)\]\'
|
||||
"" OR if cppcheck doesn't support {column} or {inconclusive:text}:
|
||||
"test.cpp:974:{column}: error:{inconclusive:inconclusive} Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
|
||||
" n[3]=3;
|
||||
" ^
|
||||
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(\w+)\]\'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]),
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'sub_type': l:match[4] is# 'style' ? 'style' : '',
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6]
|
||||
\ 'text': l:match[6],
|
||||
\ 'code': l:match[7]
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
@ -45,7 +45,9 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
|
||||
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
|
||||
call balloon_show(a:response.body.displayString)
|
||||
elseif get(l:options, 'truncated_echo', 0)
|
||||
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
|
||||
if !empty(a:response.body.displayString)
|
||||
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
|
||||
endif
|
||||
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
|
||||
call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), {
|
||||
\ 'filetype': 'ale-preview.message',
|
||||
|
@ -271,6 +271,30 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort
|
||||
call ale#lsp#NotifyForChanges(l:conn_id, l:buffer)
|
||||
endif
|
||||
|
||||
" Tell the relevant buffer that the LSP has started via an autocmd.
|
||||
if l:buffer > 0
|
||||
if l:buffer == bufnr('')
|
||||
silent doautocmd <nomodeline> User ALELSPStarted
|
||||
else
|
||||
execute 'augroup ALELSPStartedGroup' . l:buffer
|
||||
autocmd!
|
||||
|
||||
execute printf(
|
||||
\ 'autocmd BufEnter <buffer=%d>'
|
||||
\ . ' doautocmd <nomodeline> User ALELSPStarted',
|
||||
\ l:buffer
|
||||
\)
|
||||
|
||||
" Replicate ++once behavior for backwards compatibility.
|
||||
execute printf(
|
||||
\ 'autocmd BufEnter <buffer=%d>'
|
||||
\ . ' autocmd! ALELSPStartedGroup%d',
|
||||
\ l:buffer, l:buffer
|
||||
\)
|
||||
augroup END
|
||||
endif
|
||||
endif
|
||||
|
||||
call a:Callback(a:linter, a:details)
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user