From fae0b73f0de26936b34c2eb012e5faae696b7d10 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 17 May 2019 16:09:13 +0200 Subject: [PATCH] Updated plugins --- .../ale/ale_linters/c/clang.vim | 5 +- sources_non_forked/ale/ale_linters/c/gcc.vim | 5 +- .../ale/ale_linters/chef/cookstyle.vim | 54 ++ .../ale/ale_linters/clojure/clj_kondo.vim | 34 ++ .../ale/ale_linters/cpp/clang.vim | 5 +- .../ale/ale_linters/cpp/gcc.vim | 5 +- .../ale/ale_linters/css/fecs.vim | 9 + sources_non_forked/ale/ale_linters/d/dmd.vim | 21 +- .../ale/ale_linters/elixir/elixir_ls.vim | 2 +- .../ale/ale_linters/erlang/syntaxerl.vim | 17 +- .../ale/ale_linters/eruby/erubi.vim | 17 +- .../ale/ale_linters/go/gopls.vim | 30 + .../ale/ale_linters/go/gotype.vim | 2 +- .../ale/ale_linters/haml/hamllint.vim | 2 +- .../ale/ale_linters/haskell/cabal_ghc.vim | 3 +- .../ale/ale_linters/haskell/stack_ghc.vim | 3 +- .../ale/ale_linters/html/fecs.vim | 9 + .../ale/ale_linters/java/eclipselsp.vim | 137 +++++ .../ale/ale_linters/java/javac.vim | 32 +- .../ale/ale_linters/javascript/fecs.vim | 10 + .../ale/ale_linters/javascript/flow.vim | 36 +- .../ale/ale_linters/kotlin/kotlinc.vim | 51 +- .../ale/ale_linters/php/phpstan.vim | 66 +-- .../ale/ale_linters/powershell/powershell.vim | 91 +++ .../powershell/psscriptanalyzer.vim | 76 +++ .../ale/ale_linters/python/flake8.vim | 28 +- .../ale/ale_linters/python/pylint.vim | 9 +- .../ale_linters/ruby/rails_best_practices.vim | 4 +- .../ale/ale_linters/ruby/reek.vim | 29 +- .../ale/ale_linters/rust/cargo.vim | 28 +- .../ale/ale_linters/rust/rls.vim | 2 +- .../ale/ale_linters/sh/shellcheck.vim | 40 +- .../ale/ale_linters/slim/slimlint.vim | 2 +- .../ale/ale_linters/swift/sourcekitlsp.vim | 13 + .../ale/ale_linters/typescript/xo.vim | 23 + .../ale/ale_linters/vim/vint.vim | 36 +- sources_non_forked/ale/autoload/ale.vim | 26 +- .../ale/autoload/ale/assert.vim | 170 ++++-- sources_non_forked/ale/autoload/ale/c.vim | 39 +- .../ale/autoload/ale/command.vim | 52 +- .../ale/autoload/ale/completion.vim | 120 ++-- .../ale/autoload/ale/cursor.vim | 2 +- .../ale/autoload/ale/definition.vim | 19 + .../ale/autoload/ale/engine.vim | 26 +- .../ale/autoload/ale/engine/ignore.vim | 6 +- sources_non_forked/ale/autoload/ale/fix.vim | 32 +- .../ale/autoload/ale/fix/registry.vim | 29 +- .../ale/autoload/ale/fixers/eslint.vim | 24 +- .../ale/autoload/ale/fixers/fecs.vim | 17 + .../ale/autoload/ale/fixers/floskell.vim | 20 + .../ale/autoload/ale/fixers/latexindent.vim | 18 + .../ale/autoload/ale/fixers/ocp_indent.vim | 18 + .../ale/autoload/ale/fixers/prettier.vim | 23 +- .../autoload/ale/fixers/prettier_eslint.vim | 34 +- .../ale/autoload/ale/fixers/styler.vim | 16 + .../ale/autoload/ale/handlers/eslint.vim | 5 + .../ale/autoload/ale/handlers/fecs.vim | 52 ++ .../ale/autoload/ale/handlers/redpen.vim | 4 +- .../ale/autoload/ale/highlight.vim | 140 ++++- .../ale/autoload/ale/linter.vim | 10 +- sources_non_forked/ale/autoload/ale/list.vim | 2 +- .../ale/autoload/ale/lsp/message.vim | 2 +- .../ale/autoload/ale/lsp/response.vim | 2 +- .../ale/autoload/ale/lsp_linter.vim | 20 +- sources_non_forked/ale/autoload/ale/node.vim | 2 +- .../ale/autoload/ale/powershell.vim | 32 ++ .../ale/autoload/ale/references.vim | 16 +- sources_non_forked/ale/autoload/ale/ruby.vim | 2 +- .../ale/autoload/ale/semver.vim | 49 +- sources_non_forked/ale/autoload/ale/sign.vim | 2 +- sources_non_forked/ale/autoload/ale/swift.vim | 13 + sources_non_forked/ale/autoload/ale/util.vim | 2 +- .../ale/autoload/ale/virtualtext.vim | 2 +- sources_non_forked/ale/doc/ale-chef.txt | 20 + sources_non_forked/ale/doc/ale-clojure.txt | 7 + sources_non_forked/ale/doc/ale-css.txt | 8 + .../ale/doc/ale-development.txt | 48 +- sources_non_forked/ale/doc/ale-go.txt | 179 +++--- sources_non_forked/ale/doc/ale-haskell.txt | 10 + sources_non_forked/ale/doc/ale-html.txt | 8 + sources_non_forked/ale/doc/ale-java.txt | 40 ++ sources_non_forked/ale/doc/ale-javascript.txt | 27 + sources_non_forked/ale/doc/ale-ocaml.txt | 28 + sources_non_forked/ale/doc/ale-php.txt | 16 +- sources_non_forked/ale/doc/ale-powershell.txt | 77 +++ sources_non_forked/ale/doc/ale-python.txt | 8 + sources_non_forked/ale/doc/ale-r.txt | 16 + sources_non_forked/ale/doc/ale-rust.txt | 8 +- sources_non_forked/ale/doc/ale-sh.txt | 12 + .../doc/ale-supported-languages-and-tools.txt | 16 + sources_non_forked/ale/doc/ale-swift.txt | 21 + sources_non_forked/ale/doc/ale-tex.txt | 21 + sources_non_forked/ale/doc/ale.txt | 526 +++++------------- sources_non_forked/ale/plugin/ale.vim | 2 +- .../rplugin/python3/deoplete/sources/ale.py | 54 ++ sources_non_forked/ale/supported-tools.md | 18 +- sources_non_forked/goyo.vim/doc/goyo.txt | 2 +- .../autoload/lightline/colorscheme/one.vim | 16 +- .../nerdtree/autoload/nerdtree.vim | 25 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 7 +- .../nerdtree/lib/nerdtree/bookmark.vim | 2 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 2 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 2 +- .../nerdtree/lib/nerdtree/ui.vim | 9 +- .../nerdtree/plugin/NERD_tree.vim | 5 +- sources_non_forked/vim-flake8/README.mdown | 4 +- .../vim-fugitive/autoload/fugitive.vim | 208 +++---- .../vim-go/.github/ISSUE_TEMPLATE.md | 20 +- sources_non_forked/vim-go/CHANGELOG.md | 49 +- sources_non_forked/vim-go/Dockerfile | 2 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 22 +- .../vim-go/autoload/go/complete.vim | 36 +- .../vim-go/autoload/go/config.vim | 10 +- .../vim-go/autoload/go/debug.vim | 60 +- sources_non_forked/vim-go/autoload/go/doc.vim | 8 +- .../vim-go/autoload/go/guru.vim | 2 +- .../vim-go/autoload/go/issue.vim | 2 +- sources_non_forked/vim-go/autoload/go/job.vim | 8 +- .../vim-go/autoload/go/lint.vim | 24 +- sources_non_forked/vim-go/autoload/go/lsp.vim | 145 ++++- .../vim-go/autoload/go/lsp/message.vim | 36 +- sources_non_forked/vim-go/autoload/go/mod.vim | 2 +- .../vim-go/autoload/go/package.vim | 133 ++++- .../vim-go/autoload/go/package_test.vim | 58 ++ .../vim-go/autoload/go/path.vim | 13 +- .../vim-go/autoload/go/tags.vim | 18 +- .../vim-go/autoload/go/tags_test.vim | 24 +- .../vim-go/autoload/go/term.vim | 132 +++-- .../vim-go/autoload/go/term_test.vim | 4 +- .../package/src/package/bar/.gitkeep | 0 .../package/src/package/baz/.gitkeep | 0 .../test-fixtures/package/src/package/go.mod | 3 + .../package/src/package/package.go | 7 + .../package/src/package/vendor/foo/.gitkeep | 0 .../vim-go/autoload/go/test.vim | 13 +- .../vim-go/autoload/go/test_test.vim | 8 +- .../vim-go/autoload/go/tool.vim | 21 +- sources_non_forked/vim-go/autoload/go/uri.vim | 6 +- .../vim-go/autoload/go/util.vim | 91 +-- sources_non_forked/vim-go/doc/vim-go.txt | 71 ++- sources_non_forked/vim-go/ftplugin/go.vim | 23 +- sources_non_forked/vim-go/plugin/go.vim | 32 +- sources_non_forked/vim-go/scripts/run-vim | 2 +- .../vim-markdown/doc/vim-markdown.txt | 22 + .../vim-markdown/syntax/markdown.vim | 2 +- .../vim-markdown/test/syntax.vader | 9 + .../vim-pug/{README.markdown => README.md} | 0 .../vim-repeat/autoload/repeat.vim | 26 +- .../vim-snippets/UltiSnips/cs.snippets | 6 +- .../vim-snippets/UltiSnips/python.snippets | 9 +- .../vim-snippets/snippets/eelixir.snippets | 2 +- .../vim-snippets/snippets/liquid.snippets | 263 +++++++++ .../vim-snippets/snippets/puppet.snippets | 8 +- .../vim-snippets/snippets/tex.snippets | 24 +- 154 files changed, 3522 insertions(+), 1370 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/chef/cookstyle.vim create mode 100644 sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim create mode 100644 sources_non_forked/ale/ale_linters/css/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/go/gopls.vim create mode 100644 sources_non_forked/ale/ale_linters/html/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/java/eclipselsp.vim create mode 100644 sources_non_forked/ale/ale_linters/javascript/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/powershell/powershell.vim create mode 100644 sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim create mode 100644 sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim create mode 100644 sources_non_forked/ale/ale_linters/typescript/xo.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/fecs.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/floskell.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/latexindent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/styler.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/fecs.vim create mode 100644 sources_non_forked/ale/autoload/ale/powershell.vim create mode 100644 sources_non_forked/ale/autoload/ale/swift.vim create mode 100644 sources_non_forked/ale/doc/ale-powershell.txt create mode 100644 sources_non_forked/ale/doc/ale-swift.txt create mode 100644 sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py create mode 100644 sources_non_forked/vim-go/autoload/go/package_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep rename sources_non_forked/vim-pug/{README.markdown => README.md} (100%) create mode 100644 sources_non_forked/vim-snippets/snippets/liquid.snippets diff --git a/sources_non_forked/ale/ale_linters/c/clang.vim b/sources_non_forked/ale/ale_linters/c/clang.vim index 5b243bfe..681101fc 100644 --- a/sources_non_forked/ale/ale_linters/c/clang.vim +++ b/sources_non_forked/ale/ale_linters/c/clang.vim @@ -19,9 +19,6 @@ call ale#linter#Define('c', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#clang#GetCommand'} -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clang#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim index ccb1912b..d965965d 100644 --- a/sources_non_forked/ale/ale_linters/c/gcc.vim +++ b/sources_non_forked/ale/ale_linters/c/gcc.vim @@ -19,9 +19,6 @@ call ale#linter#Define('c', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#gcc#GetCommand'} -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#gcc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/chef/cookstyle.vim b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim new file mode 100644 index 00000000..50bae2aa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim @@ -0,0 +1,54 @@ +" Author: Raphael Hoegger - https://github.com/pfuender +" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files + +call ale#Set('chef_cookstyle_executable', 'cookstyle') +call ale#Set('chef_cookstyle_options', '') + +function! ale_linters#chef#cookstyle#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'chef_cookstyle_options') + + return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s' +endfunction + +function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort + if len(a:lines) == 0 + return [] + endif + + let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {}) + + 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 = str2nr(l:error['location']['start_column']) + let l:end_col = str2nr(l:error['location']['last_column']) + + if !l:end_col + let l:end_col = l:start_col + 1 + endif + + call add(l:output, { + \ 'lnum': str2nr(l:error['location']['line']), + \ 'col': l:start_col, + \ 'end_col': l:end_col, + \ 'code': l:error['cop_name'], + \ 'text': l:error['message'], + \ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('chef', { +\ 'name': 'cookstyle', +\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')}, +\ 'command': function('ale_linters#chef#cookstyle#GetCommand'), +\ 'callback': 'ale_linters#chef#cookstyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim new file mode 100644 index 00000000..5dd11c12 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim @@ -0,0 +1,34 @@ +" Author: Masashi Iizuka +" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo + +function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort + " output format + " ::: : + let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:type = 'E' + + if l:match[4] is? 'warning' + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('clojure', { +\ 'name': 'clj-kondo', +\ 'output_stream': 'stdout', +\ 'executable': 'clj-kondo', +\ 'command': 'clj-kondo --lint %t', +\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clang.vim b/sources_non_forked/ale/ale_linters/cpp/clang.vim index 5a465812..e48291eb 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clang.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clang.vim @@ -19,9 +19,6 @@ call ale#linter#Define('cpp', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#clang#GetCommand'}, -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clang#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim index 831620d5..c427020b 100644 --- a/sources_non_forked/ale/ale_linters/cpp/gcc.vim +++ b/sources_non_forked/ale/ale_linters/cpp/gcc.vim @@ -20,9 +20,6 @@ call ale#linter#Define('cpp', { \ 'aliases': ['g++'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#gcc#GetCommand'}, -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#gcc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/css/fecs.vim b/sources_non_forked/ale/ale_linters/css/fecs.vim new file mode 100644 index 00000000..511847c6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for CSS files + +call ale#linter#Define('css', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/d/dmd.vim b/sources_non_forked/ale/ale_linters/d/dmd.vim index c816d592..14461ae6 100644 --- a/sources_non_forked/ale/ale_linters/d/dmd.vim +++ b/sources_non_forked/ale/ale_linters/d/dmd.vim @@ -1,7 +1,7 @@ " Author: w0rp " Description: "dmd for D files" -function! ale_linters#d#dmd#DUBCommand(buffer) abort +function! ale_linters#d#dmd#GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. if !executable('dub') " Returning an empty string skips to the DMD command. @@ -21,7 +21,18 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort \ . ' && dub describe --import-paths' endfunction -function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort +function! ale_linters#d#dmd#RunDUBCommand(buffer) abort + let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer) + + if empty(l:command) + " If we can't run DUB, just run DMD. + return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) + endif + + return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand')) +endfunction + +function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort let l:import_list = [] " Build a list of import paths generated from DUB, if available. @@ -57,9 +68,7 @@ endfunction call ale#linter#Define('d', { \ 'name': 'dmd', \ 'executable': 'dmd', -\ 'command_chain': [ -\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#d#dmd#RunDUBCommand'), \ 'callback': 'ale_linters#d#dmd#Handle', +\ 'output_stream': 'stderr', \}) diff --git a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim index d5db7cd0..d5517de5 100644 --- a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim +++ b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim @@ -6,7 +6,7 @@ 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')) - let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh' + let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh' return l:dir . l:cmd endfunction diff --git a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim index 2b7276a1..5d555a8d 100644 --- a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim +++ b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim @@ -3,7 +3,17 @@ call ale#Set('erlang_syntaxerl_executable', 'syntaxerl') -function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort +function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable') + + return ale#command#Run( + \ a:buffer, + \ ale#Escape(l:executable) . ' -h', + \ function('ale_linters#erlang#syntaxerl#GetCommand'), + \) +endfunction + +function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1 return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t') @@ -27,9 +37,6 @@ endfunction call ale#linter#Define('erlang', { \ 'name': 'syntaxerl', \ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')}, -\ 'command_chain': [ -\ {'callback': {-> '%e -h'}}, -\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'}, -\ ], +\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)}, \ 'callback': 'ale_linters#erlang#syntaxerl#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erubi.vim b/sources_non_forked/ale/ale_linters/eruby/erubi.vim index 6f2d3ac6..ddca3f61 100644 --- a/sources_non_forked/ale/ale_linters/eruby/erubi.vim +++ b/sources_non_forked/ale/ale_linters/eruby/erubi.vim @@ -1,14 +1,10 @@ " Author: Eddie Lebow https://github.com/elebow " Description: eruby checker using `erubi` -function! ale_linters#eruby#erubi#CheckErubi(buffer) abort - return 'ruby -r erubi/capture_end -e ' . ale#Escape('""') -endfunction - -function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort +function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) - if (!empty(a:check_erubi_output)) + if !empty(a:output) " The empty command in CheckErubi returns nothing if erubi runs and " emits an error if erubi is not present return '' @@ -27,9 +23,10 @@ endfunction call ale#linter#Define('eruby', { \ 'name': 'erubi', \ 'executable': 'ruby', -\ 'command_chain': [ -\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'}, -\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': {buffer -> ale#command#Run( +\ buffer, +\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), +\ function('ale_linters#eruby#erubi#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim new file mode 100644 index 00000000..c411dc2b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -0,0 +1,30 @@ +" Author: w0rp +" Author: Jerko Steiner +" Description: https://github.com/saibing/gopls + +call ale#Set('go_gopls_executable', 'gopls') +call ale#Set('go_gopls_options', '--mode stdio') + +function! ale_linters#go#gopls#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) +endfunction + +function! ale_linters#go#gopls#FindProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:mods = ':h' + + if empty(l:project_root) + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + let l:mods = ':h:h' + endif + + return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : '' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'gopls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')}, +\ 'command': function('ale_linters#go#gopls#GetCommand'), +\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim index 159df892..d5d563aa 100644 --- a/sources_non_forked/ale/ale_linters/go/gotype.vim +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -6,7 +6,7 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort return '' endif - return ale#path#BufferCdString(a:buffer) . ' gotype .' + return ale#path#BufferCdString(a:buffer) . ' gotype -e .' endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/haml/hamllint.vim b/sources_non_forked/ale/ale_linters/haml/hamllint.vim index 7d7278aa..9fcd999f 100644 --- a/sources_non_forked/ale/ale_linters/haml/hamllint.vim +++ b/sources_non_forked/ale/ale_linters/haml/hamllint.vim @@ -19,7 +19,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort " See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89 " HamlLint::Linter::RuboCop#rubocop_flags if !empty(l:rubocop_config_file_path) - if ale#Has('win32') + if has('win32') let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&' else let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) diff --git a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim index 59978e7e..f3f248f5 100644 --- a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim @@ -4,7 +4,8 @@ call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort - return 'cabal exec -- ghc ' + return ale#path#BufferCdString(a:buffer) + \ . 'cabal exec -- ghc ' \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options') \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim index 06af7f6d..c345fe43 100644 --- a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim @@ -4,7 +4,8 @@ call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort - return ale#handlers#haskell#GetStackExecutable(a:buffer) + return ale#path#BufferCdString(a:buffer) + \ . ale#handlers#haskell#GetStackExecutable(a:buffer) \ . ' ghc -- ' \ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ' %t' diff --git a/sources_non_forked/ale/ale_linters/html/fecs.vim b/sources_non_forked/ale/ale_linters/html/fecs.vim new file mode 100644 index 00000000..15e00e12 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for HTMl files + +call ale#linter#Define('html', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim new file mode 100644 index 00000000..d0ea9d6c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -0,0 +1,137 @@ +" Author: Horacio Sanson +" Description: Support for the Eclipse language server https://github.com/eclipse/eclipse.jdt.ls + +let s:version_cache = {} + +call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls')) +call ale#Set('java_eclipselsp_executable', 'java') + +function! ale_linters#java#eclipselsp#Executable(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_executable') +endfunction + +function! ale_linters#java#eclipselsp#TargetPath(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_path') +endfunction + +function! ale_linters#java#eclipselsp#JarPath(buffer) abort + let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) + + " Search jar file within repository path when manually built using mvn + let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository' + let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) == 1 + return l:files[0] + endif + + " Search jar file within VSCode extensions folder. + let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) == 1 + return l:files[0] + endif + + return '' +endfunction + +function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort + let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h') + + if has('win32') + let l:path = l:path . '/config_win' + elseif has('macunix') + let l:path = l:path . '/config_mac' + else + let l:path = l:path . '/config_linux' + endif + + return ale#path#Simplify(l:path) +endfunction + +function! ale_linters#java#eclipselsp#VersionCheck(version_lines) abort + return s:GetVersion('', a:version_lines) +endfunction + +function! s:GetVersion(executable, version_lines) abort + let l:version = [] + + for l:line in a:version_lines + let l:match = matchlist(l:line, '\(\d\+\)\.\(\d\+\)\.\(\d\+\)') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0] + let s:version_cache[a:executable] = l:version + break + endif + endfor + + return l:version +endfunction + +function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, meta) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + let l:version = s:GetVersion(l:executable, a:version_lines) + + return ale_linters#java#eclipselsp#Command(a:buffer, l:version) +endfunction + +function! ale_linters#java#eclipselsp#Command(buffer, version) abort + let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') + + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + let l:cmd = [ ale#Escape(l:executable), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale_linters#java#eclipselsp#JarPath(a:buffer), + \ '-configuration', + \ ale_linters#java#eclipselsp#ConfigurationPath(a:buffer), + \ '-data', + \ ale#java#FindProjectRoot(a:buffer) + \ ] + + if ale#semver#GTE(a:version, [1, 9]) + call add(l:cmd, '--add-modules=ALL-SYSTEM') + call add(l:cmd, '--add-opens java.base/java.util=ALL-UNNAMED') + call add(l:cmd, '--add-opens java.base/java.lang=ALL-UNNAMED') + endif + + return join(l:cmd, ' ') +endfunction + +function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + if empty(l:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, l:executable) + return ale_linters#java#eclipselsp#Command(a:buffer, s:version_cache[l:executable]) + endif + + let l:command = ale#Escape(l:executable) . ' -version' + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#eclipselsp#CommandWithVersion') + \) +endfunction + +call ale#linter#Define('java', { +\ 'name': 'eclipselsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#java#eclipselsp#Executable'), +\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), +\ 'language': 'java', +\ 'project_root': function('ale#java#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 50cabacd..3883783b 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -7,21 +7,29 @@ call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') -function! ale_linters#java#javac#GetImportPaths(buffer) abort +function! ale_linters#java#javac#RunWithImportPaths(buffer) abort + let l:command = '' let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) + let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) \ . 'mvn dependency:build-classpath' endif - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let l:command = ale#gradle#BuildClasspathCommand(a:buffer) endif - return '' + if empty(l:command) + return ale_linters#java#javac#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#javac#GetCommand') + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort @@ -37,7 +45,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort \ : '' endfunction -function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort +function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) let l:sp_option = '' @@ -91,7 +99,7 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:16: error: ';' expected let l:directory = expand('#' . a:buffer . ':p:h') - let l:pattern = '\v^(.*):(\d+): (.+):(.+)$' + let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$' let l:col_pattern = '\v^(\s*\^)$' let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' let l:output = [] @@ -120,9 +128,7 @@ endfunction call ale#linter#Define('java', { \ 'name': 'javac', \ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#java#javac#RunWithImportPaths'), +\ 'output_stream': 'stderr', \ 'callback': 'ale_linters#java#javac#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/fecs.vim b/sources_non_forked/ale/ale_linters/javascript/fecs.vim new file mode 100644 index 00000000..e47c0a0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/fecs.vim @@ -0,0 +1,10 @@ +" Author: harttle +" Description: fecs for JavaScript files + +call ale#linter#Define('javascript', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'read_buffer': 0, +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim index 05aae030..3135e2e9 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -27,32 +27,13 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort \]) endfunction -function! ale_linters#javascript#flow#VersionCheck(buffer) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - return ale#Escape(l:executable) . ' --version' -endfunction - -function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - let l:version = ale#semver#GetVersion(l:executable, a:version_lines) - +function! ale_linters#javascript#flow#GetCommand(buffer, version) abort " If we can parse the version number, then only use --respect-pragma " if the version is >= 0.36.0, which added the argument. let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma') - \ && (empty(l:version) || ale#semver#GTE(l:version, [0, 36])) + \ && (empty(a:version) || ale#semver#GTE(a:version, [0, 36])) - return ale#Escape(l:executable) - \ . ' check-contents' + return '%e check-contents' \ . (l:use_respect_pragma ? ' --respect-pragma': '') \ . ' --json --from ale %s < %t' \ . (!has('win32') ? '; echo' : '') @@ -87,7 +68,6 @@ function! s:ExtraErrorMsg(current, new) abort return l:newMsg endfunction - function! s:GetDetails(error) abort let l:detail = '' @@ -169,10 +149,12 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow', \ 'executable': function('ale_linters#javascript#flow#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#javascript#flow#VersionCheck'}, -\ {'callback': 'ale_linters#javascript#flow#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#javascript#flow#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#javascript#flow#GetCommand'), +\ )}, \ 'callback': 'ale_linters#javascript#flow#Handle', \ 'read_buffer': 0, \}) diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 32dcc6d1..3c6854fa 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -11,26 +11,35 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi let s:classpath_sep = has('unix') ? ':' : ';' -function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort +function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort + let l:command = '' + " exec maven/gradle only if classpath is not set if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' - return '' - else - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') - - if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' - endif - - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command - endif - - return '' + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif + + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:pom_path) && executable('mvn') + let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) + \ . 'mvn dependency:build-classpath' + endif + + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let l:command = ale#gradle#BuildClasspathCommand(a:buffer) + endif + + if empty(l:command) + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#kotlin#kotlinc#GetCommand') + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort @@ -46,7 +55,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort \ : '' endfunction -function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort +function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths, meta) abort let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options') let l:command = 'kotlinc ' @@ -165,11 +174,7 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'kotlinc', \ 'executable': 'kotlinc', -\ 'command_chain': [ -\ {'callback': 'ale_linters#kotlin#kotlinc#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#kotlin#kotlinc#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'), \ 'callback': 'ale_linters#kotlin#kotlinc#Handle', \ 'lint_file': 1, \}) - diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 34d4e799..78f7dd10 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -3,44 +3,42 @@ " Set to change the ruleset let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan') -let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4') +let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') +let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') -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 +function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) - \ ? ' -c ' . l:configuration + \ ? ' -c ' . ale#Escape(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]) + let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload') + let l:autoload_option = !empty(l:autoload) + \ ? ' -a ' . ale#Escape(l:autoload) + \ : '' + + let l:level = ale#Var(a:buffer, 'php_phpstan_level') + let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') + + if empty(l:level) && empty(l:config_file_exists) + " if no configuration file is found, then use 4 as a default level + let l:level = '4' + endif + + let l:level_option = !empty(l:level) + \ ? ' -l ' . ale#Escape(l:level) + \ : '' + + let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) \ ? ' --error-format raw' \ : ' --errorFormat raw' - return '%e analyze -l' - \ . ale#Var(a:buffer, 'php_phpstan_level') + return '%e analyze --no-progress' \ . l:error_format \ . l:configuration_option + \ . l:autoload_option + \ . l:level_option \ . ' %s' endfunction @@ -56,7 +54,7 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'text': l:match[3], - \ 'type': 'W', + \ 'type': 'E', \}) endfor @@ -65,10 +63,12 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', -\ 'executable': function('ale_linters#php#phpstan#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#php#phpstan#VersionCheck'}, -\ {'callback': 'ale_linters#php#phpstan#GetCommand'}, -\ ], +\ 'executable': {b -> ale#Var(b, 'php_phpstan_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'php_phpstan_executable'), +\ '%e --version', +\ function('ale_linters#php#phpstan#GetCommand'), +\ )}, \ 'callback': 'ale_linters#php#phpstan#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/powershell/powershell.vim b/sources_non_forked/ale/ale_linters/powershell/powershell.vim new file mode 100644 index 00000000..51ded71d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/powershell.vim @@ -0,0 +1,91 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for powershell scripts synatax errors + +call ale#Set('powershell_powershell_executable', 'pwsh') + +function! ale_linters#powershell#powershell#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_powershell_executable') +endfunction + +" Some powershell magic to show syntax errors without executing the script +" thanks to keith hill: +" https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/ +function! ale_linters#powershell#powershell#GetCommand(buffer) abort + let l:script = ['Param($Script); + \ trap {$_;continue} & { + \ $Contents = Get-Content -Path $Script; + \ $Contents = [string]::Join([Environment]::NewLine, $Contents); + \ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents); + \ };'] + + return ale#powershell#RunPowerShell( + \ a:buffer, 'powershell_powershell', l:script) +endfunction + +" Parse powershell error output using regex into a list of dicts +function! ale_linters#powershell#powershell#Handle(buffer, lines) abort + let l:output = [] + " Our 3 patterns we need to scrape the data for the dicts + let l:patterns = [ + \ '\v^At line:(\d+) char:(\d+)', + \ '\v^(At|\+| )@!.*', + \ '\vFullyQualifiedErrorId : (\w+)', + \] + + let l:matchcount = 0 + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + " We want to work with 3 matches per syntax error + let l:matchcount = l:matchcount + 1 + + if l:matchcount == 1 || str2nr(l:match[1]) + " First match consists of 2 capture groups, and + " can capture the line and col + if exists('l:item') + " We may be here because the last syntax + " didn't emit a code, and so only had 2 + " matches + call add(l:output, l:item) + let l:matchcount = 1 + endif + + let l:item = { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'type': 'E', + \} + elseif l:matchcount == 2 + " Second match[0] grabs the full line in order + " to handles the text + let l:item['text'] = l:match[0] + else + " Final match handles the code, however + " powershell only emits 1 code for all errors + " so, we get the final code on the last error + " and loop over the previously added items to + " append the code we now know + call add(l:output, l:item) + unlet l:item + + if len(l:match[1]) > 0 + for l:i in l:output + let l:i['code'] = l:match[1] + endfor + endif + + " Reset the matchcount so we can begin gathering + " matches for the next syntax error + let l:matchcount = 0 + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'powershell', +\ 'executable_callback': 'ale_linters#powershell#powershell#GetExecutable', +\ 'command_callback': 'ale_linters#powershell#powershell#GetCommand', +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#powershell#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim new file mode 100644 index 00000000..4794d9d8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim @@ -0,0 +1,76 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for lintng powershell scripts +" using the PSScriptAnalyzer module. + +" let g:ale_powershell_psscriptanalyzer_exclusions = +" \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +call ale#Set('powershell_psscriptanalyzer_exclusions', '') +call ale#Set('powershell_psscriptanalyzer_executable', 'pwsh') +call ale#Set('powershell_psscriptanalyzer_module', +\ 'psscriptanalyzer') + +function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable') +endfunction + +" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines +" for each parsing +function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort + let l:exclude_option = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_exclusions') + let l:module = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_module') + let l:script = ['Param($Script); + \ Invoke-ScriptAnalyzer "$Script" ' + \ . (!empty(l:exclude_option) ? '-Exclude ' . l:exclude_option : '') + \ . '| ForEach-Object { + \ $_.Line; + \ $_.Severity; + \ $_.Message; + \ $_.RuleName}'] + + return ale#powershell#RunPowerShell( + \ a:buffer, + \ 'powershell_psscriptanalyzer', + \ l:script) +endfunction + +" add every 4 lines to an item(Dict) and every item to a list +" return the list +function! ale_linters#powershell#psscriptanalyzer#Handle(buffer, lines) abort + let l:output = [] + let l:lcount = 0 + + for l:line in a:lines + if l:lcount is# 0 + " the very first line + let l:item = {'lnum': str2nr(l:line)} + elseif l:lcount is# 1 + if l:line is# 'Error' + let l:item['type'] = 'E' + elseif l:line is# 'Information' + let l:item['type'] = 'I' + else + let l:item['type'] = 'W' + endif + elseif l:lcount is# 2 + let l:item['text'] = l:line + elseif l:lcount is# 3 + let l:item['code'] = l:line + call add(l:output, l:item) + let l:lcount = -1 + endif + + let l:lcount = l:lcount + 1 + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'psscriptanalyzer', +\ 'executable': function('ale_linters#powershell#psscriptanalyzer#GetExecutable'), +\ 'command': function('ale_linters#powershell#psscriptanalyzer#GetCommand'), +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 993d7adb..e2e7b743 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -24,28 +24,25 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort return ale#Var(a:buffer, 'python_flake8_executable') endfunction -function! ale_linters#python#flake8#VersionCheck(buffer) abort +function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#flake8#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) let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' + let l:command = ale#Escape(l:executable) . l:module_string . ' --version' - return l:executable . l:module_string . ' --version' + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale_linters#python#flake8#GetCommand'), + \) endfunction -function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort +function! ale_linters#python#flake8#GetCommand(buffer, version) abort let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory') \ ? ale#path#BufferCdString(a:buffer) \ : '' let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run flake8' @@ -53,7 +50,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort " Only include the --stdin-display-name argument if we can parse the " flake8 version, and it is recent enough to support it. - let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [3, 0, 0]) \ ? ' --stdin-display-name %s' \ : '' @@ -144,9 +141,6 @@ endfunction call ale#linter#Define('python', { \ 'name': 'flake8', \ 'executable': function('ale_linters#python#flake8#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#python#flake8#VersionCheck'}, -\ {'callback': 'ale_linters#python#flake8#GetCommand', 'output_stream': 'both'}, -\ ], +\ 'command': function('ale_linters#python#flake8#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flake8#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index 57e82691..b16d5355 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -6,6 +6,7 @@ call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) +call ale#Set('python_pylint_use_msg_id', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) @@ -64,11 +65,17 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort continue endif + if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1 + let l:code_out = l:code + else + let l:code_out = l:match[4] + endif + call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 1, \ 'text': l:match[5], - \ 'code': l:match[4], + \ 'code': l:code_out, \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim index 680cc364..a94fb671 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim @@ -30,8 +30,8 @@ function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort endif let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable') - let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout ' - let l:cat_file = ale#Has('win32') ? '; type %t' : '' + let l:output_file = has('win32') ? '%t ' : '/dev/stdout ' + let l:cat_file = has('win32') ? '; type %t' : '' return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim index 26f6e36c..e39e366f 100644 --- a/sources_non_forked/ale/ale_linters/ruby/reek.vim +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -6,26 +6,11 @@ call ale#Set('ruby_reek_show_wiki_link', 0) call ale#Set('ruby_reek_options', '') call ale#Set('ruby_reek_executable', 'reek') -function! ale_linters#ruby#reek#VersionCheck(buffer) abort - " If we have previously stored the version number in a cache, then - " don't look it up again. - if ale#semver#HasVersion('reek') - " Returning an empty string skips this command. - return '' - endif - - let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') - - return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') - \ . ' --version' -endfunction - -function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('reek', a:version_output) +function! ale_linters#ruby#reek#GetCommand(buffer, version) abort let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') " Tell reek what the filename is if the version of reek is new enough. - let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [5, 0, 0]) \ ? ' --stdin-filename %s' \ : '' @@ -70,9 +55,11 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', \ 'executable': {b -> ale#Var(b, 'ruby_reek_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#ruby#reek#VersionCheck'}, -\ {'callback': 'ale_linters#ruby#reek#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'ruby_reek_executable'), +\ '%e --version', +\ function('ale_linters#ruby#reek#GetCommand'), +\ )}, \ 'callback': 'ale_linters#ruby#reek#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index b4eabfae..f98dee9b 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -22,26 +22,18 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort endif endfunction -function! ale_linters#rust#cargo#VersionCheck(buffer) abort - return !ale#semver#HasVersion('cargo') - \ ? 'cargo --version' - \ : '' -endfunction - -function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('cargo', a:version_output) - +function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') - \ && ale#semver#GTE(l:version, [0, 17, 0]) + \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:use_all_targets = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_examples = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_examples') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_tests = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_tests') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -94,10 +86,12 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#rust#cargo#VersionCheck'}, -\ {'callback': 'ale_linters#rust#cargo#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#rust#cargo#GetCargoExecutable(buffer), +\ '%e --version', +\ function('ale_linters#rust#cargo#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#rust#HandleRustErrors', \ 'output_stream': 'both', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/rust/rls.vim b/sources_non_forked/ale/ale_linters/rust/rls.vim index 0e5c326c..111d7558 100644 --- a/sources_non_forked/ale/ale_linters/rust/rls.vim +++ b/sources_non_forked/ale/ale_linters/rust/rls.vim @@ -2,7 +2,7 @@ " Description: A language server for Rust call ale#Set('rust_rls_executable', 'rls') -call ale#Set('rust_rls_toolchain', 'nightly') +call ale#Set('rust_rls_toolchain', '') call ale#Set('rust_rls_config', {}) function! ale_linters#rust#rls#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim index bb7048cd..1d8b6096 100644 --- a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim +++ b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim @@ -10,10 +10,7 @@ call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_excl call ale#Set('sh_shellcheck_executable', 'shellcheck') call ale#Set('sh_shellcheck_dialect', 'auto') call ale#Set('sh_shellcheck_options', '') - -function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'sh_shellcheck_executable') -endfunction +call ale#Set('sh_shellcheck_change_directory', 1) function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) @@ -39,30 +36,21 @@ function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort return '' endfunction -function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - - " Don't check the version again if we've already cached it. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - +function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') - let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : '' + let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' + let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory') + \ ? ale#path#BufferCdString(a:buffer) + \ : '' if l:dialect is# 'auto' let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) endif - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + return l:cd_string + \ . '%e' \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') @@ -108,10 +96,12 @@ endfunction call ale#linter#Define('sh', { \ 'name': 'shellcheck', -\ 'executable': function('ale_linters#sh#shellcheck#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'}, -\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'}, -\ ], +\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'sh_shellcheck_executable'), +\ '%e --version', +\ function('ale_linters#sh#shellcheck#GetCommand'), +\ )}, \ 'callback': 'ale_linters#sh#shellcheck#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/slim/slimlint.vim b/sources_non_forked/ale/ale_linters/slim/slimlint.vim index 1a4008ae..1b365e25 100644 --- a/sources_non_forked/ale/ale_linters/slim/slimlint.vim +++ b/sources_non_forked/ale/ale_linters/slim/slimlint.vim @@ -11,7 +11,7 @@ function! ale_linters#slim#slimlint#GetCommand(buffer) abort " " See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop if !empty(l:rubocop_config) - if ale#Has('win32') + if has('win32') let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command else let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command diff --git a/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim new file mode 100644 index 00000000..560893bf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim @@ -0,0 +1,13 @@ +" Author: Dan Loman +" Description: Support for sourcekit-lsp https://github.com/apple/sourcekit-lsp + +call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp') + +call ale#linter#Define('swift', { +\ 'name': 'sourcekitlsp', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale#swift#FindProjectRoot'), +\ 'language': 'swift', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/xo.vim b/sources_non_forked/ale/ale_linters/typescript/xo.vim new file mode 100644 index 00000000..8b015efd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/xo.vim @@ -0,0 +1,23 @@ +call ale#Set('typescript_xo_executable', 'xo') +call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_xo_options', '') + +function! ale_linters#typescript#xo#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'typescript_xo', [ + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale_linters#typescript#xo#GetCommand(buffer) abort + return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer)) + \ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options')) + \ . ' --reporter unix --stdin --stdin-filename %s' +endfunction + +" xo uses eslint and the output format is the same +call ale#linter#Define('typescript', { +\ 'name': 'xo', +\ 'executable': function('ale_linters#typescript#xo#GetExecutable'), +\ 'command': function('ale_linters#typescript#xo#GetCommand'), +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/vim/vint.vim b/sources_non_forked/ale/ale_linters/vim/vint.vim index 3808c47e..65e19126 100644 --- a/sources_non_forked/ale/ale_linters/vim/vint.vim +++ b/sources_non_forked/ale/ale_linters/vim/vint.vim @@ -7,29 +7,13 @@ call ale#Set('vim_vint_executable', 'vint') let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' -function! ale_linters#vim#vint#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'vim_vint_executable') -endfunction - -function! ale_linters#vim#vint#VersionCommand(buffer) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - - " Check the Vint version if we haven't checked it already. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - - let l:can_use_no_color_flag = empty(l:version) - \ || ale#semver#GTE(l:version, [0, 3, 7]) +function! ale_linters#vim#vint#GetCommand(buffer, version) abort + let l:can_use_no_color_flag = empty(a:version) + \ || ale#semver#GTE(a:version, [0, 3, 7]) let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' - return ale#Escape(l:executable) + return '%e' \ . ' ' . l:warning_flag \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim @@ -65,10 +49,12 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'vint', -\ 'executable': function('ale_linters#vim#vint#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, -\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, -\ ], +\ 'executable': {buffer -> ale#Var(buffer, 'vim_vint_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'vim_vint_executable'), +\ '%e --version', +\ function('ale_linters#vim#vint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#vim#vint#Handle', \}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 5aa5fbfc..04329dfd 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -8,6 +8,7 @@ let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') " Ignoring linters, for disabling some, or ignoring LSP diagnostics. let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) +let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0) let s:lint_timer = -1 let s:getcmdwintype_exists = exists('*getcmdwintype') @@ -42,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif + " Do nothing for diff buffers. + if getbufvar(a:buffer, '&diff') + return 1 + endif + " Do nothing for blacklisted files. if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0 return 1 @@ -90,8 +96,9 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Apply ignore lists for linters only if needed. let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') - let l:linters = !empty(l:ignore_config) - \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config) + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + let l:linters = !empty(l:ignore_config) || l:disable_lsp + \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp) \ : l:linters " Tell other sources that they can start checking the buffer now. @@ -149,12 +156,19 @@ function! ale#Queue(delay, ...) abort endif endfunction -let g:ale_has_override = get(g:, 'ale_has_override', {}) +let s:current_ale_version = [2, 4, 0] -" Call has(), but check a global Dictionary so we can force flags on or off -" for testing purposes. +" A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort - return get(g:ale_has_override, a:feature, has(a:feature)) + let l:match = matchlist(a:feature, '\c\v^ale-(\d+)\.(\d+)(\.(\d+))?$') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + + return ale#semver#GTE(s:current_ale_version, l:version) + endif + + return 0 endfunction " Given a buffer number and a variable name, look for that variable in the diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 6c2586a6..ed90792d 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -1,7 +1,7 @@ -let s:chain_results = [] +let s:command_output = [] -function! ale#assert#WithChainResults(...) abort - let s:chain_results = a:000 +function! ale#assert#GivenCommandOutput(...) abort + let s:command_output = a:000 endfunction function! s:GetLinter() abort @@ -19,6 +19,39 @@ function! s:GetLinter() abort return l:filetype_linters[0] endfunction +function! s:FormatExe(command, executable) abort + return substitute(a:command, '%e', '\=ale#Escape(a:executable)', 'g') +endfunction + +function! s:ProcessDeferredCommands(initial_result) abort + let l:result = a:initial_result + let l:command_index = 0 + let l:command = [] + + while ale#command#IsDeferred(l:result) + call add(l:command, s:FormatExe(l:result.command, l:result.executable)) + + if get(g:, 'ale_run_synchronously_emulate_commands') + " Don't run commands, but simulate the results. + let l:Callback = g:ale_run_synchronously_callbacks[0] + let l:output = get(s:command_output, l:command_index, []) + call l:Callback(0, l:output) + unlet g:ale_run_synchronously_callbacks + + let l:command_index += 1 + else + " Run the commands in the shell, synchronously. + call ale#test#FlushJobs() + endif + + let l:result = l:result.value + endwhile + + call add(l:command, l:result) + + return l:command +endfunction + " Load the currently loaded linter for a test case, and check that the command " matches the given string. function! ale#assert#Linter(expected_executable, expected_command) abort @@ -31,47 +64,20 @@ function! ale#assert#Linter(expected_executable, expected_command) abort let l:executable = l:executable.value endwhile - if has_key(l:linter, 'command_chain') - let l:callbacks = map(copy(l:linter.command_chain), 'v:val.callback') + let l:command = s:ProcessDeferredCommands( + \ ale#linter#GetCommand(l:buffer, l:linter), + \) - " If the expected command is a string, just check the last one. - if type(a:expected_command) is v:t_string - if len(l:callbacks) is 1 - let l:command = call(l:callbacks[0], [l:buffer]) - else - let l:input = get(s:chain_results, len(l:callbacks) - 2, []) - let l:command = call(l:callbacks[-1], [l:buffer, l:input]) - endif - else - let l:command = [] - let l:chain_index = 0 - - for l:Callback in l:callbacks - if l:chain_index is 0 - call add(l:command, call(l:Callback, [l:buffer])) - else - let l:input = get(s:chain_results, l:chain_index - 1, []) - call add(l:command, call(l:Callback, [l:buffer, l:input])) - endif - - let l:chain_index += 1 - endfor - endif - else - let l:command = ale#linter#GetCommand(l:buffer, l:linter) - - while ale#command#IsDeferred(l:command) - call ale#test#FlushJobs() - let l:command = l:command.value - endwhile + if type(a:expected_command) isnot v:t_list + let l:command = l:command[-1] endif if type(l:command) is v:t_string " Replace %e with the escaped executable, so tests keep passing after " linters are changed to use %e. - let l:command = substitute(l:command, '%e', '\=ale#Escape(l:executable)', 'g') + let l:command = s:FormatExe(l:command, l:executable) elseif type(l:command) is v:t_list - call map(l:command, 'substitute(v:val, ''%e'', ''\=ale#Escape(l:executable)'', ''g'')') + call map(l:command, 's:FormatExe(v:val, l:executable)') endif AssertEqual @@ -79,6 +85,17 @@ function! ale#assert#Linter(expected_executable, expected_command) abort \ [l:executable, l:command] endfunction +function! ale#assert#Fixer(expected_result) abort + let l:buffer = bufnr('') + let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer)) + + if type(a:expected_result) isnot v:t_list + let l:result = l:result[-1] + endif + + AssertEqual a:expected_result, l:result +endfunction + function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() @@ -128,7 +145,7 @@ function! ale#assert#LSPAddress(expected_address) abort endfunction function! ale#assert#SetUpLinterTestCommands() abort - command! -nargs=+ WithChainResults :call ale#assert#WithChainResults() + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() command! -nargs=+ AssertLinter :call ale#assert#Linter() command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted() command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() @@ -138,6 +155,11 @@ function! ale#assert#SetUpLinterTestCommands() abort command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress() endfunction +function! ale#assert#SetUpFixerTestCommands() abort + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertFixer :call ale#assert#Fixer() +endfunction + " A dummy function for making sure this module is loaded. function! ale#assert#SetUpLinterTest(filetype, name) abort " Set up a marker so ALE doesn't create real random temporary filenames. @@ -179,14 +201,21 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort endif call ale#assert#SetUpLinterTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 endfunction function! ale#assert#TearDownLinterTest() abort unlet! g:ale_create_dummy_temporary_file - let s:chain_results = [] + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] - if exists(':WithChainResults') - delcommand WithChainResults + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput endif if exists(':AssertLinter') @@ -229,3 +258,62 @@ function! ale#assert#TearDownLinterTest() abort call ale#semver#ResetVersionCache() endif endfunction + +function! ale#assert#SetUpFixerTest(filetype, name) abort + " Set up a marker so ALE doesn't create real random temporary filenames. + let g:ale_create_dummy_temporary_file = 1 + + let l:function_name = ale#fix#registry#GetFunc(a:name) + let s:FixerFunction = function(l:function_name) + + let l:prefix = 'ale_' . a:filetype . '_' . a:name + let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + + for l:key in filter(keys(g:), b:filter_expr) + execute 'Save g:' . l:key + unlet g:[l:key] + endfor + + for l:key in filter(keys(b:), b:filter_expr) + unlet b:[l:key] + endfor + + execute 'runtime autoload/ale/fixers/' . a:name . '.vim' + + if !exists('g:dir') + call ale#test#SetDirectory('/testplugin/test/fixers') + endif + + call ale#assert#SetUpFixerTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 +endfunction + +function! ale#assert#TearDownFixerTest() abort + unlet! g:ale_create_dummy_temporary_file + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] + unlet! s:FixerFunction + + if exists('g:dir') + call ale#test#RestoreDirectory() + endif + + Restore + + if exists('*ale#semver#ResetVersionCache') + call ale#semver#ResetVersionCache() + endif + + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput + endif + + if exists(':AssertFixer') + delcommand AssertFixer + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index d759b25a..a9289e22 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -219,9 +219,32 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort " Search for an exact file match first. let l:basename = tolower(expand('#' . a:buffer . ':t')) let l:file_list = get(a:file_lookup, l:basename, []) + " A source file matching the header filename. + let l:source_file = '' + + if empty(l:file_list) && l:basename =~? '\.h$\|\.hpp$' + for l:suffix in ['.c', '.cpp'] + let l:key = fnamemodify(l:basename, ':r') . l:suffix + let l:file_list = get(a:file_lookup, l:key, []) + + if !empty(l:file_list) + let l:source_file = l:key + break + endif + endfor + endif for l:item in l:file_list - if bufnr(l:item.file) is a:buffer && has_key(l:item, 'command') + " Load the flags for this file, or for a source file matching the + " header file. + if has_key(l:item, 'command') + \&& ( + \ bufnr(l:item.file) is a:buffer + \ || ( + \ !empty(l:source_file) + \ && l:item.file[-len(l:source_file):] is? l:source_file + \ ) + \) return ale#c#ParseCFlags(l:item.directory, l:item.command) endif endfor @@ -284,6 +307,20 @@ function! ale#c#GetMakeCommand(buffer) abort return '' endfunction +function! ale#c#RunMakeCommand(buffer, Callback) abort + let l:command = ale#c#GetMakeCommand(a:buffer) + + if empty(l:command) + return a:Callback(a:buffer, []) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ {b, output -> a:Callback(a:buffer, output)}, + \) +endfunction + " Given a buffer number, search for a project root, and output a List " of directories to include based on some heuristics. " diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim index 33ce577c..1bbc4f4c 100644 --- a/sources_non_forked/ale/autoload/ale/command.vim +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -329,30 +329,46 @@ function! ale#command#Run(buffer, command, Callback, ...) abort " " The `_deferred_job_id` is used for both checking the type of object, and " for checking the job ID and status. - let l:result = {'_deferred_job_id': l:job_id} + " + " The original command here is used in tests. + let l:result = { + \ '_deferred_job_id': l:job_id, + \ 'executable': get(l:options, 'executable', ''), + \ 'command': a:command, + \} if get(g:, 'ale_run_synchronously') == 1 && l:job_id - " Run a command synchronously if this test option is set. - call extend(l:line_list, systemlist( - \ type(l:command) is v:t_list - \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) - \ : l:command - \)) - - " Don't capture output when the callbacks aren't set. - if !has_key(l:job_options, 'out_cb') - \&& !has_key(l:job_options, 'err_cb') - let l:line_list = [] - endif - if !exists('g:ale_run_synchronously_callbacks') let g:ale_run_synchronously_callbacks = [] endif - call add( - \ g:ale_run_synchronously_callbacks, - \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} - \) + if get(g:, 'ale_run_synchronously_emulate_commands', 0) + call add( + \ g:ale_run_synchronously_callbacks, + \ {exit_code, output -> [ + \ extend(l:line_list, output), + \ l:job_options.exit_cb(l:job_id, exit_code), + \ ]} + \) + else + " Run a command synchronously if this test option is set. + call extend(l:line_list, systemlist( + \ type(l:command) is v:t_list + \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) + \ : l:command + \)) + + " Don't capture output when the callbacks aren't set. + if !has_key(l:job_options, 'out_cb') + \&& !has_key(l:job_options, 'err_cb') + let l:line_list = [] + endif + + call add( + \ g:ale_run_synchronously_callbacks, + \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} + \) + endif endif return l:result diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 682f4c43..03cc6471 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -159,18 +159,20 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort endfunction function! s:ReplaceCompletionOptions() abort - " Remember the old omnifunc value, if there is one. - " If we don't store an old one, we'll just never reset the option. - " This will stop some random exceptions from appearing. - if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) - let b:ale_old_omnifunc = &l:omnifunc + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + " Remember the old omnifunc value, if there is one. + " If we don't store an old one, we'll just never reset the option. + " This will stop some random exceptions from appearing. + if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) + let b:ale_old_omnifunc = &l:omnifunc + endif + + let &l:omnifunc = 'ale#completion#OmniFunc' endif - let &l:omnifunc = 'ale#completion#OmniFunc' - - let l:info = get(b:, 'ale_completion_info', {}) - - if !get(l:info, 'manual') + if l:source is# 'ale-automatic' if !exists('b:ale_old_completeopt') let b:ale_old_completeopt = &l:completeopt endif @@ -199,31 +201,49 @@ function! ale#completion#RestoreCompletionOptions() abort endif endfunction +function! ale#completion#GetCompletionPosition() abort + if !exists('b:ale_completion_info') + return 0 + endif + + let l:line = b:ale_completion_info.line + let l:column = b:ale_completion_info.column + let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) + let l:up_to_column = getline(l:line)[: l:column - 2] + let l:match = matchstr(l:up_to_column, l:regex) + + return l:column - len(l:match) - 1 +endfunction + +function! ale#completion#GetCompletionResult() abort + " Parse a new response if there is one. + if exists('b:ale_completion_response') + \&& exists('b:ale_completion_parser') + let l:response = b:ale_completion_response + let l:parser = b:ale_completion_parser + + unlet b:ale_completion_response + unlet b:ale_completion_parser + + let b:ale_completion_result = function(l:parser)(l:response) + endif + + if exists('b:ale_completion_result') + return b:ale_completion_result + endif + + return v:null +endfunction + function! ale#completion#OmniFunc(findstart, base) abort if a:findstart - let l:line = b:ale_completion_info.line - let l:column = b:ale_completion_info.column - let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) - let l:up_to_column = getline(l:line)[: l:column - 2] - let l:match = matchstr(l:up_to_column, l:regex) - - return l:column - len(l:match) - 1 + return ale#completion#GetCompletionPosition() else - " Parse a new response if there is one. - if exists('b:ale_completion_response') - \&& exists('b:ale_completion_parser') - let l:response = b:ale_completion_response - let l:parser = b:ale_completion_parser - - unlet b:ale_completion_response - unlet b:ale_completion_parser - - let b:ale_completion_result = function(l:parser)(l:response) - endif + let l:result = ale#completion#GetCompletionResult() call s:ReplaceCompletionOptions() - return get(b:, 'ale_completion_result', []) + return l:result isnot v:null ? l:result : [] endif endfunction @@ -239,7 +259,14 @@ function! ale#completion#Show(response, completion_parser) abort " Replace completion options shortly before opening the menu. call s:ReplaceCompletionOptions() - call timer_start(0, {-> ale#util#FeedKeys("\(ale_show_completion_menu)")}) + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + call timer_start( + \ 0, + \ {-> ale#util#FeedKeys("\(ale_show_completion_menu)")} + \) + endif endfunction function! s:CompletionStillValid(request_id) abort @@ -249,7 +276,10 @@ function! s:CompletionStillValid(request_id) abort \&& has_key(b:, 'ale_completion_info') \&& b:ale_completion_info.request_id == a:request_id \&& b:ale_completion_info.line == l:line - \&& b:ale_completion_info.column == l:column + \&& ( + \ b:ale_completion_info.column == l:column + \ || b:ale_completion_info.source is# 'deoplete' + \) endfunction function! ale#completion#ParseTSServerCompletions(response) abort @@ -356,6 +386,8 @@ function! ale#completion#ParseLSPCompletions(response) abort if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN \&& type(get(l:item, 'textEdit')) is v:t_dict let l:text = l:item.textEdit.newText + elseif type(get(l:item, 'insertText')) is v:t_string + let l:text = l:item.insertText else let l:text = l:item.label endif @@ -517,14 +549,27 @@ function! s:OnReady(linter, lsp_details) abort endif endfunction +" This function can be called to check if ALE can provide completion data for +" the current buffer. 1 will be returned if there's a potential source of +" completion data ALE can use, and 0 will be returned otherwise. +function! ale#completion#CanProvideCompletions() abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + return 1 + endif + endfor + + return 0 +endfunction + " This function can be used to manually trigger autocomplete, even when " g:ale_completion_enabled is set to false -function! ale#completion#GetCompletions(manual) abort +function! ale#completion#GetCompletions(source) abort let [l:line, l:column] = getpos('.')[1:2] let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) - if !a:manual && empty(l:prefix) + if a:source is# 'ale-automatic' && empty(l:prefix) return endif @@ -537,8 +582,9 @@ function! ale#completion#GetCompletions(manual) abort \ 'prefix': l:prefix, \ 'conn_id': 0, \ 'request_id': 0, - \ 'manual': a:manual, + \ 'source': a:source, \} + unlet! b:ale_completion_result let l:buffer = bufnr('') let l:Callback = function('s:OnReady') @@ -551,7 +597,7 @@ function! ale#completion#GetCompletions(manual) abort endfunction function! s:TimerHandler(...) abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif @@ -562,7 +608,7 @@ function! s:TimerHandler(...) abort " When running the timer callback, we have to be sure that the cursor " hasn't moved from where it was when we requested completions by typing. if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i' - call ale#completion#GetCompletions(0) + call ale#completion#GetCompletions('ale-automatic') endif endfunction @@ -576,7 +622,7 @@ function! ale#completion#StopTimer() abort endfunction function! ale#completion#Queue() abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index eea8ffe6..8c331c5c 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -25,7 +25,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort let l:cursor_position = getpos('.') " The message is truncated and saved to the history. - setlocal shortmess+=T + silent! setlocal shortmess+=T try exec "norm! :echomsg l:message\n" diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 521f0b45..3915cac1 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -3,6 +3,9 @@ let s:go_to_definition_map = {} +" Enable automatic updates of the tagstack +let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1) + " Used to get the definition map in tests. function! ale#definition#GetMap() abort return deepcopy(s:go_to_definition_map) @@ -17,6 +20,20 @@ function! ale#definition#ClearLSPData() abort let s:go_to_definition_map = {} endfunction +function! ale#definition#UpdateTagStack() abort + let l:should_update_tagstack = exists('*gettagstack') && exists('*settagstack') && g:ale_update_tagstack + + if l:should_update_tagstack + " Grab the old location (to jump back to) and the word under the + " cursor (as a label for the tagstack) + let l:old_location = [bufnr('%'), line('.'), col('.'), 0] + let l:tagname = expand('') + let l:winid = win_getid() + call settagstack(l:winid, {'items': [{'from': l:old_location, 'tagname': l:tagname}]}, 'a') + call settagstack(l:winid, {'curidx': len(gettagstack(l:winid)['items']) + 1}) + endif +endfunction + function! ale#definition#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') is# 'definition' \&& has_key(s:go_to_definition_map, a:response.request_seq) @@ -27,6 +44,7 @@ function! ale#definition#HandleTSServerResponse(conn_id, response) abort let l:line = a:response.body[0].start.line let l:column = a:response.body[0].start.offset + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) endif endif @@ -51,6 +69,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort let l:line = l:item.range.start.line + 1 let l:column = l:item.range.start.character + 1 + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) break endfor diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 340f6913..7db808d6 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -39,8 +39,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort endif endfunction -function! ale#engine#MarkLinterInactive(info, linter) abort - call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name') +function! ale#engine#MarkLinterInactive(info, linter_name) abort + call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name') endfunction function! ale#engine#ResetExecutableCache() abort @@ -107,24 +107,36 @@ endfunction " Register a temporary file to be managed with the ALE engine for " a current job run. function! ale#engine#ManageFile(buffer, filename) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#ManageFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + call ale#command#ManageFile(a:buffer, a:filename) endfunction " Same as the above, but manage an entire directory. function! ale#engine#ManageDirectory(buffer, directory) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#ManageDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + call ale#command#ManageDirectory(a:buffer, a:directory) endfunction function! ale#engine#CreateFile(buffer) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#CreateFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + return ale#command#CreateFile(a:buffer) endfunction " Create a new temporary directory and manage it in one go. function! ale#engine#CreateDirectory(buffer) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#CreateDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + return ale#command#CreateDirectory(a:buffer) endfunction @@ -183,7 +195,7 @@ function! s:HandleExit(job_info, buffer, output, data) abort let l:next_chain_index = a:job_info.next_chain_index " Remove this job from the list. - call ale#engine#MarkLinterInactive(l:buffer_info, l:linter) + call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name) " Stop here if we land in the handle for a job completing if we're in " a sandbox. diff --git a/sources_non_forked/ale/autoload/ale/engine/ignore.vim b/sources_non_forked/ale/autoload/ale/engine/ignore.vim index 2db2c6c1..80574656 100644 --- a/sources_non_forked/ale/autoload/ale/engine/ignore.vim +++ b/sources_non_forked/ale/autoload/ale/engine/ignore.vim @@ -22,7 +22,7 @@ function! ale#engine#ignore#GetList(filetype, config) abort endfunction " Given a List of linter descriptions, exclude the linters to be ignored. -function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort +function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config) let l:filtered_linters = [] @@ -37,6 +37,10 @@ function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort endif endfor + if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# '' + let l:should_include = 0 + endif + if l:should_include call add(l:filtered_linters, l:linter) endif diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index b8674606..92ae3e14 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -1,3 +1,5 @@ +call ale#Set('fix_on_save_ignore', {}) + " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. function! ale#fix#ApplyQueuedFixes() abort @@ -117,6 +119,10 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort let l:input = a:job_info.input endif + if l:ChainCallback isnot v:null && !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''chain_with is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + let l:next_index = l:ChainCallback is v:null \ ? a:job_info.callback_index + 1 \ : a:job_info.callback_index @@ -261,7 +267,21 @@ function! s:AddSubCallbacks(full_list, callbacks) abort return 1 endfunction -function! s:GetCallbacks(buffer, fixers) abort +function! s:IgnoreFixers(callback_list, filetype, config) abort + if type(a:config) is v:t_list + let l:ignore_list = a:config + else + let l:ignore_list = [] + + for l:part in split(a:filetype , '\.') + call extend(l:ignore_list, get(a:config, l:part, [])) + endfor + endif + + call filter(a:callback_list, 'index(l:ignore_list, v:val) < 0') +endfunction + +function! s:GetCallbacks(buffer, fixing_flag, fixers) abort if len(a:fixers) let l:callback_list = a:fixers elseif type(get(b:, 'ale_fixers')) is v:t_list @@ -286,8 +306,12 @@ function! s:GetCallbacks(buffer, fixers) abort endif endif - if empty(l:callback_list) - return [] + if a:fixing_flag is# 'save_file' + let l:config = ale#Var(a:buffer, 'fix_on_save_ignore') + + if !empty(l:config) + call s:IgnoreFixers(l:callback_list, &filetype, l:config) + endif endif let l:corrected_list = [] @@ -335,7 +359,7 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort endif try - let l:callback_list = s:GetCallbacks(a:buffer, a:000) + let l:callback_list = s:GetCallbacks(a:buffer, a:fixing_flag, a:000) catch /E700\|BADNAME/ let l:function_name = join(split(split(v:exception, ':')[3])) let l:echo_message = printf( diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 7118c44a..3a36f367 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -27,6 +27,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'fecs': { +\ 'function': 'ale#fixers#fecs#Fix', +\ 'suggested_filetypes': ['javascript', 'css', 'html'], +\ 'description': 'Apply fecs format to a file.', +\ }, \ 'tidy': { \ 'function': 'ale#fixers#tidy#Fix', \ 'suggested_filetypes': ['html'], @@ -185,6 +190,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['hack'], \ 'description': 'Fix Hack files with hackfmt.', \ }, +\ 'floskell': { +\ 'function': 'ale#fixers#floskell#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with floskell.', +\ }, \ 'hfmt': { \ 'function': 'ale#fixers#hfmt#Fix', \ 'suggested_filetypes': ['haskell'], @@ -210,6 +220,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['ocaml'], \ 'description': 'Fix OCaml files with ocamlformat.', \ }, +\ 'ocp-indent': { +\ 'function': 'ale#fixers#ocp_indent#Fix', +\ 'suggested_filetypes': ['ocaml'], +\ 'description': 'Fix OCaml files with ocp-indent.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], @@ -247,8 +262,8 @@ let s:default_registry = { \ }, \ 'xo': { \ 'function': 'ale#fixers#xo#Fix', -\ 'suggested_filetypes': ['javascript'], -\ 'description': 'Fix JavaScript files using xo --fix.', +\ 'suggested_filetypes': ['javascript', 'typescript'], +\ 'description': 'Fix JavaScript/TypeScript files using xo --fix.', \ }, \ 'qmlfmt': { \ 'function': 'ale#fixers#qmlfmt#Fix', @@ -280,6 +295,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['kt'], \ 'description': 'Fix Kotlin files with ktlint.', \ }, +\ 'styler': { +\ 'function': 'ale#fixers#styler#Fix', +\ 'suggested_filetypes': ['r'], +\ 'description': 'Fix R files with styler.', +\ }, +\ 'latexindent': { +\ 'function': 'ale#fixers#latexindent#Fix', +\ 'suggested_filetypes': ['tex'], +\ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.', +\ }, \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index ea5b2a63..0f57cba6 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -3,15 +3,15 @@ function! ale#fixers#eslint#Fix(buffer) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + let l:command = ale#node#Executable(a:buffer, l:executable) + \ . ' --version' - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#node#Executable(a:buffer, l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale#fixers#eslint#ApplyFixForVersion'), + \) endfunction function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort @@ -33,10 +33,8 @@ function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - let l:config = ale#handlers#eslint#FindConfig(a:buffer) if empty(l:config) @@ -44,7 +42,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort endif " Use --fix-to-stdout with eslint_d - if l:executable =~# 'eslint_d$' && ale#semver#GTE(l:version, [3, 19, 0]) + if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ' --stdin-filename %s --stdin --fix-to-stdout', @@ -53,7 +51,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort endif " 4.9.0 is the first version with --fix-dry-run - if ale#semver#GTE(l:version, [4, 9, 0]) + if ale#semver#GTE(a:version, [4, 9, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', diff --git a/sources_non_forked/ale/autoload/ale/fixers/fecs.vim b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim new file mode 100644 index 00000000..d692bc97 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim @@ -0,0 +1,17 @@ +" Author: harttle +" Description: Apply fecs format to a file. + +function! ale#fixers#fecs#Fix(buffer) abort + let l:executable = ale#handlers#fecs#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:config_options = ' format --replace=true %t' + + return { + \ 'command': ale#Escape(l:executable) . l:config_options, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/floskell.vim b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim new file mode 100644 index 00000000..f0015db7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim @@ -0,0 +1,20 @@ +" Author: robertjlooby +" Description: Integration of floskell with ALE. + +call ale#Set('haskell_floskell_executable', 'floskell') + +function! ale#fixers#floskell#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell') +endfunction + +function! ale#fixers#floskell#Fix(buffer) abort + let l:executable = ale#fixers#floskell#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim new file mode 100644 index 00000000..b0a0884a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim @@ -0,0 +1,18 @@ +" Author: riley-martine +" Description: Integration of latexindent with ALE. + +call ale#Set('tex_latexindent_executable', 'latexindent') +call ale#Set('tex_latexindent_options', '') + +function! ale#fixers#latexindent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'tex_latexindent_executable') + let l:options = ale#Var(a:buffer, 'tex_latexindent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -l -w' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim new file mode 100644 index 00000000..e1b047b3 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim @@ -0,0 +1,18 @@ +" Author: Kanenobu Mitsuru +" Description: Integration of ocp-indent with ALE. + +call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent') +call ale#Set('ocaml_ocp_indent_options', '') +call ale#Set('ocaml_ocp_indent_config', '') + +function! ale#fixers#ocp_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable') + let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config') + let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config)) + \ . (empty(l:options) ? '': ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index 0f99ae97..b7f0ecd7 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -15,16 +15,12 @@ function! ale#fixers#prettier#GetExecutable(buffer) abort endfunction function! ale#fixers#prettier#Fix(buffer) abort - let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier#ApplyFixForVersion'), + \) endfunction function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort @@ -38,10 +34,9 @@ function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_prettier_options') - let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:parser = '' " Append the --parser flag depending on the current filetype (unless it's @@ -50,7 +45,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort " Mimic Prettier's defaults. In cases without a file extension or " filetype (scratch buffer), Prettier needs `parser` set to know how " to process the buffer. - if ale#semver#GTE(l:version, [1, 16, 0]) + if ale#semver#GTE(a:version, [1, 16, 0]) let l:parser = 'babel' else let l:parser = 'babylon' @@ -94,7 +89,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort endif " 1.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [1, 4, 0]) + if ale#semver#GTE(a:version, [1, 4, 0]) return { \ 'command': ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim index bc0caadd..1e66f49e 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -2,13 +2,9 @@ " w0rp , morhetz (Pavel Pertsev) " Description: Integration between Prettier and ESLint. -function! ale#fixers#prettier_eslint#SetOptionDefaults() abort - call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') - call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) - call ale#Set('javascript_prettier_eslint_options', '') -endfunction - -call ale#fixers#prettier_eslint#SetOptionDefaults() +call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') +call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ @@ -18,26 +14,20 @@ function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort endfunction function! ale#fixers#prettier_eslint#Fix(buffer) abort - let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier_eslint#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier_eslint#ApplyFixForVersion'), + \) endfunction -function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options') let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - " 4.2.0 is the first version with --eslint-config-path - let l:config = ale#semver#GTE(l:version, [4, 2, 0]) + let l:config = ale#semver#GTE(a:version, [4, 2, 0]) \ ? ale#handlers#eslint#FindConfig(a:buffer) \ : '' let l:eslint_config_option = !empty(l:config) @@ -45,7 +35,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) \ : '' " 4.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [4, 4, 0]) + if ale#semver#GTE(a:version, [4, 4, 0]) return { \ 'command': ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) diff --git a/sources_non_forked/ale/autoload/ale/fixers/styler.vim b/sources_non_forked/ale/autoload/ale/fixers/styler.vim new file mode 100644 index 00000000..7ff3275c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/styler.vim @@ -0,0 +1,16 @@ +" Author: tvatter +" Description: Fixing R files with styler. + +call ale#Set('r_styler_executable', 'Rscript') +call ale#Set('r_styler_options', 'tidyverse_style') + +function! ale#fixers#styler#Fix(buffer) abort + return { + \ 'command': 'Rscript --vanilla -e ' + \ . '"suppressPackageStartupMessages(library(styler));' + \ . 'style_file(commandArgs(TRUE), style = ' + \ . ale#Var(a:buffer, 'r_styler_options') . ')"' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index bc7c0321..5183f4cd 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -143,6 +143,11 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort " The code can be something like 'Error/foo/bar', or just 'Error' if !empty(get(l:split_code, 1)) let l:obj.code = join(l:split_code[1:], '/') + + if l:obj.code is# 'no-trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + continue + endif endif for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns) diff --git a/sources_non_forked/ale/autoload/ale/handlers/fecs.vim b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim new file mode 100644 index 00000000..5362edb9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim @@ -0,0 +1,52 @@ +" Author: harttle +" Description: fecs http://fecs.baidu.com/ + +call ale#Set('javascript_fecs_executable', 'fecs') +call ale#Set('javascript_fecs_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#handlers#fecs#GetCommand(buffer) abort + return '%e check --colors=false --rule=true %t' +endfunction + +function! ale#handlers#fecs#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_fecs', [ + \ 'node_modules/.bin/fecs', + \ 'node_modules/fecs/bin/fecs', + \]) +endfunction + +function! ale#handlers#fecs#Handle(buffer, lines) abort + " Matches patterns looking like the following + " + " fecs WARN → line 20, col 25: Unexpected console statement. (no-console) + " fecs ERROR → line 24, col 36: Missing radix parameter. (radix) + " + let l:pattern = '\v^.*(WARN|ERROR)\s+→\s+line (\d+),\s+col\s+(\d+):\s+(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4] + \} + + let l:code_match = matchlist(l:match[4], '\v^(.{-})\s*\((.+)\)$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[2] + let l:obj.text = l:code_match[1] + endif + + if l:match[1] is# 'WARN' + let l:obj.type = 'W' + elseif l:match[1] is# 'ERROR' + let l:obj.type = 'E' + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim index 84e331ed..195057ca 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim @@ -4,10 +4,10 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " Only one file was passed to redpen. So response array has only one " element. - let l:res = json_decode(join(a:lines))[0] + let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {}) let l:output = [] - for l:err in l:res.errors + for l:err in get(l:res, 'errors', []) let l:item = { \ 'text': l:err.message, \ 'type': 'W', diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index ae1f3e7d..172f9d54 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -26,6 +26,41 @@ endif let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) +" Check if we have neovim's buffer highlight API +" +" Below we define some functions' implementation conditionally if this API +" exists or not. +" +" The API itself is more ergonomic and neovim performs highlights positions +" rebases during edits so we see less stalled highlights. +let s:nvim_api = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') + +function! ale#highlight#HasNeovimApi() abort + return s:nvim_api +endfunction + +function! ale#highlight#nvim_buf_clear_namespace(...) abort + return call('nvim_buf_clear_namespace', a:000) +endfunction + +function! ale#highlight#nvim_buf_add_highlight(...) abort + return call('nvim_buf_add_highlight', a:000) +endfunction + +function! s:ale_nvim_highlight_id(bufnr) abort + let l:id = getbufvar(a:bufnr, 'ale_nvim_highlight_id', -1) + + if l:id is -1 + " NOTE: This will highlight nothing but will allocate new id + let l:id = ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, 0, '', 0, 0, -1 + \) + call setbufvar(a:bufnr, 'ale_nvim_highlight_id', l:id) + endif + + return l:id +endfunction + function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort if a:line >= a:end_line " For single lines, just return the one position. @@ -49,12 +84,90 @@ endfunction " Given a loclist for current items to highlight, remove all highlights " except these which have matching loclist item entries. + function! ale#highlight#RemoveHighlights() abort - for l:match in getmatches() - if l:match.group =~# '^ALE' - call matchdelete(l:match.id) + if ale#highlight#HasNeovimApi() + if get(b:, 'ale_nvim_highlight_id', 0) + let l:bufnr = bufnr('%') + " NOTE: 0, -1 means from 0 line till the end of buffer + call ale#highlight#nvim_buf_clear_namespace( + \ l:bufnr, + \ b:ale_nvim_highlight_id, + \ 0, -1 + \) endif - endfor + else + for l:match in getmatches() + if l:match.group =~# '^ALE' + call matchdelete(l:match.id) + endif + endfor + endif +endfunction + +function! s:highlight_line(bufnr, lnum, group) abort + if ale#highlight#HasNeovimApi() + let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ a:lnum - 1, 0, -1 + \) + else + call matchaddpos(a:group, [a:lnum]) + endif +endfunction + +function! s:highlight_range(bufnr, range, group) abort + if ale#highlight#HasNeovimApi() + let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) + " NOTE: lines and columns indicies are 0-based in nvim_buf_* API. + let l:lnum = a:range.lnum - 1 + let l:end_lnum = a:range.end_lnum - 1 + let l:col = a:range.col - 1 + let l:end_col = a:range.end_col + + if l:lnum >= l:end_lnum + " For single lines, just return the one position. + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:lnum, l:col, l:end_col + \) + else + " highlight first line from start till the line end + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:lnum, l:col, -1 + \) + + " highlight all lines between the first and last entirely + let l:cur = l:lnum + 1 + + while l:cur < l:end_lnum + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:cur, 0, -1 + \ ) + let l:cur += 1 + endwhile + + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:end_lnum, 0, l:end_col + \) + endif + else + " Set all of the positions, which are chunked into Lists which + " are as large as will be accepted by matchaddpos. + call map( + \ ale#highlight#CreatePositions( + \ a:range.lnum, + \ a:range.col, + \ a:range.end_lnum, + \ a:range.end_col + \ ), + \ 'matchaddpos(a:group, v:val)' + \) + endif endfunction function! ale#highlight#UpdateHighlights() abort @@ -79,17 +192,14 @@ function! ale#highlight#UpdateHighlights() abort let l:group = 'ALEError' endif - let l:line = l:item.lnum - let l:col = l:item.col - let l:end_line = get(l:item, 'end_lnum', l:line) - let l:end_col = get(l:item, 'end_col', l:col) + let l:range = { + \ 'lnum': l:item.lnum, + \ 'col': l:item.col, + \ 'end_lnum': get(l:item, 'end_lnum', l:item.lnum), + \ 'end_col': get(l:item, 'end_col', l:item.col) + \} - " Set all of the positions, which are chunked into Lists which - " are as large as will be accepted by matchaddpos. - call map( - \ ale#highlight#CreatePositions(l:line, l:col, l:end_line, l:end_col), - \ 'matchaddpos(l:group, v:val)' - \) + call s:highlight_range(l:item.bufnr, l:range, l:group) endfor " If highlights are enabled and signs are not enabled, we should still @@ -111,7 +221,7 @@ function! ale#highlight#UpdateHighlights() abort endif if l:available_groups[l:group] - call matchaddpos(l:group, [l:item.lnum]) + call s:highlight_line(l:item.bufnr, l:item.lnum, l:group) endif endfor endif diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 4937a6d7..8c657675 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -32,7 +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'], +\ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -340,7 +340,13 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`aliases` must be a List of String values' endif - " TODO: Emit deprecation warnings for deprecated options later. + for l:key in filter(keys(a:linter), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''') + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + + break + endfor return l:obj endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 3417575c..63d97f35 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -115,7 +115,7 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort let l:open_type = '' if ale#Var(a:buffer, 'list_vertical') == 1 - let l:open_type = 'vert ' + let l:open_type = 'vert rightbelow ' endif if g:ale_set_quickfix diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index 646dbd20..4ad94c4b 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -159,7 +159,7 @@ function! ale#lsp#message#Hover(buffer, line, column) abort endfunction function! ale#lsp#message#DidChangeConfiguration(buffer, config) abort - return [0, 'workspace/didChangeConfiguration', { + return [1, 'workspace/didChangeConfiguration', { \ 'settings': a:config, \}] endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index b91d875b..9ce05260 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort for l:diagnostic in a:response.params.diagnostics let l:severity = get(l:diagnostic, 'severity', 0) let l:loclist_item = { - \ 'text': l:diagnostic.message, + \ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'), \ 'type': 'E', \ 'lnum': l:diagnostic.range.start.line + 1, \ 'col': l:diagnostic.range.start.character + 1, diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index d544916a..f70042dd 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -10,6 +10,11 @@ endif " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnore(buffer, linter_name) abort + " Ignore all diagnostics if LSP integration is disabled. + if ale#Var(a:buffer, 'disable_lsp') + return 1 + endif + let l:config = ale#Var(a:buffer, 'linters_ignore') " Don't load code for ignoring diagnostics if there's nothing to ignore. @@ -27,12 +32,13 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] let l:filename = ale#path#FromURI(a:response.params.uri) let l:buffer = bufnr(l:filename) + let l:info = get(g:ale_buffer_info, l:buffer, {}) - if s:ShouldIgnore(l:buffer, l:linter_name) + if empty(l:info) return endif - if l:buffer <= 0 + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -50,6 +56,8 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort return endif + call ale#engine#MarkLinterInactive(l:info, l:linter_name) + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -376,6 +384,10 @@ function! s:CheckWithLSP(linter, details) abort if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Geterr(l:buffer) let l:notified = ale#lsp#Send(l:id, l:message) != 0 + + if l:notified + call ale#engine#MarkLinterActive(l:info, a:linter) + endif else let l:notified = ale#lsp#NotifyForChanges(l:id, l:buffer) endif @@ -386,10 +398,6 @@ function! s:CheckWithLSP(linter, details) abort let l:save_message = ale#lsp#message#DidSave(l:buffer) let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 endif - - if l:notified - call ale#engine#MarkLinterActive(l:info, a:linter) - endif endfunction function! ale#lsp_linter#CheckWithLSP(buffer, linter) abort diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim index f75280b7..69060122 100644 --- a/sources_non_forked/ale/autoload/ale/node.vim +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -32,7 +32,7 @@ endfunction " " The executable is only prefixed for Windows machines function! ale#node#Executable(buffer, executable) abort - if ale#Has('win32') && a:executable =~? '\.js$' + if has('win32') && a:executable =~? '\.js$' let l:node = ale#Var(a:buffer, 'windows_node_executable_path') return ale#Escape(l:node) . ' ' . ale#Escape(a:executable) diff --git a/sources_non_forked/ale/autoload/ale/powershell.vim b/sources_non_forked/ale/autoload/ale/powershell.vim new file mode 100644 index 00000000..8c163206 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/powershell.vim @@ -0,0 +1,32 @@ +" Author: zigford +" Description: Functions for integrating with Powershell linters. + +" Write a powershell script to a temp file for execution +" return the command used to execute it +function! s:TemporaryPSScript(buffer, input) abort + let l:filename = 'script.ps1' + " Create a temp dir to house our temp .ps1 script + " a temp dir is needed as powershell needs the .ps1 + " extension + let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/') + let l:tempscript = l:tempdir . l:filename + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:tempdir, '', 0750) + " Automatically delete the directory later. + call ale#command#ManageDirectory(a:buffer, l:tempdir) + " Write the script input out to a file. + call ale#util#Writefile(a:buffer, a:input, l:tempscript) + + return l:tempscript +endfunction + +function! ale#powershell#RunPowerShell(buffer, base_var_name, command) abort + let l:executable = ale#Var(a:buffer, a:base_var_name . '_executable') + let l:tempscript = s:TemporaryPSScript(a:buffer, a:command) + + return ale#Escape(l:executable) + \ . ' -Exe Bypass -NoProfile -File ' + \ . ale#Escape(l:tempscript) + \ . ' %t' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index 0e88afe2..b9725e1e 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -49,13 +49,15 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort let l:result = get(a:response, 'result', []) let l:item_list = [] - for l:response_item in l:result - call add(l:item_list, { - \ 'filename': ale#path#FromURI(l:response_item.uri), - \ 'line': l:response_item.range.start.line + 1, - \ 'column': l:response_item.range.start.character + 1, - \}) - endfor + if type(l:result) is v:t_list + for l:response_item in l:result + call add(l:item_list, { + \ 'filename': ale#path#FromURI(l:response_item.uri), + \ 'line': l:response_item.range.start.line + 1, + \ 'column': l:response_item.range.start.character + 1, + \}) + endfor + endif if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim index 69d7a0c0..15e835c9 100644 --- a/sources_non_forked/ale/autoload/ale/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -1,7 +1,7 @@ " Author: Eddie Lebow https://github.com/elebow " Description: Functions for integrating with Ruby tools -" Find the nearest dir contining "app", "db", and "config", and assume it is +" Find the nearest dir containing "app", "db", and "config", and assume it is " the root of a Rails app. function! ale#ruby#FindRailsRoot(buffer) abort for l:name in ['app', 'config', 'db'] diff --git a/sources_non_forked/ale/autoload/ale/semver.vim b/sources_non_forked/ale/autoload/ale/semver.vim index 5f1b46fc..e3eb49c0 100644 --- a/sources_non_forked/ale/autoload/ale/semver.vim +++ b/sources_non_forked/ale/autoload/ale/semver.vim @@ -5,31 +5,52 @@ function! ale#semver#ResetVersionCache() abort let s:version_cache = {} endfunction +function! ale#semver#ParseVersion(version_lines) abort + for l:line in a:version_lines + let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') + + if !empty(l:match) + return [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + endif + endfor + + return [] +endfunction + " Given an executable name and some lines of output, which can be empty, " parse the version from the lines of output, or return the cached version " triple [major, minor, patch] " " If the version cannot be found, an empty List will be returned instead. -function! ale#semver#GetVersion(executable, version_lines) abort +function! s:GetVersion(executable, version_lines) abort let l:version = get(s:version_cache, a:executable, []) + let l:parsed_version = ale#semver#ParseVersion(a:version_lines) - for l:line in a:version_lines - let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') - - if !empty(l:match) - let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] - let s:version_cache[a:executable] = l:version - - break - endif - endfor + if !empty(l:parsed_version) + let l:version = l:parsed_version + let s:version_cache[a:executable] = l:version + endif return l:version endfunction -" Return 1 if the semver version has been cached for a given executable. -function! ale#semver#HasVersion(executable) abort - return has_key(s:version_cache, a:executable) +function! ale#semver#RunWithVersionCheck(buffer, executable, command, Callback) abort + if empty(a:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, a:executable) + return a:Callback(a:buffer, s:version_cache[a:executable]) + endif + + return ale#command#Run( + \ a:buffer, + \ a:command, + \ {_, output -> a:Callback(a:buffer, s:GetVersion(a:executable, output))}, + \ {'output_stream': 'both', 'executable': a:executable} + \) endfunction " Given two triples of integers [major, minor, patch], compare the triples diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 933fc055..7395b0e2 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -66,7 +66,7 @@ endif " Spaces and backslashes need to be escaped for signs. function! s:EscapeSignText(sign_text) abort - return substitute(a:sign_text, '\\\| ', '\\\0', 'g') + return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g') endfunction " Signs show up on the left for error markers. diff --git a/sources_non_forked/ale/autoload/ale/swift.vim b/sources_non_forked/ale/autoload/ale/swift.vim new file mode 100644 index 00000000..b31b8dc5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/swift.vim @@ -0,0 +1,13 @@ +" Author: Dan Loman +" Description: Functions for integrating with Swift tools + +" Find the nearest dir containing a Package.swift file and assume it is the root of the Swift project. +function! ale#swift#FindProjectRoot(buffer) abort + let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') + + if !empty(l:swift_config) + return fnamemodify(l:swift_config, ':h') + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index e57307e4..e7563608 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -422,7 +422,7 @@ function! ale#util#Writefile(buffer, lines, filename) abort \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines - call writefile(l:corrected_lines, a:filename) " no-custom-checks + call writefile(l:corrected_lines, a:filename, 'S') " no-custom-checks endfunction if !exists('s:patial_timers') diff --git a/sources_non_forked/ale/autoload/ale/virtualtext.vim b/sources_non_forked/ale/autoload/ale/virtualtext.vim index 532427fb..d7c5360e 100644 --- a/sources_non_forked/ale/autoload/ale/virtualtext.vim +++ b/sources_non_forked/ale/autoload/ale/virtualtext.vim @@ -81,7 +81,7 @@ function! ale#virtualtext#ShowCursorWarning(...) abort call ale#virtualtext#Clear() if !empty(l:loc) - let l:msg = get(l:loc, 'detail', l:loc.text) + let l:msg = l:loc.text let l:hl_group = 'ALEVirtualTextInfo' let l:type = get(l:loc, 'type', 'E') diff --git a/sources_non_forked/ale/doc/ale-chef.txt b/sources_non_forked/ale/doc/ale-chef.txt index 5024e279..75e144ec 100644 --- a/sources_non_forked/ale/doc/ale-chef.txt +++ b/sources_non_forked/ale/doc/ale-chef.txt @@ -2,6 +2,26 @@ ALE Chef Integration *ale-chef-options* +=============================================================================== +cookstyle *ale-chef-cookstyle* + +g:ale_chef_cookstyle_options *g:ale_chef_cookstyle_options* + *b:ale_chef_cookstyle_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to cookstyle. + + +g:ale_chef_cookstyle_executable *g:ale_chef_cookstyle_executable* + *b:ale_chef_cookstyle_executable* + Type: |String| + Default: `'cookstyle'` + + This variable can be changed to point to the cookstyle binary in case it's + not on the $PATH or a specific version/path must be used. + + =============================================================================== foodcritic *ale-chef-foodcritic* diff --git a/sources_non_forked/ale/doc/ale-clojure.txt b/sources_non_forked/ale/doc/ale-clojure.txt index a83e336f..2bf00c03 100644 --- a/sources_non_forked/ale/doc/ale-clojure.txt +++ b/sources_non_forked/ale/doc/ale-clojure.txt @@ -2,6 +2,13 @@ ALE Clojure Integration *ale-clojure-options* +=============================================================================== +clj-kondo *ale-clojure-clj-kondo* + +A minimal and opinionated linter for code that sparks joy. + +https://github.com/borkdude/clj-kondo + =============================================================================== joker *ale-clojure-joker* diff --git a/sources_non_forked/ale/doc/ale-css.txt b/sources_non_forked/ale/doc/ale-css.txt index f3cae385..ff74b263 100644 --- a/sources_non_forked/ale/doc/ale-css.txt +++ b/sources_non_forked/ale/doc/ale-css.txt @@ -2,6 +2,14 @@ ALE CSS Integration *ale-css-options* +=============================================================================== +fecs *ale-css-fecs* + +`fecs` options for CSS is the same as the options for JavaScript, and both of +them reads `./.fecsrc` as the default configuration file. See: +|ale-javascript-fecs|. + + =============================================================================== prettier *ale-css-prettier* diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 408b176f..9c9f0394 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -12,6 +12,7 @@ CONTENTS *ale-development-contents* 3. Coding Standards.....................|ale-coding-standards| 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| + 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| =============================================================================== 1. Introduction *ale-development-introduction* @@ -288,10 +289,10 @@ and should be written like so. > AssertLinter 'some-command', ale#Escape('some-command') . ' --foo' Execute(Check chained commands): - " WithChainResults can be called with 1 or more list for passing output + " GivenCommandOutput can be called with 1 or more list for passing output " to chained commands. The output for each callback defaults to an empty " list. - WithChainResults ['v2.1.2'] + GivenCommandOutput ['v2.1.2'] " Given a List of commands, check all of them. " Given a String, only the last command in the chain will be checked. AssertLinter 'some-command', [ @@ -302,7 +303,7 @@ and should be written like so. > The full list of commands that will be temporarily defined for linter tests given the above setup are as follows. -`WithChainResults [...]` - Define output for command chain functions. +`GivenCommandOutput [...]` - Define output for ale#command#Run. `AssertLinter executable, command` - Check the executable and command. `AssertLinterNotExecuted` - Check that linters will not be executed. `AssertLSPLanguage language` - Check the language given to an LSP server. @@ -311,5 +312,46 @@ given the above setup are as follows. `AssertLSPProject project_root` - Check the root given to an LSP server. `AssertLSPAddress address` - Check the address to an LSP server. + +=============================================================================== +4.2 Writing Fixer Tests *ale-development-fixer-tests* + +Tests for ALE fixers should go in the `test/fixers` directory, and should +be written like so. > + + Before: + " Load the fixer and set up a series of commands, reset fixer variables, + " clear caches, etc. + " + " Vader's 'Save' command will be called here for fixer variables. + call ale#assert#SetUpFixerTest('filetype', 'fixer_name') + + After: + " Reset fixers, variables, etc. + " + " Vader's 'Restore' command will be called here. + call ale#assert#TearDownFixerTest() + + Execute(The default command should be correct): + " AssertFixer checks the result of the loaded fixer function. + AssertFixer {'command': ale#Escape('some-command') . ' --foo'} + + Execute(Check chained commands): + " Same as above for linter tests. + GivenCommandOutput ['v2.1.2'] + " Given a List of commands, check all of them. + " Given anything else, only the last result will be checked. + AssertFixer [ + \ ale#Escape('some-command') . ' --version', + \ {'command': ale#Escape('some-command') . ' --foo'} + \] +< +The full list of commands that will be temporarily defined for fixer tests +given the above setup are as follows. + +`GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertFixer results` - Check the fixer results + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 3fbc6fb9..611e3fdd 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -30,6 +30,23 @@ g:ale_go_go_executable *g:ale_go_go_options* the `gomod` fixer. +=============================================================================== +bingo *ale-go-bingo* + +g:ale_go_bingo_executable *g:ale_go_bingo_executable* + *b:ale_go_bingo_executable* + Type: |String| + Default: `'bingo'` + + Location of the bingo binary file. + + +g:ale_go_bingo_options *g:ale_go_bingo_options* + *b:ale_go_bingo_options* + Type: |String| + Default: `''` + + =============================================================================== gobuild *ale-go-gobuild* @@ -53,6 +70,60 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* This variable can be set to pass additional options to the gofmt fixer. +=============================================================================== +golangci-lint *ale-go-golangci-lint* + +`golangci-lint` is a `lint_file` linter, which only lints files that are +written to disk. This differs from the default behavior of linting the buffer. +See: |ale-lint-file| + +g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* + *b:ale_go_golangci_lint_executable* + Type: |String| + Default: `'golangci-lint'` + + The executable that will be run for golangci-lint. + + +g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* + *b:ale_go_golangci_lint_options* + Type: |String| + Default: `'--enable-all'` + + This variable can be changed to alter the command-line arguments to the + golangci-lint invocation. + + +g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* + *b:ale_go_golangci_lint_package* + Type: |Number| + Default: `0` + + When set to `1`, the whole Go package will be checked instead of only the + current file. + + +=============================================================================== +golangserver *ale-go-golangserver* + +g:ale_go_langserver_executable *g:ale_go_langserver_executable* + *b:ale_go_langserver_executable* + Type: |String| + Default: `'go-langserver'` + + Location of the go-langserver binary file. + + +g:ale_go_langserver_options *g:ale_go_langserver_options* + *b:ale_go_langserver_options* + Type: |String| + Default: `''` + + Additional options passed to the go-langserver command. Note that the + `-gocodecompletion` option is ignored because it is handled automatically + by the |g:ale_completion_enabled| variable. + + =============================================================================== golint *ale-go-golint* @@ -72,17 +143,6 @@ g:ale_go_golint_options *g:ale_go_golint_options* This variable can be set to pass additional options to the golint linter. -=============================================================================== -govet *ale-go-govet* - -g:ale_go_govet_options *g:ale_go_govet_options* - *b:ale_go_govet_options* - Type: |String| - Default: `''` - - This variable can be set to pass additional options to the go vet linter. - - =============================================================================== gometalinter *ale-go-gometalinter* @@ -121,6 +181,34 @@ g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package* current file. +=============================================================================== +gopls *ale-go-gopls* + +g:ale_go_gopls_executable *g:ale_go_gopls_executable* + *b:ale_go_gopls_executable* + Type: |String| + Default: `'gopls'` + + Location of the gopls binary file. + + +g:ale_go_gopls_options *g:ale_go_gopls_options* + *b:ale_go_gopls_options* + Type: |String| + Default: `''` + + +=============================================================================== +govet *ale-go-govet* + +g:ale_go_govet_options *g:ale_go_govet_options* + *b:ale_go_govet_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the go vet linter. + + =============================================================================== staticcheck *ale-go-staticcheck* @@ -142,74 +230,5 @@ g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* current file. -=============================================================================== -golangserver *ale-go-golangserver* - -g:ale_go_langserver_executable *g:ale_go_langserver_executable* - *b:ale_go_langserver_executable* - Type: |String| - Default: `'go-langserver'` - - Location of the go-langserver binary file. - -g:ale_go_langserver_options *g:ale_go_langserver_options* - *b:ale_go_langserver_options* - Type: |String| - Default: `''` - - Additional options passed to the go-langserver command. Note that the - `-gocodecompletion` option is ignored because it is handled automatically - by the |g:ale_completion_enabled| variable. - - -=============================================================================== -golangci-lint *ale-go-golangci-lint* - -`golangci-lint` is a `lint_file` linter, which only lints files that are -written to disk. This differs from the default behavior of linting the buffer. -See: |ale-lint-file| - -g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* - *b:ale_go_golangci_lint_executable* - Type: |String| - Default: `'golangci-lint'` - - The executable that will be run for golangci-lint. - - -g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* - *b:ale_go_golangci_lint_options* - Type: |String| - Default: `'--enable-all'` - - This variable can be changed to alter the command-line arguments to the - golangci-lint invocation. - - -g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* - *b:ale_go_golangci_lint_package* - Type: |Number| - Default: `0` - - When set to `1`, the whole Go package will be checked instead of only the - current file. - - -=============================================================================== -bingo *ale-go-bingo* - -g:ale_go_bingo_executable *g:ale_go_bingo_executable* - *b:ale_go_bingo_executable* - Type: |String| - Default: `'go-bingo'` - - Location of the go-bingo binary file. - -g:ale_go_bingo_options *g:ale_go_bingo_options* - *b:ale_go_bingo_options* - Type: |String| - Default: `''` - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index 2247eddc..e2073e37 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -12,6 +12,16 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* This variable can be changed to use a different executable for brittany. +=============================================================================== +floskell *ale-haskell-floskell* + +g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable* + *b:ale_haskell_floskell_executable* + Type: |String| + Default: `'floskell'` + + This variable can be changed to use a different executable for floskell. + =============================================================================== ghc *ale-haskell-ghc* diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index 1d30929f..5d6b20e2 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -2,6 +2,14 @@ ALE HTML Integration *ale-html-options* +=============================================================================== +fecs *ale-html-fecs* + +`fecs` options for HTMl is the same as the options for JavaScript, +and both of them reads `./.fecsrc` as the default configuration file. +See: |ale-javascript-fecs|. + + =============================================================================== htmlhint *ale-html-htmlhint* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index aa226305..2805c9c8 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -101,6 +101,46 @@ g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* This variable can be changed to use a different executable for java. +=============================================================================== +eclipselsp *ale-java-eclipselsp* + +To enable Eclipse LSP linter you need to clone and build the eclipse.jdt.ls +language server from https://github.com/eclipse/eclipse.jdt.ls. Simply +clone the source code repo and then build the plugin: + + ./mvnw clean verify + +Note: currently, the build can only run when launched with JDK 8. JDK 9 or more +recent versions can be used to run the server though. + +After build completes the files required to run the language server will be +located inside the repository folder `eclipse.jdt.ls`. Please ensure to set +|g:ale_java_eclipselsp_path| to the absolute path of that folder. + +You could customize compiler options and code assists of the server. +Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` +with options presented at +https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html. + +g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* + *b:ale_java_eclipselsp_path* + + Type: |String| + Default: `'$HOME/eclipse.jdt.ls'` + + Absolute path to the location of the eclipse.jdt.ls repository folder. Or if + you have VSCode extension installed the absolute path to the VSCode extensions + folder (e.g. $HOME/.vscode/extensions in Linux). + + +g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* + *b:ale_java_eclipse_executable* + Type: |String| + Default: `'java'` + + This variable can be set to change the executable path used for java. + + =============================================================================== uncrustify *ale-java-uncrustify* diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt index 53a70fd7..ea0a7089 100644 --- a/sources_non_forked/ale/doc/ale-javascript.txt +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -73,6 +73,33 @@ g:ale_javascript_eslint_suppress_missing_config configuration files are found. +=============================================================================== +fecs *ale-javascript-fecs* + +`fecs` is a lint tool for HTML/CSS/JavaScript, can be installed via: + + `$ npm install --save-dev fecs` + +And the configuration file is located at `./fecsrc`, see http://fecs.baidu.com +for more options. + + +g:ale_javascript_fecs_executable *g:ale_javascript_fecs_executable* + *b:ale_javascript_fecs_executable* + Type: |String| + Default: `'fecs'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_fecs_use_global *g:ale_javascript_fecs_use_global* + *b:ale_javascript_fecs_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== flow *ale-javascript-flow* diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt index adf17716..8b644c17 100644 --- a/sources_non_forked/ale/doc/ale-ocaml.txt +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -50,5 +50,33 @@ g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options* This variable can be set to pass additional options to the ocamlformat fixer. +=============================================================================== +ocp-indent *ale-ocaml-ocp-indent* + +g:ale_ocaml_ocp_indent_executable *g:ale_ocaml_ocp_indent_executable* + *b:ale_ocaml_ocp_indent_executable* + Type: |String| + Default: `ocp-indent` + + This variable can be set to pass the path of the ocp-indent. + +g:ale_ocaml_ocp_indent_options *g:ale_ocaml_ocp_indent_options* + *b:ale_ocaml_ocp_indent_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the ocp-indent. + +g:ale_ocaml_ocp_indent_config *g:ale_ocaml_ocp_indent_config* + *b:ale_ocaml_ocp_indent_config* + Type: |String| + Default: `''` + + This variable can be set to pass additional config to the ocp-indent. + Expand after "--config=". + + "ocp-indent" can also be enabled from ocamlformat config. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 83bc0fd5..d41fb50d 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -154,11 +154,13 @@ g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* g:ale_php_phpstan_level *g:ale_php_phpstan_level* *b:ale_php_phpstan_level* - Type: |Number| - Default: `4` + Type: |String| + Default: `''` This variable controls the rule levels. 0 is the loosest and 4 is the - strictest. + strictest. If this option isn't set, the rule level will be controlled by + the configuration file. If no configuration file can be detected, `'4'` will + be used instead. g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* @@ -169,6 +171,14 @@ g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* This variable sets path to phpstan configuration file. +g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload* + *b:ale_php_phpstan_autoload* + Type: |String| + Default: `''` + + This variable sets path to phpstan autoload file. + + =============================================================================== psalm *ale-php-psalm* diff --git a/sources_non_forked/ale/doc/ale-powershell.txt b/sources_non_forked/ale/doc/ale-powershell.txt new file mode 100644 index 00000000..c28ef9ea --- /dev/null +++ b/sources_non_forked/ale/doc/ale-powershell.txt @@ -0,0 +1,77 @@ +=============================================================================== +ALE PowerShell Integration *ale-powershell-options* + + +=============================================================================== +powershell *ale-powershell-powershell* + +g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* + *b:ale_powershell_powershell_executable* + Type: String + Default: `'pwsh'` + + This variable can be changed to use a different executable for powershell. + +> + " Use powershell.exe rather than the default pwsh + let g:ale_powershell_powershell_executable = 'powershell.exe' +> + +=============================================================================== +psscriptanalyzer *ale-powershell-psscriptanalyzer* + +Installation +------------------------------------------------------------------------------- + +Install PSScriptAnalyzer by any means, so long as it can be automatically +imported in PowerShell. +Some PowerShell plugins set the filetype of files to `ps1`. To continue using +these plugins, use the ale_linter_aliases global to alias `ps1` to `powershell` + +> + " Allow ps1 filetype to work with powershell linters + let g:ale_linter_aliases = {'ps1': 'powershell'} +< + +g:ale_powershell_psscriptanalyzer_executable +*g:ale_powershell_psscriptanalyzer_executable* + *b:ale_powershell_psscriptanalyzer_executable* + Type: |String| + Default: `'pwsh'` + + This variable sets executable used for powershell. + + For example, on Windows you could set powershell to be Windows Powershell: +> + let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe' +< + +g:ale_powershell_psscriptanalyzer_module +*g:ale_powershell_psscriptanalyzer_module* + *b:ale_powershell_psscriptanalyzer_module* + Type: |String + Default: `'psscriptanalyzer'` + + This variable sets the name of the psscriptanalyzer module. + for psscriptanalyzer invocation. + + +g:ale_powershell_psscriptanalyzer_exclusions +*g:ale_powershell_psscriptanalyzer_exclusions* + *b:ale_powershell_psscriptanalyzer_exclusions* + Type: |String| + Default: `''` + + Set this variable to exclude test(s) for psscriptanalyzer + (-ExcludeRule option). To exclude more than one option, separate them with + commas. + +> + " Suppress Write-Host and Global vars warnings + let g:ale_powershell_psscriptanalyzer_exclusions = + \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +< + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index dd946ad4..7dd3b65d 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -580,6 +580,14 @@ g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* + *b:ale_python_pylint_use_msg_id* + Type: |Number| + Default: `0` + + Use message for output (e.g. I0011) instead of symbolic name of the message + (e.g. locally-disabled). + =============================================================================== pyls *ale-python-pyls* diff --git a/sources_non_forked/ale/doc/ale-r.txt b/sources_non_forked/ale/doc/ale-r.txt index f85f48fd..b5ccebe5 100644 --- a/sources_non_forked/ale/doc/ale-r.txt +++ b/sources_non_forked/ale/doc/ale-r.txt @@ -25,5 +25,21 @@ g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* of `lintr::lint`. This prevents erroneous namespace warnings when linting package files. + +=============================================================================== +styler *ale-r-styler* + +g:ale_r_styler_options *g:ale_r_styler_options* + *b:ale_r_styler_options* + Type: |String| + Default: `'styler::tidyverse_style'` + + This option can be configured to change the options for styler. + + The value of this option will be used as the `style` argument for the + `styler::style_file` options. Consult the styler documentation + for more information. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 3393b9c0..44a79b18 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -164,10 +164,14 @@ g:ale_rust_rls_executable *g:ale_rust_rls_executable* g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* *b:ale_rust_rls_toolchain* Type: |String| - Default: `'nightly'` + Default: `''` This option can be set to change the toolchain used for `rls`. Possible - values include `'nightly'`, `'beta'`, and `'stable'`. + values include `'nightly'`, `'beta'`, `'stable'`, and `''`. When using + option `''`, rls will automatically find the default toolchain set by + rustup. If you want to use `rls` from a specific toolchain version, you may + also use values like `'channel-yyyy-mm-dd-arch-target'` as long as + `'rls +{toolchain_name} -V'` runs correctly in your command line. The `rls` server will only be started once per executable. diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt index 64f59609..3eac9038 100644 --- a/sources_non_forked/ale/doc/ale-sh.txt +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -62,6 +62,18 @@ g:ale_sh_shellcheck_options *g:ale_sh_shellcheck_options* < +g:ale_sh_shellcheck_change_directory *g:ale_sh_shellcheck_change_directory* + *b:ale_sh_shellcheck_change_directory* + Type: |Number| + Default: `1` + + If set to `1`, ALE will switch to the directory the shell file being + checked with `shellcheck` is in before checking it. This helps `shellcheck` + determine the path to sourced files more easily. This option can be turned + off if you want to control the directory `shellcheck` is executed from + yourself. + + g:ale_sh_shellcheck_dialect *g:ale_sh_shellcheck_dialect* *b:ale_sh_shellcheck_dialect* Type: |String| diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 9be28f87..d6fbafa6 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -71,8 +71,10 @@ Notes: * `gcc` * `uncrustify` * Chef + * `cookstyle` * `foodcritic` * Clojure + * `clj-kondo` * `joker` * CloudFormation * `cfn-python-lint` @@ -87,6 +89,7 @@ Notes: * `crystal`!! * CSS * `csslint` + * `fecs` * `prettier` * `stylelint` * Cucumber @@ -152,6 +155,7 @@ Notes: * `golint` * `gometalinter`!! * `go mod`!! + * `gopls` * `gosimple`!! * `gotype`!! * `go vet`!! @@ -171,6 +175,7 @@ Notes: * Haskell * `brittany` * `cabal-ghc` + * `floskell` * `ghc` * `ghc-mod` * `hdevtools` @@ -184,6 +189,7 @@ Notes: * `terraform-fmt` * HTML * `alex`!! + * `fecs` * `HTMLHint` * `prettier` * `proselint` @@ -195,6 +201,7 @@ Notes: * `ispc`!! * Java * `checkstyle` + * `eclipselsp` * `google-java-format` * `javac` * `javalsp` @@ -202,6 +209,7 @@ Notes: * `uncrustify` * JavaScript * `eslint` + * `fecs` * `flow` * `jscs` * `jshint` @@ -285,6 +293,7 @@ Notes: * OCaml * `merlin` (see |ale-ocaml-merlin|) * `ocamlformat` + * `ocp-indent` * `ols` * Pawn * `uncrustify` @@ -315,6 +324,9 @@ Notes: * `write-good` * Pony * `ponyc` +* PowerShell + * `powershell` + * `psscriptanalyzer` * Prolog * `swipl` * proto @@ -335,6 +347,7 @@ Notes: * `prospector` * `pycodestyle` * `pydocstyle` + * `pyflakes` * `pylama`!! * `pylint`!! * `pyls` @@ -346,6 +359,7 @@ Notes: * `qmllint` * R * `lintr` + * `styler` * Racket * `raco` * ReasonML @@ -407,6 +421,7 @@ Notes: * SugarSS * `stylelint` * Swift + * `sourcekit-lsp` * `swiftformat` * `swiftlint` * Tcl @@ -430,6 +445,7 @@ Notes: * `thrift` * TypeScript * `eslint` + * `fecs` * `prettier` * `tslint` * `tsserver` diff --git a/sources_non_forked/ale/doc/ale-swift.txt b/sources_non_forked/ale/doc/ale-swift.txt new file mode 100644 index 00000000..8fa0c06c --- /dev/null +++ b/sources_non_forked/ale/doc/ale-swift.txt @@ -0,0 +1,21 @@ +=============================================================================== +ALE Swift Integration *ale-swift-options* + + +=============================================================================== +sourcekitlsp *ale-swift-sourcekitlsp* + +To enable the SourceKit-LSP you need to install and build the executable as +described here: https://github.com/apple/sourcekit-lsp#building-sourcekit-lsp + + +g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* + *b:ale_sourcekit_lsp_executable* + Type: |String| + Default: `'sourcekit-lsp'` + + See |ale-integrations-local-executables| + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt index 24aa3112..b1b09117 100644 --- a/sources_non_forked/ale/doc/ale-tex.txt +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -32,5 +32,26 @@ g:ale_lacheck_executable *g:ale_lacheck_executable* This variable can be changed to change the path to lacheck. + +=============================================================================== +latexindent *ale-tex-latexindent* + +g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* + *b:ale_tex_latexindent_executable* + Type: |String| + Default: `'latexindent'` + + This variable can be changed to change the path to latexindent. + + +g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* + *b:ale_tex_latexindent_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to latexindent. + + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index f3ceacdb..2a086981 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -1,4 +1,4 @@ -*ale.txt* For Vim version 8.0. +*ale.txt* Plugin to lint and fix files asynchronously *ale* ALE - Asynchronous Lint Engine @@ -48,364 +48,6 @@ ALE supports the following key features for linting: 5. Setting |signs| with warnings and errors for error markers. 6. Using |echo| to show error messages when the cursor moves. 7. Setting syntax highlights for errors. - ada...................................|ale-ada-options| - gcc.................................|ale-ada-gcc| - ansible...............................|ale-ansible-options| - ansible-lint........................|ale-ansible-ansible-lint| - asciidoc..............................|ale-asciidoc-options| - write-good..........................|ale-asciidoc-write-good| - textlint............................|ale-asciidoc-textlint| - asm...................................|ale-asm-options| - 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| - clang-format........................|ale-c-clangformat| - clangtidy...........................|ale-c-clangtidy| - cppcheck............................|ale-c-cppcheck| - cquery..............................|ale-c-cquery| - flawfinder..........................|ale-c-flawfinder| - gcc.................................|ale-c-gcc| - uncrustify..........................|ale-c-uncrustify| - ccls................................|ale-c-ccls| - chef..................................|ale-chef-options| - foodcritic..........................|ale-chef-foodcritic| - clojure...............................|ale-clojure-options| - joker...............................|ale-clojure-joker| - cloudformation........................|ale-cloudformation-options| - cfn-python-lint.....................|ale-cloudformation-cfn-python-lint| - cmake.................................|ale-cmake-options| - cmakelint...........................|ale-cmake-cmakelint| - cmake-format........................|ale-cmake-cmakeformat| - cpp...................................|ale-cpp-options| - clang...............................|ale-cpp-clang| - clangd..............................|ale-cpp-clangd| - clangcheck..........................|ale-cpp-clangcheck| - clang-format........................|ale-cpp-clangformat| - clangtidy...........................|ale-cpp-clangtidy| - clazy...............................|ale-cpp-clazy| - cppcheck............................|ale-cpp-cppcheck| - cpplint.............................|ale-cpp-cpplint| - cquery..............................|ale-cpp-cquery| - flawfinder..........................|ale-cpp-flawfinder| - gcc.................................|ale-cpp-gcc| - uncrustify..........................|ale-cpp-uncrustify| - ccls................................|ale-cpp-ccls| - c#....................................|ale-cs-options| - mcs.................................|ale-cs-mcs| - mcsc................................|ale-cs-mcsc| - uncrustify..........................|ale-cs-uncrustify| - css...................................|ale-css-options| - prettier............................|ale-css-prettier| - stylelint...........................|ale-css-stylelint| - cuda..................................|ale-cuda-options| - nvcc................................|ale-cuda-nvcc| - clang-format........................|ale-cuda-clangformat| - d.....................................|ale-d-options| - dls.................................|ale-d-dls| - uncrustify..........................|ale-d-uncrustify| - dart..................................|ale-dart-options| - dartanalyzer........................|ale-dart-dartanalyzer| - dartfmt.............................|ale-dart-dartfmt| - dockerfile............................|ale-dockerfile-options| - dockerfile_lint.....................|ale-dockerfile-dockerfile_lint| - hadolint............................|ale-dockerfile-hadolint| - elixir................................|ale-elixir-options| - mix.................................|ale-elixir-mix| - mix_format..........................|ale-elixir-mix-format| - dialyxir............................|ale-elixir-dialyxir| - elixir-ls...........................|ale-elixir-elixir-ls| - credo...............................|ale-elixir-credo| - elm...................................|ale-elm-options| - elm-format..........................|ale-elm-elm-format| - elm-lsp.............................|ale-elm-elm-lsp| - elm-make............................|ale-elm-elm-make| - erlang................................|ale-erlang-options| - 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| - language_server.....................|ale-fortran-language-server| - fountain..............................|ale-fountain-options| - fusionscript..........................|ale-fuse-options| - fusion-lint.........................|ale-fuse-fusionlint| - git commit............................|ale-gitcommit-options| - gitlint.............................|ale-gitcommit-gitlint| - glsl..................................|ale-glsl-options| - glslang.............................|ale-glsl-glslang| - glslls..............................|ale-glsl-glslls| - 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| - golangserver........................|ale-go-golangserver| - golangci-lint.......................|ale-go-golangci-lint| - bingo...............................|ale-go-bingo| - graphql...............................|ale-graphql-options| - eslint..............................|ale-graphql-eslint| - gqlint..............................|ale-graphql-gqlint| - prettier............................|ale-graphql-prettier| - hack..................................|ale-hack-options| - hack................................|ale-hack-hack| - hackfmt.............................|ale-hack-hackfmt| - hhast...............................|ale-hack-hhast| - handlebars............................|ale-handlebars-options| - ember-template-lint.................|ale-handlebars-embertemplatelint| - haskell...............................|ale-haskell-options| - brittany............................|ale-haskell-brittany| - ghc.................................|ale-haskell-ghc| - ghc-mod.............................|ale-haskell-ghc-mod| - cabal-ghc...........................|ale-haskell-cabal-ghc| - hdevtools...........................|ale-haskell-hdevtools| - hfmt................................|ale-haskell-hfmt| - hlint...............................|ale-haskell-hlint| - stack-build.........................|ale-haskell-stack-build| - stack-ghc...........................|ale-haskell-stack-ghc| - stylish-haskell.....................|ale-haskell-stylish-haskell| - hie.................................|ale-haskell-hie| - hcl...................................|ale-hcl-options| - terraform-fmt.......................|ale-hcl-terraform-fmt| - 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| - google-java-format..................|ale-java-google-java-format| - pmd.................................|ale-java-pmd| - javalsp.............................|ale-java-javalsp| - uncrustify..........................|ale-java-uncrustify| - javascript............................|ale-javascript-options| - eslint..............................|ale-javascript-eslint| - flow................................|ale-javascript-flow| - importjs............................|ale-javascript-importjs| - jscs................................|ale-javascript-jscs| - jshint..............................|ale-javascript-jshint| - prettier............................|ale-javascript-prettier| - prettier-eslint.....................|ale-javascript-prettier-eslint| - prettier-standard...................|ale-javascript-prettier-standard| - standard............................|ale-javascript-standard| - xo..................................|ale-javascript-xo| - json..................................|ale-json-options| - fixjson.............................|ale-json-fixjson| - jsonlint............................|ale-json-jsonlint| - jq..................................|ale-json-jq| - prettier............................|ale-json-prettier| - julia.................................|ale-julia-options| - languageserver......................|ale-julia-languageserver| - kotlin................................|ale-kotlin-options| - kotlinc.............................|ale-kotlin-kotlinc| - ktlint..............................|ale-kotlin-ktlint| - languageserver......................|ale-kotlin-languageserver| - latex.................................|ale-latex-options| - write-good..........................|ale-latex-write-good| - textlint............................|ale-latex-textlint| - less..................................|ale-less-options| - lessc...............................|ale-less-lessc| - prettier............................|ale-less-prettier| - stylelint...........................|ale-less-stylelint| - llvm..................................|ale-llvm-options| - llc.................................|ale-llvm-llc| - lua...................................|ale-lua-options| - luac................................|ale-lua-luac| - luacheck............................|ale-lua-luacheck| - markdown..............................|ale-markdown-options| - mdl.................................|ale-markdown-mdl| - prettier............................|ale-markdown-prettier| - remark-lint.........................|ale-markdown-remark-lint| - textlint............................|ale-markdown-textlint| - write-good..........................|ale-markdown-write-good| - mercury...............................|ale-mercury-options| - mmc.................................|ale-mercury-mmc| - nasm..................................|ale-nasm-options| - nasm................................|ale-nasm-nasm| - nroff.................................|ale-nroff-options| - write-good..........................|ale-nroff-write-good| - objc..................................|ale-objc-options| - clang...............................|ale-objc-clang| - clangd..............................|ale-objc-clangd| - uncrustify..........................|ale-objc-uncrustify| - ccls................................|ale-objc-ccls| - objcpp................................|ale-objcpp-options| - clang...............................|ale-objcpp-clang| - clangd..............................|ale-objcpp-clangd| - uncrustify..........................|ale-objcpp-uncrustify| - ocaml.................................|ale-ocaml-options| - merlin..............................|ale-ocaml-merlin| - ols.................................|ale-ocaml-ols| - ocamlformat.........................|ale-ocaml-ocamlformat| - pawn..................................|ale-pawn-options| - uncrustify..........................|ale-pawn-uncrustify| - perl..................................|ale-perl-options| - perl................................|ale-perl-perl| - perlcritic..........................|ale-perl-perlcritic| - perltidy............................|ale-perl-perltidy| - perl6.................................|ale-perl6-options| - perl6...............................|ale-perl6-perl6| - php...................................|ale-php-options| - langserver..........................|ale-php-langserver| - phan................................|ale-php-phan| - phpcbf..............................|ale-php-phpcbf| - phpcs...............................|ale-php-phpcs| - phpmd...............................|ale-php-phpmd| - 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| - write-good..........................|ale-pod-write-good| - pony..................................|ale-pony-options| - ponyc...............................|ale-pony-ponyc| - prolog................................|ale-prolog-options| - swipl...............................|ale-prolog-swipl| - proto.................................|ale-proto-options| - protoc-gen-lint.....................|ale-proto-protoc-gen-lint| - pug...................................|ale-pug-options| - puglint.............................|ale-pug-puglint| - puppet................................|ale-puppet-options| - puppet..............................|ale-puppet-puppet| - puppetlint..........................|ale-puppet-puppetlint| - puppet-languageserver...............|ale-puppet-languageserver| - pyrex (cython)........................|ale-pyrex-options| - cython..............................|ale-pyrex-cython| - python................................|ale-python-options| - autopep8............................|ale-python-autopep8| - bandit..............................|ale-python-bandit| - black...............................|ale-python-black| - flake8..............................|ale-python-flake8| - isort...............................|ale-python-isort| - mypy................................|ale-python-mypy| - prospector..........................|ale-python-prospector| - pycodestyle.........................|ale-python-pycodestyle| - pydocstyle..........................|ale-python-pydocstyle| - pyflakes............................|ale-python-pyflakes| - pylama..............................|ale-python-pylama| - pylint..............................|ale-python-pylint| - pyls................................|ale-python-pyls| - pyre................................|ale-python-pyre| - vulture.............................|ale-python-vulture| - yapf................................|ale-python-yapf| - qml...................................|ale-qml-options| - qmlfmt..............................|ale-qml-qmlfmt| - r.....................................|ale-r-options| - lintr...............................|ale-r-lintr| - reasonml..............................|ale-reasonml-options| - merlin..............................|ale-reasonml-merlin| - ols.................................|ale-reasonml-ols| - refmt...............................|ale-reasonml-refmt| - restructuredtext......................|ale-restructuredtext-options| - textlint............................|ale-restructuredtext-textlint| - write-good..........................|ale-restructuredtext-write-good| - ruby..................................|ale-ruby-options| - brakeman............................|ale-ruby-brakeman| - rails_best_practices................|ale-ruby-rails_best_practices| - reek................................|ale-ruby-reek| - rubocop.............................|ale-ruby-rubocop| - 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| - scalafmt............................|ale-scala-scalafmt| - 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| - shell...............................|ale-sh-shell| - shellcheck..........................|ale-sh-shellcheck| - shfmt...............................|ale-sh-shfmt| - sml...................................|ale-sml-options| - smlnj...............................|ale-sml-smlnj| - solidity..............................|ale-solidity-options| - solhint.............................|ale-solidity-solhint| - solium..............................|ale-solidity-solium| - spec..................................|ale-spec-options| - rpmlint.............................|ale-spec-rpmlint| - sql...................................|ale-sql-options| - sqlfmt..............................|ale-sql-sqlfmt| - stylus................................|ale-stylus-options| - stylelint...........................|ale-stylus-stylelint| - sugarss...............................|ale-sugarss-options| - stylelint...........................|ale-sugarss-stylelint| - tcl...................................|ale-tcl-options| - nagelfar............................|ale-tcl-nagelfar| - terraform.............................|ale-terraform-options| - fmt.................................|ale-terraform-fmt| - tflint..............................|ale-terraform-tflint| - tex...................................|ale-tex-options| - chktex..............................|ale-tex-chktex| - lacheck.............................|ale-tex-lacheck| - texinfo...............................|ale-texinfo-options| - write-good..........................|ale-texinfo-write-good| - text..................................|ale-text-options| - textlint............................|ale-text-textlint| - write-good..........................|ale-text-write-good| - thrift................................|ale-thrift-options| - thrift..............................|ale-thrift-thrift| - typescript............................|ale-typescript-options| - eslint..............................|ale-typescript-eslint| - prettier............................|ale-typescript-prettier| - tslint..............................|ale-typescript-tslint| - tsserver............................|ale-typescript-tsserver| - vala..................................|ale-vala-options| - uncrustify..........................|ale-vala-uncrustify| - verilog/systemverilog.................|ale-verilog-options| - iverilog............................|ale-verilog-iverilog| - verilator...........................|ale-verilog-verilator| - vlog................................|ale-verilog-vlog| - xvlog...............................|ale-verilog-xvlog| - vhdl..................................|ale-vhdl-options| - ghdl................................|ale-vhdl-ghdl| - vcom................................|ale-vhdl-vcom| - xvhdl...............................|ale-vhdl-xvhdl| - vim...................................|ale-vim-options| - vint................................|ale-vim-vint| - vim help..............................|ale-vim-help-options| - write-good..........................|ale-vim-help-write-good| - vue...................................|ale-vue-options| - prettier............................|ale-vue-prettier| - vls.................................|ale-vue-vls| - xhtml.................................|ale-xhtml-options| - write-good..........................|ale-xhtml-write-good| - xml...................................|ale-xml-options| - xmllint.............................|ale-xml-xmllint| - yaml..................................|ale-yaml-options| - prettier............................|ale-yaml-prettier| - swaglint............................|ale-yaml-swaglint| - yamllint............................|ale-yaml-yamllint| - yang..................................|ale-yang-options| - yang-lsp............................|ale-yang-lsp| ALE can fix problems with files with the |ALEFix| command, using the same job control functionality used for checking for problems. Try using the @@ -500,6 +142,8 @@ ALE offers several options for controlling which linters are run. * Selecting linters to run. - |g:ale_linters| * Aliasing filetypes for linters - |g:ale_linter_aliases| * Only running linters you asked for. - |g:ale_linters_explicit| +* Disabling only a subset of linters. - |g:ale_linters_ignore| +* Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| ------------------------------------------------------------------------------- @@ -667,6 +311,9 @@ by default. |g:ale_fix_on_save| - Fix files when they are saved. +Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will +still be run when you manually run |ALEFix|. + =============================================================================== 5. Language Server Protocol Support *ale-lsp* @@ -676,40 +323,49 @@ servers. LSP linters can be used in combination with any other linter, and will automatically connect to LSP servers when needed. ALE also supports `tsserver` for TypeScript, which uses a different but very similar protocol. -ALE supports the following LSP/tsserver features: - -1. Diagnostics/linting - Enabled via selecting linters as usual. -2. Completion -3. Go to definition - +If you want to use another plugin for LSP features and tsserver, you can use +the |g:ale_disable_lsp| setting to disable ALE's own LSP integrations, or +ignore particular linters with |g:ale_linters_ignore|. ------------------------------------------------------------------------------- 5.1 Completion *ale-completion* -ALE offers limited support for automatic completion of code while you type. +ALE offers support for automatic completion of code while you type. Completion is only supported while at least one LSP linter is enabled. ALE will only suggest symbols provided by the LSP servers. -Suggestions will be made while you type after completion is enabled. -Completion can be enabled by setting |g:ale_completion_enabled| to `1`. This -setting must be set to `1` before ALE is loaded. The delay for completion can -be configured with |g:ale_completion_delay|. ALE will only suggest so many -possible matches for completion. The maximum number of items can be controlled -with |g:ale_completion_max_suggestions|. + *ale-deoplete-integration* + +ALE integrates with Deoplete for offering automatic completion data. ALE's +completion source for Deoplete is named `'ale'`, and should enabled +automatically if Deoplete is enabled and configured correctly. Deoplete +integration should not be combined with ALE's own implementation. + +ALE also offers its own completion implementation, which does not require any +other plugins. Suggestions will be made while you type after completion is +enabled. ALE's own completion implementation can be enabled by setting +|g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE +is loaded. The delay for completion can be configured with +|g:ale_completion_delay|. This setting should not be enabled if you wish to +use ALE as a completion source for other plugins. + +ALE will only suggest so many possible matches for completion. The maximum +number of items can be controlled with |g:ale_completion_max_suggestions|. If you don't like some of the suggestions you see, you can filter them out with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|. The |ALEComplete| command can be used to show completion suggestions manually, -even when |g:ale_completion_enabled| is set to `0`. +even when |g:ale_completion_enabled| is set to `0`. For manually requesting +completion information with Deoplete, consult Deoplete's documentation. *ale-completion-completeopt-bug* -Automatic completion replaces |completeopt| before opening the omnicomplete -menu with . In some versions of Vim, the value set for the option -will not be respected. If you experience issues with Vim automatically -inserting text while you type, set the following option in vimrc, and your -issues should go away. > +ALE Automatic completion implementation replaces |completeopt| before opening +the omnicomplete menu with . In some versions of Vim, the value set +for the option will not be respected. If you experience issues with Vim +automatically inserting text while you type, set the following option in +vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < @@ -726,6 +382,9 @@ information returned by LSP servers. The following commands are supported: |ALEGoToDefinitionInSplit| - The same, but in a new split. |ALEGoToDefinitionInVSplit| - The same, but in a new vertical split. +ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is +set to `0`. + ------------------------------------------------------------------------------- 5.3 Go To Type Definition *ale-go-to-type-definition* @@ -901,6 +560,7 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* +b:ale_completion_enabled *b:ale_completion_enabled* Type: |Number| Default: `0` @@ -910,6 +570,13 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting must be set to `1` before ALE is loaded for this behavior to be enabled. + This setting should not be enabled if you wish to use ALE as a completion + source for other completion plugins. + + A buffer-local version of this setting `b:ale_completion_enabled` can be set + to `0` to disable ALE's automatic completion support for a single buffer. + ALE's completion support must be enabled globally to be enabled locally. + See |ale-completion| @@ -969,6 +636,18 @@ g:ale_cursor_detail *g:ale_cursor_detail* loaded for messages to be displayed. See |ale-lint-settings-on-startup|. +g:ale_disable_lsp *g:ale_disable_lsp* + *b:ale_disable_lsp* + + Type: |Number| + Default: `0` + + When this option is set to `1`, ALE ignores all linters powered by LSP, + and also `tsserver`. + + Please see also |ale-lsp|. + + g:ale_echo_cursor *g:ale_echo_cursor* Type: |Number| @@ -1020,7 +699,7 @@ b:ale_echo_msg_format *b:ale_echo_msg_format* `%s` - replaced with the text for the problem `%...code...% `- replaced with the error code `%linter%` - replaced with the name of the linter - `%severity%` - replaced withe severity of the problem + `%severity%` - replaced with the severity of the problem The strings for `%severity%` can be configured with the following options. @@ -1037,7 +716,7 @@ b:ale_echo_msg_format *b:ale_echo_msg_format* |g:ale_echo_cursor| needs to be set to 1 for messages to be displayed. The echo message format can also be configured separately for each buffer, - so different formats can be used for differnt languages. (Say in ftplugin + so different formats can be used for different languages. (Say in ftplugin files.) @@ -1118,6 +797,43 @@ b:ale_fix_on_save *b:ale_fix_on_save* Fixing files can be disabled or enabled for individual buffers by setting `b:ale_fix_on_save` to `0` or `1`. + Some fixers can be excluded from being run automatically when you save files + with the |g:ale_fix_on_save_ignore| setting. + + +g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* +b:ale_fix_on_save_ignore *b:ale_fix_on_save_ignore* + + Type: |Dictionary| or |List| + Default: `{}` + + Given a |Dictionary| mapping filetypes to |Lists| of fixers to ignore, or + just a |List| of fixers to ignore, exclude those fixers from being run + automatically when files are saved. + + You can disable some fixers in your ftplugin file: > + + " Disable fixers 'b' and 'c' when fixing on safe for this buffer. + let b:ale_fix_on_save_ignore = ['b', 'c'] + " Alternatively, define ignore lists for different filetypes. + let b:ale_fix_on_save_ignore = {'foo': ['b'], 'bar': ['c']} +< + You can disable some fixers globally per filetype like so: > + + let g:ale_fixers = {'foo': ['a', 'b'], 'bar': ['c', 'd']} + let g:ale_fix_on_save = 1 + " For filetype `foo.bar`, only fixers 'b' and 'd' will be run on save. + let g:ale_fix_on_save_ignore = {'foo': ['a'], 'bar': ['c']} + " Alternatively, disable these fixers on save for all filetypes. + let g:ale_fix_on_save_ignore = ['a', 'c'] +< + You can ignore fixers based on matching |Funcref| values too: > + + let g:AddBar = {buffer, lines -> lines + ['bar']} + let g:ale_fixers = {'foo': g:AddBar} + " The lambda fixer will be ignored, as it will be found in the ignore list. + let g:ale_fix_on_save_ignore = [g:AddBar] +< g:ale_history_enabled *g:ale_history_enabled* @@ -1342,7 +1058,7 @@ g:ale_linters *g:ale_linters* { \ 'csh': ['shell'], - \ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], + \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -1802,6 +1518,14 @@ g:ale_sign_warning *g:ale_sign_warning* The sign for warnings in the sign gutter. +g:ale_update_tagstack *g:ale_update_tagstack* + *b:ale_update_tagstack* + Type: |Number| + Default: `1` + + This option can be set to disable updating Vim's |tagstack| automatically. + + g:ale_type_map *g:ale_type_map* *b:ale_type_map* Type: |Dictionary| @@ -2212,8 +1936,10 @@ documented in additional help files. uncrustify............................|ale-c-uncrustify| ccls..................................|ale-c-ccls| chef....................................|ale-chef-options| + cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| clojure.................................|ale-clojure-options| + clj-kondo.............................|ale-clojure-clj-kondo| joker.................................|ale-clojure-joker| cloudformation..........................|ale-cloudformation-options| cfn-python-lint.......................|ale-cloudformation-cfn-python-lint| @@ -2239,6 +1965,7 @@ documented in additional help files. mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| css.....................................|ale-css-options| + fecs..................................|ale-css-fecs| prettier..............................|ale-css-prettier| stylelint.............................|ale-css-stylelint| cuda....................................|ale-cuda-options| @@ -2281,15 +2008,16 @@ documented in additional help files. glslang...............................|ale-glsl-glslang| glslls................................|ale-glsl-glslls| go......................................|ale-go-options| + bingo.................................|ale-go-bingo| gobuild...............................|ale-go-gobuild| gofmt.................................|ale-go-gofmt| - golint................................|ale-go-golint| - govet.................................|ale-go-govet| - gometalinter..........................|ale-go-gometalinter| - staticcheck...........................|ale-go-staticcheck| - golangserver..........................|ale-go-golangserver| golangci-lint.........................|ale-go-golangci-lint| - bingo.................................|ale-go-bingo| + golangserver..........................|ale-go-golangserver| + golint................................|ale-go-golint| + gometalinter..........................|ale-go-gometalinter| + gopls.................................|ale-go-gopls| + govet.................................|ale-go-govet| + staticcheck...........................|ale-go-staticcheck| graphql.................................|ale-graphql-options| eslint................................|ale-graphql-eslint| gqlint................................|ale-graphql-gqlint| @@ -2302,6 +2030,7 @@ documented in additional help files. ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| + floskell..............................|ale-haskell-floskell| ghc...................................|ale-haskell-ghc| ghc-mod...............................|ale-haskell-ghc-mod| cabal-ghc.............................|ale-haskell-cabal-ghc| @@ -2315,6 +2044,7 @@ documented in additional help files. hcl.....................................|ale-hcl-options| terraform-fmt.........................|ale-hcl-terraform-fmt| html....................................|ale-html-options| + fecs..................................|ale-html-fecs| htmlhint..............................|ale-html-htmlhint| tidy..................................|ale-html-tidy| prettier..............................|ale-html-prettier| @@ -2330,9 +2060,11 @@ documented in additional help files. google-java-format....................|ale-java-google-java-format| pmd...................................|ale-java-pmd| javalsp...............................|ale-java-javalsp| + eclipselsp............................|ale-java-eclipselsp| uncrustify............................|ale-java-uncrustify| javascript..............................|ale-javascript-options| eslint................................|ale-javascript-eslint| + fecs..................................|ale-javascript-fecs| flow..................................|ale-javascript-flow| importjs..............................|ale-javascript-importjs| jscs..................................|ale-javascript-jscs| @@ -2390,6 +2122,7 @@ documented in additional help files. merlin................................|ale-ocaml-merlin| ols...................................|ale-ocaml-ols| ocamlformat...........................|ale-ocaml-ocamlformat| + ocp-indent............................|ale-ocaml-ocp-indent| pawn....................................|ale-pawn-options| uncrustify............................|ale-pawn-uncrustify| perl....................................|ale-perl-options| @@ -2414,6 +2147,9 @@ documented in additional help files. write-good............................|ale-pod-write-good| pony....................................|ale-pony-options| ponyc.................................|ale-pony-ponyc| + powershell............................|ale-powershell-options| + powershell..........................|ale-powershell-powershell| + psscriptanalyzer....................|ale-powershell-psscriptanalyzer| prolog..................................|ale-prolog-options| swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| @@ -2447,6 +2183,7 @@ documented in additional help files. qmlfmt................................|ale-qml-qmlfmt| r.......................................|ale-r-options| lintr.................................|ale-r-lintr| + styler................................|ale-r-styler| reasonml................................|ale-reasonml-options| merlin................................|ale-reasonml-merlin| ols...................................|ale-reasonml-ols| @@ -2497,6 +2234,8 @@ documented in additional help files. stylelint.............................|ale-stylus-stylelint| sugarss.................................|ale-sugarss-options| stylelint.............................|ale-sugarss-stylelint| + swift...................................|ale-swift-options| + sourcekitlsp..........................|ale-swift-sourcekitlsp| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| @@ -2505,6 +2244,7 @@ documented in additional help files. tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| lacheck...............................|ale-tex-lacheck| + latexindent...........................|ale-tex-latexindent| texinfo.................................|ale-texinfo-options| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| @@ -2736,7 +2476,7 @@ ALELast *ALELast* Flags can be combined to create create custom jumping. Thus you can use ":ALENext -wrap -error -nosyle" to jump to the next error which is not a - style error while going back to the begining of the file if needed. + style error while going back to the beginning of the file if needed. `ALEFirst` goes to the first error or warning in the buffer, while `ALELast` goes to the last one. @@ -2885,6 +2625,14 @@ ale#Env(variable_name, value) *ale#Env()* 'set VAR="some value" && command' # On Windows +ale#Has(feature) *ale#Has()* + + Return `1` if ALE supports a given feature, like |has()| for Vim features. + + ALE versions can be checked with version strings in the format + `ale#Has('ale-x.y.z')`, such as `ale#Has('ale-2.4.0')`. + + ale#Pad(string) *ale#Pad()* Given a string or any |empty()| value, return either the string prefixed @@ -3463,7 +3211,7 @@ ale#statusline#Count(buffer) *ale#statusline#Count()* ale#statusline#FirstProblem(buffer, type) *ale#statusline#FirstProblem()* Returns a copy of the first entry in the `loclist` that matches the supplied - buffer number and problem type. If there is no such enty, an empty dictionary + buffer number and problem type. If there is no such entry, an empty dictionary is returned. Problem type should be one of the strings listed below: diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index ad3d3e56..cf39d632 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -216,7 +216,7 @@ 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() -command! -bar ALEComplete :call ale#completion#GetCompletions(1) +command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual') " mappings for commands nnoremap (ale_previous) :ALEPrevious diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py new file mode 100644 index 00000000..7ed2f6c0 --- /dev/null +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -0,0 +1,54 @@ +""" +A Deoplete source for ALE completion via tsserver and LSP. +""" +__author__ = 'Joao Paulo, w0rp' + +try: + from deoplete.source.base import Base +except ImportError: + # Mock the Base class if deoplete isn't available, as mock isn't available + # in the Docker image. + class Base(object): + def __init__(self, vim): + pass + + +# Make sure this code is valid in Python 2, used for running unit tests. +class Source(Base): + + def __init__(self, vim): + super(Source, self).__init__(vim) + + self.name = 'ale' + self.mark = '[L]' + self.rank = 100 + self.is_bytepos = True + self.min_pattern_length = 1 + + # Returns an integer for the start position, as with omnifunc. + def get_completion_position(self): + return self.vim.call('ale#completion#GetCompletionPosition') + + def gather_candidates(self, context): + # Stop early if ALE can't provide completion data for this buffer. + if not self.vim.call('ale#completion#CanProvideCompletions'): + return None + + if context.get('is_refresh'): + context['is_async'] = False + + if context['is_async']: + # Result is the same as for omnifunc, or None. + result = self.vim.call('ale#completion#GetCompletionResult') + + if result is not None: + context['is_async'] = False + + return result + else: + context['is_async'] = True + + # Request some completion results. + self.vim.call('ale#completion#GetCompletions', 'deoplete') + + return [] diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index c044d9f3..18d69388 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -80,8 +80,10 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * Chef + * [cookstyle](https://docs.chef.io/cookstyle.html) * [foodcritic](http://www.foodcritic.io/) * Clojure + * [clj-kondo](https://github.com/borkdude/clj-kondo) * [joker](https://github.com/candid82/joker) * CloudFormation * [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) @@ -96,6 +98,7 @@ formatting. * [crystal](https://crystal-lang.org/) :floppy_disk: * CSS * [csslint](http://csslint.net/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [stylelint](https://github.com/stylelint/stylelint) * Cucumber @@ -123,7 +126,7 @@ formatting. * [credo](https://github.com/rrrene/credo) * [dialyxir](https://github.com/jeremyjh/dialyxir) * [dogma](https://github.com/lpil/dogma) - * [elixir-ls](https://github.com/JakeBecker/elixir-ls) + * [elixir-ls](https://github.com/JakeBecker/elixir-ls) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) @@ -161,6 +164,7 @@ formatting. * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [gopls](https://github.com/golang/go/wiki/gopls) :warning: * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [go vet](https://golang.org/cmd/vet/) :floppy_disk: @@ -180,6 +184,7 @@ formatting. * Haskell * [brittany](https://github.com/lspitzner/brittany) * [cabal-ghc](https://www.haskell.org/cabal/) + * [floskell](https://github.com/ennocramer/floskell) * [ghc](https://www.haskell.org/ghc/) * [ghc-mod](https://github.com/DanielG/ghc-mod) * [hdevtools](https://hackage.haskell.org/package/hdevtools) @@ -193,6 +198,7 @@ formatting. * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [fecs](http://fecs.baidu.com/) * [HTMLHint](http://htmlhint.com/) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) @@ -204,6 +210,7 @@ formatting. * [ispc](https://ispc.github.io/) :floppy_disk: * Java * [checkstyle](http://checkstyle.sourceforge.net) + * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) @@ -211,6 +218,7 @@ formatting. * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [flow](https://flowtype.org/) * [jscs](http://jscs.info/) * [jshint](http://jshint.com/) @@ -294,6 +302,7 @@ formatting. * OCaml * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions * [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) + * [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ols](https://github.com/freebroccolo/ocaml-language-server) * Pawn * [uncrustify](https://github.com/uncrustify/uncrustify) @@ -324,6 +333,9 @@ formatting. * [write-good](https://github.com/btford/write-good) * Pony * [ponyc](https://github.com/ponylang/ponyc) +* PowerShell + * [powershell](https://github.com/PowerShell/PowerShell) :floppy_disk + * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) :floppy_disk * Prolog * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto @@ -344,6 +356,7 @@ formatting. * [prospector](https://github.com/PyCQA/prospector) :warning: * [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning: * [pydocstyle](https://www.pydocstyle.org/) :warning: + * [pyflakes](https://github.com/PyCQA/pyflakes) * [pylama](https://github.com/klen/pylama) :floppy_disk: * [pylint](https://www.pylint.org/) :floppy_disk: * [pyls](https://github.com/palantir/python-language-server) :warning: @@ -355,6 +368,7 @@ formatting. * [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) * R * [lintr](https://github.com/jimhester/lintr) + * [styler](https://github.com/r-lib/styler) * Racket * [raco](https://docs.racket-lang.org/raco/) * ReasonML @@ -416,6 +430,7 @@ formatting. * SugarSS * [stylelint](https://github.com/stylelint/stylelint) * Swift + * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) * Tcl @@ -439,6 +454,7 @@ formatting. * [thrift](http://thrift.apache.org/) * TypeScript * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [tslint](https://github.com/palantir/tslint) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) diff --git a/sources_non_forked/goyo.vim/doc/goyo.txt b/sources_non_forked/goyo.vim/doc/goyo.txt index c703146f..b8050226 100644 --- a/sources_non_forked/goyo.vim/doc/goyo.txt +++ b/sources_non_forked/goyo.vim/doc/goyo.txt @@ -1,4 +1,4 @@ -goyo.txt goyo Last change: April 2 2017 +*goyo.txt* goyo Last change: April 2 2017 GOYO - TABLE OF CONTENTS *goyo* *goyo-toc* ============================================================================== diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim index a28fb8d4..9d0fba69 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colorscheme/one.vim " Author: Zoltan Dalmadi " License: MIT License -" Last Change: 2017/11/28 21:53:01. +" Last Change: 2019/05/12 20:30:51. " ============================================================================= " Common colors @@ -28,7 +28,7 @@ if lightline#colorscheme#background() ==# 'light' let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ] let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ] let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ] - let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ] + let s:p.inactive.right = [ [ s:bg, s:gray3 ] ] let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ] let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ] let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ] @@ -43,20 +43,20 @@ else let s:p.normal.middle = [ [ s:fg, s:gray2 ] ] let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ] let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ] - let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ] + let s:p.inactive.right = [ [ s:gray1, s:bg ] ] let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ] endif " Common -let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ] +let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.normal.error = [ [ s:red2, s:bg ] ] let s:p.normal.warning = [ [ s:yellow, s:bg ] ] -let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ] -let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ] -let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ] -let s:p.tabline.left = [ [ s:bg, s:gray3 ] ] +let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.tabline.left = [ [ s:fg, s:gray3 ] ] let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ] let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ] let s:p.tabline.right = copy(s:p.normal.right) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index bdf3deb7..fd192827 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -10,6 +10,29 @@ endfunction " SECTION: General Functions {{{1 "============================================================ +"FUNCTION: nerdtree#and(x,y) {{{2 +" Implements and() function for Vim <= 7.2 +function! nerdtree#and(x,y) + if exists("*and") + return and(a:x, a:y) + else + let l:x = a:x + let l:y = a:y + let l:n = 0 + let l:result = 0 + while l:x > 0 && l:y > 0 + if (l:x % 2) && (l:y % 2) + let l:result += float2nr(pow(2, l:n)) + endif + echomsg l:x . ", " . l:y . " => " l:result + let l:x = float2nr(l:x / 2) + let l:y = float2nr(l:y / 2) + let l:n += 1 + endwhile + return l:result + endif +endfunction + "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "inits a window tree in the current buffer if appropriate function! nerdtree#checkForBrowse(dir) @@ -169,7 +192,7 @@ endfunction "msg: the message to echo function! nerdtree#echo(msg) redraw - echomsg "NERDTree: " . a:msg + echomsg empty(a:msg) ? "" : ("NERDTree: " . a:msg) endfunction "FUNCTION: nerdtree#echoError {{{2 diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 8da3640a..a82ff18e 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -492,7 +492,7 @@ function! s:openNodeRecursively(node) call nerdtree#echo("Recursively opening node. Please wait...") call a:node.openRecursively() call b:NERDTree.render() - redraw! + call nerdtree#echo("") endfunction " FUNCTION: s:previewBookmark(bookmark) {{{1 @@ -543,8 +543,9 @@ function! s:refreshRoot() call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w") call b:NERDTree.root.refresh() call b:NERDTree.render() - redraw! + redraw call nerdtree#exec(l:curWin . "wincmd w") + call nerdtree#echo("") endfunction " FUNCTION: s:refreshCurrent(node) {{{1 @@ -558,7 +559,7 @@ function! s:refreshCurrent(node) call nerdtree#echo("Refreshing node. This could take a while...") call node.refresh() call b:NERDTree.render() - redraw! + call nerdtree#echo("") endfunction " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index dad3dc8c..c633a8f2 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -256,7 +256,7 @@ endfunction function! s:Bookmark.open(nerdtree, ...) let opts = a:0 ? a:1 : {} - if and(g:NERDTreeQuitOnOpen,2) + if nerdtree#and(g:NERDTreeQuitOnOpen,2) call a:nerdtree.ui.toggleShowBookmarks() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index 5a4ebc50..c1ce5ed0 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -66,7 +66,7 @@ endfunction "FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1 "Closes the NERD tree window if the close on open option is set function! s:NERDTree.CloseIfQuitOnOpen() - if and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen() + if nerdtree#and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen() call s:NERDTree.Close() endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim index 0bea771b..a834e7c1 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -432,7 +432,7 @@ function! s:TreeDirNode._initChildren(silent) call self.sortChildren() - redraw! + call nerdtree#echo("") if invalidFilesFound call nerdtree#echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree") diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 9ae643bb..6ff9878e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -280,11 +280,10 @@ endfunction " FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) - " have to do this work around because match() returns bytes, not chars - let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') - " The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+ - let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs')) - + " Replace multi-character DirArrows with a single space so the + " indentation calculation doesn't get messed up. + let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '') + let leadChars = match(l:line, '\M\[^ ]') return leadChars / s:UI.IndentWid() endfunction diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index a18082eb..595e780b 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -14,8 +14,8 @@ if exists("loaded_nerd_tree") finish endif -if v:version < 700 - echoerr "NERDTree: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!" +if v:version < 703 + echoerr "NERDTree: this plugin requires vim >= 7.3. DOWNLOAD IT! You'll thank me later!" finish endif let loaded_nerd_tree = 1 @@ -77,6 +77,7 @@ else call s:initVariable("g:NERDTreeDirArrowExpandable", "+") call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") endif + call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1) diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.mdown index d4c58111..5d4e00c8 100644 --- a/sources_non_forked/vim-flake8/README.mdown +++ b/sources_non_forked/vim-flake8/README.mdown @@ -47,7 +47,7 @@ If you don't want to use the `` key for flake8-checking, simply remap it to another key. It autodetects whether it has been remapped and won't register the `` key if so. For example, to remap it to `` instead, use: - autocmd FileType python map :call Flake8() + autocmd FileType python map :call flake8#Flake8() For flake8 configuration options please consult the following page: @@ -110,7 +110,7 @@ A tip might be to run the Flake8 check every time you write a Python file, to enable this, add the following line to your `.vimrc` file (thanks [Godefroid](https://github.com/gotcha)!): - autocmd BufWritePost *.py call Flake8() + autocmd BufWritePost *.py call flake8#Flake8() This plugin goes well together with the following plugin: diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 8e68428c..8521f551 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -427,8 +427,12 @@ function! s:add_methods(namespace, method_names) abort endfunction let s:commands = [] -function! s:command(definition) abort - let s:commands += [a:definition] +function! s:command(definition, ...) abort + if a:0 + call add(s:commands, a:definition . ' execute s:' . a:1 . "Command(, , +'', , 0, '', , , [])") + else + call add(s:commands, a:definition) + endif endfunction function! s:define_commands() abort @@ -520,7 +524,7 @@ endfunction call s:add_methods('repo',['prepare','git_command','git_chomp','git_chomp_in_tree','rev_parse']) function! s:repo_superglob(base) dict abort - return map(fugitive#Complete(a:base, self.git_dir), 'substitute(v:val, ''\\\(.\)'', ''\1'', "g")') + return map(fugitive#CompleteObject(a:base, self.git_dir), 'substitute(v:val, ''\\\(.\)'', ''\1'', "g")') endfunction call s:add_methods('repo',['superglob']) @@ -1127,7 +1131,7 @@ function! fugitive#glob(url, ...) abort let [dirglob, commit, glob] = s:DirCommitFile(a:url) let append = matchstr(glob, '/*$') let glob = substitute(glob, '/*$', '', '') - let pattern = '^' . substitute(glob, '/\=\*\*/\=\|/\=\*\|[.?\^$]', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g')[1:-1] . '$' + let pattern = '^' . substitute(glob, '/\=\*\*/\=\|/\=\*\|[.?\$]\|^^', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g')[1:-1] . '$' let results = [] for dir in dirglob =~# '[*?]' ? split(glob(dirglob), "\n") : [dirglob] if empty(dir) || !get(g:, 'fugitive_file_api', 1) || !filereadable(dir . '/HEAD') @@ -1226,8 +1230,8 @@ function! s:GlobComplete(lead, pattern) abort return results endfunction -function! fugitive#PathComplete(base, ...) abort - let dir = a:0 == 1 ? a:1 : s:Dir() +function! fugitive#CompletePath(base, ...) abort + let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() let tree = s:Tree(dir) . '/' let strip = '^\%(:/:\=\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)' let base = substitute(a:base, strip, '', '') @@ -1253,8 +1257,12 @@ function! fugitive#PathComplete(base, ...) abort return matches endfunction -function! fugitive#Complete(base, ...) abort - let dir = a:0 == 1 ? a:1 : s:Dir() +function! fugitive#PathComplete(...) abort + return call('fugitive#CompletePath', a:000) +endfunction + +function! fugitive#CompleteObject(base, ...) abort + let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() let cwd = a:0 == 1 ? s:Tree(dir) : getcwd() let tree = s:Tree(dir) . '/' let subdir = '' @@ -1278,7 +1286,7 @@ function! fugitive#Complete(base, ...) abort endif call map(results, 's:fnameescape(v:val)') if !empty(tree) - let results += a:0 == 1 ? fugitive#PathComplete(a:base, dir) : fugitive#PathComplete(a:base) + let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base) endif return results @@ -1304,9 +1312,13 @@ function! fugitive#Complete(base, ...) abort return map(entries, 's:fnameescape(v:val)') endfunction +function! fugitive#Complete(...) abort + return call('fugitive#CompleteObject', a:000) +endfunction + " Section: Buffer auto-commands -function! s:ReplaceCmd(cmd, ...) abort +function! s:ReplaceCmd(cmd) abort let temp = tempname() let err = s:TempCmd(temp, a:cmd) if v:shell_error @@ -1318,11 +1330,7 @@ function! s:ReplaceCmd(cmd, ...) abort let modelines = &modelines try set modelines=0 - if a:0 - silent keepjumps noautocmd edit! - else - silent keepjumps edit! - endif + silent keepjumps noautocmd edit! finally let &modelines = modelines try @@ -1338,6 +1346,9 @@ endfunction function! s:QueryLog(refspec) abort let lines = split(system(FugitivePrepare('log', '-n', '256', '--format=%h%x09%s', a:refspec, '--')), "\n") + if v:shell_error + return [] + endif call map(lines, 'split(v:val, "\t")') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') return lines @@ -1580,7 +1591,7 @@ function! fugitive#BufReadStatus() abort nnoremap P :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap P :execute StagePatch(line("'<"),line("'>")) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif - nnoremap gq :if bufnr('$') == 1quitelsebdeleteendif + exe 'nnoremap ' nowait "gq :if bufnr('$') == 1quitelsebdeleteendif" nnoremap R :exe ReloadStatus() nnoremap U :echoerr 'Changed to X' nnoremap g :execute StageDelete(line('.'),v:count) @@ -1821,18 +1832,18 @@ augroup END " Section: :Git -call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(0,'',)") +call s:command("-bang -nargs=? -complete=customlist,fugitive#CompleteGit Git", "Git") -function! s:Git(bang, mods, args) abort +function! s:GitCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if a:bang - return s:Edit('edit', 1, a:mods, a:args) + return s:Open('edit', 1, a:mods, a:arg, a:args) endif let git = s:UserCommand() if has('gui_running') && !has('win32') let git .= ' --no-pager' endif - let args = matchstr(a:args,'\v\C.{-}%($|\\@ 1 ? strpart(a:1, 0, a:2) : '' if pre !~# ' [[:alnum:]-]\+ ' let cmds = s:Subcommands() - return filter(sort(cmds+keys(s:Aliases())), 'strpart(v:val, 0, strlen(a:A)) ==# a:A') + return filter(sort(cmds+keys(s:Aliases(dir))), 'strpart(v:val, 0, strlen(a:lead)) ==# a:lead') elseif pre =~# ' -- ' - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:lead, dir) else - return fugitive#Complete(a:A, s:Dir()) + return fugitive#CompleteObject(a:lead, dir) endif endfunction " Section: :Gcd, :Glcd function! s:DirComplete(A, L, P) abort - return filter(fugitive#PathComplete(a:A), 'v:val =~# "/$"') + return filter(fugitive#CompletePath(a:A), 'v:val =~# "/$"') endfunction function! s:DirArg(path) abort @@ -1910,10 +1921,10 @@ call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :exe " Section: :Gstatus -call s:command("-bar -bang -range=-1 Gstatus :execute s:Status(0, , '')") -call s:command("-bar -bang -range=-1 G :execute s:Status(0, , '')") +call s:command("-bar -bang -range=-1 Gstatus", "Status") +call s:command("-bar -bang -range=-1 G", "Status") -function! s:Status(bang, count, mods) abort +function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort try let mods = a:mods ==# '' || empty(a:mods) ? '' : a:mods . ' ' if mods !~# 'aboveleft\|belowright\|leftabove\|rightbelow\|topleft\|botright' @@ -2635,9 +2646,9 @@ endfunction " Section: :Gcommit -call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit('', )") +call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit", "Commit") -function! s:Commit(mods, args, ...) abort +function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args, ...) abort let mods = s:gsub(a:mods ==# '' ? '' : a:mods, '', '-tab') let dir = a:0 ? a:1 : s:Dir() let tree = s:Tree(dir) @@ -2658,11 +2669,11 @@ function! s:Commit(mods, args, ...) abort else let command = 'env GIT_EDITOR=false ' endif - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) let command .= s:UserCommand() . ' commit ' . args if &shell =~# 'csh' noautocmd silent execute '!('.escape(command, '!#%').' > '.outfile.') >& '.errorfile - elseif a:args =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' + elseif a:arg =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' noautocmd execute '!'.command.' 2> '.errorfile else noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile @@ -2696,7 +2707,7 @@ function! s:Commit(mods, args, ...) abort endif if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod execute mods 'keepalt edit' s:fnameescape(msgfile) - elseif a:args =~# '\%(^\| \)-\w*v' || mods =~# '\' + elseif a:arg =~# '\%(^\| \)-\w*v' || mods =~# '\' execute mods 'keepalt -tabedit' s:fnameescape(msgfile) else execute mods 'keepalt split' s:fnameescape(msgfile) @@ -2733,7 +2744,7 @@ function! s:CommitComplete(A,L,P) abort let args = ['-C', '-F', '-a', '-c', '-e', '-i', '-m', '-n', '-o', '-q', '-s', '-t', '-u', '-v', '--all', '--allow-empty', '--amend', '--author=', '--cleanup=', '--dry-run', '--edit', '--file=', '--fixup=', '--include', '--interactive', '--message=', '--no-verify', '--only', '--quiet', '--reedit-message=', '--reuse-message=', '--signoff', '--squash=', '--template=', '--untracked-files', '--verbose'] return filter(args,'v:val[0 : strlen(a:A)-1] ==# a:A') else - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:A, s:Dir()) endif return [] endfunction @@ -2747,7 +2758,7 @@ function! s:FinishCommit() abort call setbufvar(buf, 'fugitive_commit_rebase', 0) let s:rebase_continue = s:Dir(buf) endif - return s:Commit('', args, s:Dir(buf)) + return s:CommitCommand(-1, -1, 0, -1, 0, '', '', args, [], s:Dir(buf)) endif return '' endfunction @@ -2848,6 +2859,16 @@ function! s:Merge(cmd, bang, mods, args, ...) abort return s:RebaseEdit(mods . 'split', dir) elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --edit-todo' && filereadable(dir . '/rebase-merge/git-rebase-todo') return s:RebaseEdit(mods . 'split', dir) + elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --continue' && !a:0 + let rdir = dir . '/rebase-merge' + call system(fugitive#Prepare(dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--')) + if v:shell_error && isdirectory(rdir) + if getfsize(rdir . '/amend') <= 0 + return 'exe ' . string(mods . 'Gcommit -n -F ' . s:shellesc(dir . '/rebase-merge/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' + elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir) + return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:shellesc(dir . '/rebase-merge/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' + endif + endif endif let [mp, efm] = [&l:mp, &l:efm] let had_merge_msg = filereadable(dir . '/MERGE_MSG') @@ -2906,7 +2927,7 @@ function! s:Merge(cmd, bang, mods, args, ...) abort let $GIT_EDITOR = old_editor endif if exists('old_sequence_editor') - let $GIT_SEQUENCE_EDITOR = old_editor + let $GIT_SEQUENCE_EDITOR = old_sequence_editor endif execute cdback endtry @@ -2979,9 +3000,9 @@ endif function! s:GrepComplete(A, L, P) abort if strpart(a:L, 0, a:P) =~# ' -- ' - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:A, s:Dir()) else - return fugitive#Complete(a:A, s:Dir()) + return fugitive#CompleteObject(a:A, s:Dir()) endif endfunction @@ -3084,7 +3105,7 @@ function! s:UsableWin(nr) abort \ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0 endfunction -function! s:EditParse(args) abort +function! s:OpenParse(args) abort let pre = [] let args = copy(a:args) while !empty(args) && args[0] =~# '^+' @@ -3126,7 +3147,7 @@ function! s:BlurStatus() abort endif endfunction -function! s:Edit(cmd, bang, mods, args, ...) abort +function! s:Open(cmd, bang, mods, arg, args) abort let mods = a:mods ==# '' ? '' : a:mods if a:bang @@ -3134,7 +3155,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort try let cdback = s:Cd(s:Tree()) let git = s:UserCommand() - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) silent! execute '!' . escape(git . ' --no-pager ' . args, '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') finally @@ -3150,7 +3171,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort return 'redraw|echo ' . string(':!' . git . ' ' . args) endif - let [file, pre] = s:EditParse(a:000) + let [file, pre] = s:OpenParse(a:args) try let file = s:Generate(file) catch /^fugitive:/ @@ -3165,7 +3186,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort return mods . ' ' . a:cmd . pre . ' ' . s:fnameescape(file) endfunction -function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort +function! s:ReadCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort let mods = a:mods ==# '' ? '' : a:mods let after = a:line2 if a:count < 0 @@ -3180,7 +3201,7 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort try let cdback = s:Cd(s:Tree()) let git = s:UserCommand() - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) silent execute mods after.'read!' escape(git . ' --no-pager ' . args, '!#%') finally execute cdback @@ -3189,7 +3210,7 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort call fugitive#ReloadStatus() return 'redraw|echo '.string(':!'.git.' '.args) endif - let [file, pre] = s:EditParse(a:000) + let [file, pre] = s:OpenParse(a:args) try let file = s:Generate(file) catch /^fugitive:/ @@ -3204,29 +3225,29 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort return mods . ' ' . after . 'read' . pre . ' ' . s:fnameescape(file) . '|' . delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '') endfunction -function! s:EditRunComplete(A,L,P) abort +function! s:ReadComplete(A,L,P) abort if a:L =~# '^\w\+!' - return s:GitComplete(a:A, a:L, a:P) + return fugitive#CompleteGit(a:A, a:L, a:P) else - return fugitive#Complete(a:A, a:L, a:P) + return fugitive#CompleteObject(a:A, a:L, a:P) endif endfunction -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Ge execute s:Edit('edit', 0, '', , )") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gedit execute s:Edit('edit', 0, '', , )") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gpedit execute s:Edit('pedit', 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gsplit execute s:Edit(( > 0 ? : '').( ? 'split' : 'edit'), 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gvsplit execute s:Edit(( > 0 ? : '').( ? 'vsplit' : 'edit!'), 0, '', , )") -call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditRunComplete" . (has('patch-7.4.542') ? ' -addr=tabs' : '') . " Gtabedit execute s:Edit(( ? : '').'tabedit', 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gread execute s:Read(, , , +'', 0, '', , )") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Ge execute s:Open('edit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gedit execute s:Open('edit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -complete=customlist,s:ReadComplete Gpedit execute s:Open('pedit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gsplit execute s:Open(( > 0 ? : '').( ? 'split' : 'edit'), 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gvsplit execute s:Open(( > 0 ? : '').( ? 'vsplit' : 'edit!'), 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete" . (has('patch-7.4.542') ? ' -addr=tabs' : '') . " Gtabedit execute s:Open(( >= 0 ? : '').'tabedit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gread", "Read") " Section: :Gwrite, :Gwq -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gwrite :execute s:Write(0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gw :execute s:Write(0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gwq :execute s:Wq(0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gwrite", "Write") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gw", "Write") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gwq", "Wq") -function! s:Write(force,...) abort +function! s:WriteCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if exists('b:fugitive_commit_arguments') return 'write|bdelete' elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != '' @@ -3246,7 +3267,7 @@ function! s:Write(force,...) abort if err !=# '' let v:errmsg = split(err,"\n")[0] return 'echoerr v:errmsg' - elseif a:force + elseif a:bang return 'bdelete' else return 'Gedit '.fnameescape(filename) @@ -3254,15 +3275,15 @@ function! s:Write(force,...) abort endif let mytab = tabpagenr() let mybufnr = bufnr('') - let file = a:0 ? s:Generate(s:Expand(join(a:000, ' '))) : fugitive#Real(@%) + let file = len(a:args) ? s:Generate(s:Expand(join(a:args, ' '))) : fugitive#Real(@%) if empty(file) return 'echoerr '.string('fugitive: cannot determine file path') endif if file =~# '^fugitive:' - return 'write' . (a:force ? '! ' : ' ') . s:fnameescape(file) + return 'write' . (a:bang ? '! ' : ' ') . s:fnameescape(file) endif let always_permitted = s:cpath(fugitive#Real(@%), file) && s:DirCommitFile(@%)[1] =~# '^0\=$' - if !always_permitted && !a:force && (len(s:TreeChomp('diff', '--name-status', 'HEAD', '--', file)) || len(s:TreeChomp('ls-files', '--others', '--', file))) + if !always_permitted && !a:bang && (len(s:TreeChomp('diff', '--name-status', 'HEAD', '--', file)) || len(s:TreeChomp('ls-files', '--others', '--', file))) let v:errmsg = 'fugitive: file has uncommitted changes (use ! to override)' return 'echoerr v:errmsg' endif @@ -3308,7 +3329,7 @@ function! s:Write(force,...) abort execute 'write! '.s:fnameescape(file) endif - if a:force + if a:bang let error = s:TreeChomp('add', '--force', '--', file) else let error = s:TreeChomp('add', '--', file) @@ -3366,12 +3387,12 @@ function! s:Write(force,...) abort return 'checktime' endfunction -function! s:Wq(force,...) abort - let bang = a:force ? '!' : '' +function! s:WqCommand(...) abort + let bang = a:5 ? '!' : '' if exists('b:fugitive_commit_arguments') return 'wq'.bang endif - let result = call(s:function('s:Write'),[a:force]+a:000) + let result = call(s:function('s:WriteCommand'),a:000) if result =~# '^\%(write\|wq\|echoerr\)' return s:sub(result,'^write','wq') else @@ -3413,9 +3434,9 @@ endfunction " Section: :Gdiff -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gdiff :execute s:Diff('',0,)") -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gvdiff :execute s:Diff('keepalt vert ',0,)") -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gsdiff :execute s:Diff('keepalt ',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gdiff :execute s:Diff('',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gvdiff :execute s:Diff('keepalt vert ',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gsdiff :execute s:Diff('keepalt ',0,)") augroup fugitive_diff autocmd! @@ -3655,10 +3676,10 @@ endfunction function! s:RenameComplete(A,L,P) abort if a:A =~# '^[.:]\=/' - return fugitive#PathComplete(a:A) + return fugitive#CompletePath(a:A) else let pre = s:Slash(fnamemodify(expand('%:p:s?[\/]$??'), ':h')) . '/' - return map(fugitive#PathComplete(pre.a:A), 'strpart(v:val, len(pre))') + return map(fugitive#CompletePath(pre.a:A), 'strpart(v:val, len(pre))') endif endfunction @@ -3687,7 +3708,7 @@ endfunction augroup fugitive_remove autocmd! autocmd User Fugitive if s:DirCommitFile(@%)[1] =~# '^0\=$' | - \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,fugitive#PathComplete Gmove :execute s:Move(0,0,)" | + \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,fugitive#CompletePath Gmove :execute s:Move(0,0,)" | \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,s:RenameComplete Grename :execute s:Move(0,1,)" | \ exe "command! -buffer -bar -bang Gremove :execute s:Remove('edit',0)" | \ exe "command! -buffer -bar -bang Gdelete :execute s:Remove('bdelete',0)" | @@ -3711,7 +3732,7 @@ augroup fugitive_blame autocmd Syntax fugitiveblame call s:BlameSyntax() autocmd User Fugitive \ if get(b:, 'fugitive_type') =~# '^\%(file\|blob\|blame\)$' || filereadable(@%) | - \ exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:Blame(0,,,,'',[])" | + \ exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:BlameCommand(,,+'',,0,'',,,[])" | \ endif autocmd ColorScheme,GUIEnter * call s:RehighlightBlame() autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') @@ -3727,7 +3748,7 @@ function! s:linechars(pattern) abort return chars endfunction -function! s:Blame(bang, line1, line2, count, mods, args) abort +function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if exists('b:fugitive_blamed_bufnr') return 'bdelete' endif @@ -3735,7 +3756,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 !~# "^\\%(--relative-date\\|--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] + if filter(copy(a:args),'v:val !~# "^\\%(--abbrev=\\d*\\|--relative-date\\|--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] call s:throw('unsupported option') endif call map(a:args,'s:sub(v:val,"^\\ze[^-]","-")') @@ -3818,10 +3839,11 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort setlocal norelativenumber endif execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) + let nowait = v:version >= 704 ? '' : '' nnoremap :help fugitive-:Gblame nnoremap g? :help fugitive-:Gblame nnoremap q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdelete','^-1','','') - nnoremap gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand("%:p") =~# "^fugitive:[\\/][\\/]"Geditendif','^-1','','') + exe 'nnoremap ' nowait "gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand(''%:p'') =~# ''^fugitive:[\\/][\\/]''Geditendif','^-1','','')" nnoremap :exe BlameCommit("exe 'norm q'edit") nnoremap - :exe BlameJump('') nnoremap P :exe BlameJump('^'.v:count1) @@ -3829,7 +3851,7 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort nnoremap i :exe BlameCommit("exe 'norm q'edit") nnoremap o :exe BlameCommit((&splitbelow ? "botright" : "topleft")." split") nnoremap O :exe BlameCommit("tabedit") - nnoremap p :exe Edit((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), matchstr(getline('.'), '\x\+')) + nnoremap p :exe Open((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), [matchstr(getline('.'), '\x\+')]) nnoremap A :exe "vertical resize ".(linechars('.\{-\}\ze [0-9:/+-][0-9:/+ -]* \d\+)')+1+v:count) nnoremap C :exe "vertical resize ".(linechars('^\S\+')+1+v:count) nnoremap D :exe "vertical resize ".(linechars('.\{-\}\ze\d\ze\s\+\d\+)')+1-v:count) @@ -3848,7 +3870,7 @@ function! s:BlameCommit(cmd, ...) abort if line =~# '^0\{4,40\} ' return 'echoerr ' . string('Not Committed Yet') endif - let cmd = s:Edit(a:cmd, 0, '', matchstr(line, '\x\+'), matchstr(line, '\x\+')) + let cmd = s:Open(a:cmd, 0, '', matchstr(line, '\x\+'), [matchstr(line, '\x\+')]) if cmd =~# '^echoerr' return cmd endif @@ -3992,17 +4014,17 @@ endfunction " Section: :Gbrowse -call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,fugitive#Complete Gbrowse :execute s:Browse(0,,,)") +call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse", "Browse") let s:redirects = {} -function! s:Browse(bang,line1,count,...) abort +function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort let dir = s:Dir() try let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\=' - if a:0 - let remote = matchstr(join(a:000, ' '),'@\zs\%('.validremote.'\)$') - let rev = substitute(join(a:000, ' '),'@\%('.validremote.'\)$','','') + if len(a:args) + let remote = matchstr(join(a:args, ' '),'@\zs\%('.validremote.'\)$') + let rev = substitute(join(a:args, ' '),'@\%('.validremote.'\)$','','') else let remote = '' let rev = '' @@ -4110,7 +4132,7 @@ function! s:Browse(bang,line1,count,...) abort if v:shell_error let commit = '' endif - if a:count && !a:0 && commit =~# '^\x\{40\}$' + if a:count && empty(a:args) && commit =~# '^\x\{40\}$' let blame_list = tempname() call writefile([commit, ''], blame_list, 'b') let blame_in = tempname() diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md index f2272398..b01238f0 100644 --- a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md +++ b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,8 @@ -### What did you do? (required. The issue will be **closed** when not provided.) +### What did you do? (required: The issue will be **closed** when not provided) + ### What did you expect to happen? @@ -9,13 +12,18 @@ ### Configuration (**MUST** fill this out): -* vim-go version: +#### vim-go version: -* `vimrc` you used to reproduce (use a *minimal* vimrc with other plugins disabled; do not link to a 2,000 line vimrc): +#### `vimrc` you used to reproduce (use a *minimal* vimrc with other plugins disabled; do not link to a 2,000 line vimrc): +
vimrc
 
