Updated vim plugins
This commit is contained in:
parent
d2d303593e
commit
e99e9e9c3e
137 changed files with 2129 additions and 846 deletions
|
@ -1,7 +1,8 @@
|
|||
" Author: Jon Parise <jon@indelible.org>
|
||||
" Description: elixir-ls integration (https://github.com/JakeBecker/elixir-ls)
|
||||
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
||||
|
||||
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
||||
call ale#Set('elixir_elixir_ls_config', {})
|
||||
|
||||
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
|
||||
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
|
||||
|
@ -15,5 +16,6 @@ call ale#linter#Define('elixir', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
|
||||
\ 'project_root_callback': 'ale#handlers#elixir#FindMixProjectRoot',
|
||||
\ 'project_root_callback': 'ale#handlers#elixir#FindMixUmbrellaRoot',
|
||||
\ 'lsp_config_callback': ale#VarFunc('elixir_elixir_ls_config'),
|
||||
\})
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: golint for Go files
|
||||
|
||||
call ale#Set('go_golint_executable', 'golint')
|
||||
call ale#Set('go_golint_options', '')
|
||||
|
||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': 'golint',
|
||||
\ 'command': 'golint %t',
|
||||
\ 'executable_callback': ale#VarFunc('go_golint_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#golint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
|
||||
" Description: haml-lint for Haml files
|
||||
|
||||
call ale#Set('haml_hamllint_executable', 'haml-lint')
|
||||
|
||||
function! ale_linters#haml#hamllint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'haml_hamllint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haml#hamllint#GetCommand(buffer) abort
|
||||
let l:prefix = ''
|
||||
|
||||
|
@ -21,7 +27,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort
|
|||
endif
|
||||
|
||||
return (!empty(l:prefix) ? l:prefix . ' ' : '')
|
||||
\ . 'haml-lint'
|
||||
\ . ale_linters#haml#hamllint#GetExecutable(a:buffer)
|
||||
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
@ -45,7 +51,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('haml', {
|
||||
\ 'name': 'hamllint',
|
||||
\ 'executable': 'haml-lint',
|
||||
\ 'executable_callback': 'ale_linters#haml#hamllint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
|
||||
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||
\})
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
" Description: checkstyle for Java files
|
||||
|
||||
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
|
||||
let l:output = []
|
||||
|
||||
" modern checkstyle versions
|
||||
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
||||
|
@ -15,13 +17,24 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
|||
\})
|
||||
endfor
|
||||
|
||||
" old checkstyle versions
|
||||
let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#checkstyle#GetCommand(buffer) abort
|
||||
return 'checkstyle '
|
||||
\ . ale#Var(a:buffer, 'java_checkstyle_options')
|
||||
\ . ' %t'
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
if !exists('g:ale_java_checkstyle_options')
|
||||
|
@ -33,4 +46,5 @@ call ale#linter#Define('java', {
|
|||
\ 'executable': 'checkstyle',
|
||||
\ 'command_callback': 'ale_linters#java#checkstyle#GetCommand',
|
||||
\ 'callback': 'ale_linters#java#checkstyle#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
|
||||
|
||||
call ale#Set('java_javalsp_jar', 'javacs.jar')
|
||||
call ale#Set('java_javalsp_executable', 'java')
|
||||
|
||||
function! ale_linters#java#javalsp#Executable(buffer) abort
|
||||
return 'java'
|
||||
return ale#Var(a:buffer, 'java_javalsp_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javalsp#Command(buffer) abort
|
||||
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
|
||||
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
|
||||
|
||||
return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
|
||||
return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
" Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz>
|
||||
" Description: This file adds support for checking PHP with php-cli
|
||||
|
||||
call ale#Set('php_php_executable', 'php')
|
||||
|
||||
function! ale_linters#php#php#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
|
@ -30,8 +32,8 @@ endfunction
|
|||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'php',
|
||||
\ 'executable': 'php',
|
||||
\ 'executable_callback': ale#VarFunc('php_php_executable'),
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --',
|
||||
\ 'command': '%e -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --',
|
||||
\ 'callback': 'ale_linters#php#php#Handle',
|
||||
\})
|
||||
|
|
|
@ -6,15 +6,40 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta
|
|||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
|
||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer) abort
|
||||
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'php_phpstan_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpstan#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
|
||||
|
||||
" If we have previously stored the version number in a cache, then
|
||||
" don't look it up again.
|
||||
if ale#semver#HasVersion(l:executable)
|
||||
" Returning an empty string skips this command.
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:executable = ale#Escape(l:executable)
|
||||
|
||||
return l:executable . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer, version_output) abort
|
||||
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
||||
let l:configuration_option = !empty(l:configuration)
|
||||
\ ? ' -c ' . l:configuration
|
||||
\ : ''
|
||||
|
||||
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
let l:error_format = ale#semver#GTE(l:version, [0, 10, 3])
|
||||
\ ? ' --error-format raw'
|
||||
\ : ' --errorFormat raw'
|
||||
|
||||
return '%e analyze -l'
|
||||
\ . ale#Var(a:buffer, 'php_phpstan_level')
|
||||
\ . ' --errorFormat raw'
|
||||
\ . l:error_format
|
||||
\ . l:configuration_option
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
@ -40,7 +65,10 @@ endfunction
|
|||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpstan',
|
||||
\ 'executable_callback': ale#VarFunc('php_phpstan_executable'),
|
||||
\ 'command_callback': 'ale_linters#php#phpstan#GetCommand',
|
||||
\ 'executable_callback': 'ale_linters#php#phpstan#GetExecutable',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#php#phpstan#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#php#phpstan#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#php#phpstan#Handle',
|
||||
\})
|
||||
|
|
|
@ -110,6 +110,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
|||
let l:item = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'vcol': 1,
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:code,
|
||||
\ 'type': 'W',
|
||||
|
|
|
@ -13,36 +13,6 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
|||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:errors = json_decode(a:lines[0])
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = l:error['location']['column'] + 0
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['line'] + 0,
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rubocop#GetType(severity) abort
|
||||
if a:severity is? 'convention'
|
||||
\|| a:severity is? 'warning'
|
||||
|
@ -57,5 +27,5 @@ call ale#linter#Define('ruby', {
|
|||
\ 'name': 'rubocop',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
|
||||
\ 'callback': 'ale#ruby#HandleRubocopOutput',
|
||||
\})
|
||||
|
|
|
@ -1,9 +1,28 @@
|
|||
" Author: KabbAmine - https://github.com/KabbAmine,
|
||||
" Ben Falconer <ben@falconers.me.uk>
|
||||
" Author: sQVe - https://github.com/sQVe
|
||||
|
||||
call ale#Set('sass_sasslint_executable', 'sass-lint')
|
||||
call ale#Set('sass_sasslint_options', '')
|
||||
call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#sass#sasslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [
|
||||
\ 'node_modules/sass-lint/bin/sass-lint.js',
|
||||
\ 'node_modules/.bin/sass-lint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sass#sasslint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -v -q -f compact %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sass', {
|
||||
\ 'name': 'sasslint',
|
||||
\ 'executable': 'sass-lint',
|
||||
\ 'command_callback': 'ale#handlers#sasslint#GetCommand',
|
||||
\ 'executable_callback': 'ale_linters#sass#sasslint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
|
||||
" <ben@falconers.me.uk>
|
||||
" Author: sQVe - https://github.com/sQVe
|
||||
|
||||
call ale#Set('scss_sasslint_executable', 'sass-lint')
|
||||
call ale#Set('scss_sasslint_options', '')
|
||||
call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#scss#sasslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [
|
||||
\ 'node_modules/sass-lint/bin/sass-lint.js',
|
||||
\ 'node_modules/.bin/sass-lint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape('sass-lint')
|
||||
\ . ' -v'
|
||||
\ . ' -q'
|
||||
\ . ' -f compact'
|
||||
\ . ' %t'
|
||||
let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -v -q -f compact %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scss', {
|
||||
\ 'name': 'sasslint',
|
||||
\ 'executable': 'sass-lint',
|
||||
\ 'executable_callback': 'ale_linters#scss#sasslint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
" Author: David Mohundro <david@mohundro.com>
|
||||
" Author: David Mohundro <david@mohundro.com>, Gordon Fontenot <gordon@fonten.io>
|
||||
" Description: swiftlint for swift files
|
||||
|
||||
call ale#Set('swift_swiftlint_executable', 'swiftlint')
|
||||
call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [
|
||||
\ 'Pods/SwiftLint/swiftlint',
|
||||
\ 'ios/Pods/SwiftLint/swiftlint',
|
||||
\ 'swiftlint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#swift#swiftlint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#swift#swiftlint#GetExecutable(a:buffer)
|
||||
let l:args = 'lint --use-stdin'
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' ' .l:args
|
||||
endfunction
|
||||
|
||||
function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
|
||||
|
@ -8,10 +26,10 @@ function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
|||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
|
||||
if l:match[4] is# 'error'
|
||||
let l:item.type = 'E'
|
||||
|
@ -45,7 +63,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('swift', {
|
||||
\ 'name': 'swiftlint',
|
||||
\ 'executable': 'swiftlint',
|
||||
\ 'command': 'swiftlint lint --use-stdin',
|
||||
\ 'executable_callback': 'ale_linters#swift#swiftlint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#swift#swiftlint#GetCommand',
|
||||
\ 'callback': 'ale_linters#swift#swiftlint#Handle',
|
||||
\})
|
||||
|
|
|
@ -8,20 +8,26 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
|
|||
"
|
||||
" "book.tex", line 37: possible unwanted space at "{"
|
||||
" "book.tex", line 38: missing `\ ' after "etc."
|
||||
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
|
||||
let l:pattern = '^"\(.\+\)", line \(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" lacheck follows `\input{}` commands. If the cwd is not the same as the
|
||||
" file in the buffer then it will fail to find the inputed items. We do not
|
||||
" want warnings from those items anyway
|
||||
if !empty(matchstr(l:match[2], '^Could not open ".\+"$'))
|
||||
if !empty(matchstr(l:match[3], '^Could not open ".\+"$'))
|
||||
continue
|
||||
endif
|
||||
|
||||
" lacheck follows `\input{}` commands. We are only interested in
|
||||
" reporting errors for the current buffer only.
|
||||
if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t')))
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
|
|
@ -50,12 +50,17 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
|||
let l:cflags_list = []
|
||||
let l:previous_options = []
|
||||
|
||||
for l:option in 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_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# ' '
|
||||
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' && l:option_index < len(l:split_lines)
|
||||
continue
|
||||
endif
|
||||
|
||||
|
@ -81,7 +86,7 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
|||
call add(l:cflags_list, l:option)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endwhile
|
||||
|
||||
return join(l:cflags_list, ' ')
|
||||
endfunction
|
||||
|
|
|
@ -52,16 +52,6 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:FindItemAtCursor(buffer) abort
|
||||
let l:info = get(g:ale_buffer_info, a:buffer, {})
|
||||
let l:loclist = get(l:info, 'loclist', [])
|
||||
let l:pos = getcurpos()
|
||||
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
|
||||
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
|
||||
|
||||
return [l:info, l:loc]
|
||||
endfunction
|
||||
|
||||
function! s:StopCursorTimer() abort
|
||||
if s:cursor_timer != -1
|
||||
call timer_stop(s:cursor_timer)
|
||||
|
@ -85,7 +75,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
|
|||
return
|
||||
endif
|
||||
|
||||
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
|
||||
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
|
||||
|
||||
if g:ale_echo_cursor
|
||||
if !empty(l:loc)
|
||||
|
@ -169,7 +159,7 @@ function! ale#cursor#ShowCursorDetail() abort
|
|||
|
||||
call s:StopCursorTimer()
|
||||
|
||||
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
|
||||
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
|
||||
|
||||
if !empty(l:loc)
|
||||
call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0})
|
||||
|
|
|
@ -22,14 +22,14 @@ let s:global_variable_list = [
|
|||
\ 'ale_lint_delay',
|
||||
\ 'ale_lint_on_enter',
|
||||
\ 'ale_lint_on_filetype_changed',
|
||||
\ 'ale_lint_on_insert_leave',
|
||||
\ 'ale_lint_on_save',
|
||||
\ 'ale_lint_on_text_changed',
|
||||
\ 'ale_lint_on_insert_leave',
|
||||
\ 'ale_linter_aliases',
|
||||
\ 'ale_linters',
|
||||
\ 'ale_linters_explicit',
|
||||
\ 'ale_list_window_size',
|
||||
\ 'ale_list_vertical',
|
||||
\ 'ale_list_window_size',
|
||||
\ 'ale_loclist_msg_format',
|
||||
\ 'ale_max_buffer_history_size',
|
||||
\ 'ale_max_signs',
|
||||
|
@ -52,6 +52,7 @@ let s:global_variable_list = [
|
|||
\ 'ale_statusline_format',
|
||||
\ 'ale_type_map',
|
||||
\ 'ale_use_global_executables',
|
||||
\ 'ale_virtualtext_cursor',
|
||||
\ 'ale_warn_about_trailing_blank_lines',
|
||||
\ 'ale_warn_about_trailing_whitespace',
|
||||
\]
|
||||
|
@ -236,10 +237,11 @@ function! ale#debugging#Info() abort
|
|||
endfunction
|
||||
|
||||
function! ale#debugging#InfoToClipboard() abort
|
||||
redir @+>
|
||||
redir => l:output
|
||||
silent call ale#debugging#Info()
|
||||
redir END
|
||||
|
||||
let @+ = l:output
|
||||
call s:Echo('ALEInfo copied to your clipboard')
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -304,6 +304,12 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
|||
call ale#cursor#EchoCursorWarning()
|
||||
endif
|
||||
|
||||
if g:ale_virtualtext_cursor
|
||||
" Try and show the warning now.
|
||||
" This will only do something meaningful if we're in normal mode.
|
||||
call ale#virtualtext#ShowCursorWarning()
|
||||
endif
|
||||
|
||||
" Reset the save event marker, used for opening windows, etc.
|
||||
call setbufvar(a:buffer, 'ale_save_event_fired', 0)
|
||||
" Set a marker showing how many times a buffer has been checked.
|
||||
|
|
|
@ -29,7 +29,7 @@ function! ale#events#SaveEvent(buffer) abort
|
|||
call setbufvar(a:buffer, 'ale_save_event_fired', 1)
|
||||
endif
|
||||
|
||||
if ale#Var(a:buffer, 'fix_on_save')
|
||||
if ale#Var(a:buffer, 'fix_on_save') && !ale#events#QuitRecently(a:buffer)
|
||||
let l:will_fix = ale#fix#Fix(a:buffer, 'save_file')
|
||||
let l:should_lint = l:should_lint && !l:will_fix
|
||||
endif
|
||||
|
@ -139,6 +139,14 @@ function! ale#events#Init() abort
|
|||
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
|
||||
endif
|
||||
|
||||
if g:ale_virtualtext_cursor
|
||||
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif
|
||||
" Look for a warning to echo as soon as we leave Insert mode.
|
||||
" The script's position variable used when moving the cursor will
|
||||
" not be changed here.
|
||||
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarning() | endif
|
||||
endif
|
||||
|
||||
if g:ale_close_preview_on_insert
|
||||
autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif
|
||||
endif
|
||||
|
|
|
@ -17,6 +17,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix PEP8 issues with autopep8.',
|
||||
\ },
|
||||
\ 'bibclean': {
|
||||
\ 'function': 'ale#fixers#bibclean#Fix',
|
||||
\ 'suggested_filetypes': ['bib'],
|
||||
\ 'description': 'Format bib files using bibclean.',
|
||||
\ },
|
||||
\ 'black': {
|
||||
\ 'function': 'ale#fixers#black#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
|
@ -56,7 +61,7 @@ let s:default_registry = {
|
|||
\ },
|
||||
\ 'prettier': {
|
||||
\ 'function': 'ale#fixers#prettier#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue'],
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'],
|
||||
\ 'description': 'Apply prettier to a file.',
|
||||
\ },
|
||||
\ 'prettier_eslint': {
|
||||
|
@ -110,6 +115,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['javascript'],
|
||||
\ 'description': 'Fix JavaScript files using standard --fix',
|
||||
\ },
|
||||
\ 'standardrb': {
|
||||
\ 'function': 'ale#fixers#standardrb#Fix',
|
||||
\ 'suggested_filetypes': ['ruby'],
|
||||
\ 'description': 'Fix ruby files with standardrb --fix',
|
||||
\ },
|
||||
\ 'stylelint': {
|
||||
\ 'function': 'ale#fixers#stylelint#Fix',
|
||||
\ 'suggested_filetypes': ['css', 'sass', 'scss', 'stylus'],
|
||||
|
|
|
@ -5,14 +5,14 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
|
|||
call ale#Set('ocaml_ocamlformat_options', '')
|
||||
|
||||
function! ale#fixers#ocamlformat#Fix(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':p')
|
||||
let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
|
||||
let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --inplace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ . ' --name=' . ale#Escape(l:filename)
|
||||
\ . ' -'
|
||||
\}
|
||||
endfunction
|
||||
|
|
|
@ -58,6 +58,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
|||
\ 'markdown': 'markdown',
|
||||
\ 'vue': 'vue',
|
||||
\ 'yaml': 'yaml',
|
||||
\ 'html': 'html',
|
||||
\}
|
||||
let l:parser = ''
|
||||
|
||||
|
|
|
@ -1,13 +1,28 @@
|
|||
" Author: Matteo Centenaro (bugant) - https://github.com/bugant
|
||||
"
|
||||
" Description: find the root directory for an elixir project that uses mix
|
||||
" Author: Jon Parise <jon@indelible.org>
|
||||
" Description: Functions for working with Elixir projects
|
||||
|
||||
" Find the root directory for an elixir project that uses mix.
|
||||
function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort
|
||||
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
|
||||
|
||||
if !empty(l:mix_file)
|
||||
return fnamemodify(l:mix_file, ':p:h')
|
||||
return fnamemodify(l:mix_file, ':p:h')
|
||||
endif
|
||||
|
||||
return '.'
|
||||
endfunction
|
||||
|
||||
" Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the
|
||||
" search upward for a potential umbrella project root. If an umbrella root
|
||||
" does not exist, the initial project root will be returned.
|
||||
function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort
|
||||
let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
let l:umbrella_root = fnamemodify(l:app_root, ':h:h')
|
||||
|
||||
if filereadable(l:umbrella_root . '/mix.exs')
|
||||
return l:umbrella_root
|
||||
endif
|
||||
|
||||
return l:app_root
|
||||
endfunction
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
" Author: KabbAmine - https://github.com/KabbAmine,
|
||||
" Ben Falconer <ben@falconers.me.uk>
|
||||
|
||||
function! ale#handlers#sasslint#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape('sass-lint')
|
||||
\ . ' -v -q -f compact %t'
|
||||
endfunction
|
|
@ -24,7 +24,21 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
|
|||
|
||||
if get(a:response, 'success', v:false) is v:true
|
||||
\&& get(a:response, 'body', v:null) isnot v:null
|
||||
if get(l:options, 'hover_from_balloonexpr', 0)
|
||||
" If we pass the show_documentation flag, we should show the full
|
||||
" documentation, and always in the preview window.
|
||||
if get(l:options, 'show_documentation', 0)
|
||||
let l:documentation = get(a:response.body, 'documentation', '')
|
||||
|
||||
" displayString is not included here, because it can be very
|
||||
" noisy and run on for many lines for complex types. A less
|
||||
" verbose alternative may be nice in future.
|
||||
if !empty(l:documentation)
|
||||
call ale#preview#Show(split(l:documentation, "\n"), {
|
||||
\ 'filetype': 'ale-preview.message',
|
||||
\ 'stay_here': 1,
|
||||
\})
|
||||
endif
|
||||
elseif get(l:options, 'hover_from_balloonexpr', 0)
|
||||
\&& exists('*balloon_show')
|
||||
\&& ale#Var(l:options.buffer, 'set_balloons')
|
||||
call balloon_show(a:response.body.displayString)
|
||||
|
@ -126,6 +140,7 @@ function! s:OnReady(linter, lsp_details, line, column, opt, ...) abort
|
|||
\ 'line': a:line,
|
||||
\ 'column': l:column,
|
||||
\ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0),
|
||||
\ 'show_documentation': get(a:opt, 'show_documentation', 0),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
|
@ -153,9 +168,30 @@ endfunction
|
|||
" - in the balloon if opt.called_from_balloonexpr and balloon_show is detected
|
||||
" - as status message otherwise
|
||||
function! ale#hover#Show(buffer, line, col, opt) abort
|
||||
let l:show_documentation = get(a:opt, 'show_documentation', 0)
|
||||
|
||||
for l:linter in ale#linter#Get(getbufvar(a:buffer, '&filetype'))
|
||||
" Only tsserver supports documentation requests at the moment.
|
||||
if !empty(l:linter.lsp)
|
||||
\&& (!l:show_documentation || l:linter.lsp is# 'tsserver')
|
||||
call s:ShowDetails(l:linter, a:buffer, a:line, a:col, a:opt)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" This function implements the :ALEHover command.
|
||||
function! ale#hover#ShowAtCursor() abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:pos = getcurpos()
|
||||
|
||||
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {})
|
||||
endfunction
|
||||
|
||||
" This function implements the :ALEDocumentation command.
|
||||
function! ale#hover#ShowDocumentationAtCursor() abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:pos = getcurpos()
|
||||
let l:options = {'show_documentation': 1}
|
||||
|
||||
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], l:options)
|
||||
endfunction
|
||||
|
|
|
@ -16,6 +16,7 @@ let s:default_ale_linter_aliases = {
|
|||
\ 'systemverilog': 'verilog',
|
||||
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
|
||||
\ 'vimwiki': 'markdown',
|
||||
\ 'vue': ['vue', 'javascript'],
|
||||
\ 'zsh': 'sh',
|
||||
\}
|
||||
|
||||
|
@ -31,6 +32,7 @@ let s:default_ale_linter_aliases = {
|
|||
" NOTE: Update the g:ale_linters documentation when modifying this.
|
||||
let s:default_ale_linters = {
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
|
||||
\ 'go': ['gofmt', 'golint', 'go vet'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
|
@ -40,6 +42,7 @@ let s:default_ale_linters = {
|
|||
\ 'rust': ['cargo'],
|
||||
\ 'spec': [],
|
||||
\ 'text': [],
|
||||
\ 'vue': ['eslint', 'vls'],
|
||||
\ 'zsh': ['shell'],
|
||||
\}
|
||||
|
||||
|
|
|
@ -66,6 +66,10 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
|
|||
let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n")
|
||||
endif
|
||||
|
||||
if has_key(l:diagnostic, 'source')
|
||||
let l:loclist_item.detail = printf('[%s] %s', l:diagnostic.source, l:diagnostic.message)
|
||||
endif
|
||||
|
||||
call add(l:loclist, l:loclist_item)
|
||||
endfor
|
||||
|
||||
|
|
|
@ -42,3 +42,35 @@ function! ale#ruby#FindProjectRoot(buffer) abort
|
|||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Handle output from rubocop and linters that depend on it (e.b. standardrb)
|
||||
function! ale#ruby#HandleRubocopOutput(buffer, lines) abort
|
||||
try
|
||||
let l:errors = json_decode(a:lines[0])
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = l:error['location']['column'] + 0
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['line'] + 0,
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -75,3 +75,13 @@ function! ale#test#GetQflistWithoutModule() abort
|
|||
|
||||
return l:results
|
||||
endfunction
|
||||
|
||||
function! ale#test#GetPreviewWindowText() abort
|
||||
for l:window in range(1, winnr('$'))
|
||||
if getwinvar(l:window, '&previewwindow', 0)
|
||||
let l:buffer = winbufnr(l:window)
|
||||
|
||||
return getbufline(l:buffer, 1, '$')
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
|
|
@ -452,3 +452,14 @@ function! ale#util#Col(str, chr) abort
|
|||
|
||||
return strlen(join(split(a:str, '\zs')[0:a:chr - 2], '')) + 1
|
||||
endfunction
|
||||
|
||||
function! ale#util#FindItemAtCursor(buffer) abort
|
||||
let l:info = get(g:ale_buffer_info, a:buffer, {})
|
||||
let l:loclist = get(l:info, 'loclist', [])
|
||||
let l:pos = getcurpos()
|
||||
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
|
||||
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
|
||||
|
||||
return [l:info, l:loc]
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@ ALE Elixir Integration *ale-elixir-options*
|
|||
===============================================================================
|
||||
mix *ale-elixir-mix*
|
||||
|
||||
|
||||
The `mix` linter is disabled by default, as it can bee too expensive to run.
|
||||
See `:help g:ale_linters`
|
||||
|
||||
|
||||
g:ale_elixir_mix_options *g:ale_elixir_mix_options*
|
||||
*b:ale_elixir_mix_options*
|
||||
Type: |String|
|
||||
|
@ -53,5 +58,20 @@ g:ale_elixir_elixir_ls_release *g:ale_elixir_elixir_ls_release*
|
|||
Location of the elixir-ls release directory. This directory must contain
|
||||
the language server scripts (language_server.sh and language_server.bat).
|
||||
|
||||
g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config*
|
||||
*b:ale_elixir_elixir_ls_config*
|
||||
Type: |Dictionary|
|
||||
Default: `{}`
|
||||
|
||||
Dictionary containing configuration settings that will be passed to the
|
||||
language server. For example, to disable Dialyzer: >
|
||||
{
|
||||
\ 'elixirLS': {
|
||||
\ 'dialyzerEnabled': v:false,
|
||||
\ },
|
||||
\ }
|
||||
<
|
||||
Consult the ElixirLS documentation for more information about settings.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -1,15 +1,37 @@
|
|||
===============================================================================
|
||||
ALE Eruby Integration *ale-eruby-options*
|
||||
|
||||
There are three linters for `eruby` files:
|
||||
There are four linters for `eruby` files:
|
||||
|
||||
- `erb`
|
||||
- `erubis`
|
||||
- `erubi`
|
||||
- `ruumba`
|
||||
|
||||
`erb` is in the Ruby standard library and is mostly universal. `erubis` is the
|
||||
default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails
|
||||
5.1 and later. To selectively enable a subset, see |g:ale_linters|.
|
||||
5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on
|
||||
the result. To selectively enable a subset, see |g:ale_linters|.
|
||||
|
||||
===============================================================================
|
||||
ruumba *ale-eruby-ruumba*
|
||||
|
||||
g:ale_eruby_ruumba_executable *g:ale_eruby_ruumba_executable*
|
||||
*b:ale_eruby_ruumba_executable*
|
||||
Type: String
|
||||
Default: `'ruumba`
|
||||
|
||||
Override the invoked ruumba binary. This is useful for running ruumba
|
||||
from binstubs or a bundle.
|
||||
|
||||
|
||||
g:ale_eruby_ruumba_options *g:ale_ruby_ruumba_options*
|
||||
*b:ale_ruby_ruumba_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be change to modify flags given to ruumba.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -27,7 +27,7 @@ g:ale_go_go_executable *g:ale_go_go_options*
|
|||
Default: `'go'`
|
||||
|
||||
The executable that will be run for the `gobuild` and `govet` linters, and
|
||||
the gomod` fixer.
|
||||
the `gomod` fixer.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
@ -53,6 +53,25 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options*
|
|||
This variable can be set to pass additional options to the gofmt fixer.
|
||||
|
||||
|
||||
===============================================================================
|
||||
golint *ale-go-golint*
|
||||
|
||||
g:ale_go_golint_executable *g:ale_go_golint_executable*
|
||||
*b:ale_go_golint_executable*
|
||||
Type: |String|
|
||||
Default: `'golint'`
|
||||
|
||||
This variable can be set to change the golint executable path.
|
||||
|
||||
|
||||
g:ale_go_golint_options *g:ale_go_golint_options*
|
||||
*b:ale_go_golint_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to the golint linter.
|
||||
|
||||
|
||||
===============================================================================
|
||||
govet *ale-go-govet*
|
||||
|
||||
|
|
|
@ -79,6 +79,12 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global*
|
|||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
prettier *ale-html-prettier*
|
||||
|
||||
See |ale-javascript-prettier| for information about the available options.
|
||||
|
||||
|
||||
===============================================================================
|
||||
stylelint *ale-html-stylelint*
|
||||
|
||||
|
|
|
@ -88,14 +88,20 @@ This generates a out/fat-jar.jar file that contains the language server. To
|
|||
let ALE use this language server you need to set the g:ale_java_javalsp_jar
|
||||
variable to the absolute path of this jar file.
|
||||
|
||||
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
|
||||
*b:ale_java_javalsp_executable*
|
||||
Type: |String|
|
||||
Default: `'java'`
|
||||
|
||||
This variable can be changed to use a different executable for java.
|
||||
|
||||
g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
|
||||
*b:ale_java_javalsp_jar*
|
||||
|
||||
Type: String
|
||||
Default: 'fat-jar.jar
|
||||
Type: |String|
|
||||
Default: `'fat-jar.jar'`
|
||||
|
||||
Path to the location of the vscode-javac language server plugin.
|
||||
and -d. They are added automatically.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
|
|
@ -203,5 +203,15 @@ g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options*
|
|||
|
||||
This variable can be set to pass additional options to php-cs-fixer.
|
||||
|
||||
===============================================================================
|
||||
php *ale-php-php*
|
||||
|
||||
g:ale_php_php_executable *g:ale_php_php_executable*
|
||||
*b:ale_php_php_executable*
|
||||
Type: |String|
|
||||
Default: `'php'`
|
||||
|
||||
This variable sets the executable used for php.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -328,6 +328,46 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv*
|
|||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
===============================================================================
|
||||
pydocstyle *ale-python-pydocstyle*
|
||||
|
||||
|
||||
g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable*
|
||||
*b:ale_python_pydocstyle_executable*
|
||||
Type: |String|
|
||||
Default: `'pydocstyle'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`.
|
||||
|
||||
|
||||
g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options*
|
||||
*b:ale_python_pydocstyle_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to add command-line arguments to the
|
||||
pydocstyle invocation.
|
||||
|
||||
|
||||
g:ale_python_pydocstyle_use_global *g:ale_python_pydocstyle_use_global*
|
||||
*b:ale_python_pydocstyle_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv*
|
||||
*b:ale_python_pydocstyle_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.
|
||||
|
||||
|
||||
===============================================================================
|
||||
pyflakes *ale-python-pyflakes*
|
||||
|
||||
|
|
|
@ -129,5 +129,27 @@ g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable*
|
|||
from binstubs or a bundle.
|
||||
|
||||
|
||||
===============================================================================
|
||||
standardrb *ale-ruby-standardrb*
|
||||
|
||||
g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable*
|
||||
*b:ale_ruby_standardrb_executable*
|
||||
Type: String
|
||||
Default: `'standardrb'`
|
||||
|
||||
Override the invoked standardrb binary. Set this to `'bundle'` to invoke
|
||||
`'bundle` `exec` standardrb'.
|
||||
|
||||
|
||||
g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options*
|
||||
*b:ale_ruby_standardrb_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be change to modify flags given to standardrb.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
ALE SASS Integration *ale-sass-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
sasslint *ale-sass-sasslint*
|
||||
|
||||
See |ale-scss-sasslint| for information about the available options.
|
||||
|
||||
|
||||
===============================================================================
|
||||
stylelint *ale-sass-stylelint*
|
||||
|
||||
|
|
|
@ -8,6 +8,33 @@ prettier *ale-scss-prettier*
|
|||
See |ale-javascript-prettier| for information about the available options.
|
||||
|
||||
|
||||
===============================================================================
|
||||
sasslint *ale-scss-sasslint*
|
||||
|
||||
g:ale_scss_sasslint_executable *g:ale_scss_sasslint_executable*
|
||||
*b:ale_scss_sasslint_executable*
|
||||
Type: |String|
|
||||
Default: `'sass-lint'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_scss_sasslint_options *g:ale_scss_sasslint_options*
|
||||
*b:ale_scss_sasslint_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to sass-lint.
|
||||
|
||||
|
||||
g:ale_scss_sasslint_use_global *g:ale_scss_sasslint_use_global*
|
||||
*b:ale_scss_sasslint_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
stylelint *ale-scss-stylelint*
|
||||
|
||||
|
|
|
@ -21,9 +21,11 @@ tslint *ale-typescript-tslint*
|
|||
|
||||
This linter isn't recommended, because TSLint can't be used for checking for
|
||||
problems while you type. You should probably use the tsserver plugin instead.
|
||||
tsserver plugins are described here:
|
||||
https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
|
||||
|
||||
Follow the instructions on the plugin website for installing it:
|
||||
https://github.com/angelozerr/tsserver-plugins
|
||||
https://github.com/Microsoft/typescript-tslint-plugin
|
||||
|
||||
Then disable TSLint in vimrc or any other Vim configuration file. >
|
||||
let g:ale_linters_ignore = {'typescript': ['tslint']}
|
||||
|
|
|
@ -21,6 +21,8 @@ CONTENTS *ale-contents*
|
|||
6.1 Highlights........................|ale-highlights|
|
||||
6.2 Options for write-good Linter.....|ale-write-good-options|
|
||||
7. Integration Documentation............|ale-integrations|
|
||||
ada...................................|ale-ada-options|
|
||||
gcc.................................|ale-ada-gcc|
|
||||
ansible...............................|ale-ansible-options|
|
||||
ansible-lint........................|ale-ansible-ansible-lint|
|
||||
asciidoc..............................|ale-asciidoc-options|
|
||||
|
@ -29,6 +31,8 @@ CONTENTS *ale-contents*
|
|||
gcc.................................|ale-asm-gcc|
|
||||
awk...................................|ale-awk-options|
|
||||
gawk................................|ale-awk-gawk|
|
||||
bib...................................|ale-bib-options|
|
||||
bibclean............................|ale-bib-bibclean|
|
||||
c.....................................|ale-c-options|
|
||||
clang...............................|ale-c-clang|
|
||||
clangd..............................|ale-c-clangd|
|
||||
|
@ -92,6 +96,7 @@ CONTENTS *ale-contents*
|
|||
erlc................................|ale-erlang-erlc|
|
||||
syntaxerl...........................|ale-erlang-syntaxerl|
|
||||
eruby.................................|ale-eruby-options|
|
||||
ruumba..............................|ale-eruby-ruumba|
|
||||
fish..................................|ale-fish-options|
|
||||
fortran...............................|ale-fortran-options|
|
||||
gcc.................................|ale-fortran-gcc|
|
||||
|
@ -107,6 +112,7 @@ CONTENTS *ale-contents*
|
|||
go....................................|ale-go-options|
|
||||
gobuild.............................|ale-go-gobuild|
|
||||
gofmt...............................|ale-go-gofmt|
|
||||
golint..............................|ale-go-golint|
|
||||
govet...............................|ale-go-govet|
|
||||
gometalinter........................|ale-go-gometalinter|
|
||||
staticcheck.........................|ale-go-staticcheck|
|
||||
|
@ -138,10 +144,13 @@ CONTENTS *ale-contents*
|
|||
html..................................|ale-html-options|
|
||||
htmlhint............................|ale-html-htmlhint|
|
||||
tidy................................|ale-html-tidy|
|
||||
prettier............................|ale-html-prettier|
|
||||
stylelint...........................|ale-html-stylelint|
|
||||
write-good..........................|ale-html-write-good|
|
||||
idris.................................|ale-idris-options|
|
||||
idris...............................|ale-idris-idris|
|
||||
ispc..................................|ale-ispc-options|
|
||||
ispc................................|ale-ispc-ispc|
|
||||
java..................................|ale-java-options|
|
||||
checkstyle..........................|ale-java-checkstyle|
|
||||
javac...............................|ale-java-javac|
|
||||
|
@ -224,6 +233,7 @@ CONTENTS *ale-contents*
|
|||
phpstan.............................|ale-php-phpstan|
|
||||
psalm...............................|ale-php-psalm|
|
||||
php-cs-fixer........................|ale-php-php-cs-fixer|
|
||||
php.................................|ale-php-php|
|
||||
po....................................|ale-po-options|
|
||||
write-good..........................|ale-po-write-good|
|
||||
pod...................................|ale-pod-options|
|
||||
|
@ -250,6 +260,7 @@ CONTENTS *ale-contents*
|
|||
mypy................................|ale-python-mypy|
|
||||
prospector..........................|ale-python-prospector|
|
||||
pycodestyle.........................|ale-python-pycodestyle|
|
||||
pydocstyle..........................|ale-python-pydocstyle|
|
||||
pyflakes............................|ale-python-pyflakes|
|
||||
pylint..............................|ale-python-pylint|
|
||||
pyls................................|ale-python-pyls|
|
||||
|
@ -274,12 +285,14 @@ CONTENTS *ale-contents*
|
|||
ruby................................|ale-ruby-ruby|
|
||||
rufo................................|ale-ruby-rufo|
|
||||
solargraph..........................|ale-ruby-solargraph|
|
||||
standardrb..........................|ale-ruby-standardrb|
|
||||
rust..................................|ale-rust-options|
|
||||
cargo...............................|ale-rust-cargo|
|
||||
rls.................................|ale-rust-rls|
|
||||
rustc...............................|ale-rust-rustc|
|
||||
rustfmt.............................|ale-rust-rustfmt|
|
||||
sass..................................|ale-sass-options|
|
||||
sasslint............................|ale-sass-sasslint|
|
||||
stylelint...........................|ale-sass-stylelint|
|
||||
scala.................................|ale-scala-options|
|
||||
sbtserver...........................|ale-scala-sbtserver|
|
||||
|
@ -287,6 +300,7 @@ CONTENTS *ale-contents*
|
|||
scalastyle..........................|ale-scala-scalastyle|
|
||||
scss..................................|ale-scss-options|
|
||||
prettier............................|ale-scss-prettier|
|
||||
sasslint............................|ale-scss-sasslint|
|
||||
stylelint...........................|ale-scss-stylelint|
|
||||
sh....................................|ale-sh-options|
|
||||
sh-language-server..................|ale-sh-language-server|
|
||||
|
@ -388,12 +402,14 @@ Notes:
|
|||
`^` No linters for text or Vim help filetypes are enabled by default.
|
||||
`!!` These linters check only files on disk. See |ale-lint-file-linters|
|
||||
|
||||
* Ada: `gcc`
|
||||
* ASM: `gcc`
|
||||
* Ansible: `ansible-lint`
|
||||
* API Blueprint: `drafter`
|
||||
* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good`
|
||||
* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good`, `vale`
|
||||
* Awk: `gawk`
|
||||
* Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt`
|
||||
* BibTeX: `bibclean`
|
||||
* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt`
|
||||
* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls`
|
||||
* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls`
|
||||
|
@ -414,7 +430,7 @@ Notes:
|
|||
* Dockerfile: `dockerfile_lint`, `hadolint`
|
||||
* Elixir: `credo`, `dialyxir`, `dogma`, `mix`!!, `elixir-ls`
|
||||
* Elm: `elm-format, elm-make`
|
||||
* Erb: `erb`, `erubi`, `erubis`
|
||||
* Erb: `erb`, `erubi`, `erubis`, `ruumba`
|
||||
* Erlang: `erlc`, `SyntaxErl`
|
||||
* Fish: `fish` (-n flag)
|
||||
* Fortran: `gcc`, `language_server`
|
||||
|
@ -429,8 +445,9 @@ Notes:
|
|||
* Handlebars: `ember-template-lint`
|
||||
* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie`
|
||||
* HCL: `terraform-fmt`
|
||||
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good`
|
||||
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `prettier`, `write-good`
|
||||
* Idris: `idris`
|
||||
* ISPC: `ispc`!!
|
||||
* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify`
|
||||
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo`
|
||||
* JSON: `fixjson`, `jsonlint`, `jq`, `prettier`
|
||||
|
@ -463,14 +480,14 @@ Notes:
|
|||
* proto: `protoc-gen-lint`
|
||||
* Pug: `pug-lint`
|
||||
* Puppet: `languageserver`, `puppet`, `puppet-lint`
|
||||
* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf`
|
||||
* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pydocstyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf`
|
||||
* QML: `qmlfmt`, `qmllint`
|
||||
* R: `lintr`
|
||||
* ReasonML: `merlin`, `ols`, `refmt`
|
||||
* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good`
|
||||
* Re:VIEW: `redpen`
|
||||
* RPM spec: `rpmlint`
|
||||
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`
|
||||
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`, `standardrb`
|
||||
* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
|
||||
* SASS: `sass-lint`, `stylelint`
|
||||
* SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint`
|
||||
|
@ -555,6 +572,7 @@ their relevant options.
|
|||
* By setting error highlights. - |g:ale_set_highlights|
|
||||
* By creating signs in the sign column. - |g:ale_set_signs|
|
||||
* By echoing messages based on your cursor. - |g:ale_echo_cursor|
|
||||
* By inline text based on your cursor. - |g:ale_virtualtext_cursor|
|
||||
* By displaying the preview based on your cursor. - |g:ale_cursor_detail|
|
||||
* By showing balloons for your mouse cursor - |g:ale_set_balloons|
|
||||
|
||||
|
@ -859,6 +877,9 @@ settings. For example: >
|
|||
set ttymouse=xterm
|
||||
<
|
||||
|
||||
Documentation for symbols at the cursor can be retrieved using the
|
||||
|ALEDocumentation| command. This command is only available for `tsserver`.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
5.5 Symbol Search *ale-symbol-search*
|
||||
|
||||
|
@ -1184,6 +1205,9 @@ b:ale_fix_on_save *b:ale_fix_on_save*
|
|||
after files are fixed, only when the buffer is open, or re-opened. Changes
|
||||
to the file will be saved to the file on disk.
|
||||
|
||||
Files will not be fixed on `:wq`, so you should check your code before
|
||||
closing a buffer.
|
||||
|
||||
Fixing files can be disabled or enabled for individual buffers by setting
|
||||
`b:ale_fix_on_save` to `0` or `1`.
|
||||
|
||||
|
@ -1362,6 +1386,7 @@ g:ale_linter_aliases *g:ale_linter_aliases*
|
|||
\ 'systemverilog': 'verilog',
|
||||
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
|
||||
\ 'vimwiki': 'markdown',
|
||||
\ 'vue': ['vue', 'javascript'],
|
||||
\ 'zsh': 'sh',
|
||||
\}
|
||||
<
|
||||
|
@ -1410,6 +1435,7 @@ g:ale_linters *g:ale_linters*
|
|||
|
||||
{
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
|
||||
\ 'go': ['gofmt', 'golint', 'go vet'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
|
@ -1419,6 +1445,7 @@ g:ale_linters *g:ale_linters*
|
|||
\ 'rust': ['cargo'],
|
||||
\ 'spec': [],
|
||||
\ 'text': [],
|
||||
\ 'vue': ['eslint', 'vls'],
|
||||
\ 'zsh': ['shell'],
|
||||
\}
|
||||
<
|
||||
|
@ -1866,6 +1893,49 @@ g:ale_use_global_executables *g:ale_use_global_executables*
|
|||
options.
|
||||
|
||||
|
||||
g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
|
||||
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
When this option is set to `1`, a message will be shown when a cursor is
|
||||
near a warning or error. ALE will attempt to find the warning or error at a
|
||||
column nearest to the cursor when the cursor is resting on a line which
|
||||
contains a warning or error. This option can be set to `0` to disable this
|
||||
behavior.
|
||||
|
||||
Messages are only displayed after a short delay. See |g:ale_virtualtext_delay|.
|
||||
|
||||
Messages can be prefixed prefixed with a string. See |g:ale_virtualtext_prefix|.
|
||||
|
||||
ALE will use the following highlight groups for problems:
|
||||
|
||||
|ALEVirtualTextError| - Items with `'type': 'E'`
|
||||
|ALEVirtualTextWarning| - Items with `'type': 'W'`
|
||||
|ALEVirtualTextInfo| - Items with `'type': 'I'`
|
||||
|ALEVirtualTextStyleError| - Items with `'type': 'E'` and `'sub_type': 'style'`
|
||||
|ALEVirtualTextStyleWarning| - Items with `'type': 'W'` and `'sub_type': 'style'`
|
||||
|
||||
|
||||
g:ale_virtualtext_delay *g:ale_virtualtext_delay*
|
||||
b:ale_virtualtext_delay *b:ale_virtualtext_delay*
|
||||
Type: |Number|
|
||||
Default: `10`
|
||||
|
||||
Given any integer, this option controls the number of milliseconds before
|
||||
ALE will show a message for a problem near the cursor.
|
||||
|
||||
The value can be increased to decrease the amount of processing ALE will do
|
||||
for files displaying a large number of problems.
|
||||
|
||||
|
||||
g:ale_virtualtext_prefix *g:ale_virtualtext_prefix*
|
||||
|
||||
Type: |String|
|
||||
Default: `'> '`
|
||||
|
||||
Prefix to be used with |g:ale_virtualtext_cursor|.
|
||||
|
||||
g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
|
||||
b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
|
||||
|
||||
|
@ -1932,7 +2002,7 @@ ALEError *ALEError*
|
|||
|
||||
Default: `highlight link ALEError SpellBad`
|
||||
|
||||
The highlight used for highlighted errors. See |g:ale_set_highlights|.
|
||||
The highlight for highlighted errors. See |g:ale_set_highlights|.
|
||||
|
||||
|
||||
ALEErrorLine *ALEErrorLine*
|
||||
|
@ -1949,21 +2019,21 @@ ALEErrorSign *ALEErrorSign*
|
|||
|
||||
Default: `highlight link ALEErrorSign error`
|
||||
|
||||
The highlight used for error signs. See |g:ale_set_signs|.
|
||||
The highlight for error signs. See |g:ale_set_signs|.
|
||||
|
||||
|
||||
ALEInfo *ALEInfo.*
|
||||
*ALEInfo-highlight*
|
||||
Default: `highlight link ALEInfo ALEWarning`
|
||||
|
||||
The highlight used for highlighted info messages. See |g:ale_set_highlights|.
|
||||
The highlight for highlighted info messages. See |g:ale_set_highlights|.
|
||||
|
||||
|
||||
ALEInfoSign *ALEInfoSign*
|
||||
|
||||
Default: `highlight link ALEInfoSign ALEWarningSign`
|
||||
|
||||
The highlight used for info message signs. See |g:ale_set_signs|.
|
||||
The highlight for info message signs. See |g:ale_set_signs|.
|
||||
|
||||
|
||||
ALEInfoLine *ALEInfoLine*
|
||||
|
@ -1980,35 +2050,70 @@ ALEStyleError *ALEStyleError*
|
|||
|
||||
Default: `highlight link ALEStyleError ALEError`
|
||||
|
||||
The highlight used for highlighted style errors. See |g:ale_set_highlights|.
|
||||
The highlight for highlighted style errors. See |g:ale_set_highlights|.
|
||||
|
||||
|
||||
ALEStyleErrorSign *ALEStyleErrorSign*
|
||||
|
||||
Default: `highlight link ALEStyleErrorSign ALEErrorSign`
|
||||
|
||||
The highlight used for style error signs. See |g:ale_set_signs|.
|
||||
The highlight for style error signs. See |g:ale_set_signs|.
|
||||
|
||||
|
||||
ALEStyleWarning *ALEStyleWarning*
|
||||
|
||||
Default: `highlight link ALEStyleWarning ALEError`
|
||||
|
||||
The highlight used for highlighted style warnings. See |g:ale_set_highlights|.
|
||||
The highlight for highlighted style warnings. See |g:ale_set_highlights|.
|
||||
|
||||
|
||||
ALEStyleWarningSign *ALEStyleWarningSign*
|
||||
|
||||
Default: `highlight link ALEStyleWarningSign ALEWarningSign`
|
||||
|
||||
The highlight used for style warning signs. See |g:ale_set_signs|.
|
||||
The highlight for style warning signs. See |g:ale_set_signs|.
|
||||
|
||||
|
||||
ALEVirtualTextError *ALEVirtualTextError*
|
||||
|
||||
Default: `highlight link ALEVirtualTextError ALEError`
|
||||
|
||||
The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|.
|
||||
|
||||
|
||||
ALEVirtualTextInfo *ALEVirtualTextInfo*
|
||||
|
||||
Default: `highlight link ALEVirtualTextInfo ALEVirtualTextWarning`
|
||||
|
||||
The highlight for virtualtext info. See |g:ale_virtualtext_cursor|.
|
||||
|
||||
|
||||
ALEVirtualTextStyleError *ALEVirtualTextStyleError*
|
||||
|
||||
Default: `highlight link ALEVirtualTextStyleError ALEVirtualTextError`
|
||||
|
||||
The highlight for virtualtext style errors. See |g:ale_virtualtext_cursor|.
|
||||
|
||||
|
||||
ALEVirtualTextStyleWarning *ALEVirtualTextStyleWarning*
|
||||
|
||||
Default: `highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning`
|
||||
|
||||
The highlight for virtualtext style warnings. See |g:ale_virtualtext_cursor|.
|
||||
|
||||
|
||||
ALEVirtualTextWarning *ALEVirtualTextWarning*
|
||||
|
||||
Default: `highlight link ALEVirtualTextWarning ALEWarning`
|
||||
|
||||
The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|.
|
||||
|
||||
|
||||
ALEWarning *ALEWarning*
|
||||
|
||||
Default: `highlight link ALEWarning SpellCap`
|
||||
|
||||
The highlight used for highlighted warnings. See |g:ale_set_highlights|.
|
||||
The highlight for highlighted warnings. See |g:ale_set_highlights|.
|
||||
|
||||
|
||||
ALEWarningLine *ALEWarningLine*
|
||||
|
@ -2025,7 +2130,7 @@ ALEWarningSign *ALEWarningSign*
|
|||
|
||||
Default: `highlight link ALEWarningSign todo`
|
||||
|
||||
The highlight used for warning signs. See |g:ale_set_signs|.
|
||||
The highlight for warning signs. See |g:ale_set_signs|.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
@ -2097,6 +2202,17 @@ ALE will use to search for Python executables.
|
|||
===============================================================================
|
||||
8. Commands/Keybinds *ale-commands*
|
||||
|
||||
ALEDocumentation *ALEDocumentation*
|
||||
|
||||
Similar to the |ALEHover| command, retrieve documentation information for
|
||||
the symbol at the cursor. Documentation data will always be shown in a
|
||||
preview window, no matter how small the documentation content is.
|
||||
|
||||
NOTE: This command is only available for `tsserver`.
|
||||
|
||||
A plug mapping `<Plug>(ale_documentation)` is defined for this command.
|
||||
|
||||
|
||||
ALEFindReferences *ALEFindReferences*
|
||||
|
||||
Find references in the codebase for the symbol under the cursor using the
|
||||
|
|
|
@ -112,6 +112,9 @@ let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
|
|||
" This flag can be set to 1 to automatically show errors in the preview window.
|
||||
let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0)
|
||||
|
||||
" This flag can be set to 1 to enable virtual text when the cursor moves.
|
||||
let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', 0)
|
||||
|
||||
" This flag can be set to 1 to automatically close the preview window upon
|
||||
" entering Insert Mode.
|
||||
let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0)
|
||||
|
@ -190,9 +193,11 @@ command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1
|
|||
" Find references for tsserver and LSP
|
||||
command! -bar ALEFindReferences :call ale#references#Find()
|
||||
|
||||
" Get information for the cursor.
|
||||
command! -bar ALEHover :call ale#hover#Show(bufnr(''), getcurpos()[1],
|
||||
\ getcurpos()[2], {})
|
||||
" Show summary information for the cursor.
|
||||
command! -bar ALEHover :call ale#hover#ShowAtCursor()
|
||||
|
||||
" Show documentation for the cursor.
|
||||
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>)
|
||||
|
@ -219,6 +224,7 @@ nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
|
|||
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
|
||||
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
|
||||
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>
|
||||
|
||||
" Set up autocmd groups now.
|
||||
call ale#events#Init()
|
||||
|
|
|
@ -2567,9 +2567,13 @@ fu! ctrlp#getvar(var)
|
|||
endf
|
||||
"}}}1
|
||||
" * Initialization {{{1
|
||||
fu! ctrlp#setlines(...)
|
||||
fu! s:setlines_pre(...)
|
||||
if a:0 | let s:itemtype = a:1 | en
|
||||
cal s:modevar()
|
||||
let g:ctrlp_lines = []
|
||||
endf
|
||||
|
||||
fu! s:setlines_post()
|
||||
let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'}
|
||||
let types = map(copy(g:ctrlp_types), 'inits[v:val]')
|
||||
if !empty(g:ctrlp_ext_vars)
|
||||
|
@ -2578,6 +2582,11 @@ fu! ctrlp#setlines(...)
|
|||
let g:ctrlp_lines = eval(types[s:itemtype])
|
||||
endf
|
||||
|
||||
fu! ctrlp#setlines(...)
|
||||
cal call('s:setlines_pre', a:000)
|
||||
cal s:setlines_post()
|
||||
endf
|
||||
|
||||
" Returns [lname, sname]
|
||||
fu! s:CurTypeName()
|
||||
if s:itemtype < len(s:coretypes)
|
||||
|
@ -2632,8 +2641,16 @@ fu! ctrlp#init(type, ...)
|
|||
retu
|
||||
en
|
||||
en
|
||||
cal ctrlp#setlines(s:settype(type))
|
||||
" Fixed issue ctrlpvim/ctrlp.vim#463 : Opening 'ctrlp' in certain modes
|
||||
" (':CtrlPBufTag', ':CtrlPLine') seems to trigger a partially deffective
|
||||
" intialisation (for example, syntax highlighting not working as expected).
|
||||
" Fix: ctrlp#setlines() split in two, as the second part (now in
|
||||
" s:setlines_post()) seems to need '&filetype', and s:DetectFileType() seems
|
||||
" to need the first part of the old ctrlp#setlines() (now in
|
||||
" s:setlines_pre()).
|
||||
cal s:setlines_pre(s:settype(type))
|
||||
let &filetype = s:DetectFileType(type, &filetype)
|
||||
cal s:setlines_post()
|
||||
cal ctrlp#syntax()
|
||||
cal s:SetDefTxt()
|
||||
let curName = s:CurTypeName()
|
||||
|
|
|
@ -2,16 +2,17 @@
|
|||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2018/09/17 12:00:00.
|
||||
" Last Change: 2018/11/24 12:00:00.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:_ = 1
|
||||
let s:_ = 1 " 1: uninitialized, 2: disabled
|
||||
|
||||
function! lightline#update() abort
|
||||
if s:_
|
||||
if s:_ == 2 | return | endif
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
endif
|
||||
|
@ -40,11 +41,8 @@ function! lightline#update_disable() abort
|
|||
endfunction
|
||||
|
||||
function! lightline#enable() abort
|
||||
call lightline#colorscheme()
|
||||
let s:_ = 1
|
||||
call lightline#update()
|
||||
if s:lightline.enable.tabline
|
||||
set tabline=%!lightline#tabline()
|
||||
endif
|
||||
augroup lightline
|
||||
autocmd!
|
||||
autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update()
|
||||
|
@ -74,6 +72,7 @@ function! lightline#disable() abort
|
|||
autocmd!
|
||||
autocmd WinEnter * call lightline#update_disable()
|
||||
augroup END
|
||||
let s:_ = 2
|
||||
endfunction
|
||||
|
||||
function! lightline#toggle() abort
|
||||
|
|
|
@ -452,13 +452,9 @@ In order to change the syntastic component more outstanding, you have to use
|
|||
\ 'syntastic': 'error',
|
||||
\ }
|
||||
\ }
|
||||
let g:syntastic_mode_map = { 'mode': 'passive' }
|
||||
augroup AutoSyntastic
|
||||
autocmd!
|
||||
autocmd BufWritePost *.c,*.cpp call s:syntastic()
|
||||
augroup END
|
||||
function! s:syntastic()
|
||||
SyntasticCheck
|
||||
" Syntastic can call a post-check hook, let's update lightline there
|
||||
" For more information: :help syntastic-loclist-callback
|
||||
function! SyntasticCheckHook(errors)
|
||||
call lightline#update()
|
||||
endfunction
|
||||
<
|
||||
|
@ -908,12 +904,9 @@ For users who uses lots of plugins:
|
|||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
augroup AutoSyntastic
|
||||
autocmd!
|
||||
autocmd BufWritePost *.c,*.cpp call s:syntastic()
|
||||
augroup END
|
||||
function! s:syntastic()
|
||||
SyntasticCheck
|
||||
" Syntastic can call a post-check hook, let's update lightline there
|
||||
" For more information: :help syntastic-loclist-callback
|
||||
function! SyntasticCheckHook(errors)
|
||||
call lightline#update()
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ endfunction
|
|||
function! s:suite.default()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
|
@ -18,10 +19,15 @@ function! s:suite.disable_enable()
|
|||
call lightline#disable()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#update()
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#enable()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
|
@ -29,9 +35,11 @@ function! s:suite.toggle()
|
|||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,7 @@ function! s:Creator._broadcastInitEvent()
|
|||
silent doautocmd User NERDTreeInit
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:Creator.BufNamePrefix() {{{2
|
||||
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
||||
function! s:Creator.BufNamePrefix()
|
||||
return 'NERD_tree_'
|
||||
endfunction
|
||||
|
|
|
@ -49,7 +49,7 @@ endfunction
|
|||
|
||||
"FUNCTION: MenuController._echoPrompt() {{{1
|
||||
function! s:MenuController._echoPrompt()
|
||||
echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated"
|
||||
echo "NERDTree Menu. Use " . g:NERDTreeMenuDown . "/" . g:NERDTreeMenuUp . "/enter and the shortcuts indicated"
|
||||
echo "=========================================================="
|
||||
|
||||
for i in range(0, len(self.menuItems)-1)
|
||||
|
@ -71,9 +71,9 @@ endfunction
|
|||
"change the selection (if appropriate) and return 1 if the user has made
|
||||
"their choice, 0 otherwise
|
||||
function! s:MenuController._handleKeypress(key)
|
||||
if a:key == 'j'
|
||||
if a:key == g:NERDTreeMenuDown
|
||||
call self._cursorDown()
|
||||
elseif a:key == 'k'
|
||||
elseif a:key == g:NERDTreeMenuUp
|
||||
call self._cursorUp()
|
||||
elseif a:key == nr2char(27) "escape
|
||||
let self.selection = -1
|
||||
|
|
|
@ -254,6 +254,13 @@ function! s:TreeDirNode.getChildIndex(path)
|
|||
return -1
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.getDirChildren() {{{1
|
||||
" Return a list of all child nodes from "self.children" that are of type
|
||||
" TreeDirNode. This function supports http://github.com/scrooloose/nerdtree-project-plugin.git.
|
||||
function! s:TreeDirNode.getDirChildren()
|
||||
return filter(copy(self.children), 'v:val.path.isDirectory == 1')
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode._glob(pattern, all) {{{1
|
||||
" Return a list of strings naming the descendants of the directory in this
|
||||
" TreeDirNode object that match the specified glob pattern.
|
||||
|
@ -370,12 +377,26 @@ function! s:TreeDirNode.hasVisibleChildren()
|
|||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.isCascadable() {{{1
|
||||
" true if this dir has only one visible child - which is also a dir
|
||||
" true if this dir has only one visible child that is also a dir
|
||||
" false if this dir is bookmarked or symlinked. Why? Two reasons:
|
||||
" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
|
||||
" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
|
||||
" text, and NERDTree cannot get the path of any child node.
|
||||
function! s:TreeDirNode.isCascadable()
|
||||
if g:NERDTreeCascadeSingleChildDir == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
if self.path.isSymLink
|
||||
return 0
|
||||
endif
|
||||
|
||||
for i in g:NERDTreeBookmark.Bookmarks()
|
||||
if i.path.equals(self.path)
|
||||
return 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
let c = self.getVisibleChildren()
|
||||
return len(c) == 1 && c[0].path.isDirectory
|
||||
endfunction
|
||||
|
|
|
@ -86,8 +86,8 @@ let g:NERDTreeOldSortOrder = []
|
|||
|
||||
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
|
||||
|
||||
" ASCII 160: non-breaking space used to delimit items in the tree's nodes.
|
||||
call s:initVariable("g:NERDTreeNodeDelimiter", "\u00a0")
|
||||
" ASCII 7: bell non-printing character used to delimit items in the tree's nodes.
|
||||
call s:initVariable("g:NERDTreeNodeDelimiter", "\x07")
|
||||
|
||||
if !exists('g:NERDTreeStatusline')
|
||||
|
||||
|
@ -148,6 +148,8 @@ call s:initVariable("g:NERDTreeMapToggleZoom", "A")
|
|||
call s:initVariable("g:NERDTreeMapUpdir", "u")
|
||||
call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
|
||||
call s:initVariable("g:NERDTreeMapCWD", "CD")
|
||||
call s:initVariable("g:NERDTreeMenuDown", "j")
|
||||
call s:initVariable("g:NERDTreeMenuUp", "k")
|
||||
|
||||
"SECTION: Load class files{{{2
|
||||
call nerdtree#loadClassFiles()
|
||||
|
|
|
@ -33,15 +33,15 @@ exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# cont
|
|||
"highlighting for readonly files
|
||||
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
||||
|
||||
syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile
|
||||
syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir
|
||||
syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
|
||||
syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
|
||||
|
||||
"highlighing to conceal the delimiter around the file/dir name
|
||||
if has("conceal")
|
||||
exec 'syn match NERDTreeNodeDelimiters #' . g:NERDTreeNodeDelimiter . '# conceal containedin=NERDTreeFile,NERDTreeLinkFile,NERDTreeExecFile,NERDTreeRO,NERDTreeDir'
|
||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
|
||||
setlocal conceallevel=3 concealcursor=nvic
|
||||
else
|
||||
exec 'syn match NERDTreeNodeDelimiters #' . g:NERDTreeNodeDelimiter . '# containedin=NERDTreeFile,NERDTreeLinkFile,NERDTreeExecFile,NERDTreeRO,NERDTreeDir'
|
||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
|
||||
hi! link NERDTreeNodeDelimiters Ignore
|
||||
endif
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ function! s:commands.abbrev.process(bang,line1,line2,count,args)
|
|||
let cmd = cmd . " <buffer>"
|
||||
endif
|
||||
let [bad, good] = s:badgood(a:args)
|
||||
if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$'
|
||||
if substitute(bad, '[{},]', '', 'g') !~# '^\k*$'
|
||||
call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")")
|
||||
endif
|
||||
if !self.options.delete && good == ""
|
||||
|
@ -620,12 +620,14 @@ function! s:coerce(type) abort
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar())).'iw'
|
||||
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
|
||||
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
|
||||
nnoremap <expr> <plug>(abolish-coerce-word) <sid>coerce(nr2char(getchar())).'iw'
|
||||
|
||||
" }}}1
|
||||
|
||||
if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings
|
||||
nmap cr <Plug>(abolish-coerce)
|
||||
nmap cr <Plug>(abolish-coerce-word)
|
||||
endif
|
||||
|
||||
command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish
|
||||
|
|
|
@ -2986,7 +2986,7 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort
|
|||
if empty(s:Relative('/'))
|
||||
call s:throw('file or blob required')
|
||||
endif
|
||||
if filter(copy(a:args),'v:val !~# "^\\%(--root\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != []
|
||||
if filter(copy(a:args),'v:val !~# "^\\%(--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != []
|
||||
call s:throw('unsupported option')
|
||||
endif
|
||||
call map(a:args,'s:sub(v:val,"^\\ze[^-]","-")')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
" fugitive.vim - A Git wrapper so awesome, it should be illegal
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.4
|
||||
" Version: 2.5
|
||||
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
|
||||
|
||||
if exists('g:loaded_fugitive')
|
||||
|
@ -68,6 +68,10 @@ function! FugitiveParse(...) abort
|
|||
throw v:errmsg
|
||||
endfunction
|
||||
|
||||
function! FugitivePrepare(...) abort
|
||||
return call('fugitive#Prepare', a:000)
|
||||
endfunction
|
||||
|
||||
function! FugitiveConfig(key, ...) abort
|
||||
return fugitive#Config(a:key, FugitiveGitDir(a:0 ? a:1 : -1))
|
||||
endfunction
|
||||
|
@ -205,14 +209,6 @@ function! FugitiveDetect(path) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveRoute(...) abort
|
||||
return call('FugitiveFind', a:000)
|
||||
endfunction
|
||||
|
||||
function! FugitiveGenerate(...) abort
|
||||
throw 'Use FugitiveFind() instead'
|
||||
endfunction
|
||||
|
||||
function! s:Slash(path) abort
|
||||
if exists('+shellslash')
|
||||
return tr(a:path, '\', '/')
|
||||
|
|
|
@ -77,13 +77,19 @@ endfunction
|
|||
|
||||
function! s:on_stderr_vim(channel, _data) dict abort
|
||||
call self.handler.err(self.buffer)
|
||||
try
|
||||
call ch_close(a:channel) " so close_cb and its 'out' handler are not triggered
|
||||
catch /E906/
|
||||
" noop
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_vim(_channel) dict abort
|
||||
call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n"))
|
||||
function! s:on_exit_vim(channel) dict abort
|
||||
let job = ch_getjob(a:channel)
|
||||
while 1
|
||||
if job_status(job) == 'dead'
|
||||
let exit_code = job_info(job).exitval
|
||||
break
|
||||
endif
|
||||
sleep 5m
|
||||
endwhile
|
||||
|
||||
if !exit_code
|
||||
call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n"))
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -13,6 +13,7 @@ let s:c_flag = s:git_supports_command_line_config_override()
|
|||
|
||||
let s:temp_from = tempname()
|
||||
let s:temp_buffer = tempname()
|
||||
let s:counter = 0
|
||||
|
||||
" Returns a diff of the buffer against the index or the working tree.
|
||||
"
|
||||
|
@ -89,6 +90,11 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
|
|||
" git-diff).
|
||||
let buff_file = s:temp_buffer.'.'.a:bufnr
|
||||
|
||||
" Add a counter to avoid a similar race with two quick writes of the same buffer.
|
||||
" Use a modulus greater than a maximum reasonable number of visible buffers.
|
||||
let s:counter = (s:counter + 1) % 20
|
||||
let buff_file .= '.'.s:counter
|
||||
|
||||
let extension = gitgutter#utility#extension(a:bufnr)
|
||||
if !empty(extension)
|
||||
let buff_file .= '.'.extension
|
||||
|
@ -104,6 +110,9 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
|
|||
" reading it (with git-diff).
|
||||
let from_file = s:temp_from.'.'.a:bufnr
|
||||
|
||||
" Add a counter to avoid a similar race with two quick writes of the same buffer.
|
||||
let from_file .= '.'.s:counter
|
||||
|
||||
if !empty(extension)
|
||||
let from_file .= '.'.extension
|
||||
endif
|
||||
|
@ -365,6 +374,13 @@ endfunction
|
|||
function! s:write_buffer(bufnr, file)
|
||||
let bufcontents = getbufline(a:bufnr, 1, '$')
|
||||
|
||||
if bufcontents == [''] && line2byte(1) == -1
|
||||
" Special case: completely empty buffer.
|
||||
" A nearly empty buffer of only a newline has line2byte(1) == 1.
|
||||
call writefile([], a:file)
|
||||
return
|
||||
endif
|
||||
|
||||
if getbufvar(a:bufnr, '&fileformat') ==# 'dos'
|
||||
call map(bufcontents, 'v:val."\r"')
|
||||
endif
|
||||
|
|
|
@ -8,7 +8,12 @@ endfunction
|
|||
|
||||
function! gitgutter#utility#setbufvar(buffer, varname, val)
|
||||
let buffer = +a:buffer
|
||||
let dict = get(getbufvar(buffer, '', {}), 'gitgutter', {})
|
||||
" Default value for getbufvar() was introduced in Vim 7.3.831.
|
||||
let bvars = getbufvar(buffer, '')
|
||||
if empty(bvars)
|
||||
let bvars = {}
|
||||
endif
|
||||
let dict = get(bvars, 'gitgutter', {})
|
||||
let needs_setting = empty(dict)
|
||||
let dict[a:varname] = a:val
|
||||
if needs_setting
|
||||
|
@ -115,7 +120,7 @@ function! gitgutter#utility#set_repo_path(bufnr) abort
|
|||
" * -2 - not tracked by git
|
||||
|
||||
call gitgutter#utility#setbufvar(a:bufnr, 'path', -1)
|
||||
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
|
||||
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -z -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
|
||||
|
||||
if g:gitgutter_async && gitgutter#async#available()
|
||||
if has('lambda')
|
||||
|
@ -202,8 +207,13 @@ function! s:exists_file(bufnr) abort
|
|||
return filereadable(s:abs_path(a:bufnr, 0))
|
||||
endfunction
|
||||
|
||||
" Get rid of any trailing new line or SOH character.
|
||||
"
|
||||
" git ls-files -z produces output with null line termination.
|
||||
" Vim's system() replaces any null characters in the output
|
||||
" with SOH (start of header), i.e. ^A.
|
||||
function! s:strip_trailing_new_line(line) abort
|
||||
return substitute(a:line, '\n$', '', '')
|
||||
return substitute(a:line, '[[:cntrl:]]$', '', '')
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#windows()
|
||||
|
|
|
@ -191,6 +191,20 @@ function Test_filename_leading_dash()
|
|||
endfunction
|
||||
|
||||
|
||||
function Test_filename_umlaut()
|
||||
call system('touch -- fixtüre.txt && git add -- fixtüre.txt')
|
||||
edit fixtüre.txt
|
||||
normal ggo*
|
||||
call s:trigger_gitgutter()
|
||||
|
||||
let expected = [
|
||||
\ 'line=1 id=3000 name=GitGutterLineAdded',
|
||||
\ 'line=2 id=3001 name=GitGutterLineAdded'
|
||||
\ ]
|
||||
call assert_equal(expected, s:signs('fixtüre.txt'))
|
||||
endfunction
|
||||
|
||||
|
||||
" FIXME: this test fails when it is the first (or only) test to be run
|
||||
function Test_follow_symlink()
|
||||
let tmp = 'symlink'
|
||||
|
@ -273,6 +287,7 @@ function Test_untracked_file_within_repo()
|
|||
call s:trigger_gitgutter()
|
||||
|
||||
call assert_equal([], s:signs(tmp))
|
||||
call assert_equal(-2, b:gitgutter.path)
|
||||
|
||||
call system('rm '.tmp)
|
||||
endfunction
|
||||
|
@ -633,3 +648,33 @@ function Test_encoding()
|
|||
|
||||
call assert_equal([], s:signs('cp932.txt'))
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_empty_file()
|
||||
" 0-byte file
|
||||
call system('touch empty.txt && git add empty.txt')
|
||||
edit empty.txt
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal([], s:signs('empty.txt'))
|
||||
|
||||
|
||||
" File consisting only of a newline
|
||||
call system('echo "" > newline.txt && git add newline.txt')
|
||||
edit newline.txt
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal([], s:signs('newline.txt'))
|
||||
|
||||
|
||||
" 1 line file without newline
|
||||
" Vim will force a newline unless we tell it not to.
|
||||
call system('echo -n a > oneline.txt && git add oneline.txt')
|
||||
set noeol nofixeol
|
||||
edit! oneline.txt
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal([], s:signs('oneline.txt'))
|
||||
|
||||
set eol fixeol
|
||||
endfunction
|
||||
|
|
|
@ -1,5 +1,36 @@
|
|||
## unplanned
|
||||
|
||||
IMPROVEMENTS:
|
||||
* Disable `g:go_gocode_propose_source` by default.
|
||||
[[GH-2050]](https://github.com/fatih/vim-go/pull/2050)
|
||||
* Don't spam users when Vim is run with vi compatibility.
|
||||
[[GH-2055]](https://github.com/fatih/vim-go/pull/2055)
|
||||
* Add bang support to lint commands to allow them to be run without jumping to
|
||||
errors.
|
||||
[[GH-2056]](https://github.com/fatih/vim-go/pull/2056)
|
||||
* Use `go doc` for `:GoDoc` instead of `godoc`.
|
||||
[[GH-2070]](https://github.com/fatih/vim-go/pull/2070)
|
||||
* Detach from and shutdown dlv correctly.
|
||||
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
|
||||
* Do not require `'autowrite'` or `'autowriteall'` to be set when using
|
||||
autocompletion in module mode.
|
||||
[[GH-2091]](https://github.com/fatih/vim-go/pull/2091)
|
||||
|
||||
BUG FIXES:
|
||||
* Fix opening of non-existent file from `:GoDeclsDir` when the current
|
||||
directory is not the directory containing the current buffer.
|
||||
[[GH-2048]](https://github.com/fatih/vim-go/pull/2048)
|
||||
* Fix jumping to an identifier with godef from a modified buffer.
|
||||
[[GH-2054]](https://github.com/fatih/vim-go/pull/2054)
|
||||
* Fix errors when `g:go_debug` contains `debugger-commands`.
|
||||
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
|
||||
* Fix errors from `:GoDebugStop` in Neovim.
|
||||
[[GH-2075]](https://github.com/fatih/vim-go/pull/2075)
|
||||
* Fix `:GoSameIdsToggle`.
|
||||
[[GH-2086]](https://github.com/fatih/vim-go/pull/2086)
|
||||
|
||||
## 1.19 - (November 4, 2018)
|
||||
|
||||
FEATURES:
|
||||
|
||||
* **go.mod file support!** This is the first feature for upcoming Go modules
|
||||
|
@ -64,6 +95,8 @@ IMPROVEMENTS:
|
|||
[[GH-2025]](https://github.com/fatih/vim-go/pull/2025)
|
||||
* Update autocompletion to work with Go modules.
|
||||
[[GH-1988]](https://github.com/fatih/vim-go/pull/1988)
|
||||
* Add an option to search $GOPATH/bin or $GOBIN _after_ $PATH.
|
||||
[[GH-2041]](https://github.com/fatih/vim-go/pull/2041)
|
||||
|
||||
BUG FIXES:
|
||||
* Fix `:GoRun %` on Windows.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:go_decls_var = {
|
||||
\ 'init': 'ctrlp#decls#init()',
|
||||
\ 'exit': 'ctrlp#decls#exit()',
|
||||
|
@ -20,7 +24,7 @@ function! ctrlp#decls#init() abort
|
|||
endfunction
|
||||
|
||||
function! ctrlp#decls#exit() abort
|
||||
unlet! s:decls s:current_dir s:target
|
||||
unlet! s:decls s:target
|
||||
endfunction
|
||||
|
||||
" The action to perform on the selected string
|
||||
|
@ -32,10 +36,6 @@ function! ctrlp#decls#accept(mode, str) abort
|
|||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
try
|
||||
" we jump to the file directory so we can get the fullpath via fnamemodify
|
||||
" below
|
||||
execute cd . s:current_dir
|
||||
|
||||
let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|')
|
||||
|
||||
" i.e: main.go
|
||||
|
@ -50,14 +50,10 @@ function! ctrlp#decls#accept(mode, str) abort
|
|||
call ctrlp#acceptfile(a:mode, filepath)
|
||||
call cursor(line, col)
|
||||
silent! norm! zvzz
|
||||
finally
|
||||
"jump back to old dir
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! ctrlp#decls#enter() abort
|
||||
let s:current_dir = fnameescape(expand('%:p:h'))
|
||||
let s:decls = []
|
||||
|
||||
let l:cmd = ['motion',
|
||||
|
@ -117,7 +113,7 @@ function! ctrlp#decls#enter() abort
|
|||
call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s",
|
||||
\ decl.ident . space,
|
||||
\ decl.keyword,
|
||||
\ fnamemodify(decl.filename, ":."),
|
||||
\ fnamemodify(decl.filename, ":p"),
|
||||
\ decl.line,
|
||||
\ decl.col,
|
||||
\ decl.full,
|
||||
|
@ -151,4 +147,8 @@ function! ctrlp#decls#cmd(mode, ...) abort
|
|||
return s:id
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! s:code(group, attr) abort
|
||||
let code = synIDattr(synIDtrans(hlID(a:group)), a:attr, "cterm")
|
||||
if code =~ '^[0-9]\+$'
|
||||
|
@ -146,4 +150,8 @@ function! fzf#decls#cmd(...) abort
|
|||
\ }))
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Test alternates between the implementation of code and the test code.
|
||||
function! go#alternate#Switch(bang, cmd) abort
|
||||
let file = expand('%')
|
||||
|
@ -24,4 +28,8 @@ function! go#alternate#Switch(bang, cmd) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
"
|
||||
" Flag to automatically call :Fmt when file is saved.
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:got_fmt_error = 0
|
||||
|
||||
" This is a trimmed-down version of the logic in fmt.vim.
|
||||
|
@ -65,4 +69,8 @@ function! go#asmfmt#ToggleAsmFmtAutoSave() abort
|
|||
call go#util#EchoProgress("auto asmfmt disabled")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#cmd#autowrite() abort
|
||||
if &autowrite == 1 || &autowriteall == 1
|
||||
silent! wall
|
||||
|
@ -282,4 +286,8 @@ function! s:cmd_job(args) abort
|
|||
call go#job#Spawn(a:args.cmd, a:args)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_GoBuildErrors()
|
||||
try
|
||||
let l:filename = 'cmd/bad.go'
|
||||
|
@ -27,4 +31,8 @@ func! Test_GoBuildErrors()
|
|||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! s:gocodeCommand(cmd, args) abort
|
||||
let l:gocode_bin = "gocode"
|
||||
let l:gomod = go#util#gomod()
|
||||
if filereadable(l:gomod)
|
||||
" Save the file when in module mode so that go list can read the
|
||||
" imports. If the user doesn't have autowrite or autorwriteall enabled,
|
||||
" they'll need to write the file manually to get reliable results.
|
||||
" See https://github.com/fatih/vim-go/pull/1988#issuecomment-428576989.
|
||||
"
|
||||
" TODO(bc): don't save the file when in module mode once
|
||||
" golang.org/x/tools/go/packages has support for an overlay and it's used
|
||||
" by gocode.
|
||||
call go#cmd#autowrite()
|
||||
let l:gocode_bin = "gocode-gomod"
|
||||
endif
|
||||
|
||||
|
@ -31,6 +26,8 @@ function! s:gocodeCommand(cmd, args) abort
|
|||
|
||||
if go#config#GocodeProposeSource()
|
||||
let cmd = extend(cmd, ['-source'])
|
||||
else
|
||||
let cmd = extend(cmd, ['-fallback-to-source', '-cache'])
|
||||
endif
|
||||
|
||||
if go#config#GocodeUnimportedPackages()
|
||||
|
@ -248,4 +245,8 @@ function! go#complete#ToggleAutoTypeInfo() abort
|
|||
call go#util#EchoProgress("auto type info enabled")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_GetInfo()
|
||||
let l:filename = 'complete/complete.go'
|
||||
let l:tmp = gotest#load_fixture(l:filename)
|
||||
|
@ -17,4 +21,8 @@ func! Test_GetInfo()
|
|||
unlet g:go_info_mode
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#config#AutodetectGopath() abort
|
||||
return get(g:, 'go_autodetect_gopath', 0)
|
||||
endfunction
|
||||
|
@ -149,7 +153,7 @@ function! go#config#GocodeProposeBuiltins() abort
|
|||
endfunction
|
||||
|
||||
function! go#config#GocodeProposeSource() abort
|
||||
return get(g:, 'go_gocode_propose_source', 1)
|
||||
return get(g:, 'go_gocode_propose_source', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#EchoCommandInfo() abort
|
||||
|
@ -202,7 +206,7 @@ endfunction
|
|||
|
||||
function! go#config#DebugCommands() abort
|
||||
" make sure g:go_debug_commands is set so that it can be added to easily.
|
||||
let g:go_debug_commands = get(g:, 'go_debug_commands', {})
|
||||
let g:go_debug_commands = get(g:, 'go_debug_commands', [])
|
||||
return g:go_debug_commands
|
||||
endfunction
|
||||
|
||||
|
@ -310,10 +314,6 @@ function! go#config#DeclsMode() abort
|
|||
return get(g:, "go_decls_mode", "")
|
||||
endfunction
|
||||
|
||||
function! go#config#DocCommand() abort
|
||||
return get(g:, "go_doc_command", ["godoc"])
|
||||
endfunction
|
||||
|
||||
function! go#config#FmtCommand() abort
|
||||
return get(g:, "go_fmt_command", "gofmt")
|
||||
endfunction
|
||||
|
@ -356,6 +356,10 @@ function! go#config#BinPath() abort
|
|||
return get(g:, "go_bin_path", "")
|
||||
endfunction
|
||||
|
||||
function! go#config#SearchBinPathFirst() abort
|
||||
return get(g:, 'go_search_bin_path_first', 1)
|
||||
endfunction
|
||||
|
||||
function! go#config#HighlightArrayWhitespaceError() abort
|
||||
return get(g:, 'go_highlight_array_whitespace_error', 0)
|
||||
endfunction
|
||||
|
@ -441,4 +445,8 @@ if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
|||
unlet g:go_gorename_prefill
|
||||
endif
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:toggle = 0
|
||||
|
||||
" Buffer creates a new cover profile with 'go test -coverprofile' and changes
|
||||
|
@ -286,4 +290,8 @@ function! s:coverage_browser_callback(coverfile, job, exit_status, data)
|
|||
call delete(a:coverfile)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('s:state')
|
||||
|
@ -67,81 +71,40 @@ function! s:call_jsonrpc(method, ...) abort
|
|||
echom 'sending to dlv ' . a:method
|
||||
endif
|
||||
|
||||
if len(a:000) > 0 && type(a:000[0]) == v:t_func
|
||||
let Cb = a:000[0]
|
||||
let args = a:000[1:]
|
||||
else
|
||||
let args = a:000
|
||||
endif
|
||||
let l:args = a:000
|
||||
let s:state['rpcid'] += 1
|
||||
let req_json = json_encode({
|
||||
let l:req_json = json_encode({
|
||||
\ 'id': s:state['rpcid'],
|
||||
\ 'method': a:method,
|
||||
\ 'params': args,
|
||||
\ 'params': l:args,
|
||||
\})
|
||||
|
||||
try
|
||||
" Use callback
|
||||
if exists('l:Cb')
|
||||
if has('nvim')
|
||||
let state = {'callback': Cb}
|
||||
function! state.on_data(ch, msg, event) abort
|
||||
call self.state.callback(a:ch, a:msg)
|
||||
endfunction
|
||||
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state})
|
||||
call chansend(l:ch, req_json)
|
||||
|
||||
if go#util#HasDebug('debugger-commands')
|
||||
let g:go_debug_commands = add(g:go_debug_commands, {
|
||||
\ 'request': req_json,
|
||||
\ 'response': Cb,
|
||||
\ })
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'nl', 'callback': Cb})
|
||||
call ch_sendraw(l:ch, req_json)
|
||||
|
||||
if go#util#HasDebug('debugger-commands')
|
||||
let g:go_debug_commands = add(g:go_debug_commands, {
|
||||
\ 'request': req_json,
|
||||
\ 'response': Cb,
|
||||
\ })
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
let l:ch = s:state['ch']
|
||||
if has('nvim')
|
||||
let state = {'done': 0}
|
||||
function! state.on_data(ch, msg, event) abort
|
||||
let self.state.resp = a:msg
|
||||
let self.state.done = 1
|
||||
endfunction
|
||||
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state})
|
||||
call chansend(l:ch, req_json)
|
||||
while state.done == 0
|
||||
call chansend(l:ch, l:req_json)
|
||||
while len(s:state.data) == 0
|
||||
sleep 50m
|
||||
endwhile
|
||||
let resp_json = state.resp
|
||||
let resp_json = s:state.data[0]
|
||||
let s:state.data = s:state.data[1:]
|
||||
else
|
||||
let ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000})
|
||||
call ch_sendraw(ch, req_json)
|
||||
let resp_json = ch_readraw(ch)
|
||||
call ch_sendraw(l:ch, req_json)
|
||||
let l:resp_raw = ch_readraw(l:ch)
|
||||
let resp_json = json_decode(l:resp_raw)
|
||||
endif
|
||||
|
||||
if go#util#HasDebug('debugger-commands')
|
||||
let g:go_debug_commands = add(g:go_debug_commands, {
|
||||
\ 'request': req_json,
|
||||
\ 'response': resp_json,
|
||||
let g:go_debug_commands = add(go#config#DebugCommands(), {
|
||||
\ 'request': l:req_json,
|
||||
\ 'response': l:resp_json,
|
||||
\ })
|
||||
endif
|
||||
|
||||
let obj = json_decode(resp_json)
|
||||
if type(obj) == v:t_dict && has_key(obj, 'error') && !empty(obj.error)
|
||||
throw obj.error
|
||||
if type(l:resp_json) == v:t_dict && has_key(l:resp_json, 'error') && !empty(l:resp_json.error)
|
||||
throw l:resp_json.error
|
||||
endif
|
||||
return obj
|
||||
return l:resp_json
|
||||
catch
|
||||
throw substitute(v:exception, '^Vim', '', '')
|
||||
endtry
|
||||
|
@ -247,12 +210,12 @@ function! s:clearState() abort
|
|||
let s:state['localVars'] = {}
|
||||
let s:state['functionArgs'] = {}
|
||||
let s:state['message'] = []
|
||||
|
||||
silent! sign unplace 9999
|
||||
endfunction
|
||||
|
||||
function! s:stop() abort
|
||||
" TODO(bc): call Detach
|
||||
call go#job#Stop(s:state['job'])
|
||||
let l:res = s:call_jsonrpc('RPCServer.Detach', {'kill': v:true})
|
||||
|
||||
call s:clearState()
|
||||
if has_key(s:state, 'job')
|
||||
|
@ -262,9 +225,19 @@ function! s:stop() abort
|
|||
if has_key(s:state, 'ready')
|
||||
call remove(s:state, 'ready')
|
||||
endif
|
||||
|
||||
if has_key(s:state, 'ch')
|
||||
call remove(s:state, 'ch')
|
||||
endif
|
||||
|
||||
if has_key( s:state, 'data')
|
||||
call remove(s:state, 'data')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#debug#Stop() abort
|
||||
" TODO(bc): don't remove breakpoints that were set before debugging started
|
||||
" (see out_cb).
|
||||
" Remove signs.
|
||||
for k in keys(s:state['breakpoint'])
|
||||
let bt = s:state['breakpoint'][k]
|
||||
|
@ -426,15 +399,11 @@ function! s:expand_var() abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! s:start_cb(ch, json) abort
|
||||
let res = json_decode(a:json)
|
||||
if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error)
|
||||
throw res.error
|
||||
endif
|
||||
if empty(res) || !has_key(res, 'result')
|
||||
function! s:start_cb(res) abort
|
||||
if empty(a:res) || !has_key(a:res, 'result')
|
||||
return
|
||||
endif
|
||||
for bt in res.result.Breakpoints
|
||||
for bt in a:res.result.Breakpoints
|
||||
if bt.id >= 0
|
||||
let s:state['breakpoint'][bt.id] = bt
|
||||
exe 'sign place '. bt.id .' line=' . bt.line . ' name=godebugbreakpoint file=' . bt.file
|
||||
|
@ -534,6 +503,46 @@ function! s:out_cb(ch, msg) abort
|
|||
let s:state['message'] += [a:msg]
|
||||
|
||||
if stridx(a:msg, go#config#DebugAddress()) != -1
|
||||
if has('nvim')
|
||||
let s:state['data'] = []
|
||||
let l:state = {'databuf': ''}
|
||||
function! s:on_data(ch, data, event) dict abort closure
|
||||
let l:data = self.databuf
|
||||
for msg in a:data
|
||||
let l:data .= l:msg
|
||||
endfor
|
||||
|
||||
try
|
||||
let l:res = json_decode(l:data)
|
||||
let s:state['data'] = add(s:state['data'], l:res)
|
||||
let self.databuf = ''
|
||||
catch
|
||||
" there isn't a complete message in databuf: buffer l:data and try
|
||||
" again when more data comes in.
|
||||
let self.databuf = l:data
|
||||
finally
|
||||
endtry
|
||||
endfunction
|
||||
" explicitly bind callback to state so that within it, self will
|
||||
" always refer to state. See :help Partial for more information.
|
||||
let l:state.on_data = function('s:on_data', [], l:state)
|
||||
let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': l:state.on_data, 'state': l:state})
|
||||
if l:ch == 0
|
||||
call go#util#EchoError("could not connect to debugger")
|
||||
call go#job#Stop(s:state['job'])
|
||||
return
|
||||
endif
|
||||
else
|
||||
let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000})
|
||||
if ch_status(l:ch) !=# 'open'
|
||||
call go#util#EchoError("could not connect to debugger")
|
||||
call go#job#Stop(s:state['job'])
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:state['ch'] = l:ch
|
||||
|
||||
" After this block executes, Delve will be running with all the
|
||||
" breakpoints setup, so this callback doesn't have to run again; just log
|
||||
" future messages.
|
||||
|
@ -546,7 +555,8 @@ function! s:out_cb(ch, msg) abort
|
|||
call go#debug#Breakpoint(bt.line)
|
||||
endfor
|
||||
|
||||
call s:call_jsonrpc('RPCServer.ListBreakpoints', function('s:start_cb'))
|
||||
let res = s:call_jsonrpc('RPCServer.ListBreakpoints')
|
||||
call s:start_cb(res)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -571,13 +581,6 @@ function! go#debug#Start(is_test, ...) abort
|
|||
call go#config#SetDebugDiag(s:state)
|
||||
endif
|
||||
|
||||
" cd in to test directory; this is also what running "go test" does.
|
||||
if a:is_test
|
||||
lcd %:p:h
|
||||
endif
|
||||
|
||||
let s:state.is_test = a:is_test
|
||||
|
||||
let dlv = go#path#CheckBinPath("dlv")
|
||||
if empty(dlv)
|
||||
return
|
||||
|
@ -586,14 +589,27 @@ function! go#debug#Start(is_test, ...) abort
|
|||
try
|
||||
if len(a:000) > 0
|
||||
let l:pkgname = a:1
|
||||
" Expand .; otherwise this won't work from a tmp dir.
|
||||
if l:pkgname[0] == '.'
|
||||
let l:pkgname = go#package#FromPath(getcwd()) . l:pkgname[1:]
|
||||
let l:pkgname = go#package#FromPath(l:pkgname)
|
||||
endif
|
||||
else
|
||||
let l:pkgname = go#package#FromPath(getcwd())
|
||||
endif
|
||||
|
||||
if l:pkgname is -1
|
||||
call go#util#EchoError('could not determine package name')
|
||||
return
|
||||
endif
|
||||
|
||||
" cd in to test directory; this is also what running "go test" does.
|
||||
if a:is_test
|
||||
" TODO(bc): Either remove this if it's ok to do so or else record it and
|
||||
" reset cwd after the job completes.
|
||||
lcd %:p:h
|
||||
endif
|
||||
|
||||
let s:state.is_test = a:is_test
|
||||
|
||||
let l:args = []
|
||||
if len(a:000) > 1
|
||||
let l:args = ['--'] + a:000[1:]
|
||||
|
@ -608,7 +624,6 @@ function! go#debug#Start(is_test, ...) abort
|
|||
\ '--api-version', '2',
|
||||
\ '--log', '--log-output', 'debugger,rpc',
|
||||
\ '--listen', go#config#DebugAddress(),
|
||||
\ '--accept-multiclient',
|
||||
\]
|
||||
|
||||
let buildtags = go#config#BuildTags()
|
||||
|
@ -803,20 +818,13 @@ function! s:update_stacktrace() abort
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:stack_cb(ch, json) abort
|
||||
function! s:stack_cb(res) abort
|
||||
let s:stack_name = ''
|
||||
let res = json_decode(a:json)
|
||||
if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error)
|
||||
call go#util#EchoError(res.error)
|
||||
call s:clearState()
|
||||
call go#debug#Restart()
|
||||
return
|
||||
endif
|
||||
|
||||
if empty(res) || !has_key(res, 'result')
|
||||
if empty(a:res) || !has_key(a:res, 'result')
|
||||
return
|
||||
endif
|
||||
call s:update_breakpoint(res)
|
||||
call s:update_breakpoint(a:res)
|
||||
call s:update_stacktrace()
|
||||
call s:update_variables()
|
||||
endfunction
|
||||
|
@ -847,7 +855,14 @@ function! go#debug#Stack(name) abort
|
|||
call s:call_jsonrpc('RPCServer.CancelNext')
|
||||
endif
|
||||
let s:stack_name = l:name
|
||||
call s:call_jsonrpc('RPCServer.Command', function('s:stack_cb'), {'name': l:name})
|
||||
try
|
||||
let res = s:call_jsonrpc('RPCServer.Command', {'name': l:name})
|
||||
call s:stack_cb(res)
|
||||
catch
|
||||
call go#util#EchoError(v:exception)
|
||||
call s:clearState()
|
||||
call go#debug#Restart()
|
||||
endtry
|
||||
catch
|
||||
call go#util#EchoError(v:exception)
|
||||
endtry
|
||||
|
@ -944,4 +959,8 @@ endfunction
|
|||
sign define godebugbreakpoint text=> texthl=GoDebugBreakpoint
|
||||
sign define godebugcurline text== linehl=GoDebugCurrent texthl=GoDebugCurrent
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#decls#Decls(mode, ...) abort
|
||||
let decls_mode = go#config#DeclsMode()
|
||||
if decls_mode == 'ctrlp'
|
||||
|
@ -15,4 +19,8 @@ function! go#decls#Decls(mode, ...) abort
|
|||
end
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:go_stack = []
|
||||
let s:go_stack_level = 0
|
||||
|
||||
|
@ -10,21 +14,18 @@ function! go#def#Jump(mode) abort
|
|||
" covers all edge cases, but now anyone can switch to godef if they wish
|
||||
let bin_name = go#config#DefMode()
|
||||
if bin_name == 'godef'
|
||||
if &modified
|
||||
" Write current unsaved buffer to a temp file and use the modified content
|
||||
let l:tmpname = tempname()
|
||||
call writefile(go#util#GetLines(), l:tmpname)
|
||||
let fname = l:tmpname
|
||||
endif
|
||||
|
||||
let [l:out, l:err] = go#util#Exec(['godef',
|
||||
let l:cmd = ['godef',
|
||||
\ '-f=' . l:fname,
|
||||
\ '-o=' . go#util#OffsetCursor(),
|
||||
\ '-t'])
|
||||
if exists("l:tmpname")
|
||||
call delete(l:tmpname)
|
||||
endif
|
||||
\ '-t']
|
||||
|
||||
if &modified
|
||||
let l:stdin_content = join(go#util#GetLines(), "\n")
|
||||
call add(l:cmd, "-i")
|
||||
let [l:out, l:err] = go#util#Exec(l:cmd, l:stdin_content)
|
||||
else
|
||||
let [l:out, l:err] = go#util#Exec(l:cmd)
|
||||
endif
|
||||
elseif bin_name == 'guru'
|
||||
let cmd = [go#path#CheckBinPath(bin_name)]
|
||||
let buildtags = go#config#BuildTags()
|
||||
|
@ -35,7 +36,7 @@ function! go#def#Jump(mode) abort
|
|||
let stdin_content = ""
|
||||
|
||||
if &modified
|
||||
let content = join(go#util#GetLines(), "\n")
|
||||
let content = join(go#util#GetLines(), "\n")
|
||||
let stdin_content = fname . "\n" . strlen(content) . "\n" . content
|
||||
call add(cmd, "-modified")
|
||||
endif
|
||||
|
@ -317,4 +318,8 @@ function s:def_job(args, state) abort
|
|||
call go#job#Start(a:args.cmd, l:start_options)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_jump_to_declaration_guru() abort
|
||||
try
|
||||
let l:filename = 'def/jump.go'
|
||||
|
@ -63,4 +67,8 @@ func! Test_Jump_leaves_lists() abort
|
|||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:buf_nr = -1
|
||||
|
||||
function! go#doc#OpenBrowser(...) abort
|
||||
|
@ -51,13 +55,8 @@ endfunction
|
|||
function! go#doc#Open(newmode, mode, ...) abort
|
||||
" With argument: run "godoc [arg]".
|
||||
if len(a:000)
|
||||
if empty(go#path#CheckBinPath(go#config#DocCommand()[0]))
|
||||
return
|
||||
endif
|
||||
|
||||
let [l:out, l:err] = go#util#Exec(go#config#DocCommand() + a:000)
|
||||
" Without argument: run gogetdoc on cursor position.
|
||||
else
|
||||
let [l:out, l:err] = go#util#Exec(['go', 'doc'] + a:000)
|
||||
else " Without argument: run gogetdoc on cursor position.
|
||||
let [l:out, l:err] = s:gogetdoc(0)
|
||||
if out == -1
|
||||
return
|
||||
|
@ -189,4 +188,8 @@ function! s:godocWord(args) abort
|
|||
return [pkg, exported_name]
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#fillstruct#FillStruct() abort
|
||||
let l:cmd = ['fillstruct',
|
||||
\ '-file', bufname(''),
|
||||
|
@ -61,4 +65,8 @@ function! go#fillstruct#FillStruct() abort
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_fillstruct() abort
|
||||
try
|
||||
let l:tmp = gotest#write_file('a/a.go', [
|
||||
|
@ -87,4 +91,8 @@ func! Test_fillstruct_two_cursor() abort
|
|||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
" fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible
|
||||
" toorls, such as goimports).
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" we have those problems :
|
||||
" http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree
|
||||
" http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1
|
||||
|
@ -211,4 +215,8 @@ function! go#fmt#ToggleFmtAutoSave() abort
|
|||
call go#util#EchoProgress("auto fmt enabled")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_run_fmt() abort
|
||||
let actual_file = tempname()
|
||||
call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file)
|
||||
|
@ -46,4 +50,8 @@ func! Test_goimports() abort
|
|||
call assert_equal(expected, actual)
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
" guru.vim -- Vim integration for the Go guru.
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" guru_cmd returns a dict that contains the command to execute guru. args
|
||||
" is dict with following options:
|
||||
" mode : guru mode, such as 'implements'
|
||||
|
@ -483,7 +487,7 @@ function! s:same_ids_highlight(exit_val, output, mode) abort
|
|||
" is redisplayed: e.g. :edit, :GoRename, etc.
|
||||
augroup vim-go-sameids
|
||||
autocmd!
|
||||
autocmd BufWinEnter <buffer> nested call go#guru#SameIds()
|
||||
autocmd BufWinEnter <buffer> nested call go#guru#SameIds(0)
|
||||
augroup end
|
||||
endif
|
||||
endfunction
|
||||
|
@ -515,11 +519,11 @@ endfunction
|
|||
|
||||
function! go#guru#ToggleSameIds() abort
|
||||
if go#guru#ClearSameIds() != 0
|
||||
call go#guru#SameIds()
|
||||
call go#guru#SameIds(1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#guru#AutoToogleSameIds() abort
|
||||
function! go#guru#AutoToggleSameIds() abort
|
||||
if go#config#AutoSameids()
|
||||
call go#util#EchoProgress("sameids auto highlighting disabled")
|
||||
call go#guru#ClearSameIds()
|
||||
|
@ -586,4 +590,8 @@ function! go#guru#Scope(...) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function Test_GuruScope_Set() abort
|
||||
silent call go#guru#Scope("example.com/foo/bar")
|
||||
let actual = go#config#GuruScope()
|
||||
|
@ -12,4 +16,8 @@ function Test_GuruScope_Set() abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! Test_gomodVersion_highlight() abort
|
||||
try
|
||||
syntax on
|
||||
|
@ -92,4 +96,8 @@ function! Test_gomodVersion_incompatible_highlight() abort
|
|||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#iferr#Generate()
|
||||
let [l:out, l:err] = go#util#Exec(['iferr',
|
||||
\ '-pos=' . go#util#OffsetCursor()], go#util#GetLines())
|
||||
|
@ -14,3 +18,9 @@ function! go#iferr#Generate()
|
|||
call setpos('.', l:pos)
|
||||
silent normal! 4j
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#impl#Impl(...) abort
|
||||
let recv = ""
|
||||
let iface = ""
|
||||
|
@ -164,4 +168,8 @@ function! go#impl#Complete(arglead, cmdline, cursorpos) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_impl() abort
|
||||
try
|
||||
let l:tmp = gotest#write_file('a/a.go', [
|
||||
|
@ -35,3 +39,9 @@ func! Test_impl_get() abort
|
|||
call delete(l:tmp, 'rf')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
"
|
||||
" Check out the docs for more information at /doc/vim-go.txt
|
||||
"
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#import#SwitchImport(enabled, localname, path, bang) abort
|
||||
let view = winsaveview()
|
||||
let path = substitute(a:path, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
|
@ -220,5 +225,8 @@ function! s:Error(s) abort
|
|||
echohl Error | echo a:s | echohl None
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_indent_raw_string() abort
|
||||
" The goRawString discovery requires that syntax be enabled.
|
||||
syntax on
|
||||
|
@ -60,3 +64,9 @@ func! Test_indent_raw_string() abort
|
|||
call delete(l:dir, 'rf')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:templatepath = go#util#Join(expand('<sfile>:p:h:h:h'), '.github', 'ISSUE_TEMPLATE.md')
|
||||
|
||||
function! go#issue#New() abort
|
||||
|
@ -31,4 +35,8 @@ function! s:issuebody() abort
|
|||
return join(body, "\n")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Spawn starts an asynchronous job. See the description of go#job#Options to
|
||||
" understand the args parameter.
|
||||
"
|
||||
|
@ -88,7 +92,6 @@ function! go#job#Options(args)
|
|||
let state.errorformat = a:args.errorformat
|
||||
endif
|
||||
|
||||
" do nothing in state.complete by default.
|
||||
function state.complete(job, exit_status, data)
|
||||
if has_key(self, 'custom_complete')
|
||||
let l:winid = win_getid(winnr())
|
||||
|
@ -539,4 +542,8 @@ function! s:winjobarg(idx, val) abort
|
|||
return a:val
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#keyify#Keyify()
|
||||
" Needs: https://github.com/dominikh/go-tools/pull/272
|
||||
"\ '-tags', go#config#BuildTags(),
|
||||
|
@ -53,4 +57,8 @@ function! s:chomp(string)
|
|||
return substitute(a:string, '\n\+$', '', '')
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
function! go#lint#Gometa(autosave, ...) abort
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#lint#Gometa(bang, autosave, ...) abort
|
||||
if a:0 == 0
|
||||
let goargs = [expand('%:p:h')]
|
||||
else
|
||||
|
@ -57,7 +61,7 @@ function! go#lint#Gometa(autosave, ...) abort
|
|||
let cmd += goargs
|
||||
|
||||
if go#util#has_job()
|
||||
call s:lint_job({'cmd': cmd}, a:autosave)
|
||||
call s:lint_job({'cmd': cmd}, a:bang, a:autosave)
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -85,7 +89,7 @@ function! go#lint#Gometa(autosave, ...) abort
|
|||
let errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
|
||||
if !a:autosave
|
||||
if !a:autosave && !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
|
@ -93,7 +97,7 @@ endfunction
|
|||
|
||||
" Golint calls 'golint' on the current directory. Any warnings are populated in
|
||||
" the location list
|
||||
function! go#lint#Golint(...) abort
|
||||
function! go#lint#Golint(bang, ...) abort
|
||||
if a:0 == 0
|
||||
let [l:out, l:err] = go#util#Exec([go#config#GolintBin(), go#package#ImportPath()])
|
||||
else
|
||||
|
@ -109,7 +113,9 @@ function! go#lint#Golint(...) abort
|
|||
call go#list#Parse(l:listtype, l:out, "GoLint")
|
||||
let l:errors = go#list#Get(l:listtype)
|
||||
call go#list#Window(l:listtype, len(l:errors))
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
if !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Vet calls 'go vet' on the current directory. Any warnings are populated in
|
||||
|
@ -143,7 +149,7 @@ endfunction
|
|||
|
||||
" ErrCheck calls 'errcheck' for the given packages. Any warnings are populated in
|
||||
" the location list
|
||||
function! go#lint#Errcheck(...) abort
|
||||
function! go#lint#Errcheck(bang, ...) abort
|
||||
if a:0 == 0
|
||||
let l:import_path = go#package#ImportPath()
|
||||
if import_path == -1
|
||||
|
@ -175,7 +181,7 @@ function! go#lint#Errcheck(...) abort
|
|||
if !empty(errors)
|
||||
call go#list#Populate(l:listtype, errors, 'Errcheck')
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
if !empty(errors)
|
||||
if !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
endif
|
||||
endif
|
||||
|
@ -196,11 +202,12 @@ function! go#lint#ToggleMetaLinterAutoSave() abort
|
|||
call go#util#EchoProgress("auto metalinter enabled")
|
||||
endfunction
|
||||
|
||||
function! s:lint_job(args, autosave)
|
||||
function! s:lint_job(args, bang, autosave)
|
||||
let l:opts = {
|
||||
\ 'statustype': "gometalinter",
|
||||
\ 'errorformat': '%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m',
|
||||
\ 'for': "GoMetaLinter",
|
||||
\ 'bang': a:bang,
|
||||
\ }
|
||||
|
||||
if a:autosave
|
||||
|
@ -213,4 +220,8 @@ function! s:lint_job(args, autosave)
|
|||
call go#job#Spawn(a:args.cmd, l:opts)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! Test_Gometa() abort
|
||||
let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/lint'
|
||||
silent exe 'e ' . $GOPATH . '/src/lint/lint.go'
|
||||
|
@ -11,7 +15,7 @@ func! Test_Gometa() abort
|
|||
|
||||
let g:go_metalinter_enabled = ['golint']
|
||||
|
||||
call go#lint#Gometa(0, $GOPATH . '/src/foo')
|
||||
call go#lint#Gometa(0, 0, $GOPATH . '/src/foo')
|
||||
|
||||
let actual = getqflist()
|
||||
let start = reltime()
|
||||
|
@ -37,7 +41,7 @@ func! Test_GometaWithDisabled() abort
|
|||
|
||||
let g:go_metalinter_disabled = ['vet']
|
||||
|
||||
call go#lint#Gometa(0, $GOPATH . '/src/foo')
|
||||
call go#lint#Gometa(0, 0, $GOPATH . '/src/foo')
|
||||
|
||||
let actual = getqflist()
|
||||
let start = reltime()
|
||||
|
@ -65,7 +69,7 @@ func! Test_GometaAutoSave() abort
|
|||
|
||||
let g:go_metalinter_autosave_enabled = ['golint']
|
||||
|
||||
call go#lint#Gometa(1)
|
||||
call go#lint#Gometa(0, 1)
|
||||
|
||||
let actual = getloclist(l:winnr)
|
||||
let start = reltime()
|
||||
|
@ -105,4 +109,8 @@ func! Test_Vet()
|
|||
call gotest#assert_quickfix(actual, expected)
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Window opens the list with the given height up to 10 lines maximum.
|
||||
" Otherwise g:go_loclist_height is used.
|
||||
"
|
||||
|
@ -164,4 +168,8 @@ function! go#list#Type(for) abort
|
|||
return get(go#config#ListTypeCommands(), a:for, l:listtype)
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:go_major_version = ""
|
||||
|
||||
function! go#mod#Format() abort
|
||||
|
@ -138,3 +142,9 @@ function! go#mod#ToggleModFmtAutoSave() abort
|
|||
call go#config#SetModFmtAutosave(1)
|
||||
call go#util#EchoProgress("auto mod fmt enabled")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
" This file provides a utility function that performs auto-completion of
|
||||
" package names, for use by other commands.
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:goos = $GOOS
|
||||
let s:goarch = $GOARCH
|
||||
|
||||
|
@ -55,7 +59,7 @@ function! go#package#Paths() abort
|
|||
endfunction
|
||||
|
||||
let s:import_paths = {}
|
||||
" ImportPath returns the import path in the current directory it was executed
|
||||
" ImportPath returns the import path of the package for current buffer.
|
||||
function! go#package#ImportPath() abort
|
||||
let dir = expand("%:p:h")
|
||||
if has_key(s:import_paths, dir)
|
||||
|
@ -67,47 +71,50 @@ function! go#package#ImportPath() abort
|
|||
return -1
|
||||
endif
|
||||
|
||||
let import_path = split(out, '\n')[0]
|
||||
let l:importpath = split(out, '\n')[0]
|
||||
|
||||
" go list returns '_CURRENTDIRECTORY' if the directory is not inside GOPATH.
|
||||
" Check it and retun an error if that is the case
|
||||
if import_path[0] ==# '_'
|
||||
if l:importpath[0] ==# '_'
|
||||
return -1
|
||||
endif
|
||||
|
||||
let s:import_paths[dir] = import_path
|
||||
let s:import_paths[dir] = l:importpath
|
||||
|
||||
return import_path
|
||||
return l:importpath
|
||||
endfunction
|
||||
|
||||
|
||||
" FromPath returns the import path of arg.
|
||||
function! go#package#FromPath(arg) abort
|
||||
let path = fnamemodify(resolve(a:arg), ':p')
|
||||
let dirs = go#package#Paths()
|
||||
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
|
||||
let l:dir = getcwd()
|
||||
|
||||
for dir in dirs
|
||||
if len(dir) && match(path, dir) == 0
|
||||
let workspace = dir
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
let l:path = a:arg
|
||||
if !isdirectory(l:path)
|
||||
let l:path = fnamemodify(l:path, ':h')
|
||||
endif
|
||||
|
||||
if !exists('workspace')
|
||||
execute l:cd fnameescape(l:path)
|
||||
let [l:out, l:err] = go#util#Exec(['go', 'list'])
|
||||
execute l:cd fnameescape(l:dir)
|
||||
if l:err != 0
|
||||
return -1
|
||||
endif
|
||||
|
||||
let path = substitute(path, '/*$', '', '')
|
||||
let workspace = substitute(workspace . '/src/', '/+', '', '')
|
||||
if isdirectory(path)
|
||||
return substitute(path, workspace, '', '')
|
||||
else
|
||||
return substitute(substitute(path, workspace, '', ''),
|
||||
\ '/' . fnamemodify(path, ':t'), '', '')
|
||||
let l:importpath = split(l:out, '\n')[0]
|
||||
|
||||
" go list returns '_CURRENTDIRECTORY' if the directory is not inside GOPATH.
|
||||
" Check it and retun an error if that is the case
|
||||
if l:importpath[0] ==# '_'
|
||||
return -1
|
||||
endif
|
||||
|
||||
return l:importpath
|
||||
endfunction
|
||||
|
||||
function! go#package#CompleteMembers(package, member) abort
|
||||
let [l:content, l:err] = go#util#Exec(['godoc', a:package])
|
||||
let [l:content, l:err] = go#util#Exec(['go', 'doc', a:package])
|
||||
if l:err || !len(content)
|
||||
return []
|
||||
endif
|
||||
|
@ -137,37 +144,41 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort
|
|||
return go#package#CompleteMembers(words[1], words[2])
|
||||
endif
|
||||
|
||||
let dirs = go#package#Paths()
|
||||
let dirs = go#package#Paths()
|
||||
|
||||
if len(dirs) == 0
|
||||
" should not happen
|
||||
return []
|
||||
endif
|
||||
if len(dirs) == 0
|
||||
" should not happen
|
||||
return []
|
||||
endif
|
||||
|
||||
let ret = {}
|
||||
for dir in dirs
|
||||
" this may expand to multiple lines
|
||||
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
|
||||
call add(root, expand(dir . '/src'))
|
||||
for r in root
|
||||
for i in split(globpath(r, a:ArgLead.'*'), "\n")
|
||||
if isdirectory(i)
|
||||
let i .= '/'
|
||||
elseif i !~ '\.a$'
|
||||
continue
|
||||
endif
|
||||
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'),
|
||||
\ '\.a$', '', 'g')
|
||||
let ret = {}
|
||||
for dir in dirs
|
||||
" this may expand to multiple lines
|
||||
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
|
||||
call add(root, expand(dir . '/src'))
|
||||
for r in root
|
||||
for i in split(globpath(r, a:ArgLead.'*'), "\n")
|
||||
if isdirectory(i)
|
||||
let i .= '/'
|
||||
elseif i !~ '\.a$'
|
||||
continue
|
||||
endif
|
||||
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'),
|
||||
\ '\.a$', '', 'g')
|
||||
|
||||
" without this the result can have duplicates in form of
|
||||
" 'encoding/json' and '/encoding/json/'
|
||||
let i = go#util#StripPathSep(i)
|
||||
" without this the result can have duplicates in form of
|
||||
" 'encoding/json' and '/encoding/json/'
|
||||
let i = go#util#StripPathSep(i)
|
||||
|
||||
let ret[i] = i
|
||||
endfor
|
||||
endfor
|
||||
let ret[i] = i
|
||||
endfor
|
||||
endfor
|
||||
return sort(keys(ret))
|
||||
endfor
|
||||
return sort(keys(ret))
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" initial_go_path is used to store the initial GOPATH that was set when Vim
|
||||
" was started. It's used with :GoPathClear to restore the GOPATH when the user
|
||||
" changed it explicitly via :GoPath. Initially it's empty. It's being set when
|
||||
|
@ -142,7 +146,8 @@ function! go#path#BinPath() abort
|
|||
endfunction
|
||||
|
||||
" CheckBinPath checks whether the given binary exists or not and returns the
|
||||
" path of the binary. It returns an empty string doesn't exists.
|
||||
" path of the binary, respecting the go_bin_path and go_search_bin_path_first
|
||||
" settings. It returns an empty string if the binary doesn't exist.
|
||||
function! go#path#CheckBinPath(binpath) abort
|
||||
" remove whitespaces if user applied something like 'goimports '
|
||||
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
|
@ -155,7 +160,12 @@ function! go#path#CheckBinPath(binpath) abort
|
|||
if !empty(go_bin_path)
|
||||
" append our GOBIN and GOPATH paths and be sure they can be found there...
|
||||
" let us search in our GOBIN and GOPATH paths
|
||||
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
|
||||
" respect the ordering specified by go_search_bin_path_first
|
||||
if go#config#SearchBinPathFirst()
|
||||
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
|
||||
else
|
||||
let $PATH = $PATH . go#util#PathListSep() . go_bin_path
|
||||
endif
|
||||
endif
|
||||
|
||||
" if it's in PATH just return it
|
||||
|
@ -195,4 +205,8 @@ function! s:CygwinPath(path)
|
|||
return substitute(a:path, '\\', '/', "g")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#play#Share(count, line1, line2) abort
|
||||
if !executable('curl')
|
||||
echohl ErrorMsg | echomsg "vim-go: require 'curl' command" | echohl None
|
||||
|
@ -66,4 +70,8 @@ function! s:get_visual_selection() abort
|
|||
return join(lines, "\n")
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#rename#Rename(bang, ...) abort
|
||||
let to_identifier = ""
|
||||
if a:0 == 0
|
||||
|
@ -117,4 +121,8 @@ function! go#rename#Complete(lead, cmdline, cursor)
|
|||
\ 'strpart(v:val, 0, len(a:lead)) == a:lead')
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Statusline
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
|
@ -109,4 +113,8 @@ function! go#statusline#Clear(timer_id) abort
|
|||
exe 'let &ro = &ro'
|
||||
endfunction
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" mapped to :GoAddTags
|
||||
function! go#tags#Add(start, end, count, ...) abort
|
||||
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
|
@ -208,4 +212,8 @@ func s:create_cmd(args) abort
|
|||
return {'cmd': cmd}
|
||||
endfunc
|
||||
|
||||
" restore Vi compatibility settings
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue