mirror of
https://github.com/amix/vimrc
synced 2025-06-23 06:35:01 +08:00
Updated plugins
This commit is contained in:
@ -137,9 +137,7 @@ function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
function! ale_linters#elm#make#GetPackageFile(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
if empty(l:elm_json)
|
||||
@ -147,10 +145,55 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
endif
|
||||
|
||||
return l:elm_json
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#IsVersionGte19(buffer) abort
|
||||
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||
|
||||
if l:elm_json =~# '-package'
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetRootDir(buffer) abort
|
||||
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||
|
||||
if empty(l:elm_json)
|
||||
return ''
|
||||
else
|
||||
return fnamemodify(l:elm_json, ':p:h')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#IsTest(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
if empty(l:root_dir)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:tests_dir = join([l:root_dir, 'tests', ''], has('win32') ? '\' : '/')
|
||||
|
||||
let l:buffer_path = fnamemodify(bufname(a:buffer), ':p')
|
||||
|
||||
if stridx(l:buffer_path, l:tests_dir) == 0
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
if empty(l:root_dir)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
let l:root_dir = fnamemodify(l:elm_json, ':p:h')
|
||||
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
||||
endif
|
||||
|
||||
@ -161,11 +204,24 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
return l:dir_set_cmd . '%e make --report=json --output=/dev/null %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
let l:is_test = ale_linters#elm#make#IsTest(a:buffer)
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
|
||||
if l:is_test && l:is_v19
|
||||
return ale#node#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'elm_make',
|
||||
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
|
||||
\ )
|
||||
else
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('elm_make', [
|
||||
\ 'node_modules/.bin/elm',
|
||||
\ ]),
|
||||
\ 'executable_callback': 'ale_linters#elm#make#GetExecutable',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
|
29
sources_non_forked/ale/ale_linters/go/bingo.vim
Normal file
29
sources_non_forked/ale/ale_linters/go/bingo.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" Author: Jerko Steiner <https://github.com/jeremija>
|
||||
" Description: https://github.com/saibing/bingo
|
||||
|
||||
call ale#Set('go_bingo_executable', 'bingo')
|
||||
call ale#Set('go_bingo_options', '--mode stdio')
|
||||
|
||||
function! ale_linters#go#bingo#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#bingo#FindProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:mods = ':h'
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
let l:mods = ':h:h'
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'bingo',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('go_bingo_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#bingo#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#go#bingo#FindProjectRoot',
|
||||
\})
|
@ -1,9 +1,15 @@
|
||||
" Author: Michiel Westerbeek <happylinks@gmail.com>
|
||||
" Description: Linter for GraphQL Schemas
|
||||
|
||||
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'gqlint'
|
||||
\ . ' --reporter=simple %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'gqlint',
|
||||
\ 'executable': 'gqlint',
|
||||
\ 'command': 'gqlint --reporter=simple %t',
|
||||
\ 'command_callback': 'ale_linters#graphql#gqlint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
|
@ -18,7 +18,7 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||
let l:pattern = '\(..\{-}\) at \(..\{-}\) line \(\d\+\)'
|
||||
let l:output = []
|
||||
let l:basename = expand('#' . a:buffer . ':t')
|
||||
|
||||
|
@ -48,26 +48,38 @@ endfunction
|
||||
|
||||
function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
||||
let l:cflags_list = []
|
||||
let l:previous_options = []
|
||||
let l:previous_options = ''
|
||||
|
||||
let l:split_lines = split(a:cflag_line, '-')
|
||||
let l:split_lines = split(a:cflag_line, ' ')
|
||||
let l:option_index = 0
|
||||
|
||||
while l:option_index < len(l:split_lines)
|
||||
let l:option = l:split_lines[l:option_index]
|
||||
let l:option = l:previous_options . l:split_lines[l:option_index]
|
||||
let l:option_index = l:option_index + 1
|
||||
call add(l:previous_options, l:option)
|
||||
" Check if cflag contained a '-' and should not have been splitted
|
||||
let l:option_list = split(l:option, '\zs')
|
||||
|
||||
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' && l:option_index < len(l:split_lines)
|
||||
" Check if cflag contained an unmatched characters and should not have been splitted
|
||||
let l:option_special = substitute(l:option, '\\"', '', 'g')
|
||||
let l:option_special = substitute(l:option_special, '[^"''()`]', '', 'g')
|
||||
let l:option_special = substitute(l:option_special, '""', '', 'g')
|
||||
let l:option_special = substitute(l:option_special, '''''', '', 'g')
|
||||
let l:option_special = substitute(l:option_special, '``', '', 'g')
|
||||
let l:option_special = substitute(l:option_special, '((', '(', 'g')
|
||||
let l:option_special = substitute(l:option_special, '))', ')', 'g')
|
||||
let l:option_special = substitute(l:option_special, '()', '', 'g')
|
||||
|
||||
if len(l:option_special) > 0 && l:option_index < len(l:split_lines)
|
||||
let l:previous_options = l:option . ' '
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:option = join(l:previous_options, '-')
|
||||
let l:previous_options = []
|
||||
" Check if there was spaces after -D/-I and the flag should not have been splitted
|
||||
if l:option is# '-D' || l:option is# '-I'
|
||||
let l:previous_options = l:option
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:previous_options = ''
|
||||
|
||||
let l:option = '-' . substitute(l:option, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
|
||||
" Fix relative paths if needed
|
||||
if stridx(l:option, '-I') >= 0 &&
|
||||
@ -145,15 +157,17 @@ if !exists('s:compile_commands_cache')
|
||||
let s:compile_commands_cache = {}
|
||||
endif
|
||||
|
||||
function! s:GetListFromCompileCommandsFile(compile_commands_file) abort
|
||||
function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort
|
||||
let l:empty = [{}, {}]
|
||||
|
||||
if empty(a:compile_commands_file)
|
||||
return []
|
||||
return l:empty
|
||||
endif
|
||||
|
||||
let l:time = getftime(a:compile_commands_file)
|
||||
|
||||
if l:time < 0
|
||||
return []
|
||||
return l:empty
|
||||
endif
|
||||
|
||||
let l:key = a:compile_commands_file . ':' . l:time
|
||||
@ -162,21 +176,36 @@ function! s:GetListFromCompileCommandsFile(compile_commands_file) abort
|
||||
return s:compile_commands_cache[l:key]
|
||||
endif
|
||||
|
||||
let l:data = []
|
||||
silent! let l:data = json_decode(join(readfile(a:compile_commands_file), ''))
|
||||
let l:raw_data = []
|
||||
silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), ''))
|
||||
|
||||
if !empty(l:data)
|
||||
let s:compile_commands_cache[l:key] = l:data
|
||||
let l:file_lookup = {}
|
||||
let l:dir_lookup = {}
|
||||
|
||||
return l:data
|
||||
for l:entry in l:raw_data
|
||||
let l:basename = tolower(fnamemodify(l:entry.file, ':t'))
|
||||
let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry]
|
||||
|
||||
let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t'))
|
||||
let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:basename, []) + [l:entry]
|
||||
endfor
|
||||
|
||||
if !empty(l:file_lookup) && !empty(l:dir_lookup)
|
||||
let l:result = [l:file_lookup, l:dir_lookup]
|
||||
let s:compile_commands_cache[l:key] = l:result
|
||||
|
||||
return l:result
|
||||
endif
|
||||
|
||||
return []
|
||||
return l:empty
|
||||
endfunction
|
||||
|
||||
function! ale#c#ParseCompileCommandsFlags(buffer, dir, json_list) abort
|
||||
function! ale#c#ParseCompileCommandsFlags(buffer, dir, file_lookup, dir_lookup) abort
|
||||
" Search for an exact file match first.
|
||||
for l:item in a:json_list
|
||||
let l:basename = tolower(expand('#' . a:buffer . ':t'))
|
||||
let l:file_list = get(a:file_lookup, l:basename, [])
|
||||
|
||||
for l:item in l:file_list
|
||||
if bufnr(l:item.file) is a:buffer
|
||||
return ale#c#ParseCFlags(a:dir, l:item.command)
|
||||
endif
|
||||
@ -185,7 +214,10 @@ function! ale#c#ParseCompileCommandsFlags(buffer, dir, json_list) abort
|
||||
" Look for any file in the same directory if we can't find an exact match.
|
||||
let l:dir = ale#path#Simplify(expand('#' . a:buffer . ':p:h'))
|
||||
|
||||
for l:item in a:json_list
|
||||
let l:dirbasename = tolower(expand('#' . a:buffer . ':p:h:t'))
|
||||
let l:dir_list = get(a:dir_lookup, l:dirbasename, [])
|
||||
|
||||
for l:item in l:dir_list
|
||||
if ale#path#Simplify(fnamemodify(l:item.file, ':h')) is? l:dir
|
||||
return ale#c#ParseCFlags(a:dir, l:item.command)
|
||||
endif
|
||||
@ -196,9 +228,11 @@ endfunction
|
||||
|
||||
function! ale#c#FlagsFromCompileCommands(buffer, compile_commands_file) abort
|
||||
let l:dir = ale#path#Dirname(a:compile_commands_file)
|
||||
let l:json_list = s:GetListFromCompileCommandsFile(a:compile_commands_file)
|
||||
let l:lookups = s:GetLookupFromCompileCommandsFile(a:compile_commands_file)
|
||||
let l:file_lookup = l:lookups[0]
|
||||
let l:dir_lookup = l:lookups[1]
|
||||
|
||||
return ale#c#ParseCompileCommandsFlags(a:buffer, l:dir, l:json_list)
|
||||
return ale#c#ParseCompileCommandsFlags(a:buffer, l:dir, l:file_lookup, l:dir_lookup)
|
||||
endfunction
|
||||
|
||||
function! ale#c#GetCFlags(buffer, output) abort
|
||||
|
@ -509,6 +509,12 @@ function! ale#completion#GetCompletions() abort
|
||||
return
|
||||
endif
|
||||
|
||||
call ale#completion#AlwaysGetCompletions()
|
||||
endfunction
|
||||
|
||||
" This function can be used to manually trigger autocomplete, even when
|
||||
" g:ale_completion_enabled is set to false
|
||||
function! ale#completion#AlwaysGetCompletions() abort
|
||||
let [l:line, l:column] = getcurpos()[1:2]
|
||||
|
||||
let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column)
|
||||
|
@ -86,7 +86,7 @@ function! s:OnReady(linter, lsp_details, line, column, options, ...) abort
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message)
|
||||
|
||||
let s:go_to_definition_map[l:request_id] = {
|
||||
\ 'open_in_tab': get(a:options, 'open_in_tab', 0),
|
||||
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
|
@ -315,10 +315,10 @@ function! s:RunFixer(options) abort
|
||||
\ ? call(l:Function, [l:buffer, a:options.output])
|
||||
\ : call(l:Function, [l:buffer, a:options.output, copy(l:input)])
|
||||
else
|
||||
" Chained commands accept (buffer, [input])
|
||||
" Chained commands accept (buffer, [done, input])
|
||||
let l:result = ale#util#FunctionArgCount(l:Function) == 1
|
||||
\ ? call(l:Function, [l:buffer])
|
||||
\ : call(l:Function, [l:buffer, copy(l:input)])
|
||||
\ : call(l:Function, [l:buffer, v:null, copy(l:input)])
|
||||
endif
|
||||
|
||||
if type(l:result) is v:t_number && l:result == 0
|
||||
|
@ -4,22 +4,28 @@
|
||||
call ale#Set('python_black_executable', 'black')
|
||||
call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_black_options', '')
|
||||
call ale#Set('python_black_auto_pipenv', 0)
|
||||
|
||||
function! ale#fixers#black#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_black_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#black#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'python_black',
|
||||
\ ['black'],
|
||||
\)
|
||||
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run black'
|
||||
\ : ''
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_black_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -',
|
||||
\}
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic functions for fixing files with.
|
||||
|
||||
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
|
||||
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, done, lines) abort
|
||||
let l:end_index = len(a:lines) - 1
|
||||
|
||||
while l:end_index > 0 && empty(a:lines[l:end_index])
|
||||
@ -12,7 +12,7 @@ function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
" Remove all whitespaces at the end of lines
|
||||
function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort
|
||||
function! ale#fixers#generic#TrimWhitespace(buffer, done, lines) abort
|
||||
let l:index = 0
|
||||
let l:lines_new = range(len(a:lines))
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Description: Generic fixer functions for Python.
|
||||
|
||||
" Add blank lines before control statements.
|
||||
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, lines) abort
|
||||
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, done, lines) abort
|
||||
let l:new_lines = []
|
||||
let l:last_indent_size = 0
|
||||
let l:last_line_is_blank = 0
|
||||
@ -41,7 +41,7 @@ endfunction
|
||||
|
||||
" This function breaks up long lines so that autopep8 or other tools can
|
||||
" fix the badly-indented code which is produced as a result.
|
||||
function! ale#fixers#generic_python#BreakUpLongLines(buffer, lines) abort
|
||||
function! ale#fixers#generic_python#BreakUpLongLines(buffer, done, lines) abort
|
||||
" Default to a maximum line length of 79
|
||||
let l:max_line_length = 79
|
||||
let l:conf = ale#path#FindNearestFile(a:buffer, 'setup.cfg')
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic fixer functions for Vim help documents.
|
||||
|
||||
function! ale#fixers#help#AlignTags(buffer, lines) abort
|
||||
function! ale#fixers#help#AlignTags(buffer, done, lines) abort
|
||||
let l:new_lines = []
|
||||
|
||||
for l:line in a:lines
|
||||
|
@ -14,9 +14,11 @@ endfunction
|
||||
|
||||
function! ale#fixers#standard#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
@ -173,10 +173,6 @@ endfunction
|
||||
function! ale#job#PrepareCommand(buffer, command) abort
|
||||
let l:wrapper = ale#Var(a:buffer, 'command_wrapper')
|
||||
|
||||
let l:command = !empty(l:wrapper)
|
||||
\ ? s:PrepareWrappedCommand(l:wrapper, a:command)
|
||||
\ : a:command
|
||||
|
||||
" The command will be executed in a subshell. This fixes a number of
|
||||
" issues, including reading the PATH variables correctly, %PATHEXT%
|
||||
" expansion on Windows, etc.
|
||||
@ -184,6 +180,17 @@ function! ale#job#PrepareCommand(buffer, command) abort
|
||||
" NeoVim handles this issue automatically if the command is a String,
|
||||
" but we'll do this explicitly, so we use the same exact command for both
|
||||
" versions.
|
||||
let l:command = !empty(l:wrapper)
|
||||
\ ? s:PrepareWrappedCommand(l:wrapper, a:command)
|
||||
\ : a:command
|
||||
|
||||
" If a custom shell is specified, use that.
|
||||
if exists('g:ale_shell')
|
||||
let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
|
||||
|
||||
return split(g:ale_shell) + split(l:shell_arguments) + [l:command]
|
||||
endif
|
||||
|
||||
if has('win32')
|
||||
return 'cmd /s/c "' . l:command . '"'
|
||||
endif
|
||||
|
@ -27,6 +27,7 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort
|
||||
\ 'filename': l:response_item.file,
|
||||
\ 'line': l:response_item.start.line,
|
||||
\ 'column': l:response_item.start.offset,
|
||||
\ 'match': substitute(l:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', ''),
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
@ -87,12 +87,25 @@ function! ale#util#GetFunction(string_or_ref) abort
|
||||
return a:string_or_ref
|
||||
endfunction
|
||||
|
||||
" Open the file (at the given line).
|
||||
" options['open_in'] can be:
|
||||
" current-buffer (default)
|
||||
" tab
|
||||
" vertical-split
|
||||
" horizontal-split
|
||||
function! ale#util#Open(filename, line, column, options) abort
|
||||
if get(a:options, 'open_in_tab', 0)
|
||||
call ale#util#Execute('tabedit +' . a:line . ' ' . fnameescape(a:filename))
|
||||
let l:open_in = get(a:options, 'open_in', 'current-buffer')
|
||||
let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename)
|
||||
|
||||
if l:open_in is# 'tab'
|
||||
call ale#util#Execute('tabedit ' . l:args_to_open)
|
||||
elseif l:open_in is# 'horizontal-split'
|
||||
call ale#util#Execute('split ' . l:args_to_open)
|
||||
elseif l:open_in is# 'vertical-split'
|
||||
call ale#util#Execute('vsplit ' . l:args_to_open)
|
||||
elseif bufnr(a:filename) isnot bufnr('')
|
||||
" Open another file only if we need to.
|
||||
call ale#util#Execute('edit +' . a:line . ' ' . fnameescape(a:filename))
|
||||
call ale#util#Execute('edit ' . l:args_to_open)
|
||||
else
|
||||
normal! m`
|
||||
endif
|
||||
|
@ -7,7 +7,7 @@ Integration Information
|
||||
|
||||
The `gometalinter` linter is disabled by default. ALE enables `gofmt`,
|
||||
`golint` and `go vet` by default. It also supports `staticcheck`, `go
|
||||
build`, `gosimple`, and `golangserver`.
|
||||
build`, `gosimple`, `golangserver`.
|
||||
|
||||
To enable `gometalinter`, update |g:ale_linters| as appropriate:
|
||||
>
|
||||
@ -195,5 +195,21 @@ g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package*
|
||||
current file.
|
||||
|
||||
|
||||
===============================================================================
|
||||
bingo *ale-go-bingo*
|
||||
|
||||
g:ale_go_bingo_executable *g:ale_go_bingo_executable*
|
||||
*b:ale_go_bingo_executable*
|
||||
Type: |String|
|
||||
Default: `'go-bingo'`
|
||||
|
||||
Location of the go-bingo binary file.
|
||||
|
||||
g:ale_go_bingo_options *g:ale_go_bingo_options*
|
||||
*b:ale_go_bingo_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
@ -75,7 +75,7 @@ g:ale_python_black_executable *g:ale_python_black_executable*
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
autopep8
|
||||
|
||||
g:ale_python_black_options *g:ale_python_black_options*
|
||||
*b:ale_python_black_options*
|
||||
Type: |String|
|
||||
@ -92,6 +92,15 @@ g:ale_python_black_use_global *g:ale_python_black_use_global*
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv*
|
||||
*b:ale_python_black_auto_pipenv*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
|
||||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
===============================================================================
|
||||
flake8 *ale-python-flake8*
|
||||
|
||||
|
@ -118,6 +118,7 @@ CONTENTS *ale-contents*
|
||||
staticcheck.........................|ale-go-staticcheck|
|
||||
golangserver........................|ale-go-golangserver|
|
||||
golangci-lint.......................|ale-go-golangci-lint|
|
||||
bingo...............................|ale-go-bingo|
|
||||
graphql...............................|ale-graphql-options|
|
||||
eslint..............................|ale-graphql-eslint|
|
||||
gqlint..............................|ale-graphql-gqlint|
|
||||
@ -438,7 +439,7 @@ Notes:
|
||||
* FusionScript: `fusion-lint`
|
||||
* Git Commit Messages: `gitlint`
|
||||
* GLSL: glslang, `glslls`
|
||||
* Go: `gofmt`, `goimports`, `go mod`!!, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!!
|
||||
* Go: `gofmt`, `goimports`, `go mod`!!, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!!, `bingo`
|
||||
* GraphQL: `eslint`, `gqlint`, `prettier`
|
||||
* Hack: `hack`, `hackfmt`, `hhast`
|
||||
* Haml: `haml-lint`
|
||||
@ -675,10 +676,14 @@ The values for `g:ale_fixers` can be a list of |String|, |Funcref|, or
|
||||
for a function set in the ALE fixer registry.
|
||||
|
||||
Each function for fixing errors must accept either one argument `(buffer)` or
|
||||
two arguments `(buffer, lines)`, representing the buffer being fixed and the
|
||||
lines to fix. The functions must return either `0`, for changing nothing, a
|
||||
|List| for new lines to set, or a |Dictionary| for describing a command to be
|
||||
run in the background.
|
||||
three arguments `(buffer, done, lines)`, representing the buffer being fixed,
|
||||
a function to call with results, and the lines to fix. The functions must
|
||||
return either `0`, for changing nothing, a |List| for new lines to set, a
|
||||
|Dictionary| for describing a command to be run in the background, or `v:true`
|
||||
for indicating that results will be provided asynchronously via the `done`
|
||||
callback.
|
||||
|
||||
NOTE: The `done` function has not been implemented yet.
|
||||
|
||||
Functions receiving a variable number of arguments will not receive the second
|
||||
argument `lines`. Functions should name two arguments if the `lines` argument
|
||||
@ -816,6 +821,9 @@ with |g:ale_completion_max_suggestions|.
|
||||
If you don't like some of the suggestions you see, you can filter them out
|
||||
with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|.
|
||||
|
||||
The |ALEComplete| command can be used to show completion suggestions manually,
|
||||
even when |g:ale_completion_enabled| is set to `0`.
|
||||
|
||||
*ale-completion-completopt-bug*
|
||||
|
||||
ALE implements completion as you type by temporarily adjusting |completeopt|
|
||||
@ -836,6 +844,8 @@ information returned by LSP servers. The following commands are supported:
|
||||
|
||||
|ALEGoToDefinition| - Open the definition of the symbol under the cursor.
|
||||
|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab.
|
||||
|ALEGoToDefinitionInSplit| - The same, but in a new split.
|
||||
|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -1787,6 +1797,33 @@ g:ale_set_signs *g:ale_set_signs*
|
||||
To limit the number of signs ALE will set, see |g:ale_max_signs|.
|
||||
|
||||
|
||||
g:ale_shell *g:ale_shell*
|
||||
|
||||
Type: |String|
|
||||
Default: not set
|
||||
|
||||
Override the shell used by ALE for executing commands. ALE uses 'shell' by
|
||||
default, but falls back in `/bin/sh` if the default shell looks like `fish`
|
||||
or `pwsh`, which are not compatible with all of the commands run by ALE. The
|
||||
shell specified with this option will be used even if it might not work in
|
||||
all cases.
|
||||
|
||||
For Windows, ALE uses `cmd` when this option isn't set. Setting this option
|
||||
will apply shell escaping to the command string, even on Windows.
|
||||
|
||||
NOTE: Consider setting |g:ale_shell_arguments| if this option is defined.
|
||||
|
||||
|
||||
g:ale_shell_arguments *g:ale_shell_arguments*
|
||||
|
||||
Type: |String|
|
||||
Default: not set
|
||||
|
||||
This option specifies the arguments to use for executing a command with a
|
||||
custom shell, per |g:ale_shell|. If this option is not set, 'shellcmdflag'
|
||||
will be used instead.
|
||||
|
||||
|
||||
g:ale_sign_column_always *g:ale_sign_column_always*
|
||||
|
||||
Type: |Number|
|
||||
@ -2202,6 +2239,17 @@ ALE will use to search for Python executables.
|
||||
===============================================================================
|
||||
8. Commands/Keybinds *ale-commands*
|
||||
|
||||
ALEComplete *ALEComplete*
|
||||
|
||||
Manually trigger LSP autocomplete and show the menu. Works only when called
|
||||
from insert mode. >
|
||||
|
||||
inoremap <silent> <C-Space> <C-\><C-O>:AleComplete<CR>
|
||||
<
|
||||
A plug mapping `<Plug>(ale_complete)` is defined for this command. >
|
||||
|
||||
imap <C-Space> <Plug>(ale_complete)
|
||||
<
|
||||
ALEDocumentation *ALEDocumentation*
|
||||
|
||||
Similar to the |ALEHover| command, retrieve documentation information for
|
||||
@ -2262,6 +2310,22 @@ ALEGoToDefinitionInTab *ALEGoToDefinitionInTab*
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit*
|
||||
|
||||
The same as |ALEGoToDefinition|, but opens results in a new split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition_in_split)` is defined for this
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit*
|
||||
|
||||
The same as |ALEGoToDefinition|, but opens results in a new vertical split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition_in_vsplit)` is defined for this
|
||||
command.
|
||||
|
||||
|
||||
ALEHover *ALEHover*
|
||||
|
||||
Print brief information about the symbol under the cursor, taken from any
|
||||
|
@ -188,7 +188,9 @@ command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
|
||||
|
||||
" Go to definition for tsserver and LSP
|
||||
command! -bar ALEGoToDefinition :call ale#definition#GoTo({})
|
||||
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1})
|
||||
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'})
|
||||
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'})
|
||||
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'})
|
||||
|
||||
" Find references for tsserver and LSP
|
||||
command! -bar ALEFindReferences :call ale#references#Find()
|
||||
@ -202,6 +204,8 @@ command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor()
|
||||
" Search for appearances of a symbol, such as a type name or function name.
|
||||
command! -nargs=1 ALESymbolSearch :call ale#symbol#Search(<q-args>)
|
||||
|
||||
command! -bar ALEComplete :call ale#completion#AlwaysGetCompletions()
|
||||
|
||||
" <Plug> mappings for commands
|
||||
nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return>
|
||||
nnoremap <silent> <Plug>(ale_previous_wrap) :ALEPreviousWrap<Return>
|
||||
@ -222,9 +226,12 @@ nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
|
||||
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
|
||||
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
|
||||
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>
|
||||
inoremap <silent> <Plug>(ale_complete) <C-\><C-O>:ALEComplete<Return>
|
||||
|
||||
" Set up autocmd groups now.
|
||||
call ale#events#Init()
|
||||
|
Reference in New Issue
Block a user