-* Vim version (first three lines from `:version`):
+
-* Go version (`go version`): +#### Vim version (first three lines from `:version`): -* Go environment (`go env`): +#### Go version (`go version`): +#### Go environment +
go env Output:
+
+
diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 404cc2d0..53c72cfd 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,11 +1,41 @@ ## unplanned +IMPROVEMENTS: +* Add a new option, `g:go_code_completion_enabled`, to control whether omnifunc + is set. + [[GH-2229]](https://github.com/fatih/vim-go/pull/2229) +* Use build tags with golangci-lint. + [[GH-2261]](https://github.com/fatih/vim-go/pull/2261) +* Allow debugging of packages outside of GOPATH without a go.mod file. + [[GH-2269]](https://github.com/fatih/vim-go/pull/2269) + +BUG FIXES: +* display info about function and function types whose parameters are + `interface{}` without truncating the function signature. + [[GH-2244]](https://github.com/fatih/vim-go/pull/2244) +* install tools that require GOPATH mode when in module mode. + [[GH-2253]](https://github.com/fatih/vim-go/pull/2253) +* Detect GOPATH when starting `gopls` + [[GH-2255]](https://github.com/fatih/vim-go/pull/2255) +* Handle `gopls` responses in the same window from which the respective request + originated. + [[GH-2266]](https://github.com/fatih/vim-go/pull/2266) +* Show completion matches from gocode. + [[GH-2267]](https://github.com/fatih/vim-go/pull/2267) +* Show the completion preview window. + [[GH-2268]](https://github.com/fatih/vim-go/pull/2268) +* Set the anchor for method documentation correctly. + [[GH-2276]](https://github.com/fatih/vim-go/pull/2276) + +## 1.20 - (April 22, 2019) + FEATURES: * ***gopls support!*** * use gopls for autocompletion by default in Vim8 and Neovim. * use gopls for `:GoDef` by setting `g:go_def_mode='gopls'`. + * use gopls for `:GoInfo` by setting `g:go_info_mode='gopls'`. * Add support for golangci-lint. - * set `g:go_metalinter_command='golanci-lint'` to use golangci-lint instead + * set `g:go_metalinter_command='golangci-lint'` to use golangci-lint instead of gometalinter. * New `:GoDefType` command to jump to a type definition from an instance of the type. @@ -60,6 +90,19 @@ IMPROVEMENTS: [[GH-2172]](https://github.com/fatih/vim-go/pull/2172) * Add support for golangci-lint. [[GH-2182]](https://github.com/fatih/vim-go/pull/2182) +* Show hover balloon using gopls instead of gocode. + [[GH-2202]](https://github.com/fatih/vim-go/pull/2202) +* Add a new option, `g:go_debug_log_output`, to control logging with the + debugger. + [[GH-2203]](https://github.com/fatih/vim-go/pull/2203) +* Do not jump to quickfix or location list window when bang is used for async + jobs or linting. + [[GH-2205]](https://github.com/fatih/vim-go/pull/2205) +* Tab complete package names for commands from vendor directories and in + modules. + [[GH-2213]](https://github.com/fatih/vim-go/pull/2213) +* Add support for `gopls` to `g:go_info_mode`. + [[GH-2224]](https://github.com/fatih/vim-go/pull/2224) BUG FIXES: * Fix opening of non-existent file from `:GoDeclsDir` when the current @@ -93,6 +136,10 @@ BUG FIXES: [[GH-2189]](https://github.com/fatih/vim-go/pull/2189) * Highlight pre-release and metadata in versions in go.mod. [[GH-2192]](https://github.com/fatih/vim-go/pull/2192) +* Handle runtime panics from `:GoRun` when using Neovim's terminal. + [[GH-2209]](https://github.com/fatih/vim-go/pull/2209) +* Fix adding tag option when a tag is added. + [[GH-2227]](https://github.com/fatih/vim-go/pull/2227) ## 1.19 - (November 4, 2018) diff --git a/sources_non_forked/vim-go/Dockerfile b/sources_non_forked/vim-go/Dockerfile index 7f03ba71..2408dfdf 100644 --- a/sources_non_forked/vim-go/Dockerfile +++ b/sources_non_forked/vim-go/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.1 +FROM golang:1.12.4 RUN apt-get update -y && \ apt-get install -y build-essential curl git libncurses5-dev python3-pip && \ diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 3d06336e..fdf22990 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -115,7 +115,7 @@ function! go#cmd#RunTerm(bang, mode, files) abort else let cmd .= go#util#Shelljoin(map(copy(a:files), "expand(v:val)"), 1) endif - call go#term#newmode(a:bang, cmd, a:mode) + call go#term#newmode(a:bang, cmd, s:runerrorformat(), a:mode) endfunction " Run runs the current file (and their dependencies if any) and outputs it. @@ -167,21 +167,25 @@ function! go#cmd#Run(bang, ...) abort let l:listtype = go#list#Type("GoRun") try + + " backup user's errorformat, will be restored once we are finished + let l:old_errorformat = &errorformat + let &errorformat = s:runerrorformat() if l:listtype == "locationlist" exe 'lmake!' else exe 'make!' endif finally + "restore errorformat + let &errorformat = l:old_errorformat let &makeprg = default_makeprg endtry - let items = go#list#Get(l:listtype) - let errors = go#util#FilterValids(items) + let l:errors = go#list#Get(l:listtype) - call go#list#Populate(l:listtype, errors, &makeprg) - call go#list#Window(l:listtype, len(errors)) - if !empty(errors) && !a:bang + call go#list#Window(l:listtype, len(l:errors)) + if !empty(l:errors) && !a:bang call go#list#JumpToFirst(l:listtype) endif @@ -278,6 +282,12 @@ function! go#cmd#Generate(bang, ...) abort endfunction +function! s:runerrorformat() + let l:panicaddress = "%\\t%#%f:%l +0x%[0-9A-Fa-f]%\\+" + let l:errorformat = '%A' . l:panicaddress . "," . &errorformat + return l:errorformat +endfunction + " --------------------- " | Vim job callbacks | " --------------------- diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index e693ee65..072153ea 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -93,22 +93,6 @@ endfunction function! s:async_info(echo, showstatus) let state = {'echo': a:echo} - function! s:complete(job, exit_status, messages) abort dict - if a:exit_status != 0 - return - endif - - if &encoding != 'utf-8' - let i = 0 - while i < len(a:messages) - let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding) - let i += 1 - endwhile - endif - - let result = s:info_filter(self.echo, join(a:messages, "\n")) - call s:info_complete(self.echo, result) - endfunction " explicitly bind complete to state so that within it, self will " always refer to state. See :help Partial for more information. let state.complete = function('s:complete', [], state) @@ -151,6 +135,23 @@ function! s:async_info(echo, showstatus) call go#job#Start(cmd, opts) endfunction +function! s:complete(job, exit_status, messages) abort dict + if a:exit_status != 0 + return + endif + + if &encoding != 'utf-8' + let i = 0 + while i < len(a:messages) + let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding) + let i += 1 + endwhile + endif + + let result = s:info_filter(self.echo, join(a:messages, "\n")) + call s:info_complete(self.echo, result) +endfunction + function! s:gocodeFile() let file = tempname() call writefile(go#util#GetLines(), file) @@ -241,8 +242,7 @@ function! go#complete#GocodeComplete(findstart, base) abort if s =~ '[(){}\{\}]' return map(copy(s:completions[1]), 's:trim_bracket(v:val)') endif - - return s:completions[1] + return s:completions endif endfunction diff --git a/sources_non_forked/vim-go/autoload/go/config.vim b/sources_non_forked/vim-go/autoload/go/config.vim index 8af2840b..b325c29e 100644 --- a/sources_non_forked/vim-go/autoload/go/config.vim +++ b/sources_non_forked/vim-go/autoload/go/config.vim @@ -48,7 +48,7 @@ function! go#config#TermMode() abort endfunction function! go#config#TermEnabled() abort - return get(g:, 'go_term_enabled', 0) + return has('nvim') && get(g:, 'go_term_enabled', 0) endfunction function! go#config#SetTermEnabled(value) abort @@ -210,6 +210,10 @@ function! go#config#DebugCommands() abort return g:go_debug_commands endfunction +function! go#config#DebugLogOutput() abort + return get(g:, 'go_debug_log_output', 'debugger, rpc') +endfunction + function! go#config#LspLog() abort " make sure g:go_lsp_log is set so that it can be added to easily. let g:go_lsp_log = get(g:, 'go_lsp_log', []) @@ -462,6 +466,10 @@ function! go#config#EchoGoInfo() abort return get(g:, "go_echo_go_info", 1) endfunction +function! go#config#CodeCompletionEnabled() abort + return get(g:, "go_code_completion_enabled", 1) +endfunction + " Set the default value. A value of "1" is a shortcut for this, for " compatibility reasons. if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 diff --git a/sources_non_forked/vim-go/autoload/go/debug.vim b/sources_non_forked/vim-go/autoload/go/debug.vim index 22999544..e2d0b9fa 100644 --- a/sources_non_forked/vim-go/autoload/go/debug.vim +++ b/sources_non_forked/vim-go/autoload/go/debug.vim @@ -12,7 +12,6 @@ if !exists('s:state') \ 'localVars': {}, \ 'functionArgs': {}, \ 'message': [], - \ 'is_test': 0, \} if go#util#HasDebug('debugger-state') @@ -282,7 +281,7 @@ function! go#debug#Stop() abort silent! exe bufwinnr(bufnr('__GODEBUG_OUTPUT__')) 'wincmd c' if has('balloon_eval') - let &noballooneval=s:ballooneval + let &ballooneval=s:ballooneval let &balloonexpr=s:balloonexpr endif @@ -507,7 +506,7 @@ function! s:out_cb(ch, msg) abort if has('nvim') let s:state['data'] = [] let l:state = {'databuf': ''} - + " 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) @@ -589,50 +588,41 @@ function! go#debug#Start(is_test, ...) abort endif try - if len(a:000) > 0 - let l:pkgname = a:1 - if l:pkgname[0] == '.' - 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:] - endif - let l:cmd = [ \ dlv, \ (a:is_test ? 'test' : 'debug'), - \ l:pkgname, + \] + + " append the package when it's given. + if len(a:000) > 0 + let l:pkgname = go#package#FromPath(a:1) + if l:pkgname is -1 + call go#util#EchoError('could not determine package name') + return + endif + + let l:cmd += [l:pkgname] + endif + + let l:cmd += [ \ '--output', tempname(), \ '--headless', \ '--api-version', '2', - \ '--log', '--log-output', 'debugger,rpc', \ '--listen', go#config#DebugAddress(), \] + let l:debugLogOutput = go#config#DebugLogOutput() + if l:debugLogOutput != '' + let cmd += ['--log', '--log-output', l:debugLogOutput] + endif - let buildtags = go#config#BuildTags() + let l:buildtags = go#config#BuildTags() if buildtags isnot '' let l:cmd += ['--build-flags', '--tags=' . buildtags] endif - let l:cmd += l:args + + if len(a:000) > 1 + let l:cmd += ['--'] + a:000[1:] + endif let s:state['message'] = [] let l:opts = { diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 5449bf7b..3960a1be 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -31,8 +31,12 @@ function! go#doc#OpenBrowser(...) abort let godoc_url = go#config#DocUrl() let godoc_url .= "/" . import - if decl !~ "^package" - let godoc_url .= "#" . name + if decl !~ '^package' + let anchor = name + if decl =~ '^func (' + let anchor = substitute(decl, '^func ([^ ]\+ \*\?\([^)]\+\)) ' . name . '(.*', '\1', '') . "." . name + endif + let godoc_url .= "#" . anchor endif call go#util#OpenBrowser(godoc_url) diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 95c00caf..8ff3b3f3 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -246,7 +246,7 @@ function! go#guru#DescribeInfo(showstatus) abort \ 'selected': -1, \ 'needs_scope': 0, \ 'custom_parse': function('s:info'), - \ 'disable_progress': 1, + \ 'disable_progress': a:showstatus == 0, \ } call s:run_guru(args) diff --git a/sources_non_forked/vim-go/autoload/go/issue.vim b/sources_non_forked/vim-go/autoload/go/issue.vim index 38fcd61b..65db9d80 100644 --- a/sources_non_forked/vim-go/autoload/go/issue.vim +++ b/sources_non_forked/vim-go/autoload/go/issue.vim @@ -5,7 +5,7 @@ set cpo&vim let s:templatepath = go#util#Join(expand(':p:h:h:h'), '.github', 'ISSUE_TEMPLATE.md') function! go#issue#New() abort - let body = go#uriEncode(s:issuebody()) + let body = go#uri#Encode(s:issuebody()) let url = "https://github.com/fatih/vim-go/issues/new?body=" . l:body call go#util#OpenBrowser(l:url) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim index 4c4a8495..328572ef 100644 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ b/sources_non_forked/vim-go/autoload/go/job.vim @@ -214,7 +214,9 @@ function! go#job#Options(args) " the job was started. if self.winid == l:winid call go#list#Window(l:listtype, len(errors)) - if !self.bang + if self.bang + call win_gotoid(l:winid) + else call go#list#JumpToFirst(l:listtype) endif endif @@ -489,7 +491,9 @@ function! s:neocb(mode, ch, buf, data, callback) let l:buf = '' - " a single empty string means EOF was reached. + " A single empty string means EOF was reached. The first item will never be + " an empty string except for when it's the only item and is signaling that + " EOF was reached. if len(a:data) == 1 && a:data[0] == '' " when there's nothing buffered, return early so that an " erroneous message will not be added. diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 0e645b79..d56f3da8 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -86,15 +86,18 @@ function! go#lint#Gometa(bang, autosave, ...) abort call go#list#Clean(l:listtype) echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None else + let l:winid = win_getid(winnr()) " Parse and populate our location list call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"), 'GoMetaLinter') let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !a:autosave && !a:bang - call go#list#JumpToFirst(l:listtype) + if a:autosave || a:bang + call win_gotoid(l:winid) + return endif + call go#list#JumpToFirst(l:listtype) endif endfunction @@ -112,13 +115,18 @@ function! go#lint#Golint(bang, ...) abort return endif + let l:winid = win_getid(winnr()) let l:listtype = go#list#Type("GoLint") 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)) - if !a:bang - call go#list#JumpToFirst(l:listtype) + + if a:bang + call win_gotoid(l:winid) + return endif + + call go#list#JumpToFirst(l:listtype) endfunction " Vet calls 'go vet' on the current directory. Any warnings are populated in @@ -138,12 +146,15 @@ function! go#lint#Vet(bang, ...) abort let l:listtype = go#list#Type("GoVet") if l:err != 0 + let l:winid = win_getid(winnr()) let errorformat = "%-Gexit status %\\d%\\+," . &errorformat call go#list#ParseFormat(l:listtype, l:errorformat, out, "GoVet") let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) + else + call win_gotoid(l:winid) endif else call go#list#Clean(l:listtype) @@ -171,6 +182,7 @@ function! go#lint#Errcheck(bang, ...) abort let l:listtype = go#list#Type("GoErrCheck") if l:err != 0 + let l:winid = win_getid(winnr()) let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" " Parse and populate our location list @@ -187,6 +199,8 @@ function! go#lint#Errcheck(bang, ...) abort call go#list#Window(l:listtype, len(errors)) if !a:bang call go#list#JumpToFirst(l:listtype) + else + call win_gotoid(l:winid) endif endif else @@ -255,11 +269,13 @@ function! s:golangcilintcmd(bin_path) let cmd = [a:bin_path] let cmd += ["run"] let cmd += ["--print-issued-lines=false"] + let cmd += ['--build-tags', go#config#BuildTags()] let cmd += ["--disable-all"] " do not use the default exclude patterns, because doing so causes golint " problems about missing doc strings to be ignored and other things that " golint identifies. let cmd += ["--exclude-use-default=false"] + return cmd endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lsp.vim b/sources_non_forked/vim-go/autoload/go/lsp.vim index d8bfa3bf..47205759 100644 --- a/sources_non_forked/vim-go/autoload/go/lsp.vim +++ b/sources_non_forked/vim-go/autoload/go/lsp.vim @@ -7,8 +7,7 @@ scriptencoding utf-8 let s:lspfactory = {} function! s:lspfactory.get() dict abort - if !has_key(self, 'current') - " TODO(bc): check that the lsp is still running. + if !has_key(self, 'current') || empty(self.current) let self.current = s:newlsp() endif @@ -21,7 +20,7 @@ function! s:lspfactory.reset() dict abort endif endfunction -function! s:newlsp() +function! s:newlsp() abort if !go#util#has_job() " TODO(bc): start the server in the background using a shell that waits for the right output before returning. call go#util#EchoError('This feature requires either Vim 8.0.0087 or newer with +job or Neovim.') @@ -115,16 +114,27 @@ function! s:newlsp() try let l:handler = self.handlers[l:response.id] + let l:winid = win_getid(winnr()) + " Always set the active window to the window that was active when + " the request was sent. Among other things, this makes sure that + " the correct window's location list will be populated when the + " list type is 'location' and the user has moved windows since + " sending the reques. + call win_gotoid(l:handler.winid) + if has_key(l:response, 'error') call l:handler.requestComplete(0) - call go#util#EchoError(l:response.error.message) if has_key(l:handler, 'error') call call(l:handler.error, [l:response.error.message]) + else + call go#util#EchoError(l:response.error.message) endif + call win_gotoid(l:winid) return endif call l:handler.requestComplete(1) call call(l:handler.handleResult, [l:response.result]) + call win_gotoid(l:winid) finally call remove(self.handlers, l:response.id) endtry @@ -149,9 +159,19 @@ function! s:newlsp() if !self.last_request_id " TODO(bc): run a server per module and one per GOPATH? (may need to " keep track of servers by rootUri). - let l:msg = self.newMessage(go#lsp#message#Initialize(getcwd())) + let l:wd = go#util#ModuleRoot() + if l:wd == -1 + call go#util#EchoError('could not determine appropriate working directory for gopls') + return + endif - let l:state = s:newHandlerState('gopls') + if l:wd == '' + let l:wd = getcwd() + endif + + let l:msg = self.newMessage(go#lsp#message#Initialize(l:wd)) + + let l:state = s:newHandlerState('') let l:state.handleResult = funcref('self.handleInitializeResult', [], l:self) let self.handlers[l:msg.id] = l:state @@ -251,10 +271,10 @@ function! s:newlsp() return l:lsp endfunction -function! s:noop() +function! s:noop(...) abort endfunction -function! s:newHandlerState(statustype) +function! s:newHandlerState(statustype) abort let l:state = { \ 'winid': win_getid(winnr()), \ 'statustype': a:statustype, @@ -324,7 +344,7 @@ endfunction " list of strings in the form 'file:line:col: message'. handler will be " attached to a dictionary that manages state (statuslines, sets the winid, " etc.) -function! go#lsp#Definition(fname, line, col, handler) +function! go#lsp#Definition(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -346,7 +366,7 @@ endfunction " list of strings in the form 'file:line:col: message'. handler will be " attached to a dictionary that manages state (statuslines, sets the winid, " etc.) -function! go#lsp#TypeDef(fname, line, col, handler) +function! go#lsp#TypeDef(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -363,11 +383,15 @@ function! s:typeDefinitionHandler(next, msg) abort dict call call(a:next, l:args) endfunction -function! go#lsp#DidOpen(fname) +function! go#lsp#DidOpen(fname) abort if get(b:, 'go_lsp_did_open', 0) return endif + if !filereadable(a:fname) + return + endif + let l:lsp = s:lspfactory.get() let l:msg = go#lsp#message#DidOpen(fnamemodify(a:fname, ':p'), join(go#util#GetLines(), "\n") . "\n") let l:state = s:newHandlerState('') @@ -377,9 +401,18 @@ function! go#lsp#DidOpen(fname) let b:go_lsp_did_open = 1 endfunction -function! go#lsp#DidChange(fname) - if get(b:, 'go_lsp_did_open', 0) - return go#lsp#DidOpen(a:fname) +function! go#lsp#DidChange(fname) abort + " DidChange is called even when fname isn't open in a buffer (e.g. via + " go#lsp#Info); don't report the file as open or as having changed when it's + " not actually a buffer. + if bufnr(a:fname) == -1 + return + endif + + call go#lsp#DidOpen(a:fname) + + if !filereadable(a:fname) + return endif let l:lsp = s:lspfactory.get() @@ -389,7 +422,11 @@ function! go#lsp#DidChange(fname) call l:lsp.sendMessage(l:msg, l:state) endfunction -function! go#lsp#DidClose(fname) +function! go#lsp#DidClose(fname) abort + if !filereadable(a:fname) + return + endif + if !get(b:, 'go_lsp_did_open', 0) return endif @@ -403,7 +440,7 @@ function! go#lsp#DidClose(fname) let b:go_lsp_did_open = 0 endfunction -function! go#lsp#Completion(fname, line, col, handler) +function! go#lsp#Completion(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -420,7 +457,7 @@ function! s:completionHandler(next, msg) abort dict for l:item in a:msg.items let l:match = {'abbr': l:item.label, 'word': l:item.textEdit.newText, 'info': '', 'kind': go#lsp#completionitemkind#Vim(l:item.kind)} if has_key(l:item, 'detail') - let l:item.info = l:item.detail + let l:match.info = l:item.detail endif if has_key(l:item, 'documentation') @@ -437,6 +474,80 @@ function! s:completionErrorHandler(next, error) abort dict call call(a:next, [[]]) endfunction +function! go#lsp#Hover(fname, line, col, handler) abort + call go#lsp#DidChange(a:fname) + + let l:lsp = s:lspfactory.get() + let l:msg = go#lsp#message#Hover(a:fname, a:line, a:col) + let l:state = s:newHandlerState('') + let l:state.handleResult = funcref('s:hoverHandler', [function(a:handler, [], l:state)], l:state) + let l:state.error = funcref('s:noop') + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:hoverHandler(next, msg) abort dict + let l:content = split(a:msg.contents.value, '; ') + if len(l:content) > 1 + let l:curly = stridx(l:content[0], '{') + let l:content = extend([l:content[0][0:l:curly]], map(extend([l:content[0][l:curly+1:]], l:content[1:]), '"\t" . v:val')) + let l:content[len(l:content)-1] = '}' + endif + + let l:args = [l:content] + call call(a:next, l:args) +endfunction + +function! go#lsp#Info(showstatus) + let l:fname = expand('%:p') + let [l:line, l:col] = getpos('.')[1:2] + + call go#lsp#DidChange(l:fname) + + let l:lsp = s:lspfactory.get() + + if a:showstatus + let l:state = s:newHandlerState('info') + else + let l:state = s:newHandlerState('') + endif + + let l:state.handleResult = funcref('s:infoDefinitionHandler', [function('s:info', []), a:showstatus], l:state) + let l:state.error = funcref('s:noop') + let l:msg = go#lsp#message#Definition(l:fname, l:line, l:col) + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:infoDefinitionHandler(next, showstatus, msg) abort dict + " gopls returns a []Location; just take the first one. + let l:msg = a:msg[0] + + let l:fname = go#path#FromURI(l:msg.uri) + let l:line = l:msg.range.start.line+1 + let l:col = l:msg.range.start.character+1 + + let l:lsp = s:lspfactory.get() + let l:msg = go#lsp#message#Hover(l:fname, l:line, l:col) + + if a:showstatus + let l:state = s:newHandlerState('info') + else + let l:state = s:newHandlerState('') + endif + + let l:state.handleResult = funcref('s:hoverHandler', [function('s:info', [], l:state)], l:state) + let l:state.error = funcref('s:noop') + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:info(content) abort dict + let l:content = a:content[0] + " strip off the method set and fields of structs and interfaces. + if l:content =~# '^type [^ ]\+ \(struct\|interface\)' + let l:content = substitute(l:content, '{.*', '', '') + endif + call go#util#ShowInfo(l:content) +endfunction + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save diff --git a/sources_non_forked/vim-go/autoload/go/lsp/message.vim b/sources_non_forked/vim-go/autoload/go/lsp/message.vim index c182a56d..63981854 100644 --- a/sources_non_forked/vim-go/autoload/go/lsp/message.vim +++ b/sources_non_forked/vim-go/autoload/go/lsp/message.vim @@ -2,7 +2,7 @@ let s:cpo_save = &cpo set cpo&vim -function! go#lsp#message#Initialize(wd) +function! go#lsp#message#Initialize(wd) abort return { \ 'notification': 0, \ 'method': 'initialize', @@ -11,13 +11,17 @@ function! go#lsp#message#Initialize(wd) \ 'rootUri': go#path#ToURI(a:wd), \ 'capabilities': { \ 'workspace': {}, - \ 'textDocument': {} + \ 'textDocument': { + \ 'hover': { + \ 'contentFormat': ['plaintext'], + \ }, + \ } \ } \ } \ } endfunction -function! go#lsp#message#Definition(file, line, col) +function! go#lsp#message#Definition(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/definition', @@ -30,8 +34,7 @@ function! go#lsp#message#Definition(file, line, col) \ } endfunction - -function! go#lsp#message#TypeDefinition(file, line, col) +function! go#lsp#message#TypeDefinition(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/typeDefinition', @@ -44,7 +47,7 @@ function! go#lsp#message#TypeDefinition(file, line, col) \ } endfunction -function! go#lsp#message#DidOpen(file, content) +function! go#lsp#message#DidOpen(file, content) abort return { \ 'notification': 1, \ 'method': 'textDocument/didOpen', @@ -58,7 +61,7 @@ function! go#lsp#message#DidOpen(file, content) \ } endfunction -function! go#lsp#message#DidChange(file, content) +function! go#lsp#message#DidChange(file, content) abort return { \ 'notification': 1, \ 'method': 'textDocument/didChange', @@ -75,7 +78,7 @@ function! go#lsp#message#DidChange(file, content) \ } endfunction -function! go#lsp#message#DidClose(file) +function! go#lsp#message#DidClose(file) abort return { \ 'notification': 1, \ 'method': 'textDocument/didClose', @@ -87,7 +90,7 @@ function! go#lsp#message#DidClose(file) \ } endfunction -function! go#lsp#message#Completion(file, line, col) +function! go#lsp#message#Completion(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/completion', @@ -100,7 +103,20 @@ function! go#lsp#message#Completion(file, line, col) \ } endfunction -function! s:position(line, col) +function! go#lsp#message#Hover(file, line, col) abort + return { + \ 'notification': 0, + \ 'method': 'textDocument/hover', + \ 'params': { + \ 'textDocument': { + \ 'uri': go#path#ToURI(a:file) + \ }, + \ 'position': s:position(a:line, a:col), + \ } + \ } +endfunction + +function! s:position(line, col) abort return {'line': a:line - 1, 'character': a:col-1} endfunction diff --git a/sources_non_forked/vim-go/autoload/go/mod.vim b/sources_non_forked/vim-go/autoload/go/mod.vim index 021f7f92..ab36d0b5 100644 --- a/sources_non_forked/vim-go/autoload/go/mod.vim +++ b/sources_non_forked/vim-go/autoload/go/mod.vim @@ -7,7 +7,7 @@ let s:go_major_version = "" function! go#mod#Format() abort " go mod only exists in `v1.11` if empty(s:go_major_version) - let tokens = matchlist(go#util#System("go version"), '\d\+.\(\d\+\)\(\.\d\+\)\? ') + let tokens = matchlist(go#util#Exec(['go', 'version']), '\d\+.\(\d\+\)\(\.\d\+\)\? ') let s:go_major_version = str2nr(tokens[1]) endif diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index 898ef535..796f62d7 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -32,7 +32,7 @@ if len(s:goarch) == 0 endif endif -function! go#package#Paths() abort +function! s:paths() abort let dirs = [] if !exists("s:goroot") @@ -58,6 +58,58 @@ function! go#package#Paths() abort return dirs endfunction +function! s:module() abort + let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Dir}}']) + if l:err != 0 + return {} + endif + let l:dir = split(l:out, '\n')[0] + + let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Path}}']) + if l:err != 0 + return {} + endif + let l:path = split(l:out, '\n')[0] + + return {'dir': l:dir, 'path': l:path} +endfunction + +function! s:vendordirs() abort + let l:vendorsuffix = go#util#PathSep() . 'vendor' + let l:module = s:module() + if empty(l:module) + let [l:root, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Root}}']) + if l:err != 0 + return [] + endif + let l:root = split(l:root, '\n')[0] . go#util#PathSep() . 'src' + + let [l:dir, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Dir}}']) + if l:err != 0 + return [] + endif + let l:dir = split(l:dir, '\n')[0] + + let l:vendordirs = [] + while l:dir != l:root + let l:vendordir = l:dir . l:vendorsuffix + if isdirectory(l:vendordir) + let l:vendordirs = add(l:vendordirs, l:vendordir) + endif + + let l:dir = fnamemodify(l:dir, ':h') + endwhile + + return l:vendordirs + endif + + let l:vendordir = l:module.dir . l:vendorsuffix + if !isdirectory(l:vendordir) + return [] + endif + return [l:vendordir] +endfunction + let s:import_paths = {} " ImportPath returns the import path of the package for current buffer. function! go#package#ImportPath() abort @@ -85,7 +137,9 @@ function! go#package#ImportPath() abort endfunction -" FromPath returns the import path of arg. +" go#package#FromPath returns the import path of arg. -1 is returned when arg +" does not specify a package. -2 is returned when arg is a relative path +" outside of GOPATH and not in a module. function! go#package#FromPath(arg) abort let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let l:dir = getcwd() @@ -104,10 +158,10 @@ function! go#package#FromPath(arg) abort 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 + " go list returns '_CURRENTDIRECTORY' if the directory is neither in GOPATH + " nor in a module. Check it and retun an error if that is the case if l:importpath[0] ==# '_' - return -1 + return -2 endif return l:importpath @@ -144,33 +198,80 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort return go#package#CompleteMembers(words[1], words[2]) endif - let dirs = go#package#Paths() + let dirs = s:paths() + let module = s:module() - if len(dirs) == 0 + if len(dirs) == 0 && empty(module) " should not happen return [] endif + let vendordirs = s:vendordirs() + 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$' + let root = add(root, expand(dir . '/src'), ) + let root = extend(root, vendordirs) + let root = add(root, module) + for item in root + " item may be a dictionary when operating in a module. + if type(item) == type({}) + if empty(item) continue endif - let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), + let dir = item.dir + let path = item.path + else + let dir = item + let path = item + endif + + if !empty(module) && dir ==# module.dir + if stridx(a:ArgLead, module.path) == 0 + if len(a:ArgLead) != len(module.path) + let glob = globpath(module.dir, substitute(a:ArgLead, module.path . '/\?', '', '').'*') + else + let glob = module.dir + endif + elseif stridx(module.path, a:ArgLead) == 0 && stridx(module.path, '/', len(a:ArgLead)) < 0 + " use the module directory when a:ArgLead is contained in + " module.path and module.path does not have any path segments after + " a:ArgLead. + let glob = module.dir + else + continue + endif + else + let glob = globpath(dir, a:ArgLead.'*') + endif + for candidate in split(glob) + if isdirectory(candidate) + " TODO(bc): use wildignore instead of filtering out vendor + " directories manually? + if fnamemodify(candidate, ':t') == 'vendor' + continue + endif + let candidate .= '/' + elseif candidate !~ '\.a$' + continue + endif + + if dir !=# path + let candidate = substitute(candidate, '^' . dir, path, 'g') + else + let candidate = candidate[len(dir)+1:] + endif + " replace a backslash with a forward slash and drop .a suffixes + let candidate = substitute(substitute(candidate, '[\\]', '/', 'g'), \ '\.a$', '', 'g') " without this the result can have duplicates in form of " 'encoding/json' and '/encoding/json/' - let i = go#util#StripPathSep(i) + let candidate = go#util#StripPathSep(candidate) - let ret[i] = i + let ret[candidate] = candidate endfor endfor endfor diff --git a/sources_non_forked/vim-go/autoload/go/package_test.vim b/sources_non_forked/vim-go/autoload/go/package_test.vim new file mode 100644 index 00000000..4938d480 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/package_test.vim @@ -0,0 +1,58 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +func! Test_Complete_GOPATH_simple() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package', ['package']) +endfunc + +func! Test_Complete_Module_simple() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package', ['package']) +endfunc + +func! Test_Complete_GOPATH_subdirs() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package/', ['package/bar', 'package/baz']) +endfunc + +func! Test_Complete_Module_subdirs() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package/', ['package/bar', 'package/baz']) +endfunc + +func! Test_Complete_GOPATH_baronly() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package/bar', ['package/bar']) +endfunc + +func! Test_Complete_Module_baronly() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package/bar', ['package/bar']) +endfunc + +func! Test_Complete_GOPATH_vendor() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('foo', ['foo']) +endfunc + +func! Test_Complete_Module_vendor() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('foo', ['foo']) +endfunc + +func! s:complete(arglead, expected) abort + let l:candidates = go#package#Complete(a:arglead, '', 1) + call assert_equal(a:expected, l:candidates) +endfunc + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index 3c6173de..656afec6 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -209,13 +209,18 @@ endfunction " Relative paths cannot be properly converted to a URI; when path is a " relative path, the file scheme will not be prepended. function! go#path#ToURI(path) + let l:absolute = !go#util#IsWin() && a:path[0] is# '/' + let l:prefix = '' let l:path = a:path - if l:path[1:2] is# ':\' - let l:path = '/' . l:path[0:1] . l:path[3:] + + if go#util#IsWin() && l:path[1:2] is# ':\' + let l:absolute = 1 + let l:prefix = '/' . l:path[0:1] + let l:path = l:path[2:] endif return substitute( - \ (l:path[0] is# '/' ? 'file://' : '') . go#uri#EncodePath(l:path), + \ (l:absolute ? 'file://' : '') . l:prefix . go#uri#EncodePath(l:path), \ '\\', \ '/', \ 'g', @@ -229,7 +234,7 @@ function! go#path#FromURI(uri) abort let l:path = go#uri#Decode(l:encoded_path) " If the path is like /C:/foo/bar, it should be C:\foo\bar instead. - if l:path =~# '^/[a-zA-Z]:' + if go#util#IsWin() && l:path =~# '^/[a-zA-Z]:' let l:path = substitute(l:path[1:], '/', '\\', 'g') endif diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim index 83751d71..c1239b02 100644 --- a/sources_non_forked/vim-go/autoload/go/tags.vim +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -163,17 +163,17 @@ func s:create_cmd(args) abort endfor endif - " construct options + " default value + if empty(l:tags) + let l:tags = ["json"] + endif + + " construct tags + call extend(cmd, ["-add-tags", join(l:tags, ",")]) + + " construct options if !empty(l:options) call extend(cmd, ["-add-options", join(l:options, ",")]) - else - " default value - if empty(l:tags) - let l:tags = ["json"] - endif - - " construct tags - call extend(cmd, ["-add-tags", join(l:tags, ",")]) endif elseif l:mode == "remove" if empty(l:cmd_args) diff --git a/sources_non_forked/vim-go/autoload/go/tags_test.vim b/sources_non_forked/vim-go/autoload/go/tags_test.vim index a311a059..17aec410 100644 --- a/sources_non_forked/vim-go/autoload/go/tags_test.vim +++ b/sources_non_forked/vim-go/autoload/go/tags_test.vim @@ -2,7 +2,7 @@ let s:cpo_save = &cpo set cpo&vim -func! Test_add_tags() abort +func! TestAddTags() abort try let l:tmp = gotest#load_fixture('tags/add_all_input.go') silent call go#tags#run(0, 0, 40, "add", bufname(''), 1) @@ -13,6 +13,28 @@ func! Test_add_tags() abort endfunc +func! TestAddTags_WithOptions() abort + try + let l:tmp = gotest#load_fixture('tags/add_all_input.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') + call gotest#assert_fixture('tags/add_all_golden_options.go') + finally + call delete(l:tmp, 'rf') + endtry +endfunc + +func! TestAddTags_AddOptions() abort + try + let l:tmp = gotest#load_fixture('tags/add_all_input.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json') + call gotest#assert_fixture('tags/add_all_golden.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') + call gotest#assert_fixture('tags/add_all_golden_options.go') + finally + call delete(l:tmp, 'rf') + endtry +endfunc + func! Test_remove_tags() abort try let l:tmp = gotest#load_fixture('tags/remove_all_input.go') diff --git a/sources_non_forked/vim-go/autoload/go/term.vim b/sources_non_forked/vim-go/autoload/go/term.vim index a835c5b2..d7a463eb 100644 --- a/sources_non_forked/vim-go/autoload/go/term.vim +++ b/sources_non_forked/vim-go/autoload/go/term.vim @@ -4,31 +4,33 @@ set cpo&vim " new creates a new terminal with the given command. Mode is set based on the " global variable g:go_term_mode, which is by default set to :vsplit -function! go#term#new(bang, cmd) abort - return go#term#newmode(a:bang, a:cmd, go#config#TermMode()) +function! go#term#new(bang, cmd, errorformat) abort + return go#term#newmode(a:bang, a:cmd, a:errorformat, go#config#TermMode()) endfunction -" new creates a new terminal with the given command and window mode. -function! go#term#newmode(bang, cmd, mode) abort - let mode = a:mode - if empty(mode) - let mode = go#config#TermMode() +" go#term#newmode creates a new terminal with the given command and window mode. +function! go#term#newmode(bang, cmd, errorformat, mode) abort + let l:mode = a:mode + if empty(l:mode) + let l:mode = go#config#TermMode() endif - let state = { + let l:state = { \ 'cmd': a:cmd, \ 'bang' : a:bang, \ 'winid': win_getid(winnr()), - \ 'stdout': [] + \ 'stdout': [], + \ 'stdout_buf': '', + \ 'errorformat': a:errorformat, \ } " execute go build in the files directory - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() + let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let l:dir = getcwd() - execute cd . fnameescape(expand("%:p:h")) + execute l:cd . fnameescape(expand("%:p:h")) - execute mode.' __go_term__' + execute l:mode . ' __go_term__' setlocal filetype=goterm setlocal bufhidden=delete @@ -41,83 +43,103 @@ function! go#term#newmode(bang, cmd, mode) abort " " Don't set an on_stderr, because it will be passed the same data as " on_stdout. See https://github.com/neovim/neovim/issues/2836 - let job = { + let l:job = { \ 'on_stdout': function('s:on_stdout', [], state), \ 'on_exit' : function('s:on_exit', [], state), \ } - let state.id = termopen(a:cmd, job) - let state.termwinid = win_getid(winnr()) + let l:state.id = termopen(a:cmd, l:job) + let l:state.termwinid = win_getid(winnr()) - execute cd . fnameescape(dir) + execute l:cd . fnameescape(l:dir) " resize new term if needed. - let height = go#config#TermHeight() - let width = go#config#TermWidth() + let l:height = go#config#TermHeight() + let l:width = go#config#TermWidth() " Adjust the window width or height depending on whether it's a vertical or " horizontal split. - if mode =~ "vertical" || mode =~ "vsplit" || mode =~ "vnew" - exe 'vertical resize ' . width + if l:mode =~ "vertical" || l:mode =~ "vsplit" || l:mode =~ "vnew" + exe 'vertical resize ' . l:width elseif mode =~ "split" || mode =~ "new" - exe 'resize ' . height + exe 'resize ' . l:height endif " we also need to resize the pty, so there you go... - call jobresize(state.id, width, height) + call jobresize(l:state.id, l:width, l:height) - call win_gotoid(state.winid) + call win_gotoid(l:state.winid) - return state.id + return l:state.id endfunction function! s:on_stdout(job_id, data, event) dict abort - call extend(self.stdout, a:data) + " A single empty string means EOF was reached. The first item will never be + " the empty string except for when it's the only item and is signaling that + " EOF was reached. + if len(a:data) == 1 && a:data[0] == '' + " when there's nothing buffered, return early so that an + " erroneous message will not be added. + if self.stdout_buf == '' + return + endif + + let self.stdout = add(self.stdout, self.stdout_buf) + else + let l:data = copy(a:data) + let l:data[0] = self.stdout_buf . l:data[0] + + " The last element may be a partial line; save it for next time. + let self.stdout_buf = l:data[-1] + let self.stdout = extend(self.stdout, l:data[:-2]) + endif endfunction function! s:on_exit(job_id, exit_status, event) dict abort + let l:winid = win_getid(winnr()) + call win_gotoid(self.winid) let l:listtype = go#list#Type("_term") - " usually there is always output so never branch into this clause - if empty(self.stdout) - call s:cleanlist(self.winid, l:listtype) + if a:exit_status == 0 + call go#list#Clean(l:listtype) + call win_gotoid(l:winid) return endif - let errors = go#util#ParseErrors(self.stdout) - let errors = go#util#FilterValids(errors) + call win_gotoid(self.winid) - if !empty(errors) - " close terminal; we don't need it anymore - call win_gotoid(self.termwinid) - close + let l:title = self.cmd + if type(l:title) == v:t_list + let l:title = join(self.cmd) + endif - call win_gotoid(self.winid) + let l:i = 0 + while l:i < len(self.stdout) + let self.stdout[l:i] = substitute(self.stdout[l:i], "\r$", '', 'g') + let l:i += 1 + endwhile - let title = self.cmd - if type(title) == v:t_list - let title = join(self.cmd) - endif - call go#list#Populate(l:listtype, errors, title) - call go#list#Window(l:listtype, len(errors)) - if !self.bang - call go#list#JumpToFirst(l:listtype) - endif + call go#list#ParseFormat(l:listtype, self.errorformat, self.stdout, l:title) + let l:errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(l:errors)) + if empty(l:errors) + call go#util#EchoError( '[' . l:title . '] ' . "FAIL") + call win_gotoid(l:winid) return endif - call s:cleanlist(self.winid, l:listtype) -endfunction + " close terminal; we don't need it anymore + call win_gotoid(self.termwinid) + close! -function! s:cleanlist(winid, listtype) abort - " There are no errors. Clean and close the list. Jump to the window to which - " the location list is attached, close the list, and then jump back to the - " current window. - let winid = win_getid(winnr()) - call win_gotoid(a:winid) - call go#list#Clean(a:listtype) - call win_gotoid(l:winid) + if self.bang + call win_gotoid(l:winid) + return + endif + + call win_gotoid(self.winid) + call go#list#JumpToFirst(l:listtype) endfunction " restore Vi compatibility settings diff --git a/sources_non_forked/vim-go/autoload/go/term_test.vim b/sources_non_forked/vim-go/autoload/go/term_test.vim index 2b3ce1f8..40f0a52a 100644 --- a/sources_non_forked/vim-go/autoload/go/term_test.vim +++ b/sources_non_forked/vim-go/autoload/go/term_test.vim @@ -17,7 +17,7 @@ func! Test_GoTermNewMode() let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) set nosplitright - call go#term#newmode(0, cmd, '') + call go#term#new(0, cmd, &errorformat) let actual = expand('%:p') call assert_equal(actual, l:expected) @@ -41,7 +41,7 @@ func! Test_GoTermNewMode_SplitRight() let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) set splitright - call go#term#newmode(0, cmd, '') + call go#term#new(0, cmd, &errorformat) let actual = expand('%:p') call assert_equal(actual, l:expected) diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod new file mode 100644 index 00000000..d414eac7 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod @@ -0,0 +1,3 @@ +module package + +go 1.12 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go new file mode 100644 index 00000000..50e8d8d3 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("vim-go") +} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test.vim b/sources_non_forked/vim-go/autoload/go/test.vim index 492a8838..f33d7d94 100644 --- a/sources_non_forked/vim-go/autoload/go/test.vim +++ b/sources_non_forked/vim-go/autoload/go/test.vim @@ -30,8 +30,8 @@ function! go#test#Test(bang, compile, ...) abort call add(args, printf("-timeout=%s", timeout)) endif - if has('nvim') && go#config#TermEnabled() - call go#term#new(a:bang, ["go"] + args) + if go#config#TermEnabled() + call go#term#new(a:bang, ["go"] + args, s:errorformat()) endif if go#util#has_job() @@ -75,14 +75,17 @@ function! go#test#Test(bang, compile, ...) abort execute cd fnameescape(expand("%:p:h")) if l:err != 0 + let l:winid = win_getid(winnr()) call go#list#ParseFormat(l:listtype, s:errorformat(), split(out, '\n'), l:cmd) let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !empty(errors) && !a:bang - call go#list#JumpToFirst(l:listtype) - elseif empty(errors) + if empty(errors) " failed to parse errors, output the original content call go#util#EchoError(out) + elseif a:bang + call win_gotoid(l:winid) + else + call go#list#JumpToFirst(l:listtype) endif else call go#list#Clean(l:listtype) diff --git a/sources_non_forked/vim-go/autoload/go/test_test.vim b/sources_non_forked/vim-go/autoload/go/test_test.vim index 500476ca..28d7993c 100644 --- a/sources_non_forked/vim-go/autoload/go/test_test.vim +++ b/sources_non_forked/vim-go/autoload/go/test_test.vim @@ -66,9 +66,9 @@ endfunc func! Test_GoTestShowName() abort let expected = [ \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld'}, - \ {'lnum': 6, 'bufnr': 9, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'}, + \ {'lnum': 6, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'}, \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld/sub'}, - \ {'lnum': 9, 'bufnr': 9, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'}, + \ {'lnum': 9, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'}, \ ] let g:go_test_show_name=1 @@ -78,14 +78,14 @@ endfunc func! Test_GoTestVet() abort let expected = [ - \ {'lnum': 6, 'bufnr': 16, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'}, + \ {'lnum': 6, 'bufnr': 10, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'}, \ ] call s:test('veterror/veterror.go', expected) endfunc func! Test_GoTestTestCompilerError() abort let expected = [ - \ {'lnum': 10, 'bufnr': 11, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'}, + \ {'lnum': 10, 'bufnr': 8, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'}, \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'struct {} does not implement io.Reader (missing Read method)'} \ ] diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 547d8519..fdeaaf12 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -86,8 +86,10 @@ function! go#tool#Info(showstatus) abort call go#complete#Info(a:showstatus) elseif l:mode == 'guru' call go#guru#DescribeInfo(a:showstatus) + elseif l:mode == 'gopls' + call go#lsp#Info(a:showstatus) else - call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru]') + call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru, gopls]') endif endfunction @@ -112,7 +114,22 @@ function! go#tool#Exists(importpath) abort endfunction function! go#tool#DescribeBalloon() - return go#guru#DescribeBalloon() + let l:fname = fnamemodify(bufname(v:beval_bufnr), ':p') + call go#lsp#Hover(l:fname, v:beval_lnum, v:beval_col, funcref('s:balloon', [])) + return '' +endfunction + +function! s:balloon(msg) + let l:msg = a:msg + if has('balloon_eval') + if has('balloon_multiline') + let l:msg = join(a:msg, "\n") + else + let l:msg = substitute(join(map(deepcopy(a:msg), 'substitute(v:val, "\t", "", "")'), '; '), '{;', '{', '') + endif + endif + + call balloon_show(l:msg) endfunction " restore Vi compatibility settings diff --git a/sources_non_forked/vim-go/autoload/go/uri.vim b/sources_non_forked/vim-go/autoload/go/uri.vim index f74de63d..e8f38ab8 100644 --- a/sources_non_forked/vim-go/autoload/go/uri.vim +++ b/sources_non_forked/vim-go/autoload/go/uri.vim @@ -7,7 +7,11 @@ function! go#uri#Encode(value) abort endfunction function! go#uri#EncodePath(value) abort - return s:encode(a:value, '[^/A-Za-z0-9_.~-]') + let l:separator = '/' + if go#util#IsWin() + let l:separator = '\\' + endif + return s:encode(a:value, '[^' . l:separator . 'A-Za-z0-9_.~-]') endfunction function! s:encode(value, unreserved) diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 50b48cab..965f1e8b 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -137,11 +137,33 @@ function! go#util#gomod() abort return substitute(s:exec(['go', 'env', 'GOMOD'])[0], '\n', '', 'g') endfunction - function! go#util#osarch() abort return go#util#env("goos") . '_' . go#util#env("goarch") endfunction +" go#util#ModuleRoot returns the root directory of the module of the current +" buffer. +function! go#util#ModuleRoot() abort + let [l:out, l:err] = go#util#ExecInDir(['go', 'env', 'GOMOD']) + if l:err != 0 + return -1 + endif + + let l:module = split(l:out, '\n', 1)[0] + + " When run with `GO111MODULE=on and not in a module directory, the module will be reported as /dev/null. + let l:fakeModule = '/dev/null' + if go#util#IsWin() + let l:fakeModule = 'NUL' + endif + + if l:fakeModule == l:module + return expand('%:p:h') + endif + + return fnamemodify(l:module, ':p:h') +endfunction + " Run a shell command. " " It will temporary set the shell to /bin/sh for Unix-like systems if possible, @@ -511,42 +533,6 @@ function! go#util#ParseErrors(lines) abort return errors endfunction -" FilterValids filters the given items with only items that have a valid -" filename. Any non valid filename is filtered out. -function! go#util#FilterValids(items) abort - " Remove any nonvalid filename from the location list to avoid opening an - " empty buffer. See https://github.com/fatih/vim-go/issues/287 for - " details. - let filtered = [] - let is_readable = {} - - for item in a:items - if has_key(item, 'bufnr') - let filename = bufname(item.bufnr) - elseif has_key(item, 'filename') - let filename = item.filename - else - " nothing to do, add item back to the list - call add(filtered, item) - continue - endif - - if !has_key(is_readable, filename) - let is_readable[filename] = filereadable(filename) - endif - if is_readable[filename] - call add(filtered, item) - endif - endfor - - for k in keys(filter(is_readable, '!v:val')) - echo "vim-go: " | echohl Identifier | echon "[run] Dropped " | echohl Constant | echon '"' . k . '"' - echohl Identifier | echon " from location list (nonvalid filename)" | echohl None - endfor - - return filtered -endfunction - function! go#util#ShowInfo(info) if empty(a:info) return @@ -555,6 +541,37 @@ function! go#util#ShowInfo(info) echo "vim-go: " | echohl Function | echon a:info | echohl None endfunction +" go#util#SetEnv takes the name of an environment variable and what its value +" should be and returns a function that will restore it to its original value. +function! go#util#SetEnv(name, value) abort + let l:state = {} + + if len(a:name) == 0 + return function('s:noop', [], l:state) + endif + + let l:remove = 0 + if exists('$' . a:name) + let l:oldvalue = eval('$' . a:name) + else + let l:remove = 1 + endif + + call execute('let $' . a:name . ' = "' . a:value . '"') + + if l:remove + function! s:remove(name) abort + call execute('unlet $' . a:name) + endfunction + return function('s:remove', [a:name], l:state) + endif + + return function('go#util#SetEnv', [a:name, l:oldvalue], l:state) +endfunction + +function! s:noop(...) abort dict +endfunction + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index aaf67a7a..8715995e 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -32,17 +32,18 @@ CONTENTS *go-contents* INTRO *go-intro* Go (golang) support for Vim. vim-go comes with sensible predefined settings -(e.g. automatic `gofmt` on save), has autocomplete, snippet support, improved -syntax highlighting, go toolchain commands, etc. It is highly customizable, -and individual features can be toggled easily. vim-go leverages a number of -tools developed by the Go community to provide a seamless Vim experience. +(e.g. automatic `gofmt` on save), has code completion, snippet support, +improved syntax highlighting, go toolchain commands, etc. It is highly +customizable, and individual features can be toggled easily. vim-go leverages +a number of tools developed by the Go community to provide a seamless Vim +experience. * Compile your package with |:GoBuild|, install it with |:GoInstall| or test it with |:GoTest|. Run a single test with |:GoTestFunc|). * Quickly execute your current file(s) with |:GoRun|. * Improved syntax highlighting and folding. * Debug programs with integrated `delve` support with |:GoDebugStart|. - * Completion support via `gocode` and `gopls`. + * Code completion support via `gocode` and `gopls`. * `gofmt` or `goimports` on save keeps the cursor position and undo history. * Go to symbol/declaration with |:GoDef|. * Look up documentation with |:GoDoc| or |:GoDocBrowser|. @@ -127,7 +128,7 @@ or $GOPATH/bin (default: $HOME/go/bin). It requires `git`. Depending on your installation method, you may have to generate the plugin's |:helptags| manually (e.g. `:helptags ALL`). -Autocompletion is enabled by default via 'omnifunc', which you can trigger +Code completion is enabled by default via 'omnifunc', which you can trigger with |i_CTRL-X_CTRL-O| (``). Supported Go plugins~ *vim-go-plugins* @@ -138,8 +139,12 @@ The following plugins are supported for use with vim-go: https://github.com/Shougo/neocomplete.vim * Real-time completion (Neovim and Vim 8): - https://github.com/Shougo/deoplete.nvim and - https://github.com/zchee/deoplete-go + https://github.com/Shougo/deoplete.nvim + + Add the following line to your vimrc. This instructs deoplete to use omni + completion for Go files. + + call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) * Display source code navigation in a sidebar: https://github.com/majutsushi/tagbar @@ -149,9 +154,6 @@ The following plugins are supported for use with vim-go: https://github.com/SirVer/ultisnips or https://github.com/joereynolds/vim-minisnip -* Integration with `delve` (Neovim only): - https://github.com/jodosha/vim-godebug - * Interactive |:GoDecls| and |:GoDeclsDir|: https://github.com/ctrlpvim/ctrlp.vim or https://github.com/junegunn/fzf.vim or @@ -1202,6 +1204,13 @@ balloonexpr`. ============================================================================== SETTINGS *go-settings* + *'g:go_code_completion_enabled'* + +Enable code completion with |'omnifunc'|. By default it is enabled. +> + let g:go_code_completion_enabled = 1 +< + *'g:go_test_show_name'* Show the name of each failed test before the errors and logs output by the @@ -1251,8 +1260,8 @@ updated. By default it's disabled. The delay can be configured with the Use this option to define the command to be used for |:GoInfo|. By default `gocode` is being used as it's the fastest option. But one might also use -`guru` as it's covers more cases and is more accurate. Current valid options -are: `[gocode, guru]` > +`gopls` or `guru` as they cover more cases and are more accurate. Current +valid options are: `[gocode, guru, gopls]` > let g:go_info_mode = 'gocode' < @@ -1635,15 +1644,15 @@ same. *'g:go_gocode_propose_builtins'* Specifies whether `gocode` should add built-in types, functions and constants -to an autocompletion proposals. By default it is enabled. +to code completion proposals. By default it is enabled. > let g:go_gocode_propose_builtins = 1 < *'g:go_gocode_propose_source'* Specifies whether `gocode` should use source files instead of binary packages -for autocompletion proposals. When disabled, only identifiers from the current -package and packages that have been installed will proposed. +for code completion proposals. When disabled, only identifiers from the +current package and packages that have been installed will proposed. > let g:go_gocode_propose_source = 0 < @@ -1732,8 +1741,8 @@ i.e: |go#statusline#Show()|. By default it's enabled < *'g:go_echo_go_info'* -Use this option to show the identifier information when completion is done. By -default it's enabled > +Use this option to show the identifier information when code completion is +done. By default it's enabled. > let g:go_echo_go_info = 1 < @@ -2017,8 +2026,9 @@ rest of the commands and mappings become available after starting debug mode. * Setup the debug windows according to |'g:go_debug_windows'|. * Make the `:GoDebug*` commands and `(go-debug-*)` mappings available. - The current directory is used if [pkg] is empty. Any other arguments will - be passed to the program. + The directory of the current buffer is used if [pkg] is empty. Any other + arguments will be passed to the program. When [pkg] is relative, it will + be interpreted relative to the directory of the current buffer. Use |:GoDebugStop| to stop `dlv` and exit debugging mode. @@ -2031,7 +2041,6 @@ rest of the commands and mappings become available after starting debug mode. Use `-test.flag` to pass flags to `go test` when debugging a test; for example `-test.v` or `-test.run TestFoo` - *:GoDebugRestart* :GoDebugRestart @@ -2153,6 +2162,16 @@ Defaults to `127.0.0.1:8181`: let g:go_debug_address = '127.0.0.1:8181' < + *'g:go_debug_log_output'* + +Specifies log output options for `dlv`. Value should be a single string +of comma-separated options suitable for passing to `dlv`. An empty string +(`''`) will suppress logging entirely. +Default: `'debugger, rpc'`: +> + let g:go_debug_log = 'debugger, rpc' +< + *'g:go_highlight_debug'* Highlight the current line and breakpoints in the debugger. @@ -2164,6 +2183,12 @@ Highlight the current line and breakpoints in the debugger. ============================================================================== FAQ TROUBLESHOOTING *go-troubleshooting* +I get "Unknown function: go#config#..." error when I open a Go file.~ + +This often happens to vim-polyglot users when new config options are added to +vim-go. Run vim-polyglot's `build` script or make sure that vim-go is loaded +before vim-polyglot. + I get "not an editor command" error when I invoke :GoXXX~ This happens if vim-go is not installed properly. Be sure you have added this @@ -2364,14 +2389,14 @@ You can install and test all Vim versions by running `make`. DONATION *go-donation* People have asked for this for a long time, now you can be a fully supporter -by being a patreon at: https://www.patreon.com/fatih +by being a patreon at: https://www.patreon.com/bhcleek By being a patron, you are enabling vim-go to grow and mature, helping me to invest in bug fixes, new documentation, and improving both current and future features. It's completely optional and is just a direct way to support vim-go's ongoing development. Thanks! -Check it out: https://www.patreon.com/fatih +Check it out: https://www.patreon.com/bhcleek ============================================================================== diff --git a/sources_non_forked/vim-go/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim index c5fecd94..df2743dd 100644 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ b/sources_non_forked/vim-go/ftplugin/go.vim @@ -25,10 +25,12 @@ setlocal noexpandtab compiler go -" Set autocompletion -setlocal omnifunc=go#complete#Complete -if !go#util#has_job() - setlocal omnifunc=go#complete#GocodeComplete +if go#config#CodeCompletionEnabled() + " Set autocompletion + setlocal omnifunc=go#complete#Complete + if !go#util#has_job() + setlocal omnifunc=go#complete#GocodeComplete + endif endif if get(g:, "go_doc_keywordprg_enabled", 1) @@ -82,9 +84,16 @@ endif augroup vim-go-buffer autocmd! * - " TODO(bc): notify gopls about changes on CursorHold when the buffer is - " modified. - " TODO(bc): notify gopls that the file on disk is correct on BufWritePost + " The file is registered (textDocument/DidOpen) with gopls in plugin/go.vim + " on the FileType event. + " TODO(bc): handle all the other events that may be of interest to gopls, + " too (e.g. BufFilePost , CursorHold , CursorHoldI, FileReadPost, + " StdinReadPre, BufWritePost, TextChange, TextChangedI) + if go#util#has_job() + autocmd BufWritePost call go#lsp#DidChange(expand(':p')) + autocmd FileChangedShell call go#lsp#DidChange(expand(':p')) + autocmd BufDelete call go#lsp#DidClose(expand(':p')) + endif autocmd CursorHold call go#auto#auto_type_info() autocmd CursorHold call go#auto#auto_sameids() diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 59f44e89..7b3832d3 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -101,11 +101,11 @@ function! s:GoInstallBinaries(updateBinaries, ...) " change $GOBIN so go get can automatically install to it let $GOBIN = go_bin_path - " old_path is used to restore users own path - let old_path = $PATH - " vim's executable path is looking in PATH so add our go_bin path to it - let $PATH = go_bin_path . go#util#PathListSep() . $PATH + let Restore_path = go#util#SetEnv('PATH', go_bin_path . go#util#PathListSep() . $PATH) + + " GO111MODULE must be off to install golanci-lint and gometalinter + let Restore_modules = go#util#SetEnv('GO111MODULE', 'off') " when shellslash is set on MS-* systems, shellescape puts single quotes " around the output string. cmd on Windows does not handle single quotes @@ -185,7 +185,9 @@ function! s:GoInstallBinaries(updateBinaries, ...) endfor " restore back! - let $PATH = old_path + call call(Restore_path, []) + call call(Restore_modules, []) + if resetshellslash set shellslash endif @@ -234,6 +236,22 @@ function! s:gofiletype_post() let &g:fileencodings = s:current_fileencodings endfunction +function! s:register() + if !(&modifiable && expand('') ==# 'go') + return + endif + + let l:RestoreGopath = function('s:noop') + if go#config#AutodetectGopath() + let l:RestoreGopath = go#util#SetEnv('GOPATH', go#path#Detect()) + endif + call go#lsp#DidOpen(expand(':p')) + call call(l:RestoreGopath, []) +endfunction + +function! s:noop(...) abort +endfunction + augroup vim-go autocmd! @@ -245,6 +263,10 @@ augroup vim-go autocmd BufNewFile *.s if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif autocmd BufRead *.s call s:gofiletype_pre() autocmd BufReadPost *.s call s:gofiletype_post() + + if go#util#has_job() + autocmd FileType * call s:register() + endif augroup end " restore Vi compatibility settings diff --git a/sources_non_forked/vim-go/scripts/run-vim b/sources_non_forked/vim-go/scripts/run-vim index 864eeb4d..18878079 100644 --- a/sources_non_forked/vim-go/scripts/run-vim +++ b/sources_non_forked/vim-go/scripts/run-vim @@ -23,7 +23,7 @@ fi dir="/tmp/vim-go-test/$1-install" export GOPATH=$dir -export GO111MODULE=off +export GO111MODULE=auto export PATH=${GOPATH}/bin:$PATH shift diff --git a/sources_non_forked/vim-markdown/doc/vim-markdown.txt b/sources_non_forked/vim-markdown/doc/vim-markdown.txt index 1e81ea2e..4e1c487e 100644 --- a/sources_non_forked/vim-markdown/doc/vim-markdown.txt +++ b/sources_non_forked/vim-markdown/doc/vim-markdown.txt @@ -133,6 +133,7 @@ Options ~ ------------------------------------------------------------------------------- *vim-markdown-disable-folding* + *g:vim_markdown_folding_disabled* Disable Folding ~ Add the following line to your '.vimrc' to disable the folding configuration: @@ -147,6 +148,8 @@ To enable/disable folding use Vim's standard folding configuration. < ------------------------------------------------------------------------------- *vim-markdown-change-fold-style* + *g:vim_markdown_folding_style_pythonic* + *g:vim_markdown_override_foldtext* Change fold style ~ To fold in a style like python-mode [6], add the following to your '.vimrc': @@ -162,6 +165,7 @@ To prevent foldtext from being set add the following to your '.vimrc': < ------------------------------------------------------------------------------- *vim-markdown-set-header-folding-level* + *g:vim_markdown_folding_level* Set header folding level ~ Folding level is a number between 1 and 6. By default, if not specified, it is @@ -176,6 +180,7 @@ Tip: it can be changed on the fly with: < ------------------------------------------------------------------------------- *vim-markdown-disable-default-key-mappings* + *g:vim_markdown_no_default_key_mappings* Disable Default Key Mappings ~ Add the following line to your '.vimrc' to disable default key mappings: @@ -186,6 +191,7 @@ You can also map them by yourself with '' mappings. ------------------------------------------------------------------------------- *vim-markdown-enable-toc-window-auto-fit* + *g:vim_markdown_toc_autofit* Enable TOC window auto-fit ~ Allow for the TOC window to auto-fit when it's possible for it to shrink. It @@ -195,6 +201,7 @@ never increases its default size (half screen), it only shrinks. < ------------------------------------------------------------------------------- *vim-markdown-text-emphasis-restriction-to-single-lines* + *g:vim_markdown_emphasis_multiline* Text emphasis restriction to single-lines ~ By default text emphasis works across multiple lines until a closing token is @@ -205,6 +212,7 @@ for it to be applied a closing token must be found on the same line). To do so: < ------------------------------------------------------------------------------- *vim-markdown-syntax-concealing* + *g:vim_markdown_conceal* Syntax Concealing ~ Concealing is set for some syntax. @@ -231,6 +239,7 @@ your '.vimrc': < ------------------------------------------------------------------------------- *vim-markdown-fenced-code-block-languages* + *g:vim_markdown_fenced_languages* Fenced code block languages ~ You can use filetype name as fenced code block languages for syntax @@ -249,6 +258,8 @@ Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']". ------------------------------------------------------------------------------- *vim-markdown-follow-named-anchors* + *g:vim_markdown_follow_anchor* + *g:vim_markdown_anchorexpr* Follow named anchors ~ This feature allows the 'ge' command to follow named anchors in links of the @@ -285,6 +296,7 @@ are off by default. ------------------------------------------------------------------------------- *vim-markdown-latex-math* + *g:vim_markdown_math* LaTeX math ~ Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'. @@ -293,6 +305,7 @@ Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'. < ------------------------------------------------------------------------------- *vim-markdown-yaml-front-matter* + *g:vim_markdown_frontmatter* YAML Front Matter ~ Highlight YAML front matter as used by Jekyll or Hugo [7]. @@ -301,6 +314,7 @@ Highlight YAML front matter as used by Jekyll or Hugo [7]. < ------------------------------------------------------------------------------- *vim-markdown-toml-front-matter* + *g:vim_markdown_toml_frontmatter* TOML Front Matter ~ Highlight TOML front matter as used by Hugo [7]. @@ -311,6 +325,7 @@ TOML syntax highlight requires vim-toml [8]. < ------------------------------------------------------------------------------- *vim-markdown-json-front-matter* + *g:vim_markdown_json_frontmatter* JSON Front Matter ~ Highlight JSON front matter as used by Hugo [7]. @@ -321,6 +336,7 @@ JSON syntax highlight requires vim-json [9]. < ------------------------------------------------------------------------------- *vim-markdown-strikethrough* + *g:vim_markdown_strikethrough* Strikethrough ~ Strikethrough uses two tildes. '~~Scratch this.~~' @@ -329,6 +345,7 @@ Strikethrough uses two tildes. '~~Scratch this.~~' < ------------------------------------------------------------------------------- *vim-markdown-adjust-new-list-item-indent* + *g:vim_markdown_new_list_item_indent* Adjust new list item indent ~ You can adjust a new list indent. For example, you insert a single line like @@ -349,6 +366,7 @@ of indent is 4. If you'd like to change the number as 2, just write: < ------------------------------------------------------------------------------- *vim-markdown-do-not-require-.md-extensions-for-markdown-links* + *g:vim_markdown_no_extensions_in_markdown* Do not require .md extensions for Markdown links ~ If you want to have a link like this '[link text](link-url)' and follow it for @@ -365,6 +383,7 @@ work. So this option adds some consistency between the two. ------------------------------------------------------------------------------- *vim-markdown-auto-write-when-following-link* + *g:vim_markdown_autowrite* Auto-write when following link ~ If you follow a link like this '[link text](link-url)' using the 'ge' shortcut, @@ -374,6 +393,7 @@ this option will automatically save any edits you made before moving you: < ------------------------------------------------------------------------------- *vim-markdown-change-default-file-extension* + *g:vim_markdown_auto_extension_ext* Change default file extension ~ If you would like to use a file extension other than '.md' you may do so using @@ -383,6 +403,7 @@ the 'vim_markdown_auto_extension_ext' variable: < ------------------------------------------------------------------------------- *vim-markdown-do-not-automatically-insert-bulletpoints* + *g:vim_markdown_auto_insert_bullets* Do not automatically insert bulletpoints ~ Automatically inserting bulletpoints can lead to problems when wrapping text @@ -397,6 +418,7 @@ well, or you will have to remove an indent each time you add a new list item: < ------------------------------------------------------------------------------- *vim-markdown-change-how-to-open-new-files* + *g:vim_markdown_edit_url_in* Change how to open new files ~ By default when following a link the target file will be opened in your current diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 7134f382..d8d34ea1 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -99,7 +99,7 @@ syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell syn match mkdLineBreak / \+$/ syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@ MyMap -" \ :silent! call repeat#setreg("\Plug>MyMap", v:register) +" \ :execute 'silent! call repeat#setreg("\Plug>MyMap", v:register)' " \ call MyFunction(v:register, ...) " \ silent! call repeat#set("\Plug>MyMap") @@ -73,17 +73,34 @@ function! repeat#setreg(sequence,register) let g:repeat_reg = [a:sequence, a:register] endfunction + +function! s:default_register() + let values = split(&clipboard, ',') + if index(values, 'unnamedplus') != -1 + return '+' + elseif index(values, 'unnamed') != -1 + return '*' + else + return '"' + endif +endfunction + function! repeat#run(count) try if g:repeat_tick == b:changedtick let r = '' if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1]) - if g:repeat_reg[1] ==# '=' + " Take the original register, unless another (non-default, we + " unfortunately cannot detect no vs. a given default register) + " register has been supplied to the repeat command (as an + " explicit override). + let regname = v:register ==# s:default_register() ? g:repeat_reg[1] : v:register + if regname ==# '=' " This causes a re-evaluation of the expression on repeat, which " is what we want. let r = '"=' . getreg('=', 1) . "\" else - let r = '"' . g:repeat_reg[1] + let r = '"' . regname endif endif @@ -92,6 +109,9 @@ function! repeat#run(count) let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : '')) if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) exe 'norm ' . r . cnt . s + elseif v:version <= 703 + call feedkeys(r . cnt, 'n') + call feedkeys(s, '') else call feedkeys(s, 'i') call feedkeys(r . cnt, 'ni') diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets index 13d3c971..303fd209 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -16,21 +16,21 @@ namespace ${1:MyNamespace} endsnippet snippet class "class" w -${1:public} class ${2:MyClass} +${1:public} class ${2:`!p snip.rv = snip.basename`} { $0 } endsnippet snippet struct "struct" w -struct ${1:MyStruct} +struct ${1:`!p snip.rv = snip.basename`} { $0 } endsnippet snippet interface "interface" w -interface I${1:Interface} +interface I${1:`!p snip.rv = snip.basename`} { $0 } diff --git a/sources_non_forked/vim-snippets/UltiSnips/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets index 79e7aff9..a6c7416e 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -51,7 +51,9 @@ DOUBLE_QUOTES = '"' class Arg(object): def __init__(self, arg): self.arg = arg - self.name = arg.split('=')[0].strip() + name_and_type = arg.split('=')[0].split(':') + self.name = name_and_type[0].strip() + self.type = name_and_type[1].strip() if len(name_and_type) == 2 else None def __str__(self): return self.name @@ -62,6 +64,9 @@ class Arg(object): def is_kwarg(self): return '=' in self.arg + def is_vararg(self): + return '*' in self.name + def get_args(arglist): args = [Arg(arg) for arg in arglist.split(',') if arg] @@ -211,7 +216,7 @@ def write_init_body(args, parents, snip): if parents: snip.rv += '\n' + snip.mkline('', indent='') - for arg in args: + for arg in filter(lambda arg: not arg.is_vararg(), args): snip += "self._%s = %s" % (arg, arg) diff --git a/sources_non_forked/vim-snippets/snippets/eelixir.snippets b/sources_non_forked/vim-snippets/snippets/eelixir.snippets index 84caaba6..9910975a 100644 --- a/sources_non_forked/vim-snippets/snippets/eelixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/eelixir.snippets @@ -17,7 +17,7 @@ snippet if snippet ife <%= if ${1} do %> ${2:${VISUAL}} - <%= else %> + <% else %> ${0} <% end %> snippet ft diff --git a/sources_non_forked/vim-snippets/snippets/liquid.snippets b/sources_non_forked/vim-snippets/snippets/liquid.snippets new file mode 100644 index 00000000..4f11f086 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/liquid.snippets @@ -0,0 +1,263 @@ +# Port of Shopify Liquid Template Snippets +# https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets + +snippet if + {% if ${1:condition} %} + ${0:${VISUAL}} + {% endif %} +snippet else + {% else %} +snippet elsif + {% elsif ${1:condition} %} +snippet ifelse + {% if ${1:condition} %} + ${2} + {% else %} + ${0} + {% endif %} +snippet unless + {% unless ${1:condition} %} + ${0:${VISUAL}} + {% endunless %} +snippet case + {% case ${1:variable} %} + {% when ${2:condition} %} + ${3} + {% else %} + ${0} + {% endcase %} +snippet when + {% when ${1:condition} %} + ${0} +snippet cycle + {% cycle '${1:odd}', '${2:even}' %} +snippet cyclegroup + {% cycle '${1:group name}': '${2:odd}', '${3:even}' %} +snippet for + {% for ${1:item} in ${2:collection} %} + ${0} + {% endfor %} +snippet limit + limit: ${1:5} +snippet offset + offset: ${1:0} +snippet reversed + reversed +snippet break + {% break %} +snippet continue + {% continue %} +snippet tablerow + {% tablerow ${1:item} in ${2:collection} cols: ${3:2} %} + ${0} + {% endtablerow %} +snippet assign + {% assign ${1:variable} = ${0:value} %} +snippet increment + {% increment ${0:variable} %} +snippet decrement + {% decrement ${0:variable} %} +snippet capture + {% capture ${1:variable} %}${0}{% endcapture %} +snippet include + {% include '${0:snippet}' %} +snippet includewith + {% include '${1:snippet}', ${2:variable}: ${0:value} %} +snippet section + {% section '${1:snippet}' %} +snippet raw + {% raw %}${0}{% endraw %} +snippet layout + {% layout '${1:layout}' %} +snippet layoutnone + {% layout none %} +snippet paginate + {% paginate ${1:collection.products} by ${2:12} %} + {% for ${3:product} in $1 %} + ${0} + {% endfor %} + {% endpaginate %} +snippet schema + {% schema %} + { + ${0} + } + {% endschema %} +snippet stylesheet + {% stylesheet %} + ${0} + {% endstylesheet %} +snippet stylesheet_scss + {% stylesheet '${1:scss}' %} + ${0} + {% endstylesheet %} +snippet javascript + {% javascript %} + ${0} + {% endjavascript %} +snippet comment- + {%- comment -%}${0}{%- endcomment -%} +snippet if- + {%- if ${1:condition} -%} + ${0:${VISUAL}} + {%- endif -%} +snippet else- + {%- else -%} +snippet elsif- + {%- elsif ${1:condition} -%} +snippet ifelse- + {%- if ${1:condition} -%} + ${2} + {%- else -%} + ${0} + {%- endif -%} +snippet unless- + {%- unless ${1:condition} -%} + ${0:${VISUAL}} + {%- endunless -%} +snippet case- + {%- case ${1:variable} -%} + {%- when ${2:condition} -%} + ${3} + {%- else -%} + ${0} + {%- endcase -%} +snippet when- + {%- when ${1:condition} -%} + ${0} +snippet cycle- + {%- cycle '${1:odd}', '${2:even}' -%} +snippet cyclegroup- + {%- cycle '${1:group name}': '${2:odd}', '${3:even}' -%} +snippet for- + {%- for ${1:item} in ${2:collection} -%} + ${0} + {%- endfor -%} +snippet continue- + {%- continue -%} +snippet tablerow- + {%- tablerow ${1:item} in ${2:collection} cols: ${3:2} -%} + ${0} + {%- endtablerow -%} +snippet assign- + {%- assign ${1:variable} = ${0:value} -%} +snippet capture- + {%- capture ${1:variable} -%}${0}{%- endcapture -%} +snippet include- + {%- include '${0:snippet}' -%} +snippet includewith- + {%- include '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet join + | join: '${1:, }' +snippet first + | first +snippet last + | last +snippet concat + | concat: ${1:array} +snippet map + | map: '${1:key}' +snippet reverse + | reverse +snippet size + | size +snippet sort + | sort: '${1:key}' +snippet uniq + | uniq +snippet img_tag + | img_tag +snippet img_tag_param + | img_tag: '${1:alt}', '${2:class}' +snippet script_tag + | script_tag +snippet stylesheet_tag + | stylesheet_tag +snippet abs + | abs +snippet ceil + | ceil +snippet divided_by + | divided_by: ${1:2} +snippet floor + | floor +snippet minus + | minus: ${1:1} +snippet plus + | plus: ${1:1} +snippet round + | round: ${1:0} +snippet times + | times: ${1:1} +snippet modulo + | modulo: ${1:2} +snippet money + | money +snippet money_with_currency + | money_with_currency +snippet money_without_trailing_zeros + | money_without_trailing_zeros +snippet money_without_currency + | money_without_currency +snippet append + | append: '${1:string}' +snippet camelcase + | camelcase +snippet capitalize + | capitalize +snippet downcase + | downcase +snippet escape + | escape +snippet handleize + | handleize +snippet md5 + | md5 +snippet newline_to_br + | newline_to_br +snippet pluralize + | pluralize: '${1:item}', '${2:items}' +snippet prepend + | prepend: '${1:string}' +snippet remove + | remove: '${1:string}' +snippet remove_first + | remove_first: '${1:string}' +snippet replace + | replace: '${1:target}', '${2:replace}' +snippet replace_first + | replace_first: '${1:target}', '${2:replace}' +snippet slice + | slice: ${1:0}, ${2:5} +snippet slice_single + | slice: ${1:at} +snippet split + | split: '${1:,}' +snippet strip + | strip +snippet lstrip + | lstrip +snippet rstrip + | rstrip +snippet strip_html + | strip_html +snippet strip_newlines + | strip_newlines +snippet truncate + | truncate: ${1:20}, '${2:...}' +snippet truncatewords + | truncatewords: ${1:5}, '${2:...}' +snippet upcase + | upcase +snippet url_encode + | url_encode +snippet url_escape + | url_escape +snippet url_param_escape + | url_param_escape +snippet asset_url + | asset_url +snippet asset_img_url + | asset_img_url: '${1:medium}' +snippet img_url + | img_url: '${1:medium}' diff --git a/sources_non_forked/vim-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets index 7d8e6d8a..adb781dd 100644 --- a/sources_non_forked/vim-snippets/snippets/puppet.snippets +++ b/sources_non_forked/vim-snippets/snippets/puppet.snippets @@ -7,16 +7,16 @@ # Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html # More info: https://github.com/puppetlabs/puppet-strings snippet classheader - # ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'class-name')`} + # ${1:`vim_snippets#Filename(substitute(expand('%:p:s?\v.{-}/(\w+)/manifests/(.+)\.pp?\1/\2?'), '/', '::', 'g'), 'class-name')`} # ${2:A description of what this class does} # # @summary ${3:A short summary of the purpose of this class} # - # @param ${4:parameter1} [${5:String}] + # @param ${4:parameter1} # ${6:Explanation of what this parameter affects.} # # @example Simple use - # class { '$1': } + # include $1 # # @example Use with params # class { '$1': @@ -28,7 +28,7 @@ snippet classheader # @note Copyright `strftime("%Y")` $8 # class $1( - $$4 = undef, + ${5:String} $$4 = undef, ) { ${0} } diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 79e70628..895fbe57 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -204,34 +204,34 @@ snippet fcite \footcite[]{} \\footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. snippet ita italic text - \\textit{${1:${VISUAL:text}}} ${0} + \\textit{${1:${VISUAL:text}}}${0} snippet bf bold face text - \\textbf{${1:${VISUAL:text}}} ${0} + \\textbf{${1:${VISUAL:text}}}${0} snippet under underline text - \\underline{${1:${VISUAL:text}}} ${0} + \\underline{${1:${VISUAL:text}}}${0} snippet over overline text - \\overline{${1:${VISUAL:text}}} ${0} + \\overline{${1:${VISUAL:text}}}${0} snippet emp emphasize text \\emph{${1:${VISUAL:text}}}${0} snippet sc small caps text - \\textsc{${1:${VISUAL:text}}} ${0} + \\textsc{${1:${VISUAL:text}}}${0} #Choosing font snippet sf sans serife text - \\textsf{${1:${VISUAL:text}}} ${0} + \\textsf{${1:${VISUAL:text}}}${0} snippet rm roman font text - \\textrm{${1:${VISUAL:text}}} ${0} + \\textrm{${1:${VISUAL:text}}}${0} snippet tt typewriter (monospace) text - \\texttt{${1:${VISUAL:text}}} ${0} + \\texttt{${1:${VISUAL:text}}}${0} #Math font snippet mf mathfrak - \\mathfrak{${1:${VISUAL:text}}} ${0} + \\mathfrak{${1:${VISUAL:text}}}${0} snippet mc mathcal - \\mathcal{${1:${VISUAL:text}}} ${0} + \\mathcal{${1:${VISUAL:text}}}${0} snippet ms mathscr - \\mathscr{${1:${VISUAL:text}}} ${0} + \\mathscr{${1:${VISUAL:text}}}${0} #misc snippet ft \footnote - \\footnote{${1:${VISUAL:text}}} ${0} + \\footnote{${1:${VISUAL:text}}}${0} snippet fig figure environment (includegraphics) \\begin{figure} \\begin{center}