From a6b64938eb43f5c1e09b9218177d90f40b622e70 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Mon, 24 Sep 2018 21:40:17 -0300 Subject: [PATCH] Updated plugins --- .../ale/ale_linters/apiblueprint/drafter.vim | 2 + .../ale/ale_linters/c/clangd.vim | 1 + .../ale/ale_linters/clojure/joker.vim | 2 + .../ale/ale_linters/cpp/clangd.vim | 1 + .../ale/ale_linters/cucumber/cucumber.vim | 1 + .../ale/ale_linters/cuda/nvcc.vim | 2 - .../ale/ale_linters/dafny/dafny.vim | 1 + .../ale/ale_linters/dart/language_server.vim | 2 +- .../ale/ale_linters/dockerfile/hadolint.vim | 2 + .../ale/ale_linters/elixir/mix.vim | 3 +- .../ale/ale_linters/gitcommit/gitlint.vim | 6 +- .../ale/ale_linters/go/gobuild.vim | 6 +- .../ale/ale_linters/go/golangci_lint.vim | 56 +++ .../ale/ale_linters/go/govet.vim | 8 +- .../ale/ale_linters/go/langserver.vim | 28 ++ .../ale/ale_linters/html/tidy.vim | 2 +- .../ale/ale_linters/idris/idris.vim | 3 +- .../ale/ale_linters/java/javac.vim | 2 +- .../ale/ale_linters/java/javalsp.vim | 23 ++ .../ale/ale_linters/javascript/flow.vim | 3 - .../ale/ale_linters/json/jsonlint.vim | 1 - .../ale/ale_linters/julia/languageserver.vim | 21 ++ .../ale/ale_linters/kotlin/kotlinc.vim | 7 +- .../ale/ale_linters/make/checkmake.vim | 1 + .../ale/ale_linters/markdown/remark_lint.vim | 2 + .../ale/ale_linters/nasm/nasm.vim | 2 + .../ale/ale_linters/objc/clangd.vim | 1 + .../ale/ale_linters/objcpp/clangd.vim | 1 + .../ale/ale_linters/perl/perl.vim | 5 + .../ale/ale_linters/puppet/languageserver.vim | 2 + .../ale/ale_linters/puppet/puppet.vim | 14 +- .../ale/ale_linters/python/flake8.vim | 6 + .../ale/ale_linters/python/mypy.vim | 6 + .../ale/ale_linters/python/prospector.vim | 7 + .../ale/ale_linters/python/pycodestyle.vim | 6 + .../ale/ale_linters/python/pyflakes.vim | 6 + .../ale/ale_linters/python/pylint.vim | 6 + .../ale/ale_linters/python/pyls.vim | 6 + .../ale/ale_linters/python/pyre.vim | 6 + .../ale/ale_linters/rst/rstcheck.vim | 1 + .../ale/ale_linters/ruby/brakeman.vim | 12 +- .../ale_linters/ruby/rails_best_practices.vim | 14 +- .../ale/ale_linters/ruby/reek.vim | 13 +- .../ale/ale_linters/ruby/rubocop.vim | 14 +- .../ale/ale_linters/ruby/solargraph.vim | 20 ++ .../ale/ale_linters/rust/cargo.vim | 2 + .../ale/ale_linters/scala/sbtserver.vim | 31 ++ .../ale/ale_linters/scala/scalastyle.vim | 2 + .../ale/ale_linters/sml/smlnj_cm.vim | 1 + .../ale/ale_linters/solidity/solhint.vim | 1 - .../ale/ale_linters/tcl/nagelfar.vim | 1 - .../ale/ale_linters/terraform/tflint.vim | 1 + .../ale/ale_linters/tex/lacheck.vim | 1 - .../ale/ale_linters/thrift/thrift.vim | 5 +- .../vim/ale_custom_linting_rules.vim | 28 +- .../ale/ale_linters/xml/xmllint.vim | 4 +- .../ale/ale_linters/yang/yang_lsp.vim | 1 + sources_non_forked/ale/autoload/ale.vim | 7 +- .../ale/autoload/ale/assert.vim | 13 + sources_non_forked/ale/autoload/ale/c.vim | 3 +- .../ale/autoload/ale/completion.vim | 23 +- .../ale/autoload/ale/cursor.vim | 83 +++-- .../ale/autoload/ale/definition.vim | 2 +- .../ale/autoload/ale/engine.vim | 20 +- .../ale/autoload/ale/events.vim | 6 +- sources_non_forked/ale/autoload/ale/fix.vim | 10 +- .../ale/autoload/ale/fix/registry.vim | 25 ++ .../ale/autoload/ale/fixers/eslint.vim | 2 +- .../ale/autoload/ale/fixers/fixjson.vim | 1 + .../ale/autoload/ale/fixers/gomod.vim | 10 + .../ale/autoload/ale/fixers/importjs.vim | 1 + .../ale/autoload/ale/fixers/ocamlformat.vim | 18 + .../ale/autoload/ale/fixers/php_cs_fixer.vim | 1 + .../ale/autoload/ale/fixers/phpcbf.vim | 1 + .../ale/autoload/ale/fixers/puppetlint.vim | 1 + .../ale/autoload/ale/fixers/rubocop.vim | 11 +- .../ale/autoload/ale/fixers/scalafmt.vim | 1 - .../ale/autoload/ale/fixers/shfmt.vim | 18 +- .../ale/autoload/ale/fixers/sqlfmt.vim | 13 + .../ale/autoload/ale/fixers/uncrustify.vim | 16 + .../ale/autoload/ale/fixers/xmllint.vim | 29 ++ sources_non_forked/ale/autoload/ale/go.vim | 27 ++ .../ale/autoload/ale/handlers/eslint.vim | 7 + .../ale/autoload/ale/handlers/gawk.vim | 2 + .../ale/autoload/ale/handlers/go.vim | 1 + .../ale/autoload/ale/handlers/ols.vim | 1 + .../ale/autoload/ale/handlers/pony.vim | 1 - .../ale/autoload/ale/handlers/redpen.vim | 11 +- .../ale/autoload/ale/handlers/rubocop.vim | 6 - .../ale/autoload/ale/handlers/ruby.vim | 9 + .../ale/autoload/ale/handlers/sml.vim | 5 +- .../ale/autoload/ale/handlers/vale.vim | 1 + sources_non_forked/ale/autoload/ale/java.vim | 20 ++ sources_non_forked/ale/autoload/ale/job.vim | 7 + sources_non_forked/ale/autoload/ale/julia.vim | 19 ++ .../ale/autoload/ale/linter.vim | 2 +- sources_non_forked/ale/autoload/ale/list.vim | 3 + sources_non_forked/ale/autoload/ale/lsp.vim | 2 + .../ale/autoload/ale/lsp_linter.vim | 16 +- .../ale/autoload/ale/preview.vim | 2 +- .../ale/autoload/ale/python.vim | 7 + sources_non_forked/ale/autoload/ale/ruby.vim | 22 ++ .../ale/autoload/ale/socket.vim | 12 +- .../ale/autoload/ale/toggle.vim | 20 +- sources_non_forked/ale/autoload/ale/util.vim | 3 +- sources_non_forked/ale/doc/ale-c.txt | 19 ++ sources_non_forked/ale/doc/ale-cpp.txt | 6 + sources_non_forked/ale/doc/ale-cs.txt | 6 + sources_non_forked/ale/doc/ale-d.txt | 12 + .../ale/doc/ale-development.txt | 1 + sources_non_forked/ale/doc/ale-go.txt | 64 +++- sources_non_forked/ale/doc/ale-java.txt | 29 ++ sources_non_forked/ale/doc/ale-julia.txt | 20 ++ sources_non_forked/ale/doc/ale-objc.txt | 6 + sources_non_forked/ale/doc/ale-objcpp.txt | 6 + sources_non_forked/ale/doc/ale-ocaml.txt | 17 + sources_non_forked/ale/doc/ale-pawn.txt | 12 + sources_non_forked/ale/doc/ale-puppet.txt | 20 ++ sources_non_forked/ale/doc/ale-python.txt | 80 +++++ sources_non_forked/ale/doc/ale-ruby.txt | 39 ++- sources_non_forked/ale/doc/ale-rust.txt | 4 +- sources_non_forked/ale/doc/ale-scala.txt | 33 ++ sources_non_forked/ale/doc/ale-sql.txt | 25 ++ sources_non_forked/ale/doc/ale-thrift.txt | 2 +- sources_non_forked/ale/doc/ale-vala.txt | 12 + sources_non_forked/ale/doc/ale-xml.txt | 8 + sources_non_forked/ale/doc/ale.txt | 111 ++++-- sources_non_forked/ale/plugin/ale.vim | 14 + .../auto-pairs/doc/AutoPairs.txt | 2 +- .../ctrlp.vim/autoload/ctrlp.vim | 3 +- .../lightline.vim/autoload/lightline.vim | 24 +- .../autoload/lightline/colorscheme.vim | 4 +- .../lightline.vim/test/expand.vim | 37 +- .../lightline.vim/test/link.vim | 30 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 117 +++---- sources_non_forked/nerdtree/doc/NERDTree.txt | 8 +- .../nerdtree/lib/nerdtree/bookmark.vim | 7 +- .../nerdtree/lib/nerdtree/creator.vim | 16 +- .../nerdtree/lib/nerdtree/opener.vim | 3 + .../nerdtree/lib/nerdtree/tree_dir_node.vim | 26 ++ .../nerdtree/lib/nerdtree/tree_file_node.vim | 78 ++--- .../nerdtree/lib/nerdtree/ui.vim | 71 ++-- .../nerdtree/plugin/NERD_tree.vim | 22 +- .../vim-flake8/autoload/flake8.vim | 12 +- .../vim-fugitive/autoload/fugitive.vim | 320 +++++++++++------- .../vim-fugitive/doc/fugitive.txt | 21 +- .../vim-fugitive/plugin/fugitive.vim | 26 +- sources_non_forked/vim-go/.codecov.yml | 1 + sources_non_forked/vim-go/.travis.yml | 2 +- sources_non_forked/vim-go/CHANGELOG.md | 52 ++- sources_non_forked/vim-go/Dockerfile | 2 +- sources_non_forked/vim-go/README.md | 2 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 23 +- .../vim-go/autoload/go/complete.vim | 118 +++---- .../vim-go/autoload/go/complete_test.vim | 20 ++ .../vim-go/autoload/go/config.vim | 18 +- .../vim-go/autoload/go/coverage.vim | 13 +- .../vim-go/autoload/go/debug.vim | 22 +- sources_non_forked/vim-go/autoload/go/def.vim | 37 +- .../vim-go/autoload/go/def_test.vim | 2 +- .../vim-go/autoload/go/guru.vim | 156 ++------- .../vim-go/autoload/go/import.vim | 13 +- .../vim-go/autoload/go/indent_test.vim | 22 ++ sources_non_forked/vim-go/autoload/go/job.vim | 205 +++++++---- .../vim-go/autoload/go/lint.vim | 32 +- .../vim-go/autoload/go/list.vim | 1 + sources_non_forked/vim-go/autoload/go/mod.vim | 140 ++++++++ .../vim-go/autoload/go/rename.vim | 3 +- .../go/test-fixtures/complete/complete.go | 9 + .../vim-go/autoload/go/test.vim | 53 +-- .../vim-go/autoload/go/test_test.vim | 2 +- .../vim-go/autoload/go/tool.vim | 6 +- .../vim-go/autoload/go/util.vim | 4 + sources_non_forked/vim-go/doc/vim-go.txt | 69 +++- .../vim-go/ftdetect/gofiletype.vim | 19 ++ .../vim-go/ftplugin/go/commands.vim | 7 +- .../vim-go/ftplugin/go/mappings.vim | 7 +- sources_non_forked/vim-go/ftplugin/gomod.vim | 15 + .../vim-go/ftplugin/gomod/commands.vim | 3 + .../vim-go/ftplugin/gomod/mappings.vim | 1 + .../vim-go/gosnippets/UltiSnips/go.snippets | 22 ++ .../vim-go/gosnippets/minisnip/_go_tt | 17 + .../vim-go/gosnippets/snippets/go.snip | 19 ++ sources_non_forked/vim-go/indent/go.vim | 23 +- sources_non_forked/vim-go/plugin/go.vim | 49 ++- sources_non_forked/vim-go/scripts/install-vim | 2 +- sources_non_forked/vim-go/syntax/go.vim | 14 +- sources_non_forked/vim-go/syntax/gomod.vim | 46 +++ sources_non_forked/vim-pug/syntax/pug.vim | 2 +- sources_non_forked/vim-snippets/README.md | 53 ++- .../vim-snippets/UltiSnips/php.snippets | 4 +- .../vim-snippets/snippets/cpp.snippets | 8 + .../vim-snippets/snippets/elm.snippets | 56 ++- .../vim-snippets/snippets/freemarker.snippets | 27 ++ .../vim-snippets/snippets/go.snippets | 5 + .../vim-snippets/snippets/ocaml.snippets | 39 +++ .../vim-snippets/snippets/racket.snippets | 72 ++++ .../vim-snippets/snippets/scheme.snippets | 14 +- .../vim-snippets/snippets/tex.snippets | 20 +- 199 files changed, 2897 insertions(+), 980 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/go/golangci_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/go/langserver.vim create mode 100644 sources_non_forked/ale/ale_linters/java/javalsp.vim create mode 100644 sources_non_forked/ale/ale_linters/julia/languageserver.vim create mode 100644 sources_non_forked/ale/ale_linters/ruby/solargraph.vim create mode 100644 sources_non_forked/ale/ale_linters/scala/sbtserver.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/gomod.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/sqlfmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/xmllint.vim create mode 100644 sources_non_forked/ale/autoload/ale/go.vim delete mode 100644 sources_non_forked/ale/autoload/ale/handlers/rubocop.vim create mode 100644 sources_non_forked/ale/autoload/ale/java.vim create mode 100644 sources_non_forked/ale/autoload/ale/julia.vim create mode 100644 sources_non_forked/ale/doc/ale-d.txt create mode 100644 sources_non_forked/ale/doc/ale-julia.txt create mode 100644 sources_non_forked/ale/doc/ale-pawn.txt create mode 100644 sources_non_forked/ale/doc/ale-sql.txt create mode 100644 sources_non_forked/ale/doc/ale-vala.txt create mode 100644 sources_non_forked/vim-go/autoload/go/complete_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/indent_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/mod.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go create mode 100644 sources_non_forked/vim-go/ftplugin/gomod.vim create mode 100644 sources_non_forked/vim-go/ftplugin/gomod/commands.vim create mode 100644 sources_non_forked/vim-go/ftplugin/gomod/mappings.vim create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_tt create mode 100644 sources_non_forked/vim-go/syntax/gomod.vim create mode 100644 sources_non_forked/vim-snippets/snippets/freemarker.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/ocaml.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/racket.snippets diff --git a/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim b/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim index 198709f9..5d40c53a 100644 --- a/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim +++ b/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim @@ -16,10 +16,12 @@ function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \} + if l:match[5] isnot# '' let l:item.end_lnum = l:match[6] + 0 let l:item.end_col = l:match[7] + 0 endif + call add(l:output, l:item) endfor diff --git a/sources_non_forked/ale/ale_linters/c/clangd.vim b/sources_non_forked/ale/ale_linters/c/clangd.vim index 2c7c5c13..6cad601a 100644 --- a/sources_non_forked/ale/ale_linters/c/clangd.vim +++ b/sources_non_forked/ale/ale_linters/c/clangd.vim @@ -6,6 +6,7 @@ call ale#Set('c_clangd_options', '') function! ale_linters#c#clangd#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction diff --git a/sources_non_forked/ale/ale_linters/clojure/joker.vim b/sources_non_forked/ale/ale_linters/clojure/joker.vim index 7a3330a8..2f61148b 100644 --- a/sources_non_forked/ale/ale_linters/clojure/joker.vim +++ b/sources_non_forked/ale/ale_linters/clojure/joker.vim @@ -9,9 +9,11 @@ function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = 'E' + if l:match[4] is? 'Parse warning' let l:type = 'W' endif + call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, diff --git a/sources_non_forked/ale/ale_linters/cpp/clangd.vim b/sources_non_forked/ale/ale_linters/cpp/clangd.vim index 1d716c33..9139f054 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangd.vim @@ -6,6 +6,7 @@ call ale#Set('cpp_clangd_options', '') function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction diff --git a/sources_non_forked/ale/ale_linters/cucumber/cucumber.vim b/sources_non_forked/ale/ale_linters/cucumber/cucumber.vim index 6708d32f..e8ae09ff 100644 --- a/sources_non_forked/ale/ale_linters/cucumber/cucumber.vim +++ b/sources_non_forked/ale/ale_linters/cucumber/cucumber.vim @@ -22,6 +22,7 @@ function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort endtry let l:output = [] + for l:element in get(l:json, 'elements', []) for l:step in l:element['steps'] if l:step['result']['status'] is# 'undefined' diff --git a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim index a3678910..f4442cb8 100644 --- a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim +++ b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim @@ -8,7 +8,6 @@ function! ale_linters#cuda#nvcc#GetCommand(buffer) abort " Unused: use ale#util#nul_file " let l:output_file = ale#util#Tempname() . '.ii' " call ale#engine#ManageFile(a:buffer, l:output_file) - return '%e -cuda' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) @@ -23,7 +22,6 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': l:match[4] =~# 'error' ? 'E' : 'W', diff --git a/sources_non_forked/ale/ale_linters/dafny/dafny.vim b/sources_non_forked/ale/ale_linters/dafny/dafny.vim index 8bbf1b13..b5b90675 100644 --- a/sources_non_forked/ale/ale_linters/dafny/dafny.vim +++ b/sources_non_forked/ale/ale_linters/dafny/dafny.vim @@ -13,6 +13,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort \ 'type': l:match[4] =~# '^Error' ? 'E' : 'W' \ }) endfor + return l:output endfunction diff --git a/sources_non_forked/ale/ale_linters/dart/language_server.vim b/sources_non_forked/ale/ale_linters/dart/language_server.vim index 14b6ab93..8e0c139b 100644 --- a/sources_non_forked/ale/ale_linters/dart/language_server.vim +++ b/sources_non_forked/ale/ale_linters/dart/language_server.vim @@ -15,6 +15,6 @@ call ale#linter#Define('dart', { \ 'name': 'language_server', \ 'lsp': 'stdio', \ 'executable_callback': ale#VarFunc('dart_language_server_executable'), -\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable', +\ 'command': '%e', \ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot', \}) diff --git a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim index 7772afbd..dc0f5b9e 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim @@ -82,9 +82,11 @@ endfunction function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer) + if l:command is# 'docker' return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image') endif + return 'hadolint -' endfunction diff --git a/sources_non_forked/ale/ale_linters/elixir/mix.vim b/sources_non_forked/ale/ale_linters/elixir/mix.vim index 1a95e37f..4552ace5 100644 --- a/sources_non_forked/ale/ale_linters/elixir/mix.vim +++ b/sources_non_forked/ale/ale_linters/elixir/mix.vim @@ -10,7 +10,6 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort " " TODO: Warning format " warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name - let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$' let l:output = [] @@ -32,9 +31,11 @@ endfunction function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs') + if !empty(l:mix_file) return fnamemodify(l:mix_file, ':p:h') endif + return '.' endfunction diff --git a/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim b/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim index ec3bfb0b..a9c4822d 100644 --- a/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim +++ b/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim @@ -23,8 +23,10 @@ function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[2] - if l:code is# 'T2' && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - continue + if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + if l:code is# 'T2' || l:code is# 'B2' + continue + endif endif let l:item = { diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim index 2d6febdd..cef1ff88 100644 --- a/sources_non_forked/ale/ale_linters/go/gobuild.vim +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -3,6 +3,7 @@ " Description: go build for Go files " inspired by work from dzhou121 +call ale#Set('go_go_executable', 'go') call ale#Set('go_gobuild_options', '') function! ale_linters#go#gobuild#GetCommand(buffer) abort @@ -10,7 +11,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort " Run go test in local directory with relative path return ale#path#BufferCdString(a:buffer) - \ . 'go test' + \ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' endfunction @@ -21,7 +22,6 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort " file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args " file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) " file.go:5:2: expected declaration, found 'STRING' "log" - " go test returns relative paths so use tail of filename as part of pattern matcher let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$' @@ -48,7 +48,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], -\ 'executable': 'go', +\ 'executable_callback': ale#VarFunc('go_go_executable'), \ 'command_callback': 'ale_linters#go#gobuild#GetCommand', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', diff --git a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim new file mode 100644 index 00000000..dd9a3c64 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim @@ -0,0 +1,56 @@ +" Author: Sascha Grunert +" Description: Adds support of golangci-lint + +call ale#Set('go_golangci_lint_options', '--enable-all') +call ale#Set('go_golangci_lint_executable', 'golangci-lint') +call ale#Set('go_golangci_lint_package', 0) + +function! ale_linters#go#golangci_lint#GetCommand(buffer) abort + let l:filename = expand('#' . a:buffer . ':t') + let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') + let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package') + + if l:lint_package + return ale#path#BufferCdString(a:buffer) + \ . '%e run ' + \ . l:options + endif + + return ale#path#BufferCdString(a:buffer) + \ . '%e run ' + \ . ale#Escape(l:filename) + \ . ' ' . l:options +endfunction + +function! ale_linters#go#golangci_lint#GetMatches(lines) abort + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$' + + return ale#util#GetMatches(a:lines, l:pattern) +endfunction + +function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + + for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines) + " l:match[1] will already be an absolute path, output from + " golangci_lint + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': 'E', + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('go', { +\ 'name': 'golangci-lint', +\ 'executable_callback': ale#VarFunc('go_golangci_lint_executable'), +\ 'command_callback': 'ale_linters#go#golangci_lint#GetCommand', +\ 'callback': 'ale_linters#go#golangci_lint#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim index 59fea499..3d0d2adf 100644 --- a/sources_non_forked/ale/ale_linters/go/govet.vim +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -4,19 +4,23 @@ " Author: John Eikenberry " Description: updated to work with go1.10 +call ale#Set('go_go_executable', 'go') call ale#Set('go_govet_options', '') function! ale_linters#go#govet#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_govet_options') - return ale#path#BufferCdString(a:buffer) . ' go vet .' + + return ale#path#BufferCdString(a:buffer) . ' ' + \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' .' endfunction call ale#linter#Define('go', { \ 'name': 'govet', \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', -\ 'executable': 'go', +\ 'executable_callback': ale#VarFunc('go_go_executable'), \ 'command_callback': 'ale_linters#go#govet#GetCommand', \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/langserver.vim b/sources_non_forked/ale/ale_linters/go/langserver.vim new file mode 100644 index 00000000..df956483 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/langserver.vim @@ -0,0 +1,28 @@ +" Author: Horacio Sanson +" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver + +call ale#Set('go_langserver_executable', 'go-langserver') +call ale#Set('go_langserver_options', '') + +function! ale_linters#go#langserver#GetCommand(buffer) abort + let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))] + let l:options = ale#Var(a:buffer, 'go_langserver_options') + let l:options = substitute(l:options, '-gocodecompletion', '', 'g') + let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1') + + if(ale#Var(a:buffer, 'completion_enabled') == 1) + call add(l:options, '-gocodecompletion') + endif + + let l:options = uniq(sort(l:options)) + + return join(extend(l:executable, l:options), ' ') +endfunction + +call ale#linter#Define('go', { +\ 'name': 'golangserver', +\ 'lsp': 'stdio', +\ 'executable_callback': ale#VarFunc('go_langserver_executable'), +\ 'command_callback': 'ale_linters#go#langserver#GetCommand', +\ 'project_root_callback': 'ale#go#FindProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/html/tidy.vim b/sources_non_forked/ale/ale_linters/html/tidy.vim index cab8bc24..4ec29091 100644 --- a/sources_non_forked/ale/ale_linters/html/tidy.vim +++ b/sources_non_forked/ale/ale_linters/html/tidy.vim @@ -25,6 +25,7 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort " On macOS, old tidy (released on 31 Oct 2006) is installed. It does not " consider HTML5 so we should avoid it. let l:executable = ale#Var(a:buffer, 'html_tidy_executable') + if has('mac') && l:executable is# 'tidy' && exists('*exepath') \ && exepath(l:executable) is# '/usr/bin/tidy' return '' @@ -40,7 +41,6 @@ endfunction function! ale_linters#html#tidy#Handle(buffer, lines) abort " Matches patterns lines like the following: " line 7 column 5 - Warning: missing before - let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$' let l:output = [] diff --git a/sources_non_forked/ale/ale_linters/idris/idris.vim b/sources_non_forked/ale/ale_linters/idris/idris.vim index b3275b40..feac0f10 100644 --- a/sources_non_forked/ale/ale_linters/idris/idris.vim +++ b/sources_non_forked/ale/ale_linters/idris/idris.vim @@ -12,7 +12,7 @@ endfunction function! ale_linters#idris#idris#Handle(buffer, lines) abort " This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat - + " " Look for lines like the following: " foo.idr:2:6:When checking right hand side of main with expected type " bar.idr:11:11-13: @@ -30,6 +30,7 @@ function! ale_linters#idris#idris#Handle(buffer, lines) abort else let l:corrected_lines[-1] .= l:line endif + let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g') endif endfor diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 76445c18..63dcdd94 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -16,6 +16,7 @@ function! ale_linters#java#javac#GetImportPaths(buffer) abort endif let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) + if !empty(l:classpath_command) return l:classpath_command endif @@ -90,7 +91,6 @@ 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:col_pattern = '\v^(\s*\^)$' diff --git a/sources_non_forked/ale/ale_linters/java/javalsp.vim b/sources_non_forked/ale/ale_linters/java/javalsp.vim new file mode 100644 index 00000000..5d1a0c63 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/javalsp.vim @@ -0,0 +1,23 @@ +" Author: Horacio Sanson +" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac + +call ale#Set('java_javalsp_jar', 'javacs.jar') + +function! ale_linters#java#javalsp#Executable(buffer) abort + return 'java' +endfunction + +function! ale_linters#java#javalsp#Command(buffer) abort + let l:jar = ale#Var(a:buffer, 'java_javalsp_jar') + + return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main') +endfunction + +call ale#linter#Define('java', { +\ 'name': 'javalsp', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#java#javalsp#Executable', +\ 'command_callback': 'ale_linters#java#javalsp#Command', +\ 'language': 'java', +\ 'project_root_callback': 'ale#java#FindProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim index d555184e..cdb289c7 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -91,7 +91,6 @@ function! s:GetDetails(error) abort let l:detail = '' for l:extra_error in a:error.extra - if has_key(l:extra_error, 'message') for l:extra_message in l:extra_error.message let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr) @@ -105,7 +104,6 @@ function! s:GetDetails(error) abort endfor endfor endif - endfor return l:detail @@ -161,7 +159,6 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort endif call add(l:output, l:errorToAdd) - endfor return l:output diff --git a/sources_non_forked/ale/ale_linters/json/jsonlint.vim b/sources_non_forked/ale/ale_linters/json/jsonlint.vim index 75f47088..f01553d6 100644 --- a/sources_non_forked/ale/ale_linters/json/jsonlint.vim +++ b/sources_non_forked/ale/ale_linters/json/jsonlint.vim @@ -3,7 +3,6 @@ function! ale_linters#json#jsonlint#Handle(buffer, lines) abort " Matches patterns like the following: " line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'. - let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$' let l:output = [] diff --git a/sources_non_forked/ale/ale_linters/julia/languageserver.vim b/sources_non_forked/ale/ale_linters/julia/languageserver.vim new file mode 100644 index 00000000..cd2000de --- /dev/null +++ b/sources_non_forked/ale/ale_linters/julia/languageserver.vim @@ -0,0 +1,21 @@ +" Author: Bartolomeo Stellato +" Description: A language server for Julia + +" Set julia executable variable +call ale#Set('julia_executable', 'julia') + +function! ale_linters#julia#languageserver#GetCommand(buffer) abort + let l:julia_executable = ale#Var(a:buffer, 'julia_executable') + let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);' + + return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) +endfunction + +call ale#linter#Define('julia', { +\ 'name': 'languageserver', +\ 'lsp': 'stdio', +\ 'executable_callback': ale#VarFunc('julia_executable'), +\ 'command_callback': 'ale_linters#julia#languageserver#GetCommand', +\ 'language': 'julia', +\ 'project_root_callback': 'ale#julia#FindProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 00f94be5..4a993986 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -17,12 +17,14 @@ function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort 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 @@ -78,12 +80,13 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort endif let l:fname = '' + if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# '' let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' ' else " Find the src directory for files in this project. - let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + if !empty(l:project_root) let l:src_dir = l:project_root else @@ -93,6 +96,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort let l:fname .= expand(l:src_dir, 1) . ' ' endif + let l:fname .= ale#Escape(expand('#' . a:buffer . ':p')) let l:command .= l:kotlinc_opts . ' ' . l:fname @@ -124,6 +128,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort if l:buf_abspath isnot# l:curbuf_abspath continue endif + let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E' call add(l:output, { diff --git a/sources_non_forked/ale/ale_linters/make/checkmake.vim b/sources_non_forked/ale/ale_linters/make/checkmake.vim index 63c35db3..5ebdf91e 100644 --- a/sources_non_forked/ale/ale_linters/make/checkmake.vim +++ b/sources_non_forked/ale/ale_linters/make/checkmake.vim @@ -13,6 +13,7 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort \ 'text': l:match[3], \}) endfor + return l:output endfunction diff --git a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim index 88dfb9dd..4f8d48fa 100644 --- a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim +++ b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim @@ -24,10 +24,12 @@ function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort \ 'type': l:match[6] is# 'error' ? 'E' : 'W', \ 'text': l:match[7], \} + if l:match[3] isnot# '' let l:item.end_lnum = l:match[4] + 0 let l:item.end_col = l:match[5] + 0 endif + call add(l:output, l:item) endfor diff --git a/sources_non_forked/ale/ale_linters/nasm/nasm.vim b/sources_non_forked/ale/ale_linters/nasm/nasm.vim index 29d19e62..cb2119a6 100644 --- a/sources_non_forked/ale/ale_linters/nasm/nasm.vim +++ b/sources_non_forked/ale/ale_linters/nasm/nasm.vim @@ -8,10 +8,12 @@ function! ale_linters#nasm#nasm#GetCommand(buffer) abort " Note that NASM requires a trailing slash for the -I option. let l:separator = has('win32') ? '\' : '/' let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator + let l:output_null = has('win32') ? 'NUL' : '/dev/null' return '%e -X gnu -I ' . ale#Escape(l:path) \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ' %s' + \ . ' -o ' . l:output_null endfunction function! ale_linters#nasm#nasm#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/objc/clangd.vim b/sources_non_forked/ale/ale_linters/objc/clangd.vim index 161d2cc7..f090e6ce 100644 --- a/sources_non_forked/ale/ale_linters/objc/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objc/clangd.vim @@ -6,6 +6,7 @@ call ale#Set('objc_clangd_options', '') function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction diff --git a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim index 7e06796f..a09753be 100644 --- a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim @@ -6,6 +6,7 @@ call ale#Set('objcpp_clangd_options', '') function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction diff --git a/sources_non_forked/ale/ale_linters/perl/perl.vim b/sources_non_forked/ale/ale_linters/perl/perl.vim index d1dcbc9c..1cb20fa7 100644 --- a/sources_non_forked/ale/ale_linters/perl/perl.vim +++ b/sources_non_forked/ale/ale_linters/perl/perl.vim @@ -14,11 +14,16 @@ let s:begin_failed_skip_pattern = '\v' . join([ \], '|') function! ale_linters#perl#perl#Handle(buffer, lines) abort + if empty(a:lines) + return [] + endif + let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)' let l:output = [] let l:basename = expand('#' . a:buffer . ':t') let l:type = 'E' + if a:lines[-1] =~# 'syntax OK' let l:type = 'W' endif diff --git a/sources_non_forked/ale/ale_linters/puppet/languageserver.vim b/sources_non_forked/ale/ale_linters/puppet/languageserver.vim index a08b7653..a3060e65 100644 --- a/sources_non_forked/ale/ale_linters/puppet/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/puppet/languageserver.vim @@ -8,6 +8,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort " there's no requirement to have it, so fall back to the other possible " Puppet module directories let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json') + if !empty(l:root_path) return fnamemodify(l:root_path, ':h') endif @@ -17,6 +18,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort \ 'templates', \] let l:root_path = ale#path#FindNearestDirectory(a:buffer, l:test_path) + if !empty(l:root_path) return fnamemodify(l:root_path, ':h:h') endif diff --git a/sources_non_forked/ale/ale_linters/puppet/puppet.vim b/sources_non_forked/ale/ale_linters/puppet/puppet.vim index 4ca0dd55..0e37bdbd 100644 --- a/sources_non_forked/ale/ale_linters/puppet/puppet.vim +++ b/sources_non_forked/ale/ale_linters/puppet/puppet.vim @@ -1,11 +1,13 @@ " Author: Alexander Olofsson +call ale#Set('puppet_puppet_executable', 'puppet') +call ale#Set('puppet_puppet_options', '') + function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Matches patterns like the following: " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" " Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5) - let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)' let l:output = [] @@ -20,10 +22,16 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#puppet#puppet#GetCommand(buffer) abort + return '%e parser validate --color=false ' + \ . ale#Pad(ale#Var(a:buffer, 'puppet_puppet_options')) + \ . ' %t' +endfunction + call ale#linter#Define('puppet', { \ 'name': 'puppet', -\ 'executable': 'puppet', +\ 'executable_callback': ale#VarFunc('puppet_puppet_executable'), \ 'output_stream': 'stderr', -\ 'command': 'puppet parser validate --color=false %t', +\ 'command_callback': 'ale_linters#puppet#puppet#GetCommand', \ 'callback': 'ale_linters#puppet#puppet#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 358f51a4..9dcdacc6 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -5,12 +5,18 @@ call ale#Set('python_flake8_executable', 'flake8') call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_flake8_change_directory', 1) +call ale#Set('python_flake8_auto_pipenv', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' endfunction function! ale_linters#python#flake8#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) endif diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index b38ccdeb..0c90a3c7 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -5,8 +5,14 @@ call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_mypy_auto_pipenv', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/prospector.vim b/sources_non_forked/ale/ale_linters/python/prospector.vim index fff37147..b01cec87 100644 --- a/sources_non_forked/ale/ale_linters/python/prospector.vim +++ b/sources_non_forked/ale/ale_linters/python/prospector.vim @@ -1,6 +1,8 @@ " Author: chocoelho " Description: prospector linter python files +call ale#Set('python_prospector_auto_pipenv', 0) + let g:ale_python_prospector_executable = \ get(g:, 'ale_python_prospector_executable', 'prospector') @@ -10,6 +12,11 @@ let g:ale_python_prospector_options = let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#python#prospector#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_prospector_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim index de96363f..f0269585 100644 --- a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim @@ -4,8 +4,14 @@ call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pycodestyle_auto_pipenv', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/pyflakes.vim b/sources_non_forked/ale/ale_linters/python/pyflakes.vim index 86ff8773..091408d5 100644 --- a/sources_non_forked/ale/ale_linters/python/pyflakes.vim +++ b/sources_non_forked/ale/ale_linters/python/pyflakes.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyflakes_auto_pipenv', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index 9239f835..01c3cb37 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -5,8 +5,14 @@ call ale#Set('python_pylint_executable', 'pylint') 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) function! ale_linters#python#pylint#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/pyls.vim b/sources_non_forked/ale/ale_linters/python/pyls.vim index ae71f022..83fe8066 100644 --- a/sources_non_forked/ale/ale_linters/python/pyls.vim +++ b/sources_non_forked/ale/ale_linters/python/pyls.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyls_executable', 'pyls') call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyls_auto_pipenv', 0) function! ale_linters#python#pyls#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) endfunction diff --git a/sources_non_forked/ale/ale_linters/python/pyre.vim b/sources_non_forked/ale/ale_linters/python/pyre.vim index 5efef409..adc185f2 100644 --- a/sources_non_forked/ale/ale_linters/python/pyre.vim +++ b/sources_non_forked/ale/ale_linters/python/pyre.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyre_executable', 'pyre') call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyre_auto_pipenv', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre']) endfunction diff --git a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim index b660627f..8504738b 100644 --- a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim +++ b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim @@ -8,6 +8,7 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$' let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] + for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), diff --git a/sources_non_forked/ale/ale_linters/ruby/brakeman.vim b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim index 85cfc184..122e0b5b 100644 --- a/sources_non_forked/ale/ale_linters/ruby/brakeman.vim +++ b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim @@ -1,8 +1,9 @@ " Author: Eddie Lebow https://github.com/elebow " Description: Brakeman, a static analyzer for Rails security -let g:ale_ruby_brakeman_options = -\ get(g:, 'ale_ruby_brakeman_options', '') +call ale#Set('ruby_brakeman_options', '') +call ale#Set('ruby_brakeman_executable', 'brakeman') +call ale#Set('ruby_brakeman_options', '') function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort let l:output = [] @@ -33,14 +34,17 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort return '' endif - return 'brakeman -f json -q ' + let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman') + \ . ' -f json -q ' \ . ale#Var(a:buffer, 'ruby_brakeman_options') \ . ' -p ' . ale#Escape(l:rails_root) endfunction call ale#linter#Define('ruby', { \ 'name': 'brakeman', -\ 'executable': 'brakeman', +\ 'executable_callback': ale#VarFunc('ruby_brakeman_executable'), \ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand', \ 'callback': 'ale_linters#ruby#brakeman#Handle', \ 'lint_file': 1, 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 4ba1f3fe..20cadca8 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 @@ -22,26 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'ruby_rails_best_practices_executable') -endfunction - function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort - let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rails_best_practices' - \ : '' - let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if l:rails_root is? '' return '' 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' : '' - return ale#Escape(l:executable) . l:exec_args + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options') \ . ale#Escape(l:rails_root) @@ -50,7 +42,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'rails_best_practices', -\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable', +\ 'executable_callback': ale#VarFunc('ruby_rails_best_practices_executable'), \ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand', \ 'callback': 'ale_linters#ruby#rails_best_practices#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim index aa5d8d70..eefc4ecf 100644 --- a/sources_non_forked/ale/ale_linters/ruby/reek.vim +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -3,6 +3,8 @@ call ale#Set('ruby_reek_show_context', 0) 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 @@ -12,18 +14,23 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort return '' endif - return 'reek --version' + 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) + 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]) \ ? ' --stdin-filename %s' \ : '' - return 'reek -f json --no-progress --no-color' + return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') + \ . ' -f json --no-progress --no-color' \ . l:display_name_args endfunction @@ -62,7 +69,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', -\ 'executable': 'reek', +\ 'executable_callback': ale#VarFunc('ruby_reek_executable'), \ 'command_chain': [ \ {'callback': 'ale_linters#ruby#reek#VersionCheck'}, \ {'callback': 'ale_linters#ruby#reek#GetCommand'}, diff --git a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim index 777f457a..45218394 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim @@ -1,13 +1,13 @@ " Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow " Description: RuboCop, a code style analyzer for Ruby files -function! ale_linters#ruby#rubocop#GetCommand(buffer) abort - let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rubocop' - \ : '' +call ale#Set('ruby_rubocop_executable', 'rubocop') +call ale#Set('ruby_rubocop_options', '') - return ale#Escape(l:executable) . l:exec_args +function! ale_linters#ruby#rubocop#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) @@ -55,7 +55,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'rubocop', -\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable', +\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'), \ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand', \ 'callback': 'ale_linters#ruby#rubocop#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/solargraph.vim b/sources_non_forked/ale/ale_linters/ruby/solargraph.vim new file mode 100644 index 00000000..7ca0399f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/solargraph.vim @@ -0,0 +1,20 @@ +" Author: Horacio Sanson - https://github.com/hsanson +" Description: Solargraph Language Server https://solargraph.org/ +" +" Author: Devon Meunier +" Description: updated to use stdio + +call ale#Set('ruby_solargraph_executable', 'solargraph') + +function! ale_linters#ruby#solargraph#GetCommand(buffer) abort + return '%e' . ale#Pad('stdio') +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'solargraph', +\ 'lsp': 'stdio', +\ 'language': 'ruby', +\ 'executable_callback': ale#VarFunc('ruby_solargraph_executable'), +\ 'command_callback': 'ale_linters#ruby#solargraph#GetCommand', +\ 'project_root_callback': 'ale#ruby#FindProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index e6c3870a..5aefe72c 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -42,6 +42,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort \ && ale#semver#GTE(l:version, [0, 22, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') + if !empty(l:include_features) let l:include_features = ' --features ' . ale#Escape(l:include_features) endif @@ -59,6 +60,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort endif let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior') + if l:default_feature_behavior is# 'all' let l:include_features = '' let l:default_feature = ' --all-features' diff --git a/sources_non_forked/ale/ale_linters/scala/sbtserver.vim b/sources_non_forked/ale/ale_linters/scala/sbtserver.vim new file mode 100644 index 00000000..694241d7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scala/sbtserver.vim @@ -0,0 +1,31 @@ +" Author: ophirr33 +" Description: TCP lsp client for sbt Server + +call ale#Set('scala_sbtserver_address', '127.0.0.1:4273') +call ale#Set('scala_sbtserver_project_root', '') + +function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort + let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root') + + if l:project_root is? '' + let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt') + + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + endif + + return l:project_root +endfunction + +function! ale_linters#scala#sbtserver#GetAddress(buffer) abort + let l:address = ale#Var(a:buffer, 'scala_sbtserver_address') + + return l:address +endfunction + +call ale#linter#Define('scala', { +\ 'name': 'sbtserver', +\ 'lsp': 'socket', +\ 'address_callback': 'ale_linters#scala#sbtserver#GetAddress', +\ 'language': 'scala', +\ 'project_root_callback': 'ale_linters#scala#sbtserver#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/scala/scalastyle.vim b/sources_non_forked/ale/ale_linters/scala/scalastyle.vim index 3232d70b..42228cf6 100644 --- a/sources_non_forked/ale/ale_linters/scala/scalastyle.vim +++ b/sources_non_forked/ale/ale_linters/scala/scalastyle.vim @@ -53,12 +53,14 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort \ 'scalastyle_config.xml', \ 'scalastyle-config.xml' \] + for l:config in l:potential_configs let l:scalastyle_config = ale#path#ResolveLocalPath( \ a:buffer, \ l:config, \ '' \) + if !empty(l:scalastyle_config) break endif diff --git a/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim b/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim index 7a482307..bfa4bc05 100644 --- a/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim +++ b/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim @@ -3,6 +3,7 @@ function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer) + return 'sml -m ' . l:cmfile . ' < /dev/null' endfunction diff --git a/sources_non_forked/ale/ale_linters/solidity/solhint.vim b/sources_non_forked/ale/ale_linters/solidity/solhint.vim index 519fd49d..8ea33e07 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solhint.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solhint.vim @@ -4,7 +4,6 @@ function! ale_linters#solidity#solhint#Handle(buffer, lines) abort " Matches patterns like the following: " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) - let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' let l:output = [] diff --git a/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim b/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim index 183ea9e7..05fe581b 100644 --- a/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim +++ b/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim @@ -15,7 +15,6 @@ function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort " Line 5: W Found constant "bepa" which is also a variable. " Line 13: E Wrong number of arguments (3) to "set" " Line 93: N Close brace not aligned with line 90 (4 0) - let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$' let l:output = [] diff --git a/sources_non_forked/ale/ale_linters/terraform/tflint.vim b/sources_non_forked/ale/ale_linters/terraform/tflint.vim index b8e9c96d..0d77835a 100644 --- a/sources_non_forked/ale/ale_linters/terraform/tflint.vim +++ b/sources_non_forked/ale/ale_linters/terraform/tflint.vim @@ -40,6 +40,7 @@ function! ale_linters#terraform#tflint#GetCommand(buffer) abort endif let l:opts = ale#Var(a:buffer, 'terraform_tflint_options') + if !empty(l:opts) let l:cmd .= ' ' . l:opts endif diff --git a/sources_non_forked/ale/ale_linters/tex/lacheck.vim b/sources_non_forked/ale/ale_linters/tex/lacheck.vim index 38135b85..5e5a94f1 100644 --- a/sources_non_forked/ale/ale_linters/tex/lacheck.vim +++ b/sources_non_forked/ale/ale_linters/tex/lacheck.vim @@ -8,7 +8,6 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort " " "book.tex", line 37: possible unwanted space at "{" " "book.tex", line 38: missing `\ ' after "etc." - let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$' let l:output = [] diff --git a/sources_non_forked/ale/ale_linters/thrift/thrift.vim b/sources_non_forked/ale/ale_linters/thrift/thrift.vim index ac1f69fc..36a8656e 100644 --- a/sources_non_forked/ale/ale_linters/thrift/thrift.vim +++ b/sources_non_forked/ale/ale_linters/thrift/thrift.vim @@ -2,7 +2,7 @@ call ale#Set('thrift_thrift_executable', 'thrift') call ale#Set('thrift_thrift_generators', ['cpp']) -call ale#Set('thrift_thrift_includes', []) +call ale#Set('thrift_thrift_includes', ['.']) call ale#Set('thrift_thrift_options', '-strict') function! ale_linters#thrift#thrift#GetCommand(buffer) abort @@ -42,12 +42,14 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort let l:line = a:lines[l:index] let l:match = matchlist(l:line, l:pattern) + if empty(l:match) let l:index += 1 continue endif let l:severity = l:match[1] + if l:severity is# 'WARNING' let l:type = 'W' else @@ -57,6 +59,7 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort " If our text looks like "(last token was ';')", the *next* line " should contain a more descriptive error message. let l:text = l:match[4] + if l:text =~# '\(last token was .*\)' let l:index += 1 let l:text = get(a:lines, l:index, 'Unknown error ' . l:text) diff --git a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim index f4e111ee..3da44206 100644 --- a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim +++ b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim @@ -25,7 +25,13 @@ endfunction function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort let l:dir = s:GetALEProjectDir(a:buffer) - return ale#path#CdString(l:dir) . '%e .' + let l:temp_dir = ale#engine#CreateDirectory(a:buffer) + let l:temp_file = l:temp_dir . '/example.vim' + + let l:lines = getbufline(a:buffer, 1, '$') + call ale#util#Writefile(a:buffer, l:lines, l:temp_file) + + return ale#path#CdString(l:dir) . '%e ' . ale#Escape(l:temp_dir) endfunction function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort @@ -34,15 +40,17 @@ function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+) (.+)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:filename = ale#path#GetAbsPath(l:dir, l:match[1]) - - if bufnr(l:filename) is a:buffer - call add(l:output, { - \ 'lnum': l:match[2], - \ 'text': l:match[3], - \ 'type': 'W', - \}) + " Ignore trailing whitespace errors if we've turned them off. + if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + \&& l:match[3] is# 'Trailing whitespace' + continue endif + + call add(l:output, { + \ 'lnum': l:match[2], + \ 'text': l:match[3], + \ 'type': 'W', + \}) endfor return l:output @@ -53,5 +61,5 @@ call ale#linter#Define('vim', { \ 'executable_callback': 'ale_linters#vim#ale_custom_linting_rules#GetExecutable', \ 'command_callback': 'ale_linters#vim#ale_custom_linting_rules#GetCommand', \ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle', -\ 'lint_file': 1, +\ 'read_buffer': 0, \}) diff --git a/sources_non_forked/ale/ale_linters/xml/xmllint.vim b/sources_non_forked/ale/ale_linters/xml/xmllint.vim index a0f97c3a..59f43d16 100644 --- a/sources_non_forked/ale/ale_linters/xml/xmllint.vim +++ b/sources_non_forked/ale/ale_linters/xml/xmllint.vim @@ -25,9 +25,9 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort let l:output = [] for l:line in a:lines - " Parse error/warning lines let l:match_message = matchlist(l:line, l:pattern_message) + if !empty(l:match_message) let l:line = l:match_message[2] + 0 let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E' @@ -44,13 +44,13 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort " Parse column position let l:match_column_token = matchlist(l:line, l:pattern_column_token) + if !empty(l:output) && !empty(l:match_column_token) let l:previous = l:output[len(l:output) - 1] let l:previous['col'] = len(l:match_column_token[0]) continue endif - endfor return l:output diff --git a/sources_non_forked/ale/ale_linters/yang/yang_lsp.vim b/sources_non_forked/ale/ale_linters/yang/yang_lsp.vim index a60e9113..45776f98 100644 --- a/sources_non_forked/ale/ale_linters/yang/yang_lsp.vim +++ b/sources_non_forked/ale/ale_linters/yang/yang_lsp.vim @@ -2,6 +2,7 @@ call ale#Set('yang_lsp_executable', 'yang-language-server') function! ale_linters#yang#yang_lsp#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'yang.settings') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 51c0ce83..41d78753 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -27,7 +27,7 @@ let s:getcmdwintype_exists = exists('*getcmdwintype') function! ale#ShouldDoNothing(buffer) abort " The checks are split into separate if statements to make it possible to " profile each check individually with Vim's profiling tools. - + " " Do nothing if ALE is disabled. if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0)) return 1 @@ -62,6 +62,11 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif + " Don't start linting and so on when an operator is pending. + if ale#util#Mode(1) is# 'no' + return 1 + endif + " Do nothing if running in the sandbox. if ale#util#InSandbox() return 1 diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 87798520..a1bfd0b7 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -101,6 +101,14 @@ function! ale#assert#LSPProject(expected_root) abort AssertEqual a:expected_root, l:root endfunction +function! ale#assert#LSPAddress(expected_address) abort + let l:buffer = bufnr('') + let l:linter = s:GetLinter() + let l:address = ale#util#GetFunction(l:linter.address_callback)(l:buffer) + + AssertEqual a:expected_address, l:address +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. @@ -141,6 +149,7 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage() command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject() + command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress() endfunction function! ale#assert#TearDownLinterTest() abort @@ -171,6 +180,10 @@ function! ale#assert#TearDownLinterTest() abort delcommand AssertLSPProject endif + if exists(':AssertLSPAddress') + delcommand AssertLSPAddress + endif + if exists('g:dir') call ale#test#RestoreDirectory() endif diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index 5ec62011..ce59ae31 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -54,7 +54,8 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort call add(l:previous_options, l:option) " Check if cflag contained a '-' and should not have been splitted let l:option_list = split(l:option, '\zs') - if l:option_list[-1] isnot# ' ' + + if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' continue endif diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index abe0f56e..9dd913f5 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -39,10 +39,14 @@ let s:LSP_COMPLETION_COLOR_KIND = 16 let s:LSP_COMPLETION_FILE_KIND = 17 let s:LSP_COMPLETION_REFERENCE_KIND = 18 +let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$' + " Regular expressions for checking the characters in the line before where " the insert cursor is. If one of these matches, we'll check for completions. let s:should_complete_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', +\ 'clojure': s:lisp_regex, +\ 'lisp': s:lisp_regex, \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', \} @@ -75,6 +79,7 @@ endfunction " Check if we should look for completions for a language. function! ale#completion#GetPrefix(filetype, line, column) abort let l:regex = s:GetFiletypeValue(s:should_complete_map, a:filetype) + " The column we're using completions for is where we are inserting text, " like so: " abc @@ -93,14 +98,15 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort return '' endfunction -function! ale#completion#Filter(buffer, suggestions, prefix) abort +function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words') + let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype) " For completing... " foo. " ^ " We need to include all of the given suggestions. - if a:prefix is# '.' + if index(l:triggers, a:prefix) >= 0 let l:filtered_suggestions = a:suggestions else let l:filtered_suggestions = [] @@ -259,7 +265,7 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort call add(l:documentationParts, l:part.text) endfor - if l:suggestion.kind is# 'clasName' + if l:suggestion.kind is# 'className' let l:kind = 'f' elseif l:suggestion.kind is# 'parameterName' let l:kind = 'f' @@ -354,17 +360,23 @@ function! ale#completion#ParseLSPCompletions(response) abort let l:kind = 'v' endif + let l:doc = get(l:item, 'documentation', '') + + if type(l:doc) is v:t_dict && has_key(l:doc, 'value') + let l:doc = l:doc.value + endif + call add(l:results, { \ 'word': l:word, \ 'kind': l:kind, \ 'icase': 1, \ 'menu': get(l:item, 'detail', ''), - \ 'info': get(l:item, 'documentation', ''), + \ 'info': (type(l:doc) is v:t_string ? l:doc : ''), \}) endfor if has_key(l:info, 'prefix') - return ale#completion#Filter(l:buffer, l:results, l:info.prefix) + return ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix) endif return l:results @@ -385,6 +397,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort if l:command is# 'completions' let l:names = ale#completion#Filter( \ l:buffer, + \ &filetype, \ ale#completion#ParseTSServerCompletions(a:response), \ b:ale_completion_info.prefix, \)[: g:ale_completion_max_suggestions - 1] diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index 73dbebb2..c3b48ca3 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -1,4 +1,6 @@ +scriptencoding utf-8 " Author: w0rp +" Author: João Paulo S. de Souza " Description: Echoes lint message for the current line, if any " Controls the milliseconds delay before echoing a message. @@ -37,12 +39,11 @@ function! ale#cursor#TruncatedEcho(original_message) abort endtry endfunction -function! s:FindItemAtCursor() abort - let l:buf = bufnr('') - let l:info = get(g:ale_buffer_info, l:buf, {}) +function! s:FindItemAtCursor(buffer) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) let l:loclist = get(l:info, 'loclist', []) let l:pos = getcurpos() - let l:index = ale#util#BinarySearch(l:loclist, l:buf, l:pos[1], l:pos[2]) + let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2]) let l:loc = l:index >= 0 ? l:loclist[l:index] : {} return [l:info, l:loc] @@ -56,42 +57,55 @@ function! s:StopCursorTimer() abort endfunction function! ale#cursor#EchoCursorWarning(...) abort - if !g:ale_echo_cursor + let l:buffer = bufnr('') + + if !g:ale_echo_cursor && !g:ale_cursor_detail return endif " Only echo the warnings in normal mode, otherwise we will get problems. - if mode() isnot# 'n' + if mode(1) isnot# 'n' return endif - if ale#ShouldDoNothing(bufnr('')) + if ale#ShouldDoNothing(l:buffer) return endif - let l:buffer = bufnr('') - let [l:info, l:loc] = s:FindItemAtCursor() + let [l:info, l:loc] = s:FindItemAtCursor(l:buffer) - if !empty(l:loc) - let l:format = ale#Var(l:buffer, 'echo_msg_format') - let l:msg = ale#GetLocItemMessage(l:loc, l:format) - call ale#cursor#TruncatedEcho(l:msg) - let l:info.echoed = 1 - elseif get(l:info, 'echoed') - " We'll only clear the echoed message when moving off errors once, - " so we don't continually clear the echo line. - execute 'echo' - let l:info.echoed = 0 + if g:ale_echo_cursor + if !empty(l:loc) + let l:format = ale#Var(l:buffer, 'echo_msg_format') + let l:msg = ale#GetLocItemMessage(l:loc, l:format) + call ale#cursor#TruncatedEcho(l:msg) + let l:info.echoed = 1 + elseif get(l:info, 'echoed') + " We'll only clear the echoed message when moving off errors once, + " so we don't continually clear the echo line. + execute 'echo' + let l:info.echoed = 0 + endif + endif + + if g:ale_cursor_detail + if !empty(l:loc) + call s:ShowCursorDetailForItem(l:loc, {'stay_here': 1}) + else + call ale#preview#CloseIfTypeMatches('ale-preview') + endif endif endfunction function! ale#cursor#EchoCursorWarningWithDelay() abort - if !g:ale_echo_cursor + let l:buffer = bufnr('') + + if !g:ale_echo_cursor && !g:ale_cursor_detail return endif " Only echo the warnings in normal mode, otherwise we will get problems. - if mode() isnot# 'n' + if mode(1) isnot# 'n' return endif @@ -104,7 +118,7 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort " we should echo something. Otherwise we can end up doing processing " the echo message far too frequently. if l:pos != s:last_pos - let l:delay = ale#Var(bufnr(''), 'echo_delay') + let l:delay = ale#Var(l:buffer, 'echo_delay') let s:last_pos = l:pos let s:cursor_timer = timer_start( @@ -114,24 +128,37 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort endif endfunction +function! s:ShowCursorDetailForItem(loc, options) abort + let l:stay_here = get(a:options, 'stay_here', 0) + + let s:last_detailed_line = line('.') + let l:message = get(a:loc, 'detail', a:loc.text) + let l:lines = split(l:message, "\n") + call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) + + " Clear the echo message if we manually displayed details. + if !l:stay_here + execute 'echo' + endif +endfunction + function! ale#cursor#ShowCursorDetail() abort + let l:buffer = bufnr('') + " Only echo the warnings in normal mode, otherwise we will get problems. if mode() isnot# 'n' return endif - if ale#ShouldDoNothing(bufnr('')) + if ale#ShouldDoNothing(l:buffer) return endif call s:StopCursorTimer() - let [l:info, l:loc] = s:FindItemAtCursor() + let [l:info, l:loc] = s:FindItemAtCursor(l:buffer) if !empty(l:loc) - let l:message = get(l:loc, 'detail', l:loc.text) - - call ale#preview#Show(split(l:message, "\n")) - execute 'echo' + call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0}) endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index e68d279d..984a4f9d 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -49,7 +49,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort for l:item in l:result let l:filename = ale#path#FromURI(l:item.uri) let l:line = l:item.range.start.line + 1 - let l:column = l:item.range.start.character + let l:column = l:item.range.start.character + 1 call ale#util#Open(l:filename, l:line, l:column, l:options) break diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index fdf883f5..05db0e49 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -18,6 +18,22 @@ if !has_key(s:, 'executable_cache_map') let s:executable_cache_map = {} endif + +function! ale#engine#CleanupEveryBuffer() abort + for l:key in keys(g:ale_buffer_info) + " The key could be a filename or a buffer number, so try and + " convert it to a number. We need a number for the other + " functions. + let l:buffer = str2nr(l:key) + + if l:buffer > 0 + " Stop all jobs and clear the results for everything, and delete + " all of the data we stored for the buffer. + call ale#engine#Cleanup(l:buffer) + endif + endfor +endfunction + function! ale#engine#ResetExecutableCache() abort let s:executable_cache_map = {} endfunction @@ -231,6 +247,7 @@ function! s:HandleExit(job_id, exit_code) abort if l:next_chain_index < len(get(l:linter, 'command_chain', [])) call s:InvokeChain(l:buffer, l:executable, l:linter, l:next_chain_index, l:output) + return endif @@ -595,9 +612,8 @@ function! ale#engine#ProcessChain(buffer, linter, chain_index, input) abort \) endif + " If we have a command to run, execute that. if !empty(l:command) - " We hit a command to run, so we'll execute that - " The chain item can override the output_stream option. if has_key(l:chain_item, 'output_stream') let l:output_stream = l:chain_item.output_stream diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index 300aefcc..e48ad488 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -131,13 +131,17 @@ function! ale#events#Init() abort autocmd InsertLeave * call ale#Queue(0) endif - if g:ale_echo_cursor + if g:ale_echo_cursor || g:ale_cursor_detail autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif " Look for a warning to echo as soon as we leave Insert mode. " The script's position variable used when moving the cursor will " not be changed here. autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif endif + + if g:ale_close_preview_on_insert + autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif + endif endif augroup END endfunction diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index 4d82b367..03652ecf 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -30,7 +30,14 @@ function! ale#fix#ApplyQueuedFixes() abort call winrestview(l:save) endif - call setline(1, l:data.output) + " If the file is in DOS mode, we have to remove carriage returns from + " the ends of lines before calling setline(), or we will see them + " twice. + let l:lines_to_set = getbufvar(l:buffer, '&fileformat') is# 'dos' + \ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')') + \ : l:data.output + + call setline(1, l:lines_to_set) if l:data.should_save if empty(&buftype) @@ -71,6 +78,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort if l:data.lines_before != l:lines call remove(g:ale_fix_buffer_data, a:buffer) execute 'echoerr ''The file was changed before fixing finished''' + return endif endif diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index dfcdc98f..76cce87f 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -145,6 +145,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files imports with goimports.', \ }, +\ 'gomod': { +\ 'function': 'ale#fixers#gomod#Fix', +\ 'suggested_filetypes': ['gomod'], +\ 'description': 'Fix Go module files with go mod edit -fmt.', +\ }, \ 'tslint': { \ 'function': 'ale#fixers#tslint#Fix', \ 'suggested_filetypes': ['typescript'], @@ -180,6 +185,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Refactor Haskell files with stylish-haskell.', \ }, +\ 'ocamlformat': { +\ 'function': 'ale#fixers#ocamlformat#Fix', +\ 'suggested_filetypes': ['ocaml'], +\ 'description': 'Fix OCaml files with ocamlformat.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], @@ -190,6 +200,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['sh'], \ 'description': 'Fix sh files with shfmt.', \ }, +\ 'sqlfmt': { +\ 'function': 'ale#fixers#sqlfmt#Fix', +\ 'suggested_filetypes': ['sql'], +\ 'description': 'Fix SQL files with sqlfmt.', +\ }, \ 'google_java_format': { \ 'function': 'ale#fixers#google_java_format#Fix', \ 'suggested_filetypes': ['java'], @@ -225,6 +240,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['dart'], \ 'description': 'Fix Dart files with dartfmt.', \ }, +\ 'xmllint': { +\ 'function': 'ale#fixers#xmllint#Fix', +\ 'suggested_filetypes': ['xml'], +\ 'description': 'Fix XML files with xmllint.', +\ }, +\ 'uncrustify': { +\ 'function': 'ale#fixers#uncrustify#Fix', +\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ], +\ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.', +\ }, \} " 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 36f47510..ea5b2a63 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -25,7 +25,7 @@ endfunction function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort " If the output is an error message, don't use it. for l:line in a:output[:10] - if l:line =~# '^Error:' + if l:line =~# '\v^Error:|^Could not connect' return [] endif endfor diff --git a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim index 64c6ba81..33ce0af3 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim @@ -17,6 +17,7 @@ function! ale#fixers#fixjson#Fix(buffer) abort let l:command = l:executable . ' --stdin-filename ' . l:filename let l:options = ale#Var(a:buffer, 'json_fixjson_options') + if l:options isnot# '' let l:command .= ' ' . l:options endif diff --git a/sources_non_forked/ale/autoload/ale/fixers/gomod.vim b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim new file mode 100644 index 00000000..68895f9b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim @@ -0,0 +1,10 @@ +call ale#Set('go_go_executable', 'go') + +function! ale#fixers#gomod#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_go_executable') + + return { + \ 'command': ale#Escape(l:executable) . ' mod edit -fmt %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/importjs.vim b/sources_non_forked/ale/autoload/ale/fixers/importjs.vim index 50d3d74e..b5487b2c 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/importjs.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/importjs.vim @@ -5,6 +5,7 @@ call ale#Set('javascript_importjs_executable', 'importjs') function! ale#fixers#importjs#ProcessOutput(buffer, output) abort let l:result = ale#util#FuzzyJSONDecode(a:output, []) + return split(get(l:result, 'fileContent', ''), "\n") endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim new file mode 100644 index 00000000..fac142aa --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim @@ -0,0 +1,18 @@ +" Author: Stephen Lumenta <@sbl> +" Description: Integration of ocamlformat with ALE. + +call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat') +call ale#Set('ocaml_ocamlformat_options', '') + +function! ale#fixers#ocamlformat#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') + let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --inplace' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim index 26b8e5de..5c59e262 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim @@ -14,6 +14,7 @@ endfunction function! ale#fixers#php_cs_fixer#Fix(buffer) abort let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer) + return { \ 'command': ale#Escape(l:executable) \ . ' ' . ale#Var(a:buffer, 'php_cs_fixer_options') diff --git a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim index 487f369a..f14b8406 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim @@ -18,6 +18,7 @@ function! ale#fixers#phpcbf#Fix(buffer) abort let l:standard_option = !empty(l:standard) \ ? '--standard=' . l:standard \ : '' + return { \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -' \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim b/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim index 81f34e89..bf36e486 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim @@ -4,6 +4,7 @@ if !exists('g:ale_puppet_puppetlint_executable') let g:ale_puppet_puppetlint_executable = 'puppet-lint' endif + if !exists('g:ale_puppet_puppetlint_options') let g:ale_puppet_puppetlint_options = '' endif diff --git a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim index 35569b19..a4613817 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim @@ -1,16 +1,15 @@ +call ale#Set('ruby_rubocop_options', '') +call ale#Set('ruby_rubocop_executable', 'rubocop') + function! ale#fixers#rubocop#GetCommand(buffer) abort - let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rubocop' - \ : '' + let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') - return ale#Escape(l:executable) . l:exec_args + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --auto-correct %t' - endfunction function! ale#fixers#rubocop#Fix(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/fixers/scalafmt.vim b/sources_non_forked/ale/autoload/ale/fixers/scalafmt.vim index 07d28275..dd0e7745 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/scalafmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/scalafmt.vim @@ -15,7 +15,6 @@ function! ale#fixers#scalafmt#GetCommand(buffer) abort return ale#Escape(l:executable) . l:exec_args \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t' - endfunction function! ale#fixers#scalafmt#Fix(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim index 882cf3a4..06e8da57 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim @@ -5,13 +5,27 @@ scriptencoding utf-8 call ale#Set('sh_shfmt_executable', 'shfmt') call ale#Set('sh_shfmt_options', '') +function! s:DefaultOption(buffer) abort + if getbufvar(a:buffer, '&expandtab') == 0 + " Tab is used by default + return '' + endif + + let l:tabsize = getbufvar(a:buffer, '&shiftwidth') + + if l:tabsize == 0 + let l:tabsize = getbufvar(a:buffer, '&tabstop') + endif + + return ' -i ' . l:tabsize +endfunction + function! ale#fixers#shfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable') let l:options = ale#Var(a:buffer, 'sh_shfmt_options') return { \ 'command': ale#Escape(l:executable) - \ . (empty(l:options) ? '' : ' ' . l:options) + \ . (empty(l:options) ? s:DefaultOption(a:buffer) : ' ' . l:options) \} - endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/sqlfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/sqlfmt.vim new file mode 100644 index 00000000..c88a8ec2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/sqlfmt.vim @@ -0,0 +1,13 @@ +call ale#Set('sql_sqlfmt_executable', 'sqlfmt') +call ale#Set('sql_sqlfmt_options', '') + +function! ale#fixers#sqlfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sql_sqlfmt_executable') + let l:options = ale#Var(a:buffer, 'sql_sqlfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w' + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim b/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim new file mode 100644 index 00000000..ffec18ef --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim @@ -0,0 +1,16 @@ +" Author: Derek P Sifford +" Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA. + +call ale#Set('c_uncrustify_executable', 'uncrustify') +call ale#Set('c_uncrustify_options', '') + +function! ale#fixers#uncrustify#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable') + let l:options = ale#Var(a:buffer, 'c_uncrustify_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' --no-backup' + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/xmllint.vim b/sources_non_forked/ale/autoload/ale/fixers/xmllint.vim new file mode 100644 index 00000000..b14ffd36 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/xmllint.vim @@ -0,0 +1,29 @@ +" Author: Cyril Roelandt +" Description: Integration of xmllint with ALE. + +call ale#Set('xml_xmllint_executable', 'xmllint') +call ale#Set('xml_xmllint_options', '') +call ale#Set('xml_xmllint_indentsize', 2) + +function! ale#fixers#xmllint#Fix(buffer) abort + let l:executable = ale#Escape(ale#Var(a:buffer, 'xml_xmllint_executable')) + let l:filename = ale#Escape(bufname(a:buffer)) + let l:command = l:executable . ' --format ' . l:filename + + let l:indent = ale#Var(a:buffer, 'xml_xmllint_indentsize') + + if l:indent isnot# '' + let l:env = ale#Env('XMLLINT_INDENT', repeat(' ', l:indent)) + let l:command = l:env . l:command + endif + + let l:options = ale#Var(a:buffer, 'xml_xmllint_options') + + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return { + \ 'command': l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/go.vim b/sources_non_forked/ale/autoload/ale/go.vim new file mode 100644 index 00000000..a166480a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/go.vim @@ -0,0 +1,27 @@ +" Author: Horacio Sanson https://github.com/hsanson +" Description: Functions for integrating with Go tools + +" Find the nearest dir listed in GOPATH and assume it the root of the go +" project. +function! ale#go#FindProjectRoot(buffer) abort + let l:sep = has('win32') ? ';' : ':' + + let l:filename = ale#path#Simplify(expand('#' . a:buffer . ':p')) + + for l:name in split($GOPATH, l:sep) + let l:path_dir = ale#path#Simplify(l:name) + + " Use the directory from GOPATH if the current filename starts with it. + if l:filename[: len(l:path_dir) - 1] is? l:path_dir + return l:path_dir + endif + endfor + + let l:default_go_path = ale#path#Simplify(expand('~/go')) + + if isdirectory(l:default_go_path) + return l:default_go_path + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index bc10ec21..eda033e4 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -99,6 +99,13 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort \}] endif + if a:lines == ['Could not connect'] + return [{ + \ 'lnum': 1, + \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', + \}] + endif + " Matches patterns line the following: " " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle] diff --git a/sources_non_forked/ale/autoload/ale/handlers/gawk.vim b/sources_non_forked/ale/autoload/ale/handlers/gawk.vim index 942bc2b2..50bc4c45 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/gawk.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/gawk.vim @@ -9,9 +9,11 @@ function! ale#handlers#gawk#HandleGawkFormat(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:ecode = 'E' + if l:match[2] is? 'warning:' let l:ecode = 'W' endif + call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': 0, diff --git a/sources_non_forked/ale/autoload/ale/handlers/go.vim b/sources_non_forked/ale/autoload/ale/handlers/go.vim index 224df664..f17cd862 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/go.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/go.vim @@ -21,5 +21,6 @@ function! ale#handlers#go#Handler(buffer, lines) abort \ 'type': 'E', \}) endfor + return l:output endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ols.vim b/sources_non_forked/ale/autoload/ale/handlers/ols.vim index 1dda7f92..74130a26 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ols.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ols.vim @@ -3,6 +3,7 @@ function! ale#handlers#ols#GetExecutable(buffer) abort let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' + return ale#node#FindExecutable(a:buffer, l:ols_setting, [ \ 'node_modules/.bin/ocaml-language-server', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/pony.vim b/sources_non_forked/ale/autoload/ale/handlers/pony.vim index 0ac18e76..ea84ac4b 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/pony.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/pony.vim @@ -14,7 +14,6 @@ endfunction function! ale#handlers#pony#HandlePonycFormat(buffer, lines) abort " Look for lines like the following. " /home/code/pony/classes/Wombat.pony:22:30: can't lookup private fields from outside the type - let l:pattern = '\v^([^:]+):(\d+):(\d+)?:? (.+)$' let l:output = [] diff --git a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim index c136789c..84e331ed 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim @@ -6,15 +6,18 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " element. let l:res = json_decode(join(a:lines))[0] let l:output = [] + for l:err in l:res.errors let l:item = { \ 'text': l:err.message, \ 'type': 'W', \ 'code': l:err.validator, \} + if has_key(l:err, 'startPosition') let l:item.lnum = l:err.startPosition.lineNum let l:item.col = l:err.startPosition.offset + 1 + if has_key(l:err, 'endPosition') let l:item.end_lnum = l:err.endPosition.lineNum let l:item.end_col = l:err.endPosition.offset @@ -28,29 +31,35 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " Adjust column number for multibyte string let l:line = getline(l:item.lnum) + if l:line is# '' let l:line = l:err.sentence endif + let l:line = split(l:line, '\zs') if l:item.col >= 2 let l:col = 0 + for l:strlen in map(l:line[0:(l:item.col - 2)], 'strlen(v:val)') let l:col = l:col + l:strlen endfor + let l:item.col = l:col + 1 endif if has_key(l:item, 'end_col') let l:col = 0 + for l:strlen in map(l:line[0:(l:item.end_col - 1)], 'strlen(v:val)') let l:col = l:col + l:strlen endfor + let l:item.end_col = l:col endif call add(l:output, l:item) endfor + return l:output endfunction - diff --git a/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim b/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim deleted file mode 100644 index f6367cf5..00000000 --- a/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim +++ /dev/null @@ -1,6 +0,0 @@ -call ale#Set('ruby_rubocop_options', '') -call ale#Set('ruby_rubocop_executable', 'rubocop') - -function! ale#handlers#rubocop#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'ruby_rubocop_executable') -endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ruby.vim b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim index 555c13b1..c28b8b75 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim @@ -13,8 +13,10 @@ function! s:HandleSyntaxError(buffer, lines) abort for l:line in a:lines let l:match = matchlist(l:line, l:pattern) + if len(l:match) == 0 let l:match = matchlist(l:line, l:column) + if len(l:match) != 0 let l:output[len(l:output) - 1]['col'] = len(l:match[1]) endif @@ -35,3 +37,10 @@ function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort return s:HandleSyntaxError(a:buffer, a:lines) endfunction +function! ale#handlers#ruby#EscapeExecutable(executable, bundle_exec) abort + let l:exec_args = a:executable =~? 'bundle' + \ ? ' exec ' . a:bundle_exec + \ : '' + + return ale#Escape(a:executable) . l:exec_args +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/sml.vim b/sources_non_forked/ale/autoload/ale/handlers/sml.vim index 377eade5..92c5f83b 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/sml.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/sml.vim @@ -11,8 +11,10 @@ function! ale#handlers#sml#GetCmFile(buffer) abort let l:as_list = 1 let l:cmfile = '' + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) let l:results = glob(l:path . '/' . l:pattern, 0, l:as_list) + if len(l:results) > 0 " If there is more than one CM file, we take the first one " See :help ale-sml-smlnj for how to configure this. @@ -46,6 +48,7 @@ endfunction function! ale#handlers#sml#GetExecutableSmlnjCm(buffer) abort return s:GetExecutable(a:buffer, 'smlnj-cm') endfunction + function! ale#handlers#sml#GetExecutableSmlnjFile(buffer) abort return s:GetExecutable(a:buffer, 'smlnj-file') endfunction @@ -53,7 +56,6 @@ endfunction function! ale#handlers#sml#Handle(buffer, lines) abort " Try to match basic sml errors " TODO(jez) We can get better errorfmt strings from Syntastic - let l:out = [] let l:pattern = '^.*\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)' let l:pattern2 = '^.*\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)' @@ -83,7 +85,6 @@ function! ale#handlers#sml#Handle(buffer, lines) abort \}) continue endif - endfor return l:out diff --git a/sources_non_forked/ale/autoload/ale/handlers/vale.vim b/sources_non_forked/ale/autoload/ale/handlers/vale.vim index 9dc0872f..2da72fc7 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/vale.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/vale.vim @@ -23,6 +23,7 @@ function! ale#handlers#vale#Handle(buffer, lines) abort endif let l:output = [] + for l:error in l:errors[keys(l:errors)[0]] call add(l:output, { \ 'lnum': l:error['Line'], diff --git a/sources_non_forked/ale/autoload/ale/java.vim b/sources_non_forked/ale/autoload/ale/java.vim new file mode 100644 index 00000000..b7fd10bd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/java.vim @@ -0,0 +1,20 @@ +" Author: Horacio Sanson https://github.com/hsanson +" Description: Functions for integrating with Java tools + +" Find the nearest dir contining a gradle or pom file and asume it +" the root of a java app. +function! ale#java#FindProjectRoot(buffer) abort + let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer) + + if !empty(l:gradle_root) + return l:gradle_root + endif + + let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:maven_pom_file) + return fnamemodify(l:maven_pom_file, ':h') + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/job.vim b/sources_non_forked/ale/autoload/ale/job.vim index e0266cba..0117c7dd 100644 --- a/sources_non_forked/ale/autoload/ale/job.vim +++ b/sources_non_forked/ale/autoload/ale/job.vim @@ -249,6 +249,11 @@ function! ale#job#Start(command, options) abort let l:job_options.exit_cb = function('s:VimExitCallback') endif + " Use non-blocking writes for Vim versions that support the option. + if has('patch-8.1.350') + let l:job_options.noblock = 1 + endif + " Vim 8 will read the stdin from the file's buffer. let l:job_info.job = job_start(a:command, l:job_options) let l:job_id = ale#job#ParseVim8ProcessID(string(l:job_info.job)) @@ -278,11 +283,13 @@ function! ale#job#IsRunning(job_id) abort try " In NeoVim, if the job isn't running, jobpid() will throw. call jobpid(a:job_id) + return 1 catch endtry elseif has_key(s:job_map, a:job_id) let l:job = s:job_map[a:job_id].job + return job_status(l:job) is# 'run' endif diff --git a/sources_non_forked/ale/autoload/ale/julia.vim b/sources_non_forked/ale/autoload/ale/julia.vim new file mode 100644 index 00000000..18dd9ad7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/julia.vim @@ -0,0 +1,19 @@ +" Author: Bartolomeo Stellato bartolomeo.stellato@gmail.com +" Description: Functions for integrating with Julia tools + +" Find the nearest dir containing a julia project +let s:__ale_julia_project_filenames = ['REQUIRE', 'Manifest.toml', 'Project.toml'] + +function! ale#julia#FindProjectRoot(buffer) abort + for l:project_filename in s:__ale_julia_project_filenames + let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) + + if !empty(l:full_path) + let l:path = fnamemodify(l:full_path, ':p:h') + + return l:path + endif + endfor + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index aad386aa..06bc5e80 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -99,7 +99,7 @@ function! ale#linter#PreProcess(filetype, linter) abort endif if index(['', 'socket', 'stdio', 'tsserver'], l:obj.lsp) < 0 - throw '`lsp` must be either `''lsp''` or `''tsserver''` if defined' + throw '`lsp` must be either `''lsp''`, `''stdio''`, `''socket''` or `''tsserver''` if defined' endif if !l:needs_executable diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 35304a09..3417575c 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -25,6 +25,7 @@ function! ale#list#IsQuickfixOpen() abort return 1 endif endfor + return 0 endfunction @@ -112,9 +113,11 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort " open windows vertically instead of default horizontally let l:open_type = '' + if ale#Var(a:buffer, 'list_vertical') == 1 let l:open_type = 'vert ' endif + if g:ale_set_quickfix if !ale#list#IsQuickfixOpen() silent! execute l:open_type . 'copen ' . str2nr(ale#Var(a:buffer, 'list_window_size')) diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index 7f99422a..196cbe80 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -24,6 +24,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort " capabilities_queue: The list of callbacks to call with capabilities. " capabilities: Features the server supports. let s:connections[l:conn_id] = { + \ 'id': l:conn_id, \ 'is_tsserver': 0, \ 'data': '', \ 'root': a:project, @@ -98,6 +99,7 @@ function! s:CreateTSServerMessageData(message) abort endif let l:data = json_encode(l:obj) . "\n" + return [l:is_notification ? 0 : l:obj.seq, l:data] endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index 8fbad12f..a11c76bc 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -55,16 +55,29 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort endif let l:thislist = ale#lsp#response#ReadTSServerDiagnostics(a:response) + let l:no_changes = 0 " tsserver sends syntax and semantic errors in separate messages, so we " have to collect the messages separately for each buffer and join them " back together again. if a:error_type is# 'syntax' + if len(l:thislist) is 0 && len(get(l:info, 'syntax_loclist', [])) is 0 + let l:no_changes = 1 + endif + let l:info.syntax_loclist = l:thislist else + if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0 + let l:no_changes = 1 + endif + let l:info.semantic_loclist = l:thislist endif + if l:no_changes + return + endif + let l:loclist = get(l:info, 'semantic_loclist', []) \ + get(l:info, 'syntax_loclist', []) @@ -99,9 +112,10 @@ endfunction function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort let l:method = get(a:response, 'method', '') - let l:linter_name = get(s:lsp_linter_map, a:conn_id, '') if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error') + let l:linter_name = get(s:lsp_linter_map, a:conn_id, '') + call s:HandleLSPErrorMessage(l:linter_name, a:response) elseif l:method is# 'textDocument/publishDiagnostics' call s:HandleLSPDiagnostics(a:conn_id, a:response) diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index aefbb691..180a37d0 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -15,13 +15,13 @@ function! ale#preview#Show(lines, ...) abort setlocal modifiable setlocal noreadonly setlocal nobuflisted - let &l:filetype = get(l:options, 'filetype', 'ale-preview') setlocal buftype=nofile setlocal bufhidden=wipe :%d call setline(1, a:lines) setlocal nomodifiable setlocal readonly + let &l:filetype = get(l:options, 'filetype', 'ale-preview') if get(l:options, 'stay_here') wincmd p diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 1f963431..8d6bf1f0 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -1,6 +1,8 @@ " Author: w0rp " Description: Functions for integrating with Python linters. +call ale#Set('python_auto_pipenv', '0') + let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. let s:bin_dir = has('unix') ? 'bin' : 'Scripts' @@ -107,3 +109,8 @@ function! ale#python#FindExecutable(buffer, base_var_name, path_list) abort return ale#Var(a:buffer, a:base_var_name . '_executable') endfunction + +" Detects whether a pipenv environment is present. +function! ale#python#PipenvPresent(buffer) abort + return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim index b981ded6..5f0aa50d 100644 --- a/sources_non_forked/ale/autoload/ale/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -20,3 +20,25 @@ function! ale#ruby#FindRailsRoot(buffer) abort return '' endfunction + +" Find the nearest dir containing a potential ruby project. +function! ale#ruby#FindProjectRoot(buffer) abort + let l:dir = ale#ruby#FindRailsRoot(a:buffer) + + if isdirectory(l:dir) + return l:dir + endif + + for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile'] + let l:dir = fnamemodify( + \ ale#path#FindNearestFile(a:buffer, l:name), + \ ':h' + \) + + if l:dir isnot# '.' && isdirectory(l:dir) + return l:dir + endif + endfor + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/socket.vim b/sources_non_forked/ale/autoload/ale/socket.vim index 0ca4dea6..7e069fb5 100644 --- a/sources_non_forked/ale/autoload/ale/socket.vim +++ b/sources_non_forked/ale/autoload/ale/socket.vim @@ -55,11 +55,18 @@ function! ale#socket#Open(address, options) abort if !has('nvim') " Vim - let l:channel_info.channel = ch_open(a:address, { + let l:channel_options = { \ 'mode': l:mode, \ 'waittime': 0, \ 'callback': function('s:VimOutputCallback'), - \}) + \} + + " Use non-blocking writes for Vim versions that support the option. + if has('patch-8.1.350') + let l:channel_options.noblock = 1 + endif + + let l:channel_info.channel = ch_open(a:address, l:channel_options) let l:vim_info = ch_info(l:channel_info.channel) let l:channel_id = !empty(l:vim_info) ? l:vim_info.id : -1 elseif exists('*chansend') && exists('*sockconnect') @@ -104,6 +111,7 @@ function! ale#socket#IsOpen(channel_id) abort endif let l:channel = s:channel_map[a:channel_id].channel + return ch_status(l:channel) is# 'open' endfunction diff --git a/sources_non_forked/ale/autoload/ale/toggle.vim b/sources_non_forked/ale/autoload/ale/toggle.vim index da108782..8e642b3f 100644 --- a/sources_non_forked/ale/autoload/ale/toggle.vim +++ b/sources_non_forked/ale/autoload/ale/toggle.vim @@ -15,21 +15,6 @@ function! s:DisablePostamble() abort endif endfunction -function! s:CleanupEveryBuffer() abort - for l:key in keys(g:ale_buffer_info) - " The key could be a filename or a buffer number, so try and - " convert it to a number. We need a number for the other - " functions. - let l:buffer = str2nr(l:key) - - if l:buffer > 0 - " Stop all jobs and clear the results for everything, and delete - " all of the data we stored for the buffer. - call ale#engine#Cleanup(l:buffer) - endif - endfor -endfunction - function! ale#toggle#Toggle() abort let g:ale_enabled = !get(g:, 'ale_enabled') @@ -40,7 +25,7 @@ function! ale#toggle#Toggle() abort call ale#balloon#Enable() endif else - call s:CleanupEveryBuffer() + call ale#engine#CleanupEveryBuffer() call s:DisablePostamble() if exists('*ale#balloon#Disable') @@ -64,7 +49,7 @@ function! ale#toggle#Disable() abort endfunction function! ale#toggle#Reset() abort - call s:CleanupEveryBuffer() + call ale#engine#CleanupEveryBuffer() call ale#highlight#UpdateHighlights() endfunction @@ -76,6 +61,7 @@ function! ale#toggle#ToggleBuffer(buffer) abort " linting locally when linting is disabled globally if l:enabled && !g:ale_enabled execute 'echom ''ALE cannot be enabled locally when disabled globally''' + return endif diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index 8c69c54f..e0491653 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -54,6 +54,7 @@ endif function! ale#util#JoinNeovimOutput(job, last_line, data, mode, callback) abort if a:mode is# 'raw' call a:callback(a:job, join(a:data, "\n")) + return '' endif @@ -404,7 +405,7 @@ endfunction " the buffer. function! ale#util#Writefile(buffer, lines, filename) abort let l:corrected_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' - \ ? map(copy(a:lines), 'v:val . "\r"') + \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines call writefile(l:corrected_lines, a:filename) " no-custom-checks diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index 282dcf94..c3820ba0 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -262,5 +262,24 @@ g:ale_c_gcc_options *g:ale_c_gcc_options* This variable can be change to modify flags given to gcc. +=============================================================================== +uncrustify *ale-c-uncrustify* + +g:ale_c_uncrustify_executable *g:ale_c_uncrustify_executable* + *b:ale_c_uncrustify_executable* + Type: |String| + Default: `'uncrustify'` + + This variable can be changed to use a different executable for uncrustify. + + +g:ale_c_uncrustify_options *g:ale_c_uncrustify_options* + *b:ale_c_uncrustify_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to uncrustify. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt index e582ae6e..6c05c96d 100644 --- a/sources_non_forked/ale/doc/ale-cpp.txt +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -273,5 +273,11 @@ g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* This variable can be changed to modify flags given to gcc. +=============================================================================== +uncrustify *ale-cpp-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cs.txt b/sources_non_forked/ale/doc/ale-cs.txt index f65b9f39..b4cd295c 100644 --- a/sources_non_forked/ale/doc/ale-cs.txt +++ b/sources_non_forked/ale/doc/ale-cs.txt @@ -98,5 +98,11 @@ g:ale_cs_mcsc_assemblies *g:ale_cs_mcsc_assemblies* \] < +=============================================================================== +uncrustify *ale-cs-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-d.txt b/sources_non_forked/ale/doc/ale-d.txt new file mode 100644 index 00000000..8db04774 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-d.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE D Integration *ale-d-options* + + +=============================================================================== +uncrustify *ale-d-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index d83c98f2..ac72d615 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -307,6 +307,7 @@ given the above setup are as follows. `AssertLSPLanguage language` - Check the language given to an LSP server. `AssertLSPOptions options_dict` - Check the options given to an LSP server. `AssertLSPProject project_root` - Check the root given to an LSP server. +`AssertLSPAddress address` - Check the address to an LSP server. =============================================================================== 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 baf403b7..71b248ee 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -7,7 +7,7 @@ Integration Information The `gometalinter` linter is disabled by default. ALE enables `gofmt`, `golint` and `go vet` by default. It also supports `staticcheck`, `go -build` and `gosimple`. +build`, `gosimple`, and `golangserver`. To enable `gometalinter`, update |g:ale_linters| as appropriate: > @@ -20,6 +20,15 @@ the benefit of running a number of linters, more than ALE would by default, while ensuring it doesn't run any linters known to be slow or resource intensive. +g:ale_go_go_executable *g:ale_go_go_options* + *b:ale_go_go_options* + + Type: |String| + Default: `'go'` + + The executable that will be run for the `gobuild` and `govet` linters, and + the gomod` fixer. + =============================================================================== gobuild *ale-go-gobuild* @@ -114,5 +123,58 @@ 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. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 4481e823..7bba12a3 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -75,5 +75,34 @@ g:ale_java_pmd_options *g:ale_java_pmd_options* and -d. They are added automatically. +=============================================================================== +javalsp *ale-java-javalsp* + +To enable Java LSP linter you need to download and build the vscode-javac +language server from https://github.com/georgewfraser/vscode-javac. Simply +download the source code and then build the plugin using maven: + + mvn package + +This generates a out/fat-jar.jar file that contains the language server. To +let ALE use this language server you need to set the g:ale_java_javalsp_jar +variable to the absolute path of this jar file. + +g:ale_java_javalsp_jar *g:ale_java_javalsp_jar* + *b:ale_java_javalsp_jar* + + Type: String + Default: 'fat-jar.jar + + Path to the location of the vscode-javac language server plugin. + and -d. They are added automatically. + + +=============================================================================== +uncrustify *ale-java-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-julia.txt b/sources_non_forked/ale/doc/ale-julia.txt new file mode 100644 index 00000000..51532419 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-julia.txt @@ -0,0 +1,20 @@ +=============================================================================== +ALE Julia Integration *ale-julia-options* + +=============================================================================== +languageserver *ale-julia-languageserver* + +To enable Julia LSP linter you need to install the LanguageServer.jl package +within julia. + +g:ale_julia_executable *g:ale_julia_executable* + *b:ale_julia_executable* + + Type: |String| + Default: 'julia' + + Path to the julia exetuable. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-objc.txt b/sources_non_forked/ale/doc/ale-objc.txt index 9e7db367..2d560267 100644 --- a/sources_non_forked/ale/doc/ale-objc.txt +++ b/sources_non_forked/ale/doc/ale-objc.txt @@ -32,5 +32,11 @@ g:ale_objc_clangd_options *g:ale_objc_clangd_options* This variable can be changed to modify flags given to clangd. +=============================================================================== +uncrustify *ale-objc-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-objcpp.txt b/sources_non_forked/ale/doc/ale-objcpp.txt index 1f76aecb..cd65ab73 100644 --- a/sources_non_forked/ale/doc/ale-objcpp.txt +++ b/sources_non_forked/ale/doc/ale-objcpp.txt @@ -32,5 +32,11 @@ g:ale_objcpp_clangd_options *g:ale_objcpp_clangd_options* This variable can be changed to modify flags given to clangd. +=============================================================================== +uncrustify *ale-objcpp-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt index a7ef8d29..adf17716 100644 --- a/sources_non_forked/ale/doc/ale-ocaml.txt +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -33,5 +33,22 @@ g:ale_ocaml_ols_use_global *g:ale_ocaml_ols_use_global* This variable can be set to `1` to always use the globally installed executable. See also |ale-integrations-local-executables|. +=============================================================================== +ocamlformat *ale-ocaml-ocamlformat* + +g:ale_ocaml_ocamlformat_executable *g:ale_ocaml_ocamlformat_executable* + *b:ale_ocaml_ocamlformat_executable* + Type: |String| + Default: `'ocamlformat'` + + This variable can be set to pass the path of the ocamlformat fixer. + +g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options* + *b:ale_ocaml_ocamlformat_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the ocamlformat fixer. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pawn.txt b/sources_non_forked/ale/doc/ale-pawn.txt new file mode 100644 index 00000000..f836df97 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pawn.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE Pawn Integration *ale-pawn-options* + + +=============================================================================== +uncrustify *ale-pawn-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-puppet.txt b/sources_non_forked/ale/doc/ale-puppet.txt index 7c67484e..daa8c10f 100644 --- a/sources_non_forked/ale/doc/ale-puppet.txt +++ b/sources_non_forked/ale/doc/ale-puppet.txt @@ -2,6 +2,26 @@ ALE Puppet Integration *ale-puppet-options* +=============================================================================== +puppet *ale-puppet-puppet* + +g:ale_puppet_puppet_executable *g:ale_puppet_puppet_executable* + *b:ale_puppet_puppet_executable* + Type: |String| + Default: `'puppet'` + + This variable can be changed to specify the executable used for puppet. + + +g:ale_puppet_puppet_options *g:ale_puppet_puppet_options* + *b:ale_puppet_puppet_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the + puppet parser validate invocation. + + =============================================================================== puppetlint *ale-puppet-puppetlint* diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index b5c469b1..0b8e1746 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -2,6 +2,14 @@ ALE Python Integration *ale-python-options* +g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* + *b:ale_python_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + =============================================================================== ALE Python Project Root Behavior *ale-python-root* @@ -137,6 +145,15 @@ g:ale_python_flake8_use_global *g:ale_python_flake8_use_global* Both variables can be set with `b:` buffer variables instead. +g:ale_python_flake8_auto_pipenv *g:ale_python_flake8_auto_pipenv* + *b:ale_python_flake8_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== isort *ale-python-isort* @@ -211,6 +228,15 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* See |ale-integrations-local-executables| +g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* + *b:ale_python_mypy_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== prospector *ale-python-prospector* @@ -253,6 +279,15 @@ g:ale_python_prospector_use_global *g:ale_python_prospector_use_global* See |ale-integrations-local-executables| +g:ale_python_prospector_auto_pipenv *g:ale_python_prospector_auto_pipenv* + *b:ale_python_prospector_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== pycodestyle *ale-python-pycodestyle* @@ -284,6 +319,15 @@ g:ale_python_pycodestyle_use_global *g:ale_python_pycodestyle_use_global* See |ale-integrations-local-executables| +g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv* + *b:ale_python_pycodestyle_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== pyflakes *ale-python-pyflakes* @@ -298,6 +342,15 @@ g:ale_python_pyflakes_executable *g:ale_python_pyflakes_executable* Set this to `'pipenv'` to invoke `'pipenv` `run` `pyflakes'`. +g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* + *b:ale_python_pyflakes_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== pylint *ale-python-pylint* @@ -350,6 +403,15 @@ g:ale_python_pylint_use_global *g:ale_python_pylint_use_global* See |ale-integrations-local-executables| +g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* + *b:ale_python_pylint_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== pyls *ale-python-pyls* @@ -374,6 +436,15 @@ g:ale_python_pyls_use_global *g:ale_python_pyls_use_global* See |ale-integrations-local-executables| +g:ale_python_pyls_auto_pipenv *g:ale_python_pyls_auto_pipenv* + *b:ale_python_pyls_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== pyre *ale-python-pyre* @@ -398,6 +469,15 @@ g:ale_python_pyre_use_global *g:ale_python_pyre_use_global* See |ale-integrations-local-executables| +g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* + *b:ale_python_pyre_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + =============================================================================== vulture *ale-python-vulture* diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index 85a3e137..f8a41999 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -5,6 +5,15 @@ ALE Ruby Integration *ale-ruby-options* =============================================================================== brakeman *ale-ruby-brakeman* +g:ale_ruby_brakeman_executable *g:ale_ruby_brakeman_executable* + *b:ale_ruby_brakeman_executable* + Type: String + Default: `'brakeman'` + + Override the invoked brakeman binary. Set this to `'bundle'` to invoke + `'bundle` `exec` brakeman'. + + g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options* *b:ale_ruby_brakeman_options* Type: |String| @@ -20,10 +29,11 @@ g:ale_ruby_rails_best_practices_executable *g:ale_ruby_rails_best_practices_executable* *b:ale_ruby_rails_best_practices_executable* Type: String - Default: 'rails_best_practices' + Default: `'rails_best_practices'` Override the invoked rails_best_practices binary. Set this to `'bundle'` to - invoke `'bundle` `exec` `rails_best_practices'`. + invoke `'bundle` `exec` rails_best_practices'. + g:ale_ruby_rails_best_practices_options *g:ale_ruby_rails_best_practices_options* @@ -37,6 +47,15 @@ g:ale_ruby_rails_best_practices_options =============================================================================== reek *ale-ruby-reek* +g:ale_ruby_reek_executable *g:ale_ruby_reek_executable* + *b:ale_ruby_reek_executable* + Type: String + Default: `'reek'` + + Override the invoked reek binary. Set this to `'bundle'` to invoke + `'bundle` `exec` reek'. + + g:ale_ruby_reek_show_context *g:ale_ruby_reek_show_context* *b:ale_ruby_reek_show_context* Type: |Number| @@ -63,8 +82,8 @@ g:ale_ruby_rubocop_executable *g:ale_ruby_rubocop_executable* Type: String Default: `'rubocop'` - Override the invoked rubocop binary. This is useful for running rubocop - from binstubs or a bundle. + Override the invoked rubocop binary. Set this to `'bundle'` to invoke + `'bundle` `exec` rubocop'. g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* @@ -98,5 +117,17 @@ g:ale_ruby_rufo_executable *g:ale_ruby_rufo_executable* binstubs or a bundle. +=============================================================================== +solargraph *ale-ruby-solargraph* + +g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable* + *b:ale_ruby_solargraph_executable* + Type: String + Default: `'solargraph'` + + Override the invoked solargraph binary. This is useful for running solargraph + from binstubs or a bundle. + + =============================================================================== 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 a6bd59ad..13e5f6f0 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -115,8 +115,8 @@ g:ale_rust_cargo_avoid_whole_workspace *g:ale_rust_cargo_avoid_whole_workspace* Default: `1` When set to 1, and ALE is used to edit a crate that is part of a Cargo - workspace, avoid building the entire entire workspace by invoking - `cargo` directly in the crate's directory. Otherwise, behave as usual. + workspace, avoid building the entire workspace by invoking `cargo` directly + in the crate's directory. Otherwise, behave as usual. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-scala.txt b/sources_non_forked/ale/doc/ale-scala.txt index b992d428..ff43cd6c 100644 --- a/sources_non_forked/ale/doc/ale-scala.txt +++ b/sources_non_forked/ale/doc/ale-scala.txt @@ -2,6 +2,39 @@ ALE Scala Integration *ale-scala-options* +=============================================================================== +sbtserver *ale-scala-sbtserver* + +`sbtserver` requires a running ^1.1.x sbt shell to connect to. It will attempt +to connect via TCP to the address defined in `g:ale_scala_sbtserver_address`. +As `sbt` defaults to listening via unix sockets, place these settings into +your `~/.sbt/1.0/global.sbt` to ensure that ale will always attempt to connect +to the right socket: + +`serverConnectionType := ConnectionType.Tcp` and `serverPort := 4273` + + +g:ale_scala_sbtserver_address *g:ale_scala_sbtserver_address* + *b:ale_scala_sbtserver_address* + Type: |String| + Default: `'127.0.0.1:4273'` + + By default the address is found by parsing `active.json`, however, reading a + file is a blocking operation which should be avoided in ale. The easy way + around this is to configure sbt to always connect to the same port, which + the instructions above describe. + + +g:ale_scala_sbtserver_project_root *g:ale_scala_sbtserver_project_root* + *b:ale_scala_sbtserver_project_root* + Type: |String| + Default: `''` + + By default the project root is found by searching upwards for `build.sbt`. + If the project root is elsewhere, you can override the project root + directory. + + =============================================================================== scalafmt *ale-scala-scalafmt* diff --git a/sources_non_forked/ale/doc/ale-sql.txt b/sources_non_forked/ale/doc/ale-sql.txt new file mode 100644 index 00000000..75d4b0cf --- /dev/null +++ b/sources_non_forked/ale/doc/ale-sql.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE SQL Integration *ale-sql-options* + + +=============================================================================== +sqlfmt *ale-sql-sqlfmt* + +g:ale_sql_sqlfmt_executable *g:ale_sql_sqlfmt_executable* + *b:ale_sql_sqlfmt_executable* + Type: |String| + Default: `'sqlfmt'` + + This variable sets executable used for sqlfmt. + +g:ale_sql_sqlfmt_options *g:ale_sql_sqlfmt_options* + *b:ale_sql_sqlfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the sqlfmt fixer. + At this time only the -u flag is available to format with upper-case. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-thrift.txt b/sources_non_forked/ale/doc/ale-thrift.txt index ed858db8..bb2ec058 100644 --- a/sources_non_forked/ale/doc/ale-thrift.txt +++ b/sources_non_forked/ale/doc/ale-thrift.txt @@ -28,7 +28,7 @@ g:ale_thrift_thrift_generators *g:ale_thrift_thrift_generators* g:ale_thrift_thrift_includes *g:ale_thrift_thrift_includes* *b:ale_thrift_thrift_includes* Type: |List| of |String|s - Default: `[]` + Default: `['.']` This list contains paths that will be searched for thrift `include` directives. diff --git a/sources_non_forked/ale/doc/ale-vala.txt b/sources_non_forked/ale/doc/ale-vala.txt new file mode 100644 index 00000000..ca24bcf4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-vala.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE VALA Integration *ale-vala-options* + + +=============================================================================== +uncrustify *ale-vala-uncrustify* + +See |ale-c-uncrustify| for information about the available options. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-xml.txt b/sources_non_forked/ale/doc/ale-xml.txt index 6c8af6c7..e43fdefd 100644 --- a/sources_non_forked/ale/doc/ale-xml.txt +++ b/sources_non_forked/ale/doc/ale-xml.txt @@ -21,6 +21,14 @@ g:ale_xml_xmllint_options *g:ale_xml_xmllint_options* This variable can be set to pass additional options to xmllint. +g:ale_xml_xmllint_indentsize *g:ale_xml_xmllint_indentsize* + *b:ale_xml_xmllint_indentsize* + Type: |Number| + Default: 2 + + This variable can be sent to specify the amount of spaces used for + indentation. + =============================================================================== 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 8e38f92a..46ff08b0 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -33,6 +33,7 @@ CONTENTS *ale-contents* cquery..............................|ale-c-cquery| flawfinder..........................|ale-c-flawfinder| gcc.................................|ale-c-gcc| + uncrustify..........................|ale-c-uncrustify| chef..................................|ale-chef-options| foodcritic..........................|ale-chef-foodcritic| clojure...............................|ale-clojure-options| @@ -53,14 +54,18 @@ CONTENTS *ale-contents* cquery..............................|ale-cpp-cquery| flawfinder..........................|ale-cpp-flawfinder| gcc.................................|ale-cpp-gcc| + uncrustify..........................|ale-cpp-uncrustify| 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| + d.....................................|ale-d-options| + uncrustify..........................|ale-d-uncrustify| dart..................................|ale-dart-options| dartanalyzer........................|ale-dart-dartanalyzer| dartfmt.............................|ale-dart-dartfmt| @@ -95,6 +100,8 @@ CONTENTS *ale-contents* govet...............................|ale-go-govet| gometalinter........................|ale-go-gometalinter| staticcheck.........................|ale-go-staticcheck| + golangserver........................|ale-go-golangserver| + golangci-lint.......................|ale-go-golangci-lint| graphql...............................|ale-graphql-options| eslint..............................|ale-graphql-eslint| gqlint..............................|ale-graphql-gqlint| @@ -127,6 +134,8 @@ CONTENTS *ale-contents* 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| @@ -143,6 +152,8 @@ CONTENTS *ale-contents* 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| @@ -173,12 +184,17 @@ CONTENTS *ale-contents* objc..................................|ale-objc-options| clang...............................|ale-objc-clang| clangd..............................|ale-objc-clangd| + uncrustify..........................|ale-objc-uncrustify| 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| @@ -202,6 +218,7 @@ CONTENTS *ale-contents* 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| @@ -237,6 +254,7 @@ CONTENTS *ale-contents* rubocop.............................|ale-ruby-rubocop| ruby................................|ale-ruby-ruby| rufo................................|ale-ruby-rufo| + solargraph..........................|ale-ruby-solargraph| rust..................................|ale-rust-options| cargo...............................|ale-rust-cargo| rls.................................|ale-rust-rls| @@ -245,6 +263,7 @@ CONTENTS *ale-contents* sass..................................|ale-sass-options| stylelint...........................|ale-sass-stylelint| scala.................................|ale-scala-options| + sbtserver...........................|ale-scala-sbtserver| scalafmt............................|ale-scala-scalafmt| scalastyle..........................|ale-scala-scalastyle| scss..................................|ale-scss-options| @@ -262,6 +281,8 @@ CONTENTS *ale-contents* 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| tcl...................................|ale-tcl-options| @@ -283,6 +304,8 @@ CONTENTS *ale-contents* 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| @@ -352,10 +375,10 @@ Notes: * Awk: `gawk` * Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt` * Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt` -* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc` -* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc` +* C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`, `uncrustify` +* C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`, `uncrustify` * CUDA: `nvcc`!! -* C#: `mcs`, `mcsc`!! +* C#: `mcs`, `mcsc`!!, `uncrustify` * Chef: `foodcritic` * Clojure: `joker` * CloudFormation: `cfn-python-lint` @@ -365,7 +388,7 @@ Notes: * CSS: `csslint`, `prettier`, `stylelint` * Cucumber: `cucumber` * Cython (pyrex filetype): `cython` -* D: `dmd` +* D: `dmd`, `uncrustify` * Dafny: `dafny`!! * Dart: `dartanalyzer`!!, `language_server`, dartfmt!! * Dockerfile: `hadolint` @@ -379,7 +402,7 @@ Notes: * FusionScript: `fusion-lint` * Git Commit Messages: `gitlint` * GLSL: glslang, `glslls` -* Go: `gofmt`, `goimports`, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!! +* Go: `gofmt`, `goimports`, `go mod`!!, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!! * GraphQL: `eslint`, `gqlint`, `prettier` * Hack: `hack`, `hackfmt`, `hhast` * Haml: `haml-lint` @@ -387,9 +410,10 @@ Notes: * Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie` * HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good` * Idris: `idris` -* Java: `checkstyle`, `javac`, `google-java-format`, `PMD` +* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify` * JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo` * JSON: `fixjson`, `jsonlint`, `jq`, `prettier` +* Julia: `languageserver` * Kotlin: `kotlinc`!!, `ktlint`!!, `languageserver` * LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good` * Less: `lessc`, `prettier`, `stylelint` @@ -404,9 +428,10 @@ Notes: * Nim: `nim check`!! * nix: `nix-instantiate` * nroff: `alex`!!, `proselint`, `write-good` -* Objective-C: `clang`, `clangd` -* Objective-C++: `clang`, `clangd` -* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols` +* Objective-C: `clang`, `clangd`, `uncrustify` +* Objective-C++: `clang`, `clangd`, `uncrustify` +* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`, `ocamlformat` +* Pawn: `uncrustify` * Perl: `perl -c`, `perl-critic`, `perltidy` * PHP: `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer` * PO: `alex`!!, `msgfmt`, `proselint`, `write-good` @@ -422,16 +447,16 @@ Notes: * reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good` * Re:VIEW: `redpen` * RPM spec: `rpmlint` -* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo` +* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph` * Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt` * SASS: `sass-lint`, `stylelint` * SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint` -* Scala: `fsc`, `scalac`, `scalafmt`, `scalastyle` +* Scala: `fsc`, `sbtserver`, `scalac`, `scalafmt`, `scalastyle` * Slim: `slim-lint` * SML: `smlnj` * Solidity: `solhint`, `solium` * Stylus: `stylelint` -* SQL: `sqlint` +* SQL: `sqlint`, `sqlfmt` * Swift: `swiftlint`, `swiftformat` * Tcl: `nagelfar`!! * Terraform: `tflint` @@ -439,6 +464,7 @@ Notes: * Text^: `alex`!!, `proselint`, `redpen`, `textlint`, `vale`, `write-good` * Thrift: `thrift` * TypeScript: `eslint`, `prettier`, `tslint`, `tsserver`, `typecheck` +* VALA: `uncrustify` * Verilog: `iverilog`, `verilator` * Vim: `vint` * Vim help^: `alex`!!, `proselint`, `write-good` @@ -501,12 +527,13 @@ circumstances. ALE will report problems with your code in the following ways, listed with their relevant options. -* By updating loclist. (On by default) - |g:ale_set_loclist| -* By updating quickfix. (Off by default) - |g:ale_set_quickfix| -* By setting error highlights. - |g:ale_set_highlights| -* By creating signs in the sign column. - |g:ale_set_signs| -* By echoing messages based on your cursor. - |g:ale_echo_cursor| -* By showing balloons for your mouse cursor - |g:ale_set_balloons| +* By updating loclist. (On by default) - |g:ale_set_loclist| +* By updating quickfix. (Off by default) - |g:ale_set_quickfix| +* By setting error highlights. - |g:ale_set_highlights| +* By creating signs in the sign column. - |g:ale_set_signs| +* By echoing messages based on your cursor. - |g:ale_echo_cursor| +* By displaying the preview based on your cursor. - |g:ale_cursor_detail| +* By showing balloons for your mouse cursor - |g:ale_set_balloons| Please consult the documentation for each option, which can reveal some other ways of tweaking the behaviour of each way of displaying problems. You can @@ -779,6 +806,20 @@ g:ale_change_sign_column_color *g:ale_change_sign_column_color* windows. +g:ale_close_preview_on_insert *g:ale_close_preview_on_insert* + + Type: |Number| + Default: `0` + + When this option is set to `1`, ALE's |preview-window| will be automatically + closed upon entering Insert Mode. This option can be used in combination + with |g:ale_cursor_detail| for automatically displaying the preview window + on problem lines, and automatically closing it again when editing text. + + This setting must be set to `1` before ALE is loaded for this behavior + to be enabled. See |ale-lint-settings-on-startup|. + + g:ale_command_wrapper *g:ale_command_wrapper* *b:ale_command_wrapper* Type: |String| @@ -867,6 +908,27 @@ g:ale_completion_max_suggestions *g:ale_completion_max_suggestions* Adjust this option as needed, depending on the complexity of your codebase and your available processing power. +g:ale_cursor_detail *g:ale_cursor_detail* + + Type: |Number| + Default: `0` + + When this option is set to `1`, ALE's |preview-window| will be automatically + opened when the cursor moves onto lines with problems. ALE will search for + problems using the same logic that |g:ale_echo_cursor| uses. The preview + window will be closed automatically when you move away from the line. + + Messages are only displayed after a short delay. See |g:ale_echo_delay|. + + The preview window is opened without stealing focus, which means your cursor + will stay in the same buffer as it currently is. + + The preview window can be closed automatically upon entering Insert mode + by setting |g:ale_close_preview_on_insert| to `1`. + + Either this setting or |g:ale_echo_cursor| must be set to `1` before ALE is + loaded for messages to be displayed. See |ale-lint-settings-on-startup|. + g:ale_echo_cursor *g:ale_echo_cursor* @@ -877,11 +939,14 @@ g:ale_echo_cursor *g:ale_echo_cursor* cursor is near a warning or error. ALE will attempt to find the warning or error at a column nearest to the cursor when the cursor is resting on a line which contains a warning or error. This option can be set to `0` to disable - this behaviour. - The format of the message can be customizable in |g:ale_echo_msg_format|. + this behavior. - You should set this setting once before ALE is loaded, and restart Vim if - you want to change your preferences. See |ale-lint-settings-on-startup|. + Messages are only displayed after a short delay. See |g:ale_echo_delay|. + + The format of the message can be customized with |g:ale_echo_msg_format|. + + Either this setting or |g:ale_cursor_detail| must be set to `1` before ALE + is loaded for messages to be displayed. See |ale-lint-settings-on-startup|. g:ale_echo_delay *g:ale_echo_delay* @@ -890,7 +955,7 @@ g:ale_echo_delay *g:ale_echo_delay* Default: `10` Given any integer, this option controls the number of milliseconds before - ALE will echo a message for a problem near the cursor. + ALE will echo or preview a message for a problem near the cursor. The value can be increased to decrease the amount of processing ALE will do for files displaying a large number of problems. diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index ffb5da8a..41da7c74 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -109,6 +109,13 @@ let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) " This flag can be set to 0 to disable echoing when the cursor moves. let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) +" This flag can be set to 1 to automatically show errors in the preview window. +let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0) + +" This flag can be set to 1 to automatically close the preview window upon +" entering Insert Mode. +let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) + " This flag can be set to 0 to disable balloon support. let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running')) @@ -126,6 +133,9 @@ let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1) " Enable automatic completion with LSP servers and tsserver let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) +" Enable automatic detection of pipenv for Python linters. +let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) + if g:ale_set_balloons call ale#balloon#Enable() endif @@ -217,4 +227,8 @@ augroup ALECleanupGroup " Clean up buffers automatically when they are unloaded. autocmd BufDelete * if exists('*ale#engine#Cleanup') | call ale#engine#Cleanup(str2nr(expand(''))) | endif autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand(''))) + + if exists('##VimSuspend') + autocmd VimSuspend * if exists('*ale#engine#CleanupEveryBuffer') | call ale#engine#CleanupEveryBuffer() | endif + endif augroup END diff --git a/sources_non_forked/auto-pairs/doc/AutoPairs.txt b/sources_non_forked/auto-pairs/doc/AutoPairs.txt index 49ff5494..afe589ef 100644 --- a/sources_non_forked/auto-pairs/doc/AutoPairs.txt +++ b/sources_non_forked/auto-pairs/doc/AutoPairs.txt @@ -178,7 +178,7 @@ System Shortcuts: : BackInsert (|g:AutoPairsShortcutBackInsert|) - To rebind keys , or or in case of conflicts conflicts with + To rebind keys , or or in case of conflicts with another keys: let g:AutoPairsShortcutToggle = '' diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 6128e28c..a4fffaa8 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -1151,6 +1151,7 @@ fu! ctrlp#acceptfile(...) \ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) : \ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) : \ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) : + \ &bt == 'help' ? 'b' : \ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) " Reset &switchbuf option let [swb, &swb] = [&swb, ''] @@ -1590,7 +1591,7 @@ fu! s:formatline(str) let bufnr = s:bufnrfilpath(str)[0] let parts = s:bufparts(bufnr) let str = printf('%'.s:bufnr_width.'s', bufnr) - if s:has_conceal + if s:has_conceal && has('syntax_items') let str .= printf(' %-13s %s%-36s', \ ''.parts[0].'', \ ''.parts[1], '{'.parts[2].'}') diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 4571c1db..ca4c9dd7 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2018/06/22 08:50:00. +" Last Change: 2018/09/17 12:00:00. " ============================================================================= let s:save_cpo = &cpo @@ -343,9 +343,9 @@ function! s:convert(name, index) abort let type = get(s:lightline.component_type, a:name, a:index) let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw' return filter(s:map(s:evaluate_expand(s:lightline.component_expand[a:name]), - \ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '"]'), 'v:val[0] != []') + \ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []') else - return [[[a:name], 0, a:index]] + return [[[a:name], 0, a:index, a:index]] endif endfunction @@ -375,18 +375,30 @@ function! s:expand(components) abort let components = [] let expanded = [] let indices = [] + let prevtype = '' let previndex = -1 let xs = s:flatten_twice(s:map(deepcopy(a:components), 'map(v:val, "s:convert(v:val, ''" . v:key . "'')")')) - for [component, expand, index] in xs - if previndex != index - call add(indices, index) + for [component, expand, type, index] in xs + if prevtype !=# type + for i in range(previndex + 1, max([previndex, index - 1])) + call add(indices, string(i)) + call add(components, []) + call add(expanded, []) + endfor + call add(indices, type) call add(components, []) call add(expanded, []) endif call extend(components[-1], component) call extend(expanded[-1], repeat([expand], len(component))) + let prevtype = type let previndex = index endfor + for i in range(previndex + 1, max([previndex, len(a:components) - 1])) + call add(indices, string(i)) + call add(components, []) + call add(expanded, []) + endfor call add(indices, string(len(a:components))) return [components, expanded, indices] endfunction diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme.vim index 019c7cc2..79013ff2 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colorscheme.vim " Author: itchyny " License: MIT License -" Last Change: 2017/11/29 12:54:05. +" Last Change: 2018/09/01 22:48:24. " ============================================================================= let s:save_cpo = &cpo @@ -224,7 +224,7 @@ function! lightline#colorscheme#flatten(p) abort return a:p endfunction -if has('gui_running') +if has('gui_running') || (has('termguicolors') && &termguicolors) function! lightline#colorscheme#background() abort return &background endfunction diff --git a/sources_non_forked/lightline.vim/test/expand.vim b/sources_non_forked/lightline.vim/test/expand.vim index a9c85774..e1ac310d 100644 --- a/sources_non_forked/lightline.vim/test/expand.vim +++ b/sources_non_forked/lightline.vim/test/expand.vim @@ -156,7 +156,7 @@ function! s:suite.custom_void_string() let g:lightline = { 'component_expand': { 'custom': 'Custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -169,7 +169,7 @@ function! s:suite.custom_type_void_string() let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -208,7 +208,7 @@ function! s:suite.custom_void_string_array() let g:lightline = { 'component_expand': { 'custom': 'Custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -221,7 +221,7 @@ function! s:suite.custom_type_void_string_array() let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -234,7 +234,7 @@ function! s:suite.custom_void_string_array_2() let g:lightline = { 'component_expand': { 'custom': 'Custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -247,7 +247,7 @@ function! s:suite.custom_type_void_string_array_2() let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -469,7 +469,7 @@ function! s:suite.custom_error() let g:lightline = { 'component_expand': { 'custom': 'Custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -483,7 +483,7 @@ function! s:suite.custom_type_error() let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) delfunction Custom @@ -493,7 +493,7 @@ function! s:suite.notfound() let g:lightline = { 'component_expand': { 'custom': 'NotFound' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) endfunction @@ -502,11 +502,28 @@ function! s:suite.custom_type_notfound() let g:lightline = { 'component_expand': { 'custom': 'NotFound' }, 'component_type': { 'custom': 'custom' } } call lightline#init() call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]), - \ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']]) + \ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']]) call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]), \ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']]) endfunction +function! s:suite.duplicated_string() + function! Custom() + return 'custom' + endfunction + function! Modified() + return '' + endfunction + let g:lightline = { 'component_expand': { 'custom': 'Custom', 'modified': 'Modified' } } + call lightline#init() + call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]), + \ [[['filename'], ['custom', 'custom'], []], [[0], [1, 1], []], ['0', '1', '2', '3']]) + call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]), + \ [[['filename', 'custom', 'custom']], [[0, 1, 1]], ['0', '1']]) + delfunction Custom + delfunction Modified +endfunction + function! s:suite.duplicated_left_nil() function! Custom() return [ [], ['y0', 'y1'], ['z0', 'z1'] ] diff --git a/sources_non_forked/lightline.vim/test/link.vim b/sources_non_forked/lightline.vim/test/link.vim index c0811c42..98e409e6 100644 --- a/sources_non_forked/lightline.vim/test/link.vim +++ b/sources_non_forked/lightline.vim/test/link.vim @@ -2,12 +2,24 @@ let s:suite = themis#suite('link') let s:assert = themis#helper('assert') function! s:suite.before_each() - hi clear + call s:clear() let g:lightline = {} call lightline#init() call lightline#colorscheme() endfunction +function! s:clear() + hi clear + redir => hi + silent! hi + redir END + for line in split(hi, '\n') + if match(line, 'links to') > 0 + exec 'hi link' matchstr(line, '^\S*') 'NONE' + endif + endfor +endfunction + function! s:hi(name) redir => hi silent! exec 'hi' a:name @@ -19,11 +31,11 @@ function! s:suite.link() call lightline#link() call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0') call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1') - call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0') call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1') call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2') - call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal') endfunction @@ -31,11 +43,11 @@ function! s:suite.insert() call lightline#link('i') call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_insert_0') call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_insert_1') - call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_insert_0') call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_insert_1') call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_insert_2') - call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_insert') endfunction @@ -43,11 +55,11 @@ function! s:suite.visual() call lightline#link('v') call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_visual_0') call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_visual_1') - call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_visual_0') call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_visual_1') call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_visual_2') - call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_visual') endfunction @@ -55,11 +67,11 @@ function! s:suite.replace() call lightline#link('R') call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_replace_0') call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_replace_1') - call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_replace_0') call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_replace_1') call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_replace_2') - call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_replace') endfunction diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 6ba9ee64..24c63585 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -142,18 +142,9 @@ function! s:chRoot(node) endfunction " FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 -" changes the current root to CWD +" Change the NERDTree root to match the current working directory. function! nerdtree#ui_glue#chRootCwd() - try - let cwd = g:NERDTreePath.New(getcwd()) - catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("current directory does not exist.") - return - endtry - if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str() - return - endif - call s:chRoot(g:NERDTreeDirNode.New(cwd, b:NERDTree)) + NERDTreeCWD endfunction " FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 @@ -357,35 +348,6 @@ function! s:handleMiddleMouse() endif endfunction -" FUNCTION: s:jumpToChild(direction) {{{2 -" Args: -" direction: 0 if going to first child, 1 if going to last -function! s:jumpToChild(currentNode, direction) - if a:currentNode.isRoot() - return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") . " child") - end - let dirNode = a:currentNode.parent - let childNodes = dirNode.getVisibleChildren() - - let targetNode = childNodes[0] - if a:direction - let targetNode = childNodes[len(childNodes) - 1] - endif - - if targetNode.equals(a:currentNode) - let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction) - if siblingDir != {} - let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0 - let targetNode = siblingDir.getChildByIndex(indx, 1) - endif - endif - - call targetNode.putCursorHere(1, 0) - - call b:NERDTree.ui.centerView() -endfunction - - " FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1 "this is needed since I cant figure out how to invoke dict functions from a "key map @@ -393,41 +355,55 @@ function! nerdtree#ui_glue#invokeKeyMap(key) call g:NERDTreeKeyMap.Invoke(a:key) endfunction -" FUNCTION: s:jumpToFirstChild() {{{1 -" wrapper for the jump to child method +" FUNCTION: s:jumpToFirstChild(node) {{{1 function! s:jumpToFirstChild(node) call s:jumpToChild(a:node, 0) endfunction -" FUNCTION: s:jumpToLastChild() {{{1 -" wrapper for the jump to child method +" FUNCTION: s:jumpToLastChild(node) {{{1 function! s:jumpToLastChild(node) call s:jumpToChild(a:node, 1) endfunction +" FUNCTION: s:jumpToChild(node, last) {{{2 +" Jump to the first or last child node at the same file system level. +" +" Args: +" node: the node on which the cursor currently sits +" last: 1 (true) if jumping to last child, 0 (false) if jumping to first +function! s:jumpToChild(node, last) + let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node + + if l:node.isRoot() + return + endif + + let l:parent = l:node.parent + let l:children = l:parent.getVisibleChildren() + + let l:target = a:last ? l:children[len(l:children) - 1] : l:children[0] + + call l:target.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() +endfunction + " FUNCTION: s:jumpToParent(node) {{{1 -" Move the cursor to the parent of the specified node. For a cascade, move to -" the parent of the cascade's highest node. At the root, do nothing. +" Move the cursor to the parent of the specified node. For a cascade, move to +" the parent of the cascade's first node. At the root node, do nothing. function! s:jumpToParent(node) - let l:parent = a:node.parent + let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node - " If "a:node" represents a directory, back out of its cascade. - if a:node.path.isDirectory - while !empty(l:parent) && !l:parent.isRoot() - if index(l:parent.getCascade(), a:node) >= 0 - let l:parent = l:parent.parent - else - break - endif - endwhile + if l:node.isRoot() + return endif - if !empty(l:parent) - call l:parent.putCursorHere(1, 0) - call b:NERDTree.ui.centerView() - else + if empty(l:node.parent) call nerdtree#echo('could not jump to parent node') + return endif + + call l:node.parent.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() endfunction " FUNCTION: s:jumpToRoot() {{{1 @@ -447,19 +423,22 @@ function! s:jumpToPrevSibling(node) call s:jumpToSibling(a:node, 0) endfunction -" FUNCTION: s:jumpToSibling(currentNode, forward) {{{2 -" moves the cursor to the sibling of the current node in the given direction +" FUNCTION: s:jumpToSibling(node, forward) {{{2 +" Move the cursor to the next or previous node at the same file system level. " " Args: -" forward: 1 if the cursor should move to the next sibling, 0 if it should -" move back to the previous sibling -function! s:jumpToSibling(currentNode, forward) - let sibling = a:currentNode.findSibling(a:forward) +" node: the node on which the cursor currently sits +" forward: 0 to jump to previous sibling, 1 to jump to next sibling +function! s:jumpToSibling(node, forward) + let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node + let l:sibling = l:node.findSibling(a:forward) - if !empty(sibling) - call sibling.putCursorHere(1, 0) - call b:NERDTree.ui.centerView() + if empty(l:sibling) + return endif + + call l:sibling.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() endfunction " FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1 diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index a83c4e15..278eb6c8 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -142,8 +142,8 @@ The following features and functionality are provided by the NERD tree: current tab does not exist, a new one will be initialized. :NERDTreeCWD *:NERDTreeCWD* - Change tree root to current directory. If no NERD tree exists for this - tab, a new tree will be opened. + Change the NERDTree root to the current working directory. If no + NERDTree exists for this tab, a new one is opened. ------------------------------------------------------------------------------ 2.2. Bookmarks *NERDTreeBookmarks* @@ -522,7 +522,7 @@ Default key: cd Map option: NERDTreeMapChdir Applies to: files and directories. -Change vims current working directory to that of the selected node. +Change Vim's current working directory to that of the selected node. ------------------------------------------------------------------------------ *NERDTree-CD* @@ -530,7 +530,7 @@ Default key: CD Map option: NERDTreeMapCWD Applies to: no restrictions. -Change tree root to vims current working directory. +Change the NERDTree root to Vim's current working directory. ------------------------------------------------------------------------------ *NERDTree-I* diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index dd69ad05..2e0aab02 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -343,7 +343,12 @@ function! s:Bookmark.Write() for j in s:Bookmark.InvalidBookmarks() call add(bookmarkStrings, j) endfor - call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) + + try + call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) + catch + call nerdtree#echoError("Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.") + endtry endfunction " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 625914ec..78dfd9eb 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -284,16 +284,21 @@ endfunction " FUNCTION: s:Creator._setCommonBufOptions() {{{1 function! s:Creator._setCommonBufOptions() - "throwaway buffer options - setlocal noswapfile - setlocal buftype=nofile + + " Options for a non-file/control buffer. setlocal bufhidden=hide - setlocal nowrap + setlocal buftype=nofile + setlocal noswapfile + + " Options for controlling buffer/window appearance. setlocal foldcolumn=0 setlocal foldmethod=manual - setlocal nofoldenable setlocal nobuflisted + setlocal nofoldenable + setlocal nolist setlocal nospell + setlocal nowrap + if g:NERDTreeShowLineNumbers setlocal nu else @@ -311,6 +316,7 @@ function! s:Creator._setCommonBufOptions() call self._setupStatusline() call self._bindMappings() + setlocal filetype=nerdtree endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index 56701cfe..ef357ef4 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -243,6 +243,9 @@ endfunction " FUNCTION: Opener._openFile() {{{1 function! s:Opener._openFile() + if !self._stay && !g:NERDTreeQuitOnOpen && exists("b:NERDTreeZoomed") && b:NERDTreeZoomed + call b:NERDTree.ui.toggleZoom() + endif if self._reuseWindow() return 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 9d4edee8..04c598b4 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -153,6 +153,32 @@ function! s:TreeDirNode.getCascade() return [self] + visChild.getCascade() endfunction +" FUNCTION: TreeDirNode.getCascadeRoot() {{{1 +" Return the first directory node in the cascade in which this directory node +" is rendered. +function! s:TreeDirNode.getCascadeRoot() + + " Don't search above the current NERDTree root node. + if self.isRoot() + return self + endif + + let l:cascadeRoot = self + let l:parent = self.parent + + while !empty(l:parent) && !l:parent.isRoot() + + if index(l:parent.getCascade(), self) == -1 + break + endif + + let l:cascadeRoot = l:parent + let l:parent = l:parent.parent + endwhile + + return l:cascadeRoot +endfunction + " FUNCTION: TreeDirNode.getChildCount() {{{1 " Returns the number of children this node has function! s:TreeDirNode.getChildCount() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim index 3ad9fcb6..86aa7a64 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim @@ -116,68 +116,40 @@ function! s:TreeFileNode.findNode(path) return {} endfunction -" FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{1 -" -" Finds the next sibling for this node in the indicated direction. This sibling -" must be a directory and may/may not have children as specified. -" -" Args: -" direction: 0 if you want to find the previous sibling, 1 for the next sibling -" -" Return: -" a treenode object or {} if no appropriate sibling could be found -function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) - " if we have no parent then we can have no siblings - if self.parent != {} - let nextSibling = self.findSibling(a:direction) - - while nextSibling != {} - if nextSibling.path.isDirectory && nextSibling.hasVisibleChildren() && nextSibling.isOpen - return nextSibling - endif - let nextSibling = nextSibling.findSibling(a:direction) - endwhile - endif - - return {} -endfunction - " FUNCTION: TreeFileNode.findSibling(direction) {{{1 -" -" Finds the next sibling for this node in the indicated direction +" Find the next or previous sibling of this node. " " Args: -" direction: 0 if you want to find the previous sibling, 1 for the next sibling +" direction: 0 for previous, 1 for next " " Return: -" a treenode object or {} if no sibling could be found +" The next/previous TreeFileNode object or an empty dictionary if not found. function! s:TreeFileNode.findSibling(direction) - " if we have no parent then we can have no siblings - if self.parent != {} - " get the index of this node in its parents children - let siblingIndx = self.parent.getChildIndex(self.path) - - if siblingIndx != -1 - " move a long to the next potential sibling node - let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 - - " keep moving along to the next sibling till we find one that is valid - let numSiblings = self.parent.getChildCount() - while siblingIndx >= 0 && siblingIndx < numSiblings - - " if the next node is not an ignored node (i.e. wont show up in the - " view) then return it - if self.parent.children[siblingIndx].path.ignore(self.getNerdtree()) ==# 0 - return self.parent.children[siblingIndx] - endif - - " go to next node - let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 - endwhile - endif + " There can be no siblings if there is no parent. + if empty(self.parent) + return {} endif + let l:nodeIndex = self.parent.getChildIndex(self.path) + + if l:nodeIndex == -1 + return {} + endif + + " Get the next index to begin the search. + let l:nodeIndex += a:direction ? 1 : -1 + + while 0 <= l:nodeIndex && l:nodeIndex < self.parent.getChildCount() + + " Return the next node if it is not ignored. + if !self.parent.children[l:nodeIndex].path.ignore(self.getNerdtree()) + return self.parent.children[l:nodeIndex] + endif + + let l:nodeIndex += a:direction ? 1 : -1 + endwhile + return {} endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 07373107..5ea13334 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -194,51 +194,52 @@ function! s:UI.getPath(ln) return toReturn endfunction -" FUNCTION: s:UI.getLineNum(file_node){{{1 -" returns the line number this node is rendered on, or -1 if it isnt rendered -function! s:UI.getLineNum(file_node) - " if the node is the root then return the root line no. - if a:file_node.isRoot() +" FUNCTION: s:UI.getLineNum(node) {{{1 +" Return the line number where the given node is rendered. Return -1 if the +" given node is not visible. +function! s:UI.getLineNum(node) + + if a:node.isRoot() return self.getRootLineNum() endif - let totalLines = line("$") + let l:pathComponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/\s*$', '', '')] + let l:currentPathComponent = 1 - " the path components we have matched so far - let pathcomponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/ *$', '', '')] - " the index of the component we are searching for - let curPathComponent = 1 + let l:fullPath = a:node.path.str({'format': 'UI'}) - let fullpath = a:file_node.path.str({'format': 'UI'}) + for l:lineNumber in range(self.getRootLineNum() + 1, line('$')) + let l:currentLine = getline(l:lineNumber) + let l:indentLevel = self._indentLevelFor(l:currentLine) - let lnum = self.getRootLineNum() - while lnum > 0 - let lnum = lnum + 1 - " have we reached the bottom of the tree? - if lnum ==# totalLines+1 - return -1 + if l:indentLevel != l:currentPathComponent + continue endif - let curLine = getline(lnum) + let l:currentLine = self._stripMarkup(l:currentLine) + let l:currentPath = join(l:pathComponents, '/') . '/' . l:currentLine - let indent = self._indentLevelFor(curLine) - if indent ==# curPathComponent - let curLine = self._stripMarkup(curLine) - - let curPath = join(pathcomponents, '/') . '/' . curLine - if stridx(fullpath, curPath, 0) ==# 0 - if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/' - let curLine = substitute(curLine, '/ *$', '', '') - call add(pathcomponents, curLine) - let curPathComponent = curPathComponent + 1 - - if fullpath ==# curPath - return lnum - endif - endif - endif + " Directories: If the current path "starts with" the full path, then + " either the paths are equal or the line is a cascade containing the + " full path. + if l:fullPath[-1:] == '/' && stridx(l:currentPath, l:fullPath) == 0 + return l:lineNumber endif - endwhile + + " Files: The paths must exactly match. + if l:fullPath ==# l:currentPath + return l:lineNumber + endif + + " Otherwise: If the full path starts with the current path and the + " current path is a directory, we add a new path component. + if stridx(l:fullPath, l:currentPath) == 0 && l:currentPath[-1:] == '/' + let l:currentLine = substitute(l:currentLine, '/\s*$', '', '') + call add(l:pathComponents, l:currentLine) + let l:currentPathComponent += 1 + endif + endfor + return -1 endfunction diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 71d719aa..2abd248a 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -202,8 +202,28 @@ function! NERDTreeFocus() endfunction function! NERDTreeCWD() + + if empty(getcwd()) + call nerdtree#echoWarning('current directory does not exist') + return + endif + + try + let l:cwdPath = g:NERDTreePath.New(getcwd()) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echoWarning('current directory does not exist') + return + endtry + call NERDTreeFocus() - call nerdtree#ui_glue#chRootCwd() + + if b:NERDTree.root.path.equals(l:cwdPath) + return + endif + + let l:newRoot = g:NERDTreeFileNode.New(l:cwdPath, b:NERDTree) + call b:NERDTree.changeRoot(l:newRoot) + normal! ^ endfunction function! NERDTreeAddPathFilter(callback) diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index 81aedfd3..cf592cf7 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -125,6 +125,8 @@ function! s:Flake8() " {{{ let l:old_gfm=&grepformat let l:old_gp=&grepprg let l:old_shellpipe=&shellpipe + let l:old_t_ti=&t_ti + let l:old_t_te=&t_te " write any changes before continuing if &readonly == 0 @@ -132,20 +134,26 @@ function! s:Flake8() " {{{ endif set lazyredraw " delay redrawing - cclose " close any existing cwindows - " set shellpipe to > instead of tee (suppressing output) + " prevent terminal from blinking set shellpipe=> + set t_ti= + set t_te= " perform the grep itself let &grepformat="%f:%l:%c: %m\,%f:%l: %m" let &grepprg=s:flake8_cmd silent! grep! "%" + " close any existing cwindows, + " placed after 'grep' in case quickfix is open on autocmd QuickFixCmdPost + cclose " restore grep settings let &grepformat=l:old_gfm let &grepprg=l:old_gp let &shellpipe=l:old_shellpipe + let &t_ti=l:old_t_ti + let &t_te=l:old_t_te " process results let l:results=getqflist() diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index bd4eced1..b5350d6a 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -53,11 +53,12 @@ function! s:shellesc(arg) abort endif endfunction +let s:fnameescape = " \t\n*?[{`$\\%#'\"|!<" function! s:fnameescape(file) abort if exists('*fnameescape') return fnameescape(a:file) else - return escape(a:file," \t\n*?[{`$\\%#'\"|!<") + return escape(a:file, s:fnameescape) endif endfunction @@ -160,13 +161,8 @@ function! s:UserCommand() abort return get(g:, 'fugitive_git_command', g:fugitive_git_executable) endfunction -function! s:Prepare(dir, ...) abort - if type(a:dir) == type([]) - let args = ['--git-dir=' . (a:0 ? a:1 : get(b:, 'git_dir', ''))] + a:dir - else - let args = ['--git-dir=' . a:dir] + (a:000) - endif - return g:fugitive_git_executable . ' ' . join(map(args, 's:shellesc(v:val)')) +function! s:Prepare(...) abort + return call('fugitive#Prepare', a:000) endfunction let s:git_versions = {} @@ -203,55 +199,97 @@ function! s:Tree(...) abort return FugitiveTreeForGitDir(a:0 ? a:1 : get(b:, 'git_dir', '')) endfunction -function! s:PreparePathArgs(cmd, dir) abort - if fugitive#GitVersion() !~# '^[01]\.' +function! s:PreparePathArgs(cmd, dir, literal) abort + let literal_supported = fugitive#GitVersion() !~# '^0\|^1\.[1-8]\.' + if a:literal && literal_supported call insert(a:cmd, '--literal-pathspecs') endif let split = index(a:cmd, '--') - let tree = s:Tree(a:dir) - if empty(tree) || split < 0 + if split < 0 return a:cmd endif for i in range(split + 1, len(a:cmd) - 1) - let a:cmd[i] = fugitive#Path(a:cmd[i], './', a:dir) + if type(a:cmd[i]) == type(0) + let a:cmd[i] = fugitive#Path(bufname(a:cmd[i]), './', a:dir) + elseif a:literal + let a:cmd[i] = fugitive#Path(a:cmd[i], './', a:dir) + elseif !literal_supported + let a:cmd[i] = substitute(a:cmd[i], '^:\%(/\|([^)]*)\)\=:\=', './', '') + endif endfor return a:cmd endfunction -function! s:TreeChomp(...) abort - let args = copy(type(a:1) == type([]) ? a:1 : a:000) - let dir = a:0 > 1 && type(a:1) == type([]) ? a:2 : b:git_dir - call s:PreparePathArgs(args, dir) - let tree = s:Tree(dir) - let pre = '' - if empty(tree) - let args = ['--git-dir=' . dir] + args - elseif s:cpath(tree) !=# s:cpath(getcwd()) - if fugitive#GitVersion() =~# '^[01]\.' - let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? ' & ' : '; ') - else - let args = ['-C', tree] + args - endif +let s:prepare_env = { + \ 'sequence.editor': 'GIT_SEQUENCE_EDITOR', + \ 'core.editor': 'GIT_EDITOR', + \ 'core.askpass': 'GIT_ASKPASS', + \ } +function! fugitive#Prepare(...) abort + if !a:0 + return g:fugitive_git_executable + endif + if type(a:1) ==# type([]) + let cmd = a:000[1:-1] + a:1 + else + let cmd = copy(a:000) endif - return s:sub(s:System(pre . g:fugitive_git_executable . ' ' . - \ join(map(args, 's:shellesc(v:val)'))), '\n$', '') -endfunction - -function! fugitive#Prepare(cmd, ...) abort - let dir = a:0 ? a:1 : get(b:, 'git_dir', '') - let tree = s:Tree(dir) - let args = type(a:cmd) == type([]) ? join(map(s:PreparePathArgs(copy(a:cmd), dir), 's:shellesc(v:val)')) : a:cmd let pre = '' - if empty(tree) || (type(a:cmd) == type([]) && index(a:cmd, '--') == len(a:cmd) - 1) + let i = 0 + while i < len(cmd) + if cmd[i] =~# '^$\|[\/.]' && cmd[i] !~# '^-' + let dir = remove(cmd, 0) + elseif type(cmd[i]) ==# type(0) + let dir = getbufvar(remove(cmd, i), 'git_dir') + elseif cmd[i] ==# '-c' && len(cmd) > i + 1 + let key = matchstr(cmd[i+1], '^[^=]*') + if has_key(s:prepare_env, tolower(key)) || key !~# '\.' + let var = get(s:prepare_env, tolower(key), key) + let val = matchstr(cmd[i+1], '=\zs.*') + if s:winshell() + let pre .= 'set ' . var . '=' . s:shellesc(val) . ' & ' + else + let pre = (len(pre) ? pre : 'env ') . var . '=' . s:shellesc(val) . ' ' + endif + endif + if fugitive#GitVersion() =~# '^0\|^1\.[1-7]\.' || cmd[i+1] !~# '\.' + call remove(cmd, i, i + 1) + else + let i += 2 + endif + elseif cmd[i] =~# '^--.*pathspecs$' + let explicit_pathspec_option = 1 + if fugitive#GitVersion() =~# '^0\|^1\.[1-8]\.' + call remove(cmd, i) + else + let i += 1 + endif + elseif cmd[i] !~# '^-' + break + else + let i += 1 + endif + endwhile + if !exists('dir') + let dir = get(b:, 'git_dir', '') + endif + let tree = s:Tree(dir) + call s:PreparePathArgs(cmd, dir, !exists('explicit_pathspec_option')) + let args = join(map(copy(cmd), 's:shellesc(v:val)')) + if empty(tree) || index(cmd, '--') == len(cmd) - 1 let args = s:shellesc('--git-dir=' . dir) . ' ' . args - elseif fugitive#GitVersion() =~# '^[01]\.' - let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? ' & ' : '; ') + elseif fugitive#GitVersion() =~# '^0\|^1\.[1-8]\.' + let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? ' & ' : '; ') . pre else let args = '-C ' . s:shellesc(tree) . ' ' . args endif return pre . g:fugitive_git_executable . ' ' . args endfunction +function! s:TreeChomp(...) abort + return s:sub(s:System(call('fugitive#Prepare', a:000)), '\n$', '') +endfunction + function! fugitive#Head(...) abort let dir = a:0 > 1 ? a:2 : get(b:, 'git_dir', '') if empty(dir) || !filereadable(dir . '/HEAD') @@ -277,8 +315,8 @@ function! fugitive#RevParse(rev, ...) abort endfunction function! fugitive#Config(name, ...) abort - let cmd = s:Prepare(a:0 ? a:1 : get(b:, 'git_dir', ''), 'config', '--get', a:name) - let out = matchstr(system(cmd), "[^\r\n]*") + let cmd = fugitive#Prepare(a:0 ? a:1 : get(b:, 'git_dir', ''), '--no-literal-pathspecs', 'config', '--get', '--', a:name) + let out = matchstr(system(cmd), "[^\n]*") return v:shell_error ? '' : out endfunction @@ -376,13 +414,19 @@ endfunction call s:add_methods('repo',['dir','tree','bare','route','translate','head']) +function! s:repo_prepare(...) dict abort + return call('fugitive#Prepare', [self.git_dir] + a:000) +endfunction + function! s:repo_git_command(...) dict abort let git = s:UserCommand() . ' --git-dir='.s:shellesc(self.git_dir) return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') endfunction function! s:repo_git_chomp(...) dict abort - return s:sub(s:System(s:Prepare(a:000, self.git_dir)), '\n$', '') + let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) + let output = git . join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') + return s:sub(s:System(output),'\n$','') endfunction function! s:repo_git_chomp_in_tree(...) dict abort @@ -400,7 +444,7 @@ function! s:repo_rev_parse(rev) dict abort return fugitive#RevParse(a:rev, self.git_dir) endfunction -call s:add_methods('repo',['git_command','git_chomp','git_chomp_in_tree','rev_parse']) +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")') @@ -474,15 +518,33 @@ function! fugitive#Real(url) abort endfunction function! fugitive#Path(url, ...) abort - if !a:0 || empty(a:url) + if empty(a:url) + return '' + endif + let dir = a:0 > 1 ? a:2 : get(b:, 'git_dir', '') + let tree = s:Tree(dir) + if !a:0 return fugitive#Real(a:url) + elseif a:1 =~# '\.$' + let path = s:Slash(fugitive#Real(a:url)) + let cwd = getcwd() + let lead = '' + while s:cpath(tree . '/', (cwd . '/')[0 : len(tree)]) + if s:cpath(cwd . '/', path[0 : len(cwd)]) + if strpart(path, len(cwd) + 1) =~# '^\.git\%(/\|$\)' + break + endif + return a:1[0:-2] . (empty(lead) ? './' : lead) . strpart(path, len(cwd) + 1) + endif + let cwd = fnamemodify(cwd, ':h') + let lead .= '../' + endwhile + return a:1[0:-2] . path endif let url = s:Slash(fnamemodify(a:url, ':p')) if url =~# '/$' && s:Slash(a:url) !~# '/$' let url = url[0:-2] endif - let dir = a:0 > 1 ? a:2 : get(b:, 'git_dir', '') - let tree = s:Tree(dir) let [argdir, commit, file] = s:DirCommitFile(a:url) if len(argdir) && s:cpath(argdir) !=# s:cpath(dir) let file = '' @@ -504,7 +566,10 @@ function! s:Relative(...) abort endfunction function! fugitive#Route(object, ...) abort - if a:object =~# '^[~$]' + if type(a:object) == type(0) + let name = bufname(a:object) + return s:PlatformSlash(name =~# '^$\|^/\|^\a\+:' ? name : getcwd() . '/' . name) + elseif a:object =~# '^[~$]' let prefix = matchstr(a:object, '^[~$]\i*') let owner = expand(prefix) return s:PlatformSlash((len(owner) ? owner : prefix) . strpart(a:object, len(prefix))) @@ -580,7 +645,7 @@ function! fugitive#Route(object, ...) abort endif endif if !exists('f') - let commit = substitute(matchstr(rev, '^[^:]\+\|^:.*'), '^@\%($|[^~]\)\@=', 'HEAD', '') + let commit = substitute(matchstr(rev, '^[^:]\+\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') let file = substitute(matchstr(rev, '^[^:]\+\zs:.*'), '^:', '/', '') if file =~# '^/\.\.\=\%(/\|$\)\|^//\|^/\a\+:' let file = file =~# '^/\.' ? simplify(getcwd() . file) : file[1:-1] @@ -620,18 +685,13 @@ function! s:Generate(rev, ...) abort return fugitive#Route(object, dir) endfunction -function! s:RemoveDot(path, ...) abort - if a:path !~# '^\./' - return a:path +function! s:DotRelative(path) abort + let cwd = getcwd() + let path = substitute(a:path, '^[~$]\i*', '\=expand(submatch(0))', '') + if s:cpath(cwd . '/', (path . '/')[0 : len(cwd)]) + return '.' . strpart(path, len(cwd)) endif - let dir = a:0 ? a:1 : get(b:, 'git_dir', '') - let cdir = fugitive#CommonDir(dir) - if len(filter(['', '/tags', '/heads', '/remotes'], 'getftime(cdir . "/refs" . v:val . a:path[1:-1]) >= 0')) || - \ a:path =~# 'HEAD$' && filereadable(dir . a:path[1:-1]) || - \ a:path =~# '^\./refs/' && filereadable(cdir . a:path[1:-1]) - return a:path - endif - return a:path[2:-1] + return a:path endfunction function! fugitive#Object(...) abort @@ -660,6 +720,44 @@ function! fugitive#Object(...) abort endif endfunction +let s:var = '\%(%\|#<\=\d\+\|##\=\)' +let s:flag = '\%(:[p8~.htre]\|:g\=s\(.\).\{-\}\1.\{-\}\1\)' +let s:expand = '\%(\(' . s:var . '\)\(' . s:flag . '*\)\(:S\)\=\)' + +function! s:BufName(var) abort + if a:var ==# '%' + return bufname(get(b:, 'fugitive_blamed_bufnr', '')) + elseif a:var =~# '^#\d*$' + let nr = getbufvar(+a:var[1:-1], 'fugitive_blamed_bufnr', '') + return bufname(nr ? nr : +a:var[1:-1]) + else + return expand(a:var) + endif +endfunction + +function! s:ExpandVar(other, var, flags, esc) abort + if a:other =~# '^\' + return a:other[1:-1] + elseif a:other =~# '^!' + let buffer = s:BufName(len(a:other) > 1 ? '#'. a:other[1:-1] : '%') + let owner = s:Owner(buffer) + return len(owner) ? owner : '@' + endif + let flags = a:flags + let file = s:DotRelative(fugitive#Real(s:BufName(a:var))) + while len(flags) + let flag = matchstr(flags, s:flag) + let flags = strpart(flags, len(flag)) + if flag ==# ':.' + let file = s:DotRelative(file) + else + let file = fnamemodify(file, flag) + endif + endwhile + let file = s:Slash(file) + return (len(a:esc) ? shellescape(file) : file) +endfunction + function! s:Expand(rev) abort if a:rev =~# '^:[0-3]$' let file = a:rev . s:Relative(':') @@ -667,30 +765,36 @@ function! s:Expand(rev) abort let file = 'HEAD^{}' . a:rev[1:-1] . s:Relative(':') elseif a:rev =~# '^@{' let file = 'HEAD' . a:rev. s:Relative(':') - elseif a:rev =~# '^[~^]/\@!' + elseif a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]' let commit = substitute(s:DirCommitFile(@%)[1], '^\d\=$', 'HEAD', '') let file = commit . a:rev . s:Relative(':') else let file = a:rev endif - return s:sub(substitute(file, - \ '\([%#]\)$\|\\\([[:punct:]]\)','\=len(submatch(2)) ? submatch(2) : fugitive#Path(expand(submatch(1)))','g'), - \ '\.\@<=/$','') + return substitute(file, + \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),"")', 'g') +endfunction + +function! fugitive#Expand(object) abort + return substitute(a:object, + \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5))', 'g') endfunction function! s:ShellExpand(cmd) abort - return substitute(a:cmd, '\\\@ '.tmp let sha1 = readfile(tmp)[0] - let old_mode = matchstr(system(s:Prepare(dir, 'ls-files', '--stage', '--', '.' . file)), '^\d\+') + let old_mode = matchstr(system(s:Prepare(dir, 'ls-files', '--stage', '.' . file)), '^\d\+') if empty(old_mode) let old_mode = executable(s:Tree(dir) . file) ? '100755' : '100644' endif @@ -1353,13 +1440,14 @@ function! fugitive#BufReadCmd(...) abort let b:fugitive_type = 'tree' endif if v:shell_error + let error = b:fugitive_type unlet b:fugitive_type if rev =~# '^:\d:' let &readonly = !filewritable(dir . '/index') return 'silent doautocmd BufNewFile '.s:fnameescape(amatch) else setlocal readonly nomodifiable - return '' + return 'echo ' . string(error) endif elseif b:fugitive_type !~# '^\%(tag\|commit\|tree\|blob\)$' return "echoerr ".string("fugitive: unrecognized git type '".b:fugitive_type."'") @@ -1385,7 +1473,7 @@ function! fugitive#BufReadCmd(...) abort call s:ReplaceCmd([dir, 'ls-tree', exists('sha') ? sha : rev]) else if !exists('sha') - let sha = system(s:Prepare(dir, 'rev-parse', '--verify', rev))[0:-2] + let sha = system(s:Prepare(dir, 'rev-parse', '--verify', rev, '--'))[0:-2] endif call s:ReplaceCmd([dir, 'show', '--no-color', sha]) endif @@ -1406,13 +1494,13 @@ function! fugitive#BufReadCmd(...) abort if getline('.') ==# 'parent ' silent keepjumps delete_ else - silent exe 'keepjumps s/\m\C\%(^parent\)\@\)\=$','W',line('.')+3) if lnum silent keepjumps delete_ end - silent keepjumps 1,/^diff --git\|\%$/g/\r$/s/// + silent exe (exists(':keeppatterns') ? 'keeppatterns' : '') 'keepjumps 1,/^diff --git\|\%$/g/\r$/s///' keepjumps 1 endif elseif b:fugitive_type ==# 'stage' @@ -1766,7 +1854,7 @@ endfunction function! s:StageToggle(lnum1,lnum2) abort if a:lnum1 == 1 && a:lnum2 == 1 - return 'Gedit /.git|call search("^index$", "wc")' + return 'Gedit .git/|call search("^index$", "wc")' endif try let output = '' @@ -1802,11 +1890,7 @@ function! s:StageToggle(lnum1,lnum2) abort endif execute lnum if section ==# 'staged' - if filename =~ ' -> ' - let files_to_unstage = split(filename,' -> ') - else - let files_to_unstage = [filename] - endif + let files_to_unstage = split(filename, ' -> ') let filename = files_to_unstage[-1] let cmd = ['reset', '-q'] + map(copy(files_to_unstage), '"./" . v:val') elseif getline(lnum) =~# '^.\=\tdeleted:' @@ -2187,10 +2271,10 @@ function! s:Log(cmd, bang, line1, line2, ...) abort let before = substitute(args, ' --\S\@!.*', '', '') let after = strpart(args, len(before)) let path = s:Relative('/') + let relative = path[1:-1] if path =~# '^/\.git\%(/\|$\)' || len(after) let path = '' endif - let relative = s:Relative('') if before !~# '\s[^[:space:]-]' let owner = s:Owner(@%) if len(owner) @@ -2900,8 +2984,8 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort else let cmd += ['--contents', '-'] endif - let cmd += ['--', s:Relative('')] - let basecmd = escape(s:Prepare(cmd), '!#%') + let cmd += ['--', expand('%:p')] + let basecmd = escape(fugitive#Prepare(cmd), '!#%') try let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let tree = s:Tree() @@ -3262,8 +3346,11 @@ function! s:Browse(bang,line1,count,...) abort else let commit = '' if len(merge) - let remotehead = cdir . '/refs/remotes/' . remote . '/' . merge - let commit = filereadable(remotehead) ? get(readfile(remotehead), 0, '') : '' + let owner = s:Owner(@%) + let commit = s:TreeChomp('merge-base', 'refs/remotes/' . remote . '/' . merge, empty(owner) ? 'HEAD' : owner, '--') + if v:shell_error + let commit = '' + endif if a:count && !a:0 && commit =~# '^\x\{40\}$' let blame_list = tempname() call writefile([commit, ''], blame_list, 'b') @@ -3322,6 +3409,7 @@ function! s:Browse(bang,line1,count,...) abort \ 'line1': line1, \ 'line2': line2} + let url = '' for Handler in get(g:, 'fugitive_browse_handlers', []) let url = call(Handler, [copy(opts)]) if !empty(url) @@ -3453,7 +3541,7 @@ endfunction function! fugitive#StatusCfile() abort let file = s:Generate(s:StatusCfile()) - return empty(file) ? "\\" : s:fnameescape(file) + return empty(file) ? fugitive#Cfile() : s:fnameescape(file) endfunction function! s:cfile() abort @@ -3651,7 +3739,7 @@ function! fugitive#Statusline(...) abort let status = '' let commit = s:DirCommitFile(@%)[1] if len(commit) - let status .= ':' . commit[0:7] + let status .= ':' . commit[0:6] endif let status .= '('.FugitiveHead(7).')' return '[Git'.status.']' diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index 444373fc..d3d99085 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -312,14 +312,14 @@ a Show the current tag, commit, or tree in an alternate SPECIFYING OBJECTS *fugitive-object* *fugitive-revision* Fugitive objects are either work tree files or Git revisions as defined in the -"SPECIFYING REVISIONS" section in the git-rev-parse man page, with a few -convenience notations thrown in for good measure. For commands that accept an +"SPECIFYING REVISIONS" section in the git-rev-parse man page, with expansions +inspired by |cmdline-special| layered on top. For commands that accept an optional object, the default is the file in the index for work tree files and the work tree file for everything else. Example objects follow. Object Meaning ~ HEAD .git/HEAD -refs/heads/x .git/refs/heads/x +refs/heads/x .git/refs/heads/x (in "common dir" if present) @ The commit referenced by @ aka HEAD master^ The parent of the commit referenced by master master: The tree referenced by master @@ -327,15 +327,16 @@ master: The tree referenced by master Makefile The file named Makefile in the work tree @^:Makefile The file named Makefile in the parent of HEAD :Makefile The file named Makefile in the index (writable) -@:% The current file in HEAD -- The current file in HEAD --^ The current file in the previous commit --~3 The current file 3 commits ago -: .git/index (Same as |:Gstatus|) +@~2:% The current file in the grandparent of HEAD :% The current file in the index :1:% The current file's common ancestor during a conflict -:2:% The current file in the target branch during a conflict -:3:% The current file in the merged branch during a conflict +:2:# The alternate file in the target branch during a conflict +:3:#5 The file from buffer #5 in the merged branch during a conflict +! The commit owning the current file +!:Makefile The file named Makefile in the commit owning the current file +!3^2 The second parent of the commit owning buffer #3 +.git/config The repo config file +: Same as |:Gstatus| STATUSLINE *fugitive-statusline* diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index c33e3683..952c715e 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -44,7 +44,7 @@ function! FugitiveReal(...) abort endfunction function! FugitiveRoute(...) abort - return fugitive#Route(a:0 ? a:1 : ':/', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) + return fugitive#Route(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction function! FugitivePath(...) abort @@ -57,6 +57,9 @@ endfunction function! FugitiveParse(...) abort let path = s:Slash(a:0 ? a:1 : @%) + if path !~# '^fugitive:' + return ['', ''] + endif let vals = matchlist(path, '\c^fugitive:\%(//\)\=\(.\{-\}\)\%(//\|::\)\(\x\{40\}\|[0-3]\)\(/.*\)\=$') if len(vals) return [(vals[2] =~# '^.$' ? ':' : '') . vals[2] . substitute(vals[3], '^/', ':', ''), vals[1]] @@ -200,6 +203,10 @@ function! FugitiveDetect(path) abort endif endfunction +function! FugitiveFind(...) abort + return call('FugitiveRoute', a:000) +endfunction + function! FugitiveGenerate(...) abort return call('FugitiveRoute', a:000) endfunction @@ -212,6 +219,21 @@ function! s:Slash(path) abort endif endfunction +function! s:ProjectionistDetect() abort + let file = s:Slash(get(g:, 'projectionist_file', '')) + let dir = FugitiveExtractGitDir(file) + let base = matchstr(file, '^fugitive://.\{-\}//\x\+') + if empty(base) + let base = FugitiveTreeForGitDir(dir) + endif + if len(base) + if exists('+shellslash') && !&shellslash + let base = tr(base, '/', '\') + endif + call projectionist#append(base, FugitiveCommonDir(dir) . '/info/projections.json') + endif +endfunction + augroup fugitive autocmd! @@ -258,4 +280,6 @@ augroup fugitive endif autocmd User Flags call Hoist('buffer', function('FugitiveStatusline')) + + autocmd User ProjectionistDetect call s:ProjectionistDetect() augroup END diff --git a/sources_non_forked/vim-go/.codecov.yml b/sources_non_forked/vim-go/.codecov.yml index e9062d50..9a8b1bb9 100644 --- a/sources_non_forked/vim-go/.codecov.yml +++ b/sources_non_forked/vim-go/.codecov.yml @@ -6,6 +6,7 @@ coverage: target: auto threshold: 1 base: auto + patch: off comment: false ignore: - "!autoload/go/*.vim$" diff --git a/sources_non_forked/vim-go/.travis.yml b/sources_non_forked/vim-go/.travis.yml index b6f0b4de..a94744a8 100644 --- a/sources_non_forked/vim-go/.travis.yml +++ b/sources_non_forked/vim-go/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.10.x + - 1.11.x notifications: email: false matrix: diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 0aab9221..8f86924f 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,5 +1,18 @@ ## unplanned +FEATURES: + +* **go.mod file support!** This is the first feature for upcoming Go modules + support. The followings are added: + * Syntax highlighting for the `go.mod` file. + * A new `gomod` filetype is set if a `go.mod` file has been opened and starts + with the line `module ` + * New **:GoModFmt** command that formats the `go.mod` file + * Auto format on save feature for `:GoModFmt`, enabled automatically. Can be + toggled of with the setting `g:go_mod_fmt_autosave` or with the command: + `GoModFmtAutoSaveToggle` + [[GH-1931]](https://github.com/fatih/vim-go/pull/1931) + IMPROVEMENTS: * Unify async job handling for Vim8 and Neovim. [[GH-1864]](https://github.com/fatih/vim-go/pull/1864) @@ -13,6 +26,36 @@ IMPROVEMENTS: [[GH-1894]](https://github.com/fatih/vim-go/pull/1894) * Install keyify from its canonical import path. [[GH-1924]](https://github.com/fatih/vim-go/pull/1924) +* Update the tested version of Neovim to v0.3.1. + [[GH-1923]](https://github.com/fatih/vim-go/pull/1923) +* Run autocompletion asynchronously in Vim8 and Neovim. + [[GH-1926]](https://github.com/fatih/vim-go/pull/1926) +* Show statusline update when running `:GoInfo` with `g:go_info_mode='gocode'`. + [[GH-1937]](https://github.com/fatih/vim-go/pull/1937) +* Do not update statusline when highlighting sameids or showing type info via + an autocmd. + [[GH-1937]](https://github.com/fatih/vim-go/pull/1937) +* Do not indent within a raw string literal. + [[GH-1858]](https://github.com/fatih/vim-go/pull/1858) +* Highlight Go's predeclared function identifiers (the functions in `builtins`) + using keyword groups and highlight them using the `Identifiers` group. + [[GH-1939]](https://github.com/fatih/vim-go/pull/1939) +* Add a new FAQ entry to instruct users how to modify the vim-go highlight + groups. + [[GH-1939]](https://github.com/fatih/vim-go/pull/1939) +* Improve use of statusline and progress messages. + [[GH-1948]](https://github.com/fatih/vim-go/pull/1948) +* Add `tt` snippet to create a table test boilerplate (see + https://github.com/golang/go/wiki/TableDrivenTests for more information on + how to use a table driven test). + [[GH-1956]](https://github.com/fatih/vim-go/pull/1956) +* Add `(go-decls)` and `(go-decls-dir)` mappings. + [[GH-1964]](https://github.com/fatih/vim-go/pull/1964) +* Handle go1.11 test output. + [[GH-1978]](https://github.com/fatih/vim-go/pull/1978) +* Internal: install tools by their custom names + [[GH-1984]](https://github.com/fatih/vim-go/pull/1984) + BUG FIXES: * Fix `:GoRun %` on Windows. @@ -23,10 +66,17 @@ BUG FIXES: [[GH-1895]](https://github.com/fatih/vim-go/pull/1895) * Fix `:GoInfo` when `g:go_info_mode` is `gocode` [[GH-1915]](https://github.com/fatih/vim-go/pull/1915) +* Fix highlighting of pointer type in var blocks. + [[GH-1794]](https://github.com/fatih/vim-go/pull/1794) +* Fix `:GoImport` when adding to an empty import block (i.e`import ()`) + [[GH-1938]](https://github.com/fatih/vim-go/pull/1938) BACKWARDS INCOMPATIBILITIES: * Bump minimum required version of Vim to 7.4.2009. [[GH-1899]](https://github.com/fatih/vim-go/pull/1899) +* Switch gocode to github.com/mdempsky/gocode. Several gocode options have been + removed and a new one has been added. + [[GH-1853]](https://github.com/fatih/vim-go/pull/1853) ## 1.18 - (July 18, 2018) @@ -42,7 +92,7 @@ FEATURES: f, err := os.Open("file") } ``` - + Becomes: ``` diff --git a/sources_non_forked/vim-go/Dockerfile b/sources_non_forked/vim-go/Dockerfile index b46cf5c0..0b9203d1 100644 --- a/sources_non_forked/vim-go/Dockerfile +++ b/sources_non_forked/vim-go/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10.1 +FROM golang:1.11 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/README.md b/sources_non_forked/vim-go/README.md index 203dc817..14211b5a 100644 --- a/sources_non_forked/vim-go/README.md +++ b/sources_non_forked/vim-go/README.md @@ -33,7 +33,7 @@ This plugin adds Go language support for Vim, with the following main features: ## Install -vim-go requires at least Vim 7.4.2009 or Neovim 0.2.2. +vim-go requires at least Vim 7.4.2009 or Neovim 0.3.1. The [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) is the recommended version to use. If you choose to use the master branch instead, diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 05a39cd8..64c695f8 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -31,15 +31,12 @@ function! go#cmd#Build(bang, ...) abort \ [".", "errors"] " Vim and Neovim async. - if go#util#has_job() || has('nvim') - if go#config#EchoCommandInfo() - call go#util#EchoProgress("building dispatched ...") - endif - + if go#util#has_job() call s:cmd_job({ \ 'cmd': ['go'] + args, \ 'bang': a:bang, \ 'for': 'GoBuild', + \ 'statustype': 'build' \}) " Vim 7.4 without async @@ -195,14 +192,11 @@ function! go#cmd#Install(bang, ...) abort " expand all wildcards(i.e: '%' to the current file name) let goargs = map(copy(a:000), "expand(v:val)") - if go#config#EchoCommandInfo() - call go#util#EchoProgress("installing dispatched ...") - endif - call s:cmd_job({ \ 'cmd': ['go', 'install', '-tags', go#config#BuildTags()] + goargs, \ 'bang': a:bang, \ 'for': 'GoInstall', + \ 'statustype': 'install' \}) return endif @@ -281,16 +275,7 @@ endfunction " | Vim job callbacks | " --------------------- -function s:cmd_job(args) abort - let status_dir = expand('%:p:h') - let started_at = reltime() - - call go#statusline#Update(status_dir, { - \ 'desc': "current status", - \ 'type': a:args.cmd[1], - \ 'state': "started", - \}) - +function! s:cmd_job(args) abort " autowrite is not enabled for jobs call go#cmd#autowrite() diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index 9460b462..78e9a134 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -9,6 +9,15 @@ function! s:gocodeCommand(cmd, args) abort let cmd = [bin_path] let cmd = extend(cmd, ['-sock', socket_type]) let cmd = extend(cmd, ['-f', 'vim']) + + if go#config#GocodeProposeBuiltins() + let cmd = extend(cmd, ['-builtin']) + endif + + if go#config#GocodeProposeSource() + let cmd = extend(cmd, ['-source']) + endif + let cmd = extend(cmd, [a:cmd]) let cmd = extend(cmd, a:args) @@ -43,31 +52,7 @@ function! s:sync_gocode(cmd, args, input) abort return l:result endfunction -let s:optionsEnabled = 0 -function! s:gocodeEnableOptions() abort - if s:optionsEnabled - return - endif - - let l:bin_path = go#path#CheckBinPath("gocode") - if empty(l:bin_path) - return - endif - - let s:optionsEnabled = 1 - - call go#util#Exec(['gocode', 'set', 'propose-builtins', s:toBool(go#config#GocodeProposeBuiltins())]) - call go#util#Exec(['gocode', 'set', 'autobuild', s:toBool(go#config#GocodeAutobuild())]) - call go#util#Exec(['gocode', 'set', 'unimported-packages', s:toBool(go#config#GocodeUnimportedPackages())]) -endfunction - -function! s:toBool(val) abort - if a:val | return 'true' | else | return 'false' | endif -endfunction - function! s:gocodeAutocomplete() abort - call s:gocodeEnableOptions() - " use the offset as is, because the cursor position is the position for " which autocomplete candidates are needed. return s:sync_gocode('autocomplete', @@ -81,60 +66,36 @@ function! go#complete#GetInfo() abort return s:sync_info(0) endfunction -function! go#complete#Info() abort +function! go#complete#Info(showstatus) abort if go#util#has_job(1) - return s:async_info(1) + return s:async_info(1, a:showstatus) else return s:sync_info(1) endif endfunction -function! s:async_info(echo) - if exists("s:async_info_job") - call job_stop(s:async_info_job) - unlet s:async_info_job - endif +function! s:async_info(echo, showstatus) + let state = {'echo': a:echo} - let state = { - \ 'exited': 0, - \ 'exit_status': 0, - \ 'closed': 0, - \ 'messages': [], - \ 'echo': a:echo - \ } - - function! s:callback(chan, msg) dict - let l:msg = a:msg - if &encoding != 'utf-8' - let l:msg = iconv(l:msg, 'utf-8', &encoding) - endif - call add(self.messages, l:msg) - endfunction - - function! s:exit_cb(job, exitval) dict - let self.exit_status = a:exitval - let self.exited = 1 - - if self.closed - call self.complete() - endif - endfunction - - function! s:close_cb(ch) dict - let self.closed = 1 - if self.exited - call self.complete() - endif - endfunction - - function state.complete() dict - if self.exit_status != 0 + function! s:complete(job, exit_status, messages) abort dict + if a:exit_status != 0 return endif - let result = s:info_filter(self.echo, join(self.messages, "\n")) + 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) " add 1 to the offset, so that the position at the cursor will be included " in gocode's search @@ -146,23 +107,32 @@ function! s:async_info(echo) \ "GOROOT": go#util#env("goroot") \ } + let opts = { + \ 'bang': 1, + \ 'complete': state.complete, + \ 'for': '_', + \ } + + if a:showstatus + let opts.statustype = 'gocode' + endif + + let opts = go#job#Options(l:opts) + let cmd = s:gocodeCommand('autocomplete', \ [expand('%:p'), offset]) - " TODO(bc): Don't write the buffer to a file; pass the buffer directrly to + " TODO(bc): Don't write the buffer to a file; pass the buffer directly to " gocode's stdin. It shouldn't be necessary to use {in_io: 'file', in_name: " s:gocodeFile()}, but unfortunately {in_io: 'buffer', in_buf: bufnr('%')} - " should work. - let options = { + " doesn't work. + call extend(opts, { \ 'env': env, \ 'in_io': 'file', \ 'in_name': s:gocodeFile(), - \ 'callback': funcref("s:callback", [], state), - \ 'exit_cb': funcref("s:exit_cb", [], state), - \ 'close_cb': funcref("s:close_cb", [], state) - \ } + \ }) - let s:async_info_job = job_start(cmd, options) + call go#job#Start(cmd, opts) endfunction function! s:gocodeFile() diff --git a/sources_non_forked/vim-go/autoload/go/complete_test.vim b/sources_non_forked/vim-go/autoload/go/complete_test.vim new file mode 100644 index 00000000..7cd6297e --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/complete_test.vim @@ -0,0 +1,20 @@ +func! Test_GetInfo() + let l:filename = 'complete/complete.go' + let l:tmp = gotest#load_fixture(l:filename) + + call cursor(8, 3) + + let g:go_info_mode = 'gocode' + let expected = 'func Example(s string)' + let actual = go#complete#GetInfo() + call assert_equal(expected, actual) + + let g:go_info_mode = 'guru' + call go#config#InfoMode() + let actual = go#complete#GetInfo() + call assert_equal(expected, actual) + + unlet g:go_info_mode +endfunction + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/config.vim b/sources_non_forked/vim-go/autoload/go/config.vim index 140e41c5..9ca3e2ba 100644 --- a/sources_non_forked/vim-go/autoload/go/config.vim +++ b/sources_non_forked/vim-go/autoload/go/config.vim @@ -135,10 +135,6 @@ function! go#config#SetGuruScope(scope) abort endif endfunction -function! go#config#GocodeUnimportedPackages() abort - return get(g:, 'go_gocode_unimported_packages', 0) -endfunction - let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix' function! go#config#GocodeSocketType() abort return get(g:, 'go_gocode_socket_type', s:sock_type) @@ -148,8 +144,8 @@ function! go#config#GocodeProposeBuiltins() abort return get(g:, 'go_gocode_propose_builtins', 1) endfunction -function! go#config#GocodeAutobuild() abort - return get(g:, 'go_gocode_autobuild', 1) +function! go#config#GocodeProposeSource() abort + return get(g:, 'go_gocode_propose_source', 1) endfunction function! go#config#EchoCommandInfo() abort @@ -282,6 +278,14 @@ function! go#config#SetAsmfmtAutosave(value) abort let g:go_asmfmt_autosave = a:value endfunction +function! go#config#ModFmtAutosave() abort + return get(g:, "go_mod_fmt_autosave", 1) +endfunction + +function! go#config#SetModFmtAutosave(value) abort + let g:go_mod_fmt_autosave = a:value +endfunction + function! go#config#DocMaxHeight() abort return get(g:, "go_doc_max_height", 20) endfunction @@ -416,7 +420,7 @@ function! go#config#HighlightVariableDeclarations() abort return get(g:, 'go_highlight_variable_declarations', 0) endfunction -function go#config#FoldEnable(...) abort +function! go#config#FoldEnable(...) abort if a:0 > 0 return index(go#config#FoldEnable(), a:1) > -1 endif diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index c4702dd3..20848614 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -44,11 +44,7 @@ function! go#coverage#Buffer(bang, ...) abort let s:toggle = 1 let l:tmpname = tempname() - if go#config#EchoCommandInfo() - call go#util#EchoProgress("testing...") - endif - - if go#util#has_job() || has('nvim') + if go#util#has_job() call s:coverage_job({ \ 'cmd': ['go', 'test', '-tags', go#config#BuildTags(), '-coverprofile', l:tmpname] + a:000, \ 'complete': function('s:coverage_callback', [l:tmpname]), @@ -59,6 +55,10 @@ function! go#coverage#Buffer(bang, ...) abort return endif + if go#config#EchoCommandInfo() + call go#util#EchoProgress("testing...") + endif + let args = [a:bang, 0, "-coverprofile", l:tmpname] if a:0 call extend(args, a:000) @@ -89,12 +89,13 @@ endfunction " a new HTML coverage page from that profile in a new browser function! go#coverage#Browser(bang, ...) abort let l:tmpname = tempname() - if go#util#has_job() || has('nvim') + if go#util#has_job() call s:coverage_job({ \ 'cmd': ['go', 'test', '-tags', go#config#BuildTags(), '-coverprofile', l:tmpname], \ 'complete': function('s:coverage_browser_callback', [l:tmpname]), \ 'bang': a:bang, \ 'for': 'GoTest', + \ 'statustype': 'coverage', \ }) return endif diff --git a/sources_non_forked/vim-go/autoload/go/debug.vim b/sources_non_forked/vim-go/autoload/go/debug.vim index 88642490..ca647300 100644 --- a/sources_non_forked/vim-go/autoload/go/debug.vim +++ b/sources_non_forked/vim-go/autoload/go/debug.vim @@ -25,12 +25,12 @@ function! s:groutineID() abort return s:state['currentThread'].goroutineID endfunction -function! s:exit(job, status) abort +function! s:complete(job, exit_status, data) abort if has_key(s:state, 'job') call remove(s:state, 'job') endif call s:clearState() - if a:status > 0 + if a:exit_status > 0 call go#util#EchoError(s:state['message']) endif endfunction @@ -567,14 +567,18 @@ function! go#debug#Start(is_test, ...) abort endif let l:cmd += l:args - call go#util#EchoProgress('Starting GoDebug...') let s:state['message'] = [] - let s:state['job'] = job_start(l:cmd, { - \ 'out_cb': function('s:out_cb'), - \ 'err_cb': function('s:err_cb'), - \ 'exit_cb': function('s:exit'), - \ 'stoponexit': 'kill', - \}) + let l:opts = { + \ 'for': '_', + \ 'statustype': 'debug', + \ 'complete': function('s:complete'), + \ } + let l:opts = go#job#Options(l:opts) + let l:opts.out_cb = function('s:out_cb') + let l:opts.err_cb = function('s:err_cb') + let l:opts.stoponexit = 'kill' + + let s:state['job'] = go#job#Start(l:cmd, l:opts) catch call go#util#EchoError(v:exception) endtry diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index d053615a..5cae5c83 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -42,20 +42,20 @@ function! go#def#Jump(mode) abort call extend(cmd, ["definition", fname . ':#' . go#util#OffsetCursor()]) - if go#util#has_job() || has('nvim') + if go#util#has_job() + let l:state = {} let l:spawn_args = { \ 'cmd': cmd, - \ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name]), + \ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name], l:state), \ 'for': '_', + \ 'statustype': 'searching declaration', \ } if &modified let l:spawn_args.input = stdin_content endif - call go#util#EchoProgress("searching declaration ...") - - call s:def_job(spawn_args) + call s:def_job(spawn_args, l:state) return endif @@ -77,13 +77,17 @@ function! go#def#Jump(mode) abort call go#def#jump_to_declaration(out, a:mode, bin_name) endfunction -function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort +function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort dict if a:exit_status != 0 return endif call go#def#jump_to_declaration(a:data[0], a:mode, a:bin_name) call go#util#EchoSuccess(fnamemodify(a:data[0], ":t")) + + " capture the active window so that after the exit_cb and close_cb callbacks + " can return to it when a:mode caused a split. + let self.winid = win_getid(winnr()) endfunction function! go#def#jump_to_declaration(out, mode, bin_name) abort @@ -283,9 +287,26 @@ function! go#def#Stack(...) abort endif endfunction -function s:def_job(args) abort +function s:def_job(args, state) abort let l:start_options = go#job#Options(a:args) + let l:state = a:state + function! s:exit_cb(next, job, exitval) dict + call call(a:next, [a:job, a:exitval]) + if has_key(self, 'winid') + call win_gotoid(self.winid) + endif + endfunction + let l:start_options.exit_cb = funcref('s:exit_cb', [l:start_options.exit_cb], l:state) + + function! s:close_cb(next, ch) dict + call call(a:next, [a:ch]) + if has_key(self, 'winid') + call win_gotoid(self.winid) + endif + endfunction + let l:start_options.close_cb = funcref('s:close_cb', [l:start_options.close_cb], l:state) + if &modified let l:tmpname = tempname() call writefile(split(a:args.input, "\n"), l:tmpname, "b") @@ -293,7 +314,7 @@ function s:def_job(args) abort let l:start_options.in_name = l:tmpname endif - call go#job#Start(a:args.cmd, start_options) + call go#job#Start(a:args.cmd, l:start_options) endfunction " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/def_test.vim b/sources_non_forked/vim-go/autoload/go/def_test.vim index 5a8df6ba..18e5608f 100644 --- a/sources_non_forked/vim-go/autoload/go/def_test.vim +++ b/sources_non_forked/vim-go/autoload/go/def_test.vim @@ -45,7 +45,7 @@ func! Test_Jump_leaves_lists() abort call setqflist(copy(expected), 'r' ) let l:bufnr = bufnr('%') - call cursor(6, 3) + call cursor(6, 7) call go#def#Jump('') let start = reltime() diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 8d5f5483..50d7de99 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -106,64 +106,6 @@ function! s:sync_guru(args) abort return l:out endfunc -" use vim or neovim job api as appropriate -function! s:job_start(cmd, start_options) abort - if go#util#has_job() - return job_start(a:cmd, a:start_options) - endif - - let opts = {'stdout_buffered': v:true, 'stderr_buffered': v:true} - - let stdout_buf = "" - function opts.on_stdout(job_id, data, event) closure - let l:data = a:data - let l:data[0] = stdout_buf . l:data[0] - let stdout_buf = "" - - if l:data[-1] != "" - let stdout_buf = l:data[-1] - endif - - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call a:start_options.callback(a:job_id, join(l:data, "\n")) - endfunction - - let stderr_buf = "" - function opts.on_stderr(job_id, data, event) closure - let l:data = a:data - let l:data[0] = stderr_buf . l:data[0] - let stderr_buf = "" - - if l:data[-1] != "" - let stderr_buf = l:data[-1] - endif - - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call a:start_options.callback(a:job_id, join(l:data, "\n")) - endfunction - - function opts.on_exit(job_id, exit_code, event) closure - call a:start_options.exit_cb(a:job_id, a:exit_code) - call a:start_options.close_cb(a:job_id) - endfunction - - " use a shell for input redirection if needed - let cmd = a:cmd - if has_key(a:start_options, 'in_io') && a:start_options.in_io ==# 'file' && !empty(a:start_options.in_name) - let cmd = ['/bin/sh', '-c', go#util#Shelljoin(a:cmd) . ' <' . a:start_options.in_name] - endif - - return jobstart(cmd, opts) -endfunction - " async_guru runs guru in async mode with the given arguments function! s:async_guru(args) abort let result = s:guru_cmd(a:args) @@ -172,91 +114,50 @@ function! s:async_guru(args) abort return endif - if !has_key(a:args, 'disable_progress') - if a:args.needs_scope - call go#util#EchoProgress("analysing with scope " . result.scope . - \ " (see ':help go-guru-scope' if this doesn't work)...") - endif - endif - let state = { - \ 'status_dir': expand('%:p:h'), - \ 'statusline_type': printf("%s", a:args.mode), \ 'mode': a:args.mode, - \ 'status': {}, - \ 'exitval': 0, - \ 'closed': 0, - \ 'exited': 0, - \ 'messages': [], \ 'parse' : get(a:args, 'custom_parse', funcref("s:parse_guru_output")) \ } - function! s:callback(chan, msg) dict - call add(self.messages, a:msg) + function! s:complete(job, exit_status, messages) dict abort + let output = join(a:messages, "\n") + call self.parse(a:exit_status, output, self.mode) 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) - function! s:exit_cb(job, exitval) dict - let self.exited = 1 + let opts = { + \ 'statustype': get(a:args, 'statustype', a:args.mode), + \ 'for': '_', + \ 'errorformat': "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m", + \ 'complete': state.complete, + \ } - let status = { - \ 'desc': 'last status', - \ 'type': self.statusline_type, - \ 'state': "finished", - \ } + if has_key(a:args, 'disable_progress') + let opts.statustype = '' + endif - if a:exitval - let self.exitval = a:exitval - let status.state = "failed" - endif - - call go#statusline#Update(self.status_dir, status) - - if self.closed - call self.complete() - endif - endfunction - - function! s:close_cb(ch) dict - let self.closed = 1 - - if self.exited - call self.complete() - endif - endfunction - - function state.complete() dict - let out = join(self.messages, "\n") - - call self.parse(self.exitval, out, self.mode) - endfunction - - " explicitly bind the callbacks to state so that self within them always - " refers to state. See :help Partial for more information. - let start_options = { - \ 'callback': function('s:callback', [], state), - \ 'exit_cb': function('s:exit_cb', [], state), - \ 'close_cb': function('s:close_cb', [], state) - \ } + let opts = go#job#Options(l:opts) if has_key(result, 'stdin_content') let l:tmpname = tempname() call writefile(split(result.stdin_content, "\n"), l:tmpname, "b") - let l:start_options.in_io = "file" - let l:start_options.in_name = l:tmpname + let l:opts.in_io = "file" + let l:opts.in_name = l:tmpname endif - call go#statusline#Update(state.status_dir, { - \ 'desc': "current status", - \ 'type': state.statusline_type, - \ 'state': "analysing", - \}) + call go#job#Start(result.cmd, opts) - return s:job_start(result.cmd, start_options) + if a:args.needs_scope && go#config#EchoCommandInfo() && !has_key(a:args, 'disable_progress') + call go#util#EchoProgress("analysing with scope " . result.scope . + \ " (see ':help go-guru-scope' if this doesn't work)...") + endif endfunc " run_guru runs the given guru argument function! s:run_guru(args) abort - if has('nvim') || go#util#has_job() + if go#util#has_job() let res = s:async_guru(a:args) else let res = s:sync_guru(a:args) @@ -320,7 +221,7 @@ function! go#guru#Describe(selected) abort call s:run_guru(args) endfunction -function! go#guru#DescribeInfo() abort +function! go#guru#DescribeInfo(showstatus) abort " json_encode() and friends are introduced with this patch (7.4.1304) " vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ " nvim: https://github.com/neovim/neovim/pull/4131 @@ -411,7 +312,7 @@ function! go#guru#DescribeInfo() abort return endif - call go#util#EchoInfo(info) + echo "vim-go: " | echohl Function | echon info | echohl None endfunction let args = { @@ -504,7 +405,7 @@ function! go#guru#Referrers(selected) abort call s:run_guru(args) endfunction -function! go#guru#SameIds() abort +function! go#guru#SameIds(showstatus) abort " we use matchaddpos() which was introduce with 7.4.330, be sure we have " it: http://ftp.vim.org/vim/patches/7.4/7.4.330 if !exists("*matchaddpos") @@ -527,6 +428,9 @@ function! go#guru#SameIds() abort \ 'needs_scope': 0, \ 'custom_parse': function('s:same_ids_highlight'), \ } + if !a:showstatus + let args.disable_progress = 1 + endif call s:run_guru(args) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/import.vim b/sources_non_forked/vim-go/autoload/go/import.vim index a10df2c8..42a61ef1 100644 --- a/sources_non_forked/vim-go/autoload/go/import.vim +++ b/sources_non_forked/vim-go/autoload/go/import.vim @@ -65,6 +65,9 @@ function! go#import#SwitchImport(enabled, localname, path, bang) abort let packageline = line let appendline = line + elseif linestr =~# '^import\s\+(\+)' + let appendline = line + let appendstr = qlocalpath elseif linestr =~# '^import\s\+(' let appendstr = qlocalpath let indentstr = 1 @@ -161,8 +164,16 @@ function! go#import#SwitchImport(enabled, localname, path, bang) abort let linesdelta += 3 let appendstr = qlocalpath let indentstr = 1 + call append(appendline, appendstr) + elseif getline(appendline) =~# '^import\s\+(\+)' + call setline(appendline, 'import (') + call append(appendline + 0, appendstr) + call append(appendline + 1, ')') + let linesdelta -= 1 + let indentstr = 1 + else + call append(appendline, appendstr) endif - call append(appendline, appendstr) execute appendline + 1 if indentstr execute 'normal! >>' diff --git a/sources_non_forked/vim-go/autoload/go/indent_test.vim b/sources_non_forked/vim-go/autoload/go/indent_test.vim new file mode 100644 index 00000000..736d472e --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/indent_test.vim @@ -0,0 +1,22 @@ +func! Test_indent_raw_string() abort + try + let l:dir= gotest#write_file('indent/indent.go', [ + \ 'package main', + \ '', + \ 'import "fmt"', + \ '', + \ 'func main() {', + \ "\t\x1fconst msg = `", + \ '`', + \ '\tfmt.Println(msg)', + \ '}']) + + silent execute "normal o" . "not indented\" + let l:indent = indent(line('.')) + call assert_equal(0, l:indent) + finally + call delete(l:dir, 'rf') + endtry +endfunc + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim index ffbb1389..6771caf2 100644 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ b/sources_non_forked/vim-go/autoload/go/job.vim @@ -33,7 +33,10 @@ endfunction " function will be passed three arguments: the job, its exit code, and the " list of messages received from the channel. The default is a no-op. A " custom value can modify the messages before they are processed by the -" returned exit_cb and close_cb callbacks. +" returned exit_cb and close_cb callbacks. When the function is called, +" the current window will be the window that was hosting the buffer when +" the job was started. After it returns, the current window will be +" restored to what it was before the function was called. " The return value is a dictionary with these keys: " 'callback': @@ -87,14 +90,27 @@ function! go#job#Options(args) " do nothing in state.complete by default. function state.complete(job, exit_status, data) + if has_key(self, 'custom_complete') + let l:winid = win_getid(winnr()) + " Always set the active window to the window that was active when the job + " was started. 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 starting the job. + call win_gotoid(self.winid) + call self.custom_complete(a:job, a:exit_status, a:data) + call win_gotoid(l:winid) + endif + + call self.show_errors(a:job, a:exit_status, a:data) endfunction function state.show_status(job, exit_status) dict + if self.statustype == '' + return + endif + if go#config#EchoCommandInfo() - let prefix = "" - if self.statustype != '' - let prefix = '[' . self.statustype . '] ' - endif + let prefix = '[' . self.statustype . '] ' if a:exit_status == 0 call go#util#EchoSuccess(prefix . "SUCCESS") else @@ -102,10 +118,6 @@ function! go#job#Options(args) endif endif - if self.statustype == '' - return - endif - let status = { \ 'desc': 'last status', \ 'type': self.statustype, @@ -127,10 +139,15 @@ function! go#job#Options(args) endfunction if has_key(a:args, 'complete') - let state.complete = a:args.complete + let state.custom_complete = a:args.complete endif function! s:start(args) dict + if go#config#EchoCommandInfo() && self.statustype != "" + let prefix = '[' . self.statustype . '] ' + call go#util#EchoSuccess(prefix . "dispatched") + endif + if self.statustype != '' let status = { \ 'desc': 'current status', @@ -164,7 +181,6 @@ function! go#job#Options(args) if self.closed || has('nvim') call self.complete(a:job, self.exit_status, self.messages) - call self.show_errors(a:job, self.exit_status, self.messages) endif endfunction " explicitly bind exit_cb to state so that within it, self will always refer @@ -177,7 +193,6 @@ function! go#job#Options(args) if self.exited let job = ch_getjob(a:ch) call self.complete(job, self.exit_status, self.messages) - call self.show_errors(job, self.exit_status, self.messages) endif endfunction " explicitly bind close_cb to state so that within it, self will @@ -225,7 +240,7 @@ function! go#job#Options(args) if empty(errors) " failed to parse errors, output the original content - call go#util#EchoError(self.messages + [self.dir]) + call go#util#EchoError([self.dir] + self.messages) call win_gotoid(l:winid) return endif @@ -254,10 +269,21 @@ function! go#job#Start(cmd, options) let l:options = s:neooptions(l:options) endif + " Verify that the working directory for the job actually exists. Return + " early if the directory does not exist. This helps avoid errors when + " working with plugins that use virtual files that don't actually exist on + " the file system. + let filedir = expand("%:p:h") + if has_key(l:options, 'cwd') && !isdirectory(l:options.cwd) + return + elseif !isdirectory(filedir) + return + endif + if !has_key(l:options, 'cwd') " pre start let dir = getcwd() - execute l:cd fnameescape(expand("%:p:h")) + execute l:cd fnameescape(filedir) endif if has_key(l:options, '_start') @@ -267,11 +293,10 @@ function! go#job#Start(cmd, options) unlet l:options._start endif - if has('nvim') let l:input = [] - if has_key(l:options, 'in_io') && l:options.in_io ==# 'file' && !empty(l:options.in_name) - let l:input = readfile(l:options.in_name, 1) + if has_key(a:options, 'in_io') && a:options.in_io ==# 'file' && !empty(a:options.in_name) + let l:input = readfile(a:options.in_name, "b") endif let job = jobstart(a:cmd, l:options) @@ -306,49 +331,77 @@ function! s:neooptions(options) continue endif + " dealing with the channel lines of Neovim sucks. The docs (:help + " channel-lines) say: + " stream event handlers may receive partial (incomplete) lines. For a + " given invocation of on_stdout etc, `a:data` is not guaranteed to end + " with a newline. + " - `abcdefg` may arrive as `['abc']`, `['defg']`. + " - `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`, + " `['','efg']`, or even `['ab']`, `['c','efg']`. if key == 'callback' let l:options['callback'] = a:options['callback'] if !has_key(a:options, 'out_cb') - let l:options['stdout_buffered'] = v:true - function! s:callback2on_stdout(ch, data, event) dict - let l:data = a:data - let l:data[0] = self.stdout_buf . l:data[0] - let self.stdout_buf = "" + " a single empty string means 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 - if l:data[-1] != "" + let l:data = [self.stdout_buf] + let 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 l:data = l:data[:-2] + + if len(l:data) == 0 + return + endif endif - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call self.callback(a:ch, join(l:data, "\n")) + for l:msg in l:data + call self.callback(a:ch, l:msg) + endfor endfunction let l:options['on_stdout'] = function('s:callback2on_stdout', [], l:options) endif if !has_key(a:options, 'err_cb') - let l:options['stderr_buffered'] = v:true - function! s:callback2on_stderr(ch, data, event) dict - let l:data = a:data - let l:data[0] = self.stderr_buf . l:data[0] - let self.stderr_buf = "" + " a single empty string means 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.stderr_buf == '' + return + endif + let l:data = [self.stderr_buf] + let self.stderr_buf = '' + else + let l:data = copy(a:data) + let l:data[0] = self.stderr_buf . l:data[0] - if l:data[-1] != "" + " The last element may be a partial line; save it for next time. let self.stderr_buf = l:data[-1] + + let l:data = l:data[:-2] + if len(l:data) == 0 + return + endif endif - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call self.callback(a:ch, join(l:data, "\n")) + for l:msg in l:data + call self.callback(a:ch, l:msg) + endfor endfunction let l:options['on_stderr'] = function('s:callback2on_stderr', [], l:options) endif @@ -358,22 +411,32 @@ function! s:neooptions(options) if key == 'out_cb' let l:options['out_cb'] = a:options['out_cb'] - let l:options['stdout_buffered'] = v:true function! s:on_stdout(ch, data, event) dict - let l:data = a:data - let l:data[0] = self.stdout_buf . l:data[0] - let self.stdout_buf = "" + " a single empty string means 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 l:data = [self.stdout_buf] + let self.stdout_buf = '' + else + let l:data = copy(a:data) + let l:data[0] = self.stdout_buf . l:data[0] - if l:data[-1] != "" + " The last element may be a partial line; save it for next time. let self.stdout_buf = l:data[-1] + + let l:data = l:data[:-2] + if len(l:data) == 0 + return + endif endif - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call self.out_cb(a:ch, join(l:data, "\n")) + for l:msg in l:data + call self.out_cb(a:ch, l:msg) + endfor endfunction let l:options['on_stdout'] = function('s:on_stdout', [], l:options) @@ -382,22 +445,32 @@ function! s:neooptions(options) if key == 'err_cb' let l:options['err_cb'] = a:options['err_cb'] - let l:options['stderr_buffered'] = v:true function! s:on_stderr(ch, data, event) dict - let l:data = a:data - let l:data[0] = self.stderr_buf . l:data[0] - let self.stderr_buf = "" + " a single empty string means 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.stderr_buf == '' + return + endif + let l:data = [self.stderr_buf] + let self.stderr_buf = '' + else + let l:data = copy(a:data) + let l:data[0] = self.stderr_buf . l:data[0] - if l:data[-1] != "" + " The last element may be a partial line; save it for next time. let self.stderr_buf = l:data[-1] + + let l:data = l:data[:-2] + if len(l:data) == 0 + return + endif endif - let l:data = l:data[:-2] - if len(l:data) == 0 - return - endif - - call self.err_cb(a:ch, join(l:data, "\n")) + for l:msg in l:data + call self.err_cb(a:ch, l:msg) + endfor endfunction let l:options['on_stderr'] = function('s:on_stderr', [], l:options) @@ -418,6 +491,12 @@ function! s:neooptions(options) continue endif + if key == 'stoponexit' + if a:options['stoponexit'] == '' + let l:options['detach'] = 1 + endif + continue + endif endfor return l:options endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 7714b076..40faa879 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -42,7 +42,7 @@ function! go#lint#Gometa(autosave, ...) abort " Include only messages for the active buffer for autosave. let include = [printf('--include=^%s:.*$', fnamemodify(expand('%:p'), ":."))] - if go#util#has_job() || has('nvim') + if go#util#has_job() let include = [printf('--include=^%s:.*$', expand('%:p:t'))] endif let cmd += include @@ -56,7 +56,7 @@ function! go#lint#Gometa(autosave, ...) abort let cmd += goargs - if go#util#has_job() || has('nvim') + if go#util#has_job() call s:lint_job({'cmd': cmd}, a:autosave) return endif @@ -207,36 +207,10 @@ function! s:lint_job(args, autosave) let l:opts.for = "GoMetaLinterAutoSave" endif - let l:cbs = go#job#Options(l:opts) - - if a:autosave - " move to the window that was active before processing the errors, because - " the user may have moved around within the window or even moved to a - " different window since saving. Moving back to current window as of the - " start of this function avoids the perception that the quickfix window - " steals focus when linting takes a while. - - function! s:exit_cb(next, job, exitval) - let l:winid = win_getid(winnr()) - call call(a:next, [a:job, a:exitval]) - call win_gotoid(l:winid) - endfunction - " wrap l:cbs.exit_cb in s:exit_cb. - let l:cbs.exit_cb = funcref('s:exit_cb', [l:cbs.exit_cb]) - - function! s:close_cb(next, ch) - let l:winid = win_getid(winnr()) - call call(a:next, [a:ch]) - call win_gotoid(l:winid) - endfunction - " wrap l:cbs.close_cb in s:close_cb. - let l:cbs.close_cb = funcref('s:close_cb', [l:cbs.close_cb]) - endif - " autowrite is not enabled for jobs call go#cmd#autowrite() - call go#job#Start(a:args.cmd, l:cbs) + call go#job#Spawn(a:args.cmd, l:opts) endfunction " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/list.vim b/sources_non_forked/vim-go/autoload/go/list.vim index 56c5c144..8beabe52 100644 --- a/sources_non_forked/vim-go/autoload/go/list.vim +++ b/sources_non_forked/vim-go/autoload/go/list.vim @@ -141,6 +141,7 @@ let s:default_list_type_commands = { \ "GoLint": "quickfix", \ "GoMetaLinter": "quickfix", \ "GoMetaLinterAutoSave": "locationlist", + \ "GoModFmt": "locationlist", \ "GoModifyTags": "locationlist", \ "GoRename": "quickfix", \ "GoRun": "quickfix", diff --git a/sources_non_forked/vim-go/autoload/go/mod.vim b/sources_non_forked/vim-go/autoload/go/mod.vim new file mode 100644 index 00000000..0f4b5a85 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/mod.vim @@ -0,0 +1,140 @@ +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\+\) ') + let s:go_major_version = str2nr(tokens[1]) + endif + + if s:go_major_version < "11" + call go#util#EchoError("Go v1.11 is required to format go.mod file") + return + endif + + let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') + + " Save cursor position and many other things. + let l:curw = winsaveview() + + " Write current unsaved buffer to a temp file + let l:tmpname = tempname() . '.mod' + call writefile(go#util#GetLines(), l:tmpname) + if go#util#IsWin() + let l:tmpname = tr(l:tmpname, '\', '/') + endif + + let current_col = col('.') + let l:args = ['go', 'mod', 'edit', '--fmt', l:tmpname] + let [l:out, l:err] = go#util#Exec(l:args) + let diff_offset = len(readfile(l:tmpname)) - line('$') + + if l:err == 0 + call go#mod#update_file(l:tmpname, fname) + else + let errors = s:parse_errors(fname, l:out) + call s:show_errors(errors) + endif + + " We didn't use the temp file, so clean up + call delete(l:tmpname) + + " Restore our cursor/windows positions. + call winrestview(l:curw) + + " be smart and jump to the line the new statement was added/removed + call cursor(line('.') + diff_offset, current_col) + + " Syntax highlighting breaks less often. + syntax sync fromstart +endfunction + +" update_file updates the target file with the given formatted source +function! go#mod#update_file(source, target) + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + let old_fileformat = &fileformat + if exists("*getfperm") + " save file permissions + let original_fperm = getfperm(a:target) + endif + + call rename(a:source, a:target) + + " restore file permissions + if exists("*setfperm") && original_fperm != '' + call setfperm(a:target , original_fperm) + endif + + " reload buffer to reflect latest changes + silent edit! + + let &fileformat = old_fileformat + let &syntax = &syntax + + let l:listtype = go#list#Type("GoModFmt") + + " the title information was introduced with 7.4-2200 + " https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640 + if has('patch-7.4.2200') + " clean up previous list + if l:listtype == "quickfix" + let l:list_title = getqflist({'title': 1}) + else + let l:list_title = getloclist(0, {'title': 1}) + endif + else + " can't check the title, so assume that the list was for go fmt. + let l:list_title = {'title': 'Format'} + endif + + if has_key(l:list_title, "title") && l:list_title['title'] == "Format" + call go#list#Clean(l:listtype) + endif +endfunction + +" parse_errors parses the given errors and returns a list of parsed errors +function! s:parse_errors(filename, content) abort + let splitted = split(a:content, '\n') + + " list of errors to be put into location list + let errors = [] + for line in splitted + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\s*\(.*\)') + if !empty(tokens) + call add(errors,{ + \"filename": a:filename, + \"lnum": tokens[2], + \"text": tokens[3], + \ }) + endif + endfor + + return errors +endfunction + +" show_errors opens a location list and shows the given errors. If the given +" errors is empty, it closes the the location list +function! s:show_errors(errors) abort + let l:listtype = go#list#Type("GoModFmt") + if !empty(a:errors) + call go#list#Populate(l:listtype, a:errors, 'Format') + call go#util#EchoError("GoModFmt returned error") + endif + + " this closes the window if there are no errors or it opens + " it if there is any + call go#list#Window(l:listtype, len(a:errors)) +endfunction + +function! go#mod#ToggleModFmtAutoSave() abort + if go#config#ModFmtAutosave() + call go#config#SetModFmtAutosave(0) + call go#util#EchoProgress("auto mod fmt disabled") + return + end + + call go#config#SetModFmtAutosave(1) + call go#util#EchoProgress("auto mod fmt enabled") +endfunction diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index 5628e49b..d7cf7218 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -27,8 +27,7 @@ function! go#rename#Rename(bang, ...) abort let offset = printf('%s:#%d', fname, pos) let cmd = [bin_path, "-offset", offset, "-to", to_identifier, '-tags', go#config#BuildTags()] - if go#util#has_job() || has('nvim') - call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier)) + if go#util#has_job() call s:rename_job({ \ 'cmd': cmd, \ 'bang': a:bang, diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go new file mode 100644 index 00000000..f25063fe --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go @@ -0,0 +1,9 @@ +package complete + +type T struct { + V string +} + +func Example(s string) { + Example("") +} diff --git a/sources_non_forked/vim-go/autoload/go/test.vim b/sources_non_forked/vim-go/autoload/go/test.vim index 675f8d47..ce29f736 100644 --- a/sources_non_forked/vim-go/autoload/go/test.vim +++ b/sources_non_forked/vim-go/autoload/go/test.vim @@ -26,19 +26,11 @@ function! go#test#Test(bang, compile, ...) abort call add(args, printf("-timeout=%s", timeout)) endif - if go#config#EchoCommandInfo() - if a:compile - call go#util#EchoProgress("compiling tests ...") - else - call go#util#EchoProgress("testing...") - endif - endif - if has('nvim') && go#config#TermEnabled() call go#term#new(a:bang, ["go"] + args) endif - if go#util#has_job() || has('nvim') + if go#util#has_job() " use vim's job functionality to call it asynchronously let job_options = { \ 'bang': a:bang, @@ -55,6 +47,14 @@ function! go#test#Test(bang, compile, ...) abort return endif + if go#config#EchoCommandInfo() + if a:compile + call go#util#EchoProgress("compiling tests ...") + else + call go#util#EchoProgress("testing...") + endif + endif + call go#cmd#autowrite() redraw @@ -152,12 +152,12 @@ function! s:errorformat() abort " each level of test indents the test output 4 spaces. Capturing groups " (e.g. \(\)) cannot be used in an errorformat, but non-capturing groups can " (e.g. \%(\)). - let indent = '%\\%( %\\)%#' + let indent = '%\\%( %\\)' " ignore `go test -v` output for starting tests let format = "%-G=== RUN %.%#" " ignore `go test -v` output for passing tests - let format .= ",%-G" . indent . "--- PASS: %.%#" + let format .= ",%-G" . indent . "%#--- PASS: %.%#" " Match failure lines. " @@ -167,24 +167,25 @@ function! s:errorformat() abort " e.g.: " '--- FAIL: TestSomething (0.00s)' if show_name - let format .= ",%G" . indent . "--- FAIL: %m (%.%#)" + let format .= ",%G" . indent . "%#--- FAIL: %m (%.%#)" else - let format .= ",%-G" . indent . "--- FAIL: %.%#" + let format .= ",%-G" . indent . "%#--- FAIL: %.%#" endif + " Go 1.10 test output {{{1 " Matches test output lines. " " All test output lines start with the test indentation and a tab, followed " by the filename, a colon, the line number, another colon, a space, and the " message. e.g.: " '\ttime_test.go:30: Likely problem: the time zone files have not been installed.' - let format .= ",%A" . indent . "%\\t%\\+%f:%l: %m" + let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: %m" " also match lines that don't have a message (i.e. the message begins with a " newline or is the empty string): " e.g.: " t.Errorf("\ngot %v; want %v", actual, expected) " t.Error("") - let format .= ",%A" . indent . "%\\t%\\+%f:%l: " + let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: " " Match the 2nd and later lines of multi-line output. These lines are " indented the number of spaces for the level of nesting of the test, @@ -197,7 +198,17 @@ function! s:errorformat() abort " indicate that they're multiple lines of output, but in that case the lines " get concatenated in the quickfix list, which is not what users typically " want when writing a newline into their test output. - let format .= ",%G" . indent . "%\\t%\\{2}%m" + let format .= ",%G" . indent . "%#%\\t%\\{2}%m" + " }}}1 + + " Go 1.11 test output {{{1 + " Match test output lines similarly to Go 1.10 test output lines, but they + " use an indent level where the Go 1.10 test output uses tabs, so they'll + " always have at least one level indentation... + let format .= ",%A" . indent . "%\\+%f:%l: %m" + let format .= ",%A" . indent . "%\\+%f:%l: " + let format .= ",%G" . indent . "%\\{2\\,}%m" + " }}}1 " set the format for panics. @@ -261,16 +272,16 @@ function! s:errorformat() abort let format .= ",%-Cexit status %[0-9]%\\+" "let format .= ",exit status %[0-9]%\\+" - " Match and ignore exit failure lines whether part of a multi-line message + " Match and ignore failure lines whether part of a multi-line message " or not, because these lines sometimes come before and sometimes after " panic stacktraces. let format .= ",%-CFAIL%\\t%.%#" "let format .= ",FAIL%\\t%.%#" - " match compiler errors - " These are very smilar to errors from test output, but lack leading tabs - " for the first line of an error, and subsequent lines only have one tab - " instead of two. + " match compiler errors. + " These are very smilar to errors from <=go1.10 test output, but lack + " leading tabs for the first line of an error, and subsequent lines only + " have one tab instead of two. let format .= ",%A%f:%l:%c: %m" let format .= ",%A%f:%l: %m" " It would be nice if this weren't necessary, but panic lines from tests are 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 1bb69bab..7a4cb498 100644 --- a/sources_non_forked/vim-go/autoload/go/test_test.vim +++ b/sources_non_forked/vim-go/autoload/go/test_test.vim @@ -74,7 +74,7 @@ endfunc func! Test_GoTestVet() abort let expected = [ - \ {'lnum': 6, 'bufnr': 16, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has only 0 args'}, + \ {'lnum': 6, 'bufnr': 16, 'col': 0, '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 diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 7e9cf663..b6fbc792 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -76,12 +76,12 @@ function! go#tool#Imports() abort return imports endfunction -function! go#tool#Info() abort +function! go#tool#Info(showstatus) abort let l:mode = go#config#InfoMode() if l:mode == 'gocode' - call go#complete#Info() + call go#complete#Info(a:showstatus) elseif l:mode == 'guru' - call go#guru#DescribeInfo() + call go#guru#DescribeInfo(a:showstatus) else call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru]') endif diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 49eeb87a..249c7b69 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -64,6 +64,10 @@ endfunction " The (optional) first parameter can be added to indicate the 'cwd' or 'env' " parameters will be used, which wasn't added until a later version. function! go#util#has_job(...) abort + if has('nvim') + return 1 + endif + " cwd and env parameters to job_start was added in this version. if a:0 > 0 && a:1 is 1 return has('job') && has("patch-8.0.0902") diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index 638a2765..85a81841 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -806,6 +806,11 @@ CTRL-t Toggles |'g:go_fmt_autosave'|. + *:GoModFmtAutoSaveToggle* +:GoModFmtAutoSaveToggle + + Toggles |'g:go_mod_fmt_autosave'|. + *:GoAsmFmtAutoSaveToggle* :GoAsmFmtAutoSaveToggle @@ -880,6 +885,13 @@ CTRL-t } } < + *:GoModFmt* +:GoModFmt + + Filter the current go.mod buffer through "go mod edit -fmt" command. It + tries to preserve cursor position and avoids replacing the buffer with + stderr output. + ============================================================================== MAPPINGS *go-mappings* @@ -1097,6 +1109,10 @@ Calls `:GoImport` for the current package Generate if err != nil { return ... } automatically which infer the type of return values and the numbers. + *(go-mod-fmt)* + +Calls |:GoModFmt| for the current buffer + ============================================================================== TEXT OBJECTS *go-text-objects* @@ -1287,7 +1303,15 @@ doesn't break. However it's slows (creates/deletes a file for every save) and it's causing problems on some Vim versions. By default it's disabled. > let g:go_fmt_experimental = 0 + < + *'g:go_mod_fmt_autosave'* + +Use this option to auto |:GoModFmt| on save. By default it's enabled > + + let g:go_mod_fmt_autosave = 1 +< + *'g:go_doc_keywordprg_enabled'* Use this option to run `godoc` on words under the cursor with |K|; this will @@ -1497,10 +1521,10 @@ that was called. Supported values are "", "quickfix", and "locationlist". Specifies the type of list to use for command outputs (such as errors from builds, results from static analysis commands, etc...). When an expected key is not present in the dictionary, |'g:go_list_type'| will be used instead. -Supported keys are "GoBuild", "GoErrCheck", "GoFmt", "GoInstall", "GoLint", -"GoMetaLinter", "GoMetaLinterAutoSave", "GoModifyTags" (used for both -:GoAddTags and :GoRemoveTags), "GoRename", "GoRun", and "GoTest". Supported -values for each command are "quickfix" and "locationlist". +Supported keys are "GoBuild", "GoErrCheck", "GoFmt", "GoModFmt", "GoInstall", +"GoLint", "GoMetaLinter", "GoMetaLinterAutoSave", "GoModifyTags" (used for +both :GoAddTags and :GoRemoveTags), "GoRename", "GoRun", and "GoTest". +Supported values for each command are "quickfix" and "locationlist". > let g:go_list_type_commands = {} < @@ -1574,14 +1598,6 @@ same. let g:go_gorename_prefill = 'expand("") =~# "^[A-Z]"' . \ '? go#util#pascalcase(expand(""))' . \ ': go#util#camelcase(expand(""))' -< - *'g:go_gocode_autobuild'* - -Specifies whether `gocode` should automatically build out-of-date packages -when their source fields are modified, in order to obtain the freshest -autocomplete results for them. By default it is enabled. -> - let g:go_gocode_autobuild = 1 < *'g:go_gocode_propose_builtins'* @@ -1590,14 +1606,14 @@ to an autocompletion proposals. By default it is enabled. > let g:go_gocode_propose_builtins = 1 < - *'g:go_gocode_unimported_packages'* + *'g:go_gocode_propose_source'* -Specifies whether `gocode` should include suggestions from unimported -packages. By default it is disabled. +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. > - let g:go_gocode_unimported_packages = 0 + let g:go_gocode_propose_source = 1 < - *'g:go_gocode_socket_type'* Specifies whether `gocode` should use a different socket type. By default @@ -1882,6 +1898,13 @@ filetype. The `gohtmltmpl` filetype is automatically set for `*.tmpl` files; the `gotexttmpl` is never automatically set and needs to be set manually. +============================================================================== + *gomod* *ft-gomod-syntax* +go.mod file syntax~ + +The `gomod` 'filetype' provides syntax highlighting for Go's module file +`go.mod` + ============================================================================== DEBUGGER *go-debug* @@ -2245,6 +2268,18 @@ By default new terminals are opened in a vertical split. To change it let g:go_term_mode = "split" > +How can I customize the highlighting?~ + +All the highlight groups used by vim-go are prefixed with `go` (e.g. +`goType`) and are defined in the files in the `syntax` directory. To change +the highlighting for any group, add a `highlight` command for the group to +your vimrc. To turn off the highlighting for any group, add `highlight link +group-name NONE` (where `group-name` is the name of the group whose highlight +you'd like to turn off) to your vimrc. + +Some people may wish to highlight Go's builtins as keywords. To do so, one +should simply add `highlight link goBuiltins Keyword` to the `vimrc` file. + ============================================================================== DEVELOPMENT *go-development* diff --git a/sources_non_forked/vim-go/ftdetect/gofiletype.vim b/sources_non_forked/vim-go/ftdetect/gofiletype.vim index d3662f4b..28dce3be 100644 --- a/sources_non_forked/vim-go/ftdetect/gofiletype.vim +++ b/sources_non_forked/vim-go/ftdetect/gofiletype.vim @@ -31,4 +31,23 @@ au BufReadPost *.s call s:gofiletype_post() au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl +" Set the filetype if the first non-comment and non-blank line starts with +" 'module '. +au BufNewFile,BufRead go.mod call s:gomod() + +fun! s:gomod() + for l:i in range(1, line('$')) + let l:l = getline(l:i) + if l:l ==# '' || l:l[:1] ==# '//' + continue + endif + + if l:l =~# '^module .\+' + set filetype=gomod + endif + + break + endfor +endfun + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index ba29c59c..1fe28f3a 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -14,7 +14,7 @@ command! -range=% GoFreevars call go#guru#Freevars() command! -range=% GoChannelPeers call go#guru#ChannelPeers() command! -range=% GoReferrers call go#guru#Referrers() -command! -range=0 GoSameIds call go#guru#SameIds() +command! -range=0 GoSameIds call go#guru#SameIds(1) command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds() command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds() @@ -23,10 +23,13 @@ command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds() command! -nargs=* -range GoAddTags call go#tags#Add(, , , ) command! -nargs=* -range GoRemoveTags call go#tags#Remove(, , , ) +" -- mod +command! -nargs=0 -range GoModFmt call go#mod#Format() + " -- tool command! -nargs=* -complete=customlist,go#tool#ValidFiles GoFiles echo go#tool#Files() command! -nargs=0 GoDeps echo go#tool#Deps() -command! -nargs=0 GoInfo call go#tool#Info() +command! -nargs=0 GoInfo call go#tool#Info(1) command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo() " -- cmd diff --git a/sources_non_forked/vim-go/ftplugin/go/mappings.vim b/sources_non_forked/vim-go/ftplugin/go/mappings.vim index 02c94688..30562c36 100644 --- a/sources_non_forked/vim-go/ftplugin/go/mappings.vim +++ b/sources_non_forked/vim-go/ftplugin/go/mappings.vim @@ -31,7 +31,7 @@ nnoremap (go-coverage-browser) :call go#coverage#Browser(!g: nnoremap (go-files) :call go#tool#Files() nnoremap (go-deps) :call go#tool#Deps() -nnoremap (go-info) :call go#tool#Info() +nnoremap (go-info) :call go#tool#Info(1) nnoremap (go-import) :call go#import#SwitchImport(1, '', expand(''), '') nnoremap (go-imports) :call go#fmt#Format(1) @@ -43,13 +43,16 @@ nnoremap (go-callstack) :call go#guru#Callstack(-1) xnoremap (go-freevars) :call go#guru#Freevars(0) nnoremap (go-channelpeers) :call go#guru#ChannelPeers(-1) nnoremap (go-referrers) :call go#guru#Referrers(-1) -nnoremap (go-sameids) :call go#guru#SameIds() +nnoremap (go-sameids) :call go#guru#SameIds(1) nnoremap (go-pointsto) :call go#guru#PointsTo(-1) nnoremap (go-whicherrs) :call go#guru#Whicherrs(-1) nnoremap (go-sameids-toggle) :call go#guru#ToggleSameIds() nnoremap (go-rename) :call go#rename#Rename(!g:go_jump_to_error) +nnoremap (go-decls) :call go#decls#Decls(0, '') +nnoremap (go-decls-dir) :call go#decls#Decls(1, '') + nnoremap (go-def) :call go#def#Jump('') nnoremap (go-def-vertical) :call go#def#Jump("vsplit") nnoremap (go-def-split) :call go#def#Jump("split") diff --git a/sources_non_forked/vim-go/ftplugin/gomod.vim b/sources_non_forked/vim-go/ftplugin/gomod.vim new file mode 100644 index 00000000..5f3dc412 --- /dev/null +++ b/sources_non_forked/vim-go/ftplugin/gomod.vim @@ -0,0 +1,15 @@ +" gomod.vim: Vim filetype plugin for Go assembler. + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl fo< com< cms<" + +setlocal formatoptions-=t + +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/gomod/commands.vim b/sources_non_forked/vim-go/ftplugin/gomod/commands.vim new file mode 100644 index 00000000..d6a7285f --- /dev/null +++ b/sources_non_forked/vim-go/ftplugin/gomod/commands.vim @@ -0,0 +1,3 @@ +command! -nargs=0 -range GoModFmt call go#mod#Format() + +command! -nargs=0 GoModFmtAutoSaveToggle call go#mod#ToggleModFmtAutoSave() diff --git a/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim b/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim new file mode 100644 index 00000000..c8664f64 --- /dev/null +++ b/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim @@ -0,0 +1 @@ +nnoremap (go-mod-fmt) :call go#mod#Format() diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets index 87a7b376..0a9b7ae4 100644 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets @@ -363,6 +363,28 @@ func Test${1:Function}(t *testing.T) { } endsnippet +# test table snippet +snippet tt +var tests = []struct { + name string + expected string + given string +}{ + {"${1}", "${2}", "${3}",}, +} +for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T){ + actual := ${0:${VISUAL}}(tt.given) + if actual != tt.expected { + t.Errorf("$0(%s): expected %s, actual %s", tt.given, tt.expected, actual) + } + + }) +} +endsnippet + + snippet hf "http.HandlerFunc" !b func ${1:handler}(w http.ResponseWriter, r *http.Request) { ${0:fmt.Fprintf(w, "hello world")} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt b/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt new file mode 100644 index 00000000..602e017d --- /dev/null +++ b/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt @@ -0,0 +1,17 @@ +var tests = []struct { + name string + expected string + given string +}{ + {"", "", "",}, +} +for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T){ + actual := {{++}}(tt.given) + if actual != tt.expected { + t.Errorf("{{+~\~1+}}(%s): expected %s, actual %s", tt.given, tt.expected, actual) + } + + }) +} diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip index 7a22cd24..3235fb46 100644 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ b/sources_non_forked/vim-go/gosnippets/snippets/go.snip @@ -315,6 +315,25 @@ abbr func TestXYZ(t *testing.T) { ... } func Test${1:Function}(t *testing.T) { ${0} } +# test table snippet +snippet tt +abbr var test = {...}{...} for {t.Run(){...}} + var tests = []struct { + name string + expected string + given string + }{ + {"${2}", "${3}", "${4}",}, + } + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T){ + actual := ${1:Function}(tt.given) + if actual != tt.expected { + t.Errorf("given(%s): expected %s, actual %s", tt.given, tt.expected, actual) + } + }) + } # test server snippet tsrv abbr ts := httptest.NewServer(...) diff --git a/sources_non_forked/vim-go/indent/go.vim b/sources_non_forked/vim-go/indent/go.vim index ba99d54d..5ddf7e07 100644 --- a/sources_non_forked/vim-go/indent/go.vim +++ b/sources_non_forked/vim-go/indent/go.vim @@ -24,17 +24,6 @@ if exists("*GoIndent") finish endif -" use shiftwidth function only if it's available -if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc -else - func s:sw() - return &sw - endfunc -endif - function! GoIndent(lnum) let prevlnum = prevnonblank(a:lnum-1) if prevlnum == 0 @@ -49,19 +38,23 @@ function! GoIndent(lnum) let ind = previ + if prevl =~ ' = `[^`]*$' + " previous line started a multi-line raw string + return 0 + endif if prevl =~ '[({]\s*$' " previous line opened a block - let ind += s:sw() + let ind += shiftwidth() endif if prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let ind += s:sw() + let ind += shiftwidth() endif " TODO: handle if the previous line is a label. if thisl =~ '^\s*[)}]' " this line closed a block - let ind -= s:sw() + let ind -= shiftwidth() endif " Colons are tricky. @@ -69,7 +62,7 @@ function! GoIndent(lnum) " We ignore trying to deal with jump labels because (a) they're rare, and " (b) they're hard to disambiguate from a composite literal key. if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= s:sw() + let ind -= shiftwidth() endif return ind diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 95bf7fd5..e1692863 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -29,13 +29,13 @@ if endif " these packages are used by vim-go and can be automatically installed if -" needed by the user with GoInstallBinaries +" needed by the user with GoInstallBinaries. let s:packages = { \ 'asmfmt': ['github.com/klauspost/asmfmt/cmd/asmfmt'], \ 'dlv': ['github.com/derekparker/delve/cmd/dlv'], \ 'errcheck': ['github.com/kisielk/errcheck'], \ 'fillstruct': ['github.com/davidrjenni/reftools/cmd/fillstruct'], - \ 'gocode': ['github.com/nsf/gocode', {'windows': ['-ldflags', '-H=windowsgui']}], + \ 'gocode': ['github.com/mdempsky/gocode', {'windows': ['-ldflags', '-H=windowsgui']}], \ 'godef': ['github.com/rogpeppe/godef'], \ 'gogetdoc': ['github.com/zmb3/gogetdoc'], \ 'goimports': ['golang.org/x/tools/cmd/goimports'], @@ -99,9 +99,9 @@ function! s:GoInstallBinaries(updateBinaries, ...) set noshellslash endif - let l:cmd = ['go', 'get', '-v'] + let l:dl_cmd = ['go', 'get', '-v', '-d'] if get(g:, "go_get_update", 1) != 0 - let l:cmd += ['-u'] + let l:dl_cmd += ['-u'] endif " Filter packages from arguments (if any). @@ -127,16 +127,21 @@ function! s:GoInstallBinaries(updateBinaries, ...) for [binary, pkg] in items(l:packages) let l:importPath = pkg[0] - let l:run_cmd = copy(l:cmd) + let l:run_cmd = copy(l:dl_cmd) if len(l:pkg) > 1 && get(l:pkg[1], l:platform, '') isnot '' let l:run_cmd += get(l:pkg[1], l:platform, '') endif - let binname = "go_" . binary . "_bin" + let bin_setting_name = "go_" . binary . "_bin" - let bin = binary - if exists("g:{binname}") - let bin = g:{binname} + if exists("g:{bin_setting_name}") + let bin = g:{bin_setting_name} + else + if go#util#IsWin() + let bin = binary . '.exe' + else + let bin = binary + endif endif if !executable(bin) || a:updateBinaries == 1 @@ -146,7 +151,15 @@ function! s:GoInstallBinaries(updateBinaries, ...) echo "vim-go: ". binary ." not found. Installing ". importPath . " to folder " . go_bin_path endif + " first download the binary let [l:out, l:err] = go#util#Exec(l:run_cmd + [l:importPath]) + if l:err + echom "Error downloading " . l:importPath . ": " . l:out + endif + + " and then build and install it + let l:build_cmd = ['go', 'build', '-o', go_bin_path . go#util#PathSep() . bin, l:importPath] + let [l:out, l:err] = go#util#Exec(l:build_cmd + [l:importPath]) if l:err echom "Error installing " . l:importPath . ": " . l:out endif @@ -158,6 +171,12 @@ function! s:GoInstallBinaries(updateBinaries, ...) if resetshellslash set shellslash endif + + if a:updateBinaries == 1 + call go#util#EchoInfo('updating finished!') + else + call go#util#EchoInfo('installing finished!') + endif endfunction " CheckBinaries checks if the necessary binaries to install the Go tool @@ -201,14 +220,14 @@ endfunction function! s:auto_type_info() " GoInfo automatic update if get(g:, "go_auto_type_info", 0) - call go#tool#Info() + call go#tool#Info(0) endif endfunction function! s:auto_sameids() " GoSameId automatic update if get(g:, "go_auto_sameids", 0) - call go#guru#SameIds() + call go#guru#SameIds(0) endif endfunction @@ -226,6 +245,13 @@ function! s:asmfmt_autosave() endif endfunction +function! s:modfmt_autosave() + " go.mod code formatting on save + if get(g:, "go_mod_fmt_autosave", 1) + call go#mod#Format() + endif +endfunction + function! s:metalinter_autosave() " run gometalinter on save if get(g:, "go_metalinter_autosave", 0) @@ -253,6 +279,7 @@ augroup vim-go endif autocmd BufWritePre *.go call s:fmt_autosave() + autocmd BufWritePre *.mod call s:modfmt_autosave() autocmd BufWritePre *.s call s:asmfmt_autosave() autocmd BufWritePost *.go call s:metalinter_autosave() autocmd BufNewFile *.go call s:template_autocreate() diff --git a/sources_non_forked/vim-go/scripts/install-vim b/sources_non_forked/vim-go/scripts/install-vim index eccf5798..29ba49a9 100644 --- a/sources_non_forked/vim-go/scripts/install-vim +++ b/sources_non_forked/vim-go/scripts/install-vim @@ -30,7 +30,7 @@ case "$vim" in "nvim") # Use latest stable version. - tag="v0.2.0" + tag="v0.3.1" giturl="https://github.com/neovim/neovim" ;; diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim index ded0bc70..68daa0a9 100644 --- a/sources_non_forked/vim-go/syntax/go.vim +++ b/sources_non_forked/vim-go/syntax/go.vim @@ -47,12 +47,12 @@ hi def link goFloats Type hi def link goComplexes Type " Predefined functions and values -syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/ -syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/ +syn keyword goBuiltins append cap close complex copy delete imag len +syn keyword goBuiltins make new panic print println real recover syn keyword goBoolean true false syn keyword goPredefinedIdentifiers nil iota -hi def link goBuiltins Keyword +hi def link goBuiltins Identifier hi def link goBoolean Boolean hi def link goPredefinedIdentifiers goBoolean @@ -148,14 +148,14 @@ endif " var, const if go#config#FoldEnable('varconst') syn region goVar start='var (' end='^\s*)$' transparent fold - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments + \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator syn region goConst start='const (' end='^\s*)$' transparent fold - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments + \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator else syn region goVar start='var (' end='^\s*)$' transparent - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments + \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator syn region goConst start='const (' end='^\s*)$' transparent - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments + \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator endif " Single-line var, const, and import. diff --git a/sources_non_forked/vim-go/syntax/gomod.vim b/sources_non_forked/vim-go/syntax/gomod.vim new file mode 100644 index 00000000..2a9ef217 --- /dev/null +++ b/sources_non_forked/vim-go/syntax/gomod.vim @@ -0,0 +1,46 @@ +" gomod.vim: Vim syntax file for go.mod file +" +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syntax case match + +" match keywords +syntax keyword gomodModule module +syntax keyword gomodRequire require +syntax keyword gomodExclude exclude +syntax keyword gomodReplace replace + +" require, exclude and replace can be also grouped into block +syntax region gomodRequire start='require (' end=')' transparent contains=gomodRequire,gomodVersion +syntax region gomodExclude start='exclude (' end=')' transparent contains=gomodExclude,gomodVersion +syntax region gomodReplace start='replace (' end=')' transparent contains=gomodReplace,gomodVersion + +" set highlights +highlight default link gomodModule Keyword +highlight default link gomodRequire Keyword +highlight default link gomodExclude Keyword +highlight default link gomodReplace Keyword + +" comments are always in form of // ... +syntax region gomodComment start="//" end="$" contains=@Spell +highlight default link gomodComment Comment + +" make sure quoted import paths are higlighted +syntax region gomodString start=+"+ skip=+\\\\\|\\"+ end=+"+ +highlight default link gomodString String + +" replace operator is in the form of '=>' +syntax match gomodReplaceOperator "\v\=\>" +highlight default link gomodReplaceOperator Operator + + +" highlight semver, note that this is very simple. But it works for now +syntax match gomodVersion "v\d\+\.\d\+\.\d\+" +syntax match gomodVersion "v\d\+\.\d\+\.\d\+-\S*" +syntax match gomodVersion "v\d\+\.\d\+\.\d\++incompatible" +highlight default link gomodVersion Identifier + +let b:current_syntax = "gomod" diff --git a/sources_non_forked/vim-pug/syntax/pug.vim b/sources_non_forked/vim-pug/syntax/pug.vim index 7b0f1c37..df1aa1c3 100644 --- a/sources_non_forked/vim-pug/syntax/pug.vim +++ b/sources_non_forked/vim-pug/syntax/pug.vim @@ -55,7 +55,7 @@ syn match pugPlainChar "\\" contained syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript syn match pugInterpolationEscape "\\\@$1 = $$1;/g} +{${1/\w* ?\$(\w+)(, )*/\n $this->$1 = $$1;/g} } $0 endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 9496555e..f47a6834 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -58,6 +58,14 @@ snippet queue snippet pqueue std::priority_queue<${1:T}> ${2}; ## +## STL smart pointers +# std::shared_ptr +snippet msp + std::shared_ptr<${1:T}> ${2} = std::make_shared<$1>(${3}); +# std::unique_ptr +snippet mup + std::unique_ptr<${1:T}> ${2} = std::make_unique<$1>(${3}); +## ## Access Modifiers # private snippet pri diff --git a/sources_non_forked/vim-snippets/snippets/elm.snippets b/sources_non_forked/vim-snippets/snippets/elm.snippets index d2bace3d..f967f512 100644 --- a/sources_non_forked/vim-snippets/snippets/elm.snippets +++ b/sources_non_forked/vim-snippets/snippets/elm.snippets @@ -58,7 +58,7 @@ snippet doc -} snippet p |> ${0} -snippet program +snippet program Elm 0.18 program import Html exposing (Html) @@ -100,3 +100,57 @@ snippet program view : Model -> Html Msg view model = Html.text "Hello, sailor!" +snippet element + module Main exposing (Model, Msg(..), init, main, subscriptions, update, view) + + import Browser + import Html exposing (..) + import Json.Encode + + + main : Program Flags Model Msg + main = + Browser.element + { init = init + , update = update + , subscriptions = subscriptions + , view = view + } + + + type alias Model = + {} + + + type alias Flags = + Json.Encode.Value + + + init : Flags -> ( Model, Cmd Msg ) + init flags_ = + ( {} + , Cmd.none + ) + + + type Msg + = Noop + + + update : Msg -> Model -> ( Model, Cmd Msg ) + update msg model = + case msg of + Noop -> + ( model + , Cmd.none + ) + + + subscriptions : Model -> Sub Msg + subscriptions model = + Sub.none + + + view : Model -> Html Msg + view model = + h1 [] [ text "Hello, world!" ] diff --git a/sources_non_forked/vim-snippets/snippets/freemarker.snippets b/sources_non_forked/vim-snippets/snippets/freemarker.snippets new file mode 100644 index 00000000..0114ac4c --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/freemarker.snippets @@ -0,0 +1,27 @@ +extends html + +snippet assign + <#assign ${1} = ${0:${VISUAL}} /> + +snippet if + <#if ${1}> + ${0:${VISUAL}} + + +snippet ife + <#if ${1}> + ${2:${VISUAL}} + <#else> + ${0} + + +snippet list + <#list ${1} as ${2}> + ${0:${VISUAL}} + + +snippet attempt + <#attempt> + ${0:${VISUAL}} + <#recover> + diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index 5e0e4438..2c4084a8 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -257,3 +257,8 @@ snippet ja func (p *$1) MarshalJSON() ([]byte, error) { return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)}) } + +snippet errwr # Error handling with errors.Wrap + if ${1}err != nil { + return errors.Wrap(err, "${2}") + } diff --git a/sources_non_forked/vim-snippets/snippets/ocaml.snippets b/sources_non_forked/vim-snippets/snippets/ocaml.snippets new file mode 100644 index 00000000..eb5a799c --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/ocaml.snippets @@ -0,0 +1,39 @@ +snippet doc + (* + ${0} + *) +snippet let + let ${1} = ${2} in + ${0} +snippet fn + let ${1} = + ${0} +snippet fun + type ${1} = ${0} +snippet mod + module ${1} = struct + ${0} + end +snippet modty + module type ${1} = sig + ${0} + end +snippet sw + match ${1} with + | ${2} -> ${0} +snippet | + | ${1} -> ${0} +snippet p + |> ${0} +snippet if + if ${1} then + ${2} + else + ${0} +snippet fnr + let rec ${1} = + ${0} +snippet try + try + ${1} + with ${0} diff --git a/sources_non_forked/vim-snippets/snippets/racket.snippets b/sources_non_forked/vim-snippets/snippets/racket.snippets new file mode 100644 index 00000000..723d7383 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/racket.snippets @@ -0,0 +1,72 @@ +snippet #r + #lang racket +snippet #tr + #lang typed/racket +snippet #rg + #lang racket/gui +snippet #sb + #lang scribble/base +snippet #d + #lang datalog +snippet #wi + #lang web-server/insta +snippet def + (define ${1} ${0}) +snippet defun + (define (${1}) + ${0}) +snippet if + (if ${1} ${2} ${0}) +snippet ifn + (if (not ${1}) ${2} {0}) +snippet ifl + (if ${1} + (let () + ${2}) + ${0}) +snippet ifnl + (if (not ${1}) + (let () + ${2}) + ${0}) +snippet when + (when ${1} + ${0}) +snippet cond + (cond + [(${1}) + ${0}]) +snippet case + (case ${1} + [(${2}) + ${0}]) +snippet match + (match ${1} + [(${2}) + ${0}]) +snippet letcc + (let/cc here (set! ${1} here) ${0}) +snippet for + (for ([${1} ${2}]) + ${0}) +snippet req + (require ${0}) +snippet unless + (unless ${1} ${2} ${0}) +snippet let + (let ([${1}]) ${0}) +snippet begin + (begin + ${0}) +snippet lambda + (lambda (${1}) ${0}) +snippet ifb + (if ${1} + (begin + ${2}) + ${0}) +snippet ifnb + (if (not ${1}) + (begin + ${2}) + ${0}) diff --git a/sources_non_forked/vim-snippets/snippets/scheme.snippets b/sources_non_forked/vim-snippets/snippets/scheme.snippets index 035d5348..bdd445f9 100644 --- a/sources_non_forked/vim-snippets/snippets/scheme.snippets +++ b/sources_non_forked/vim-snippets/snippets/scheme.snippets @@ -1,17 +1,17 @@ snippet + - (+ ${1} + (+ ${1} ${0}) snippet - - (- ${1} + (- ${1} ${0}) snippet / - (/ ${1} + (/ ${1} ${0}) snippet * - (* ${1} + (* ${1} ${0}) # Definition @@ -22,12 +22,12 @@ snippet def # Definition with lambda snippet defl (define ${1:name} - (lambda (x)(${0:definition}))) + (lambda (x)(${0:definition}))) # Condition snippet cond - (cond ((${1:predicate}) (${2:action})) - ((${3:predicate}) (${0:action}))) + (cond ((${1:predicate}) (${2:action})) + ((${3:predicate}) (${0:action}))) # If statement snippet if diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index f304a56e..8351b393 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -119,53 +119,53 @@ snippet spl split environment \\end{split} # Part snippet part document \part - \\part{${1:part name}} % (fold) + \\part{${1:part name}} % (fold)% \\label{prt:${2:$1}} ${0} % part $2 (end) # Chapter snippet cha \chapter - \\chapter{${1:chapter name}} + \\chapter{${1:chapter name}}% \\label{cha:${2:$1}} ${0} # Section snippet sec \section - \\section{${1:section name}} + \\section{${1:section name}}% \\label{sec:${2:$1}} ${0} # Section without number snippet sec* \section* - \\section*{${1:section name}} + \\section*{${1:section name}}% \\label{sec:${2:$1}} ${0} # Sub Section snippet sub \subsection - \\subsection{${1:subsection name}} + \\subsection{${1:subsection name}}% \\label{sub:${2:$1}} ${0} # Sub Section without number snippet sub* \subsection* - \\subsection*{${1:subsection name}} + \\subsection*{${1:subsection name}}% \\label{sub:${2:$1}} ${0} # Sub Sub Section snippet ssub \subsubsection - \\subsubsection{${1:subsubsection name}} + \\subsubsection{${1:subsubsection name}}% \\label{ssub:${2:$1}} ${0} # Sub Sub Section without number snippet ssub* \subsubsection* - \\subsubsection*{${1:subsubsection name}} + \\subsubsection*{${1:subsubsection name}}% \\label{ssub:${2:$1}} ${0} # Paragraph snippet par \paragraph - \\paragraph{${1:paragraph name}} + \\paragraph{${1:paragraph name}}% \\label{par:${2:$1}} ${0} # Sub Paragraph snippet subp \subparagraph - \\subparagraph{${1:subparagraph name}} + \\subparagraph{${1:subparagraph name}}% \\label{subp:${2:$1}} ${0} snippet ni \noindent