From de80db5969c79b99870ecacde07c1a16f80fa30e Mon Sep 17 00:00:00 2001 From: Kurtis Moxley Date: Fri, 27 May 2022 20:16:55 +0800 Subject: [PATCH] Add support with Go language. --- sources_non_forked/vim-go/.codecov.yml | 13 + sources_non_forked/vim-go/.coveragerc | 3 + sources_non_forked/vim-go/.dockerignore | 8 + sources_non_forked/vim-go/.editorconfig | 17 + .../vim-go/.github/CONTRIBUTING.md | 12 + sources_non_forked/vim-go/.github/FUNDING.yml | 1 + .../vim-go/.github/ISSUE_TEMPLATE.md | 50 + .../vim-go/.github/workflows/git.yml | 11 + .../vim-go/.github/workflows/test.yml | 60 + sources_non_forked/vim-go/.gitignore | 11 + sources_non_forked/vim-go/.vintrc.yaml | 7 + sources_non_forked/vim-go/CHANGELOG.md | 2243 +++++++++++++ sources_non_forked/vim-go/Dockerfile | 27 + sources_non_forked/vim-go/LICENSE | 60 + sources_non_forked/vim-go/Makefile | 31 + sources_non_forked/vim-go/README.md | 104 + sources_non_forked/vim-go/addon-info.json | 6 + sources_non_forked/vim-go/assets/vim-go.png | Bin 0 -> 29252 bytes sources_non_forked/vim-go/assets/vim-go.svg | 821 +++++ .../vim-go/autoload/ctrlp/decls.vim | 152 + .../vim-go/autoload/fzf/decls.vim | 155 + .../vim-go/autoload/go/alternate.vim | 35 + .../vim-go/autoload/go/asmfmt.vim | 76 + .../vim-go/autoload/go/auto.vim | 203 ++ .../vim-go/autoload/go/calls.vim | 32 + .../vim-go/autoload/go/calls_test.vim | 48 + sources_non_forked/vim-go/autoload/go/cmd.vim | 375 +++ .../vim-go/autoload/go/cmd_test.vim | 37 + .../vim-go/autoload/go/complete.vim | 67 + .../vim-go/autoload/go/complete_test.vim | 29 + .../vim-go/autoload/go/config.vim | 632 ++++ .../vim-go/autoload/go/config_test.vim | 107 + .../vim-go/autoload/go/coverage.vim | 295 ++ .../vim-go/autoload/go/debug.vim | 1771 ++++++++++ .../vim-go/autoload/go/debug_test.vim | 177 + .../vim-go/autoload/go/decls.vim | 26 + sources_non_forked/vim-go/autoload/go/def.vim | 366 +++ .../vim-go/autoload/go/def_test.vim | 223 ++ sources_non_forked/vim-go/autoload/go/doc.vim | 217 ++ .../vim-go/autoload/go/fillstruct.vim | 83 + .../vim-go/autoload/go/fillstruct_test.vim | 223 ++ sources_non_forked/vim-go/autoload/go/fmt.vim | 231 ++ .../vim-go/autoload/go/fmt_test.vim | 57 + .../vim-go/autoload/go/guru.vim | 584 ++++ .../vim-go/autoload/go/guru_test.vim | 23 + .../vim-go/autoload/go/highlight_test.vim | 599 ++++ .../vim-go/autoload/go/iferr.vim | 26 + .../vim-go/autoload/go/impl.vim | 175 + .../vim-go/autoload/go/impl_test.vim | 47 + .../vim-go/autoload/go/implements.vim | 44 + .../vim-go/autoload/go/import.vim | 232 ++ .../vim-go/autoload/go/import_test.vim | 35 + .../vim-go/autoload/go/indent_test.vim | 72 + .../vim-go/autoload/go/issue.vim | 56 + sources_non_forked/vim-go/autoload/go/job.vim | 573 ++++ .../vim-go/autoload/go/job_test.vim | 54 + .../vim-go/autoload/go/keyify.vim | 64 + .../vim-go/autoload/go/lint.vim | 493 +++ .../vim-go/autoload/go/lint_test.vim | 600 ++++ .../vim-go/autoload/go/list.vim | 190 ++ sources_non_forked/vim-go/autoload/go/lsp.vim | 2035 ++++++++++++ .../autoload/go/lsp/completionitemkind.vim | 63 + .../vim-go/autoload/go/lsp/filechangetype.vim | 19 + .../vim-go/autoload/go/lsp/lsp.vim | 72 + .../vim-go/autoload/go/lsp/lsp_test.vim | 32 + .../vim-go/autoload/go/lsp/message.vim | 438 +++ .../vim-go/autoload/go/lsp_test.vim | 97 + sources_non_forked/vim-go/autoload/go/mod.vim | 147 + .../vim-go/autoload/go/package.vim | 346 ++ .../vim-go/autoload/go/package_test.vim | 62 + .../vim-go/autoload/go/path.vim | 195 ++ .../vim-go/autoload/go/play.vim | 78 + .../vim-go/autoload/go/promise.vim | 58 + .../vim-go/autoload/go/promise_test.vim | 41 + .../vim-go/autoload/go/referrers.vim | 44 + .../vim-go/autoload/go/rename.vim | 152 + .../vim-go/autoload/go/statusline.vim | 124 + .../vim-go/autoload/go/tags.vim | 224 ++ .../vim-go/autoload/go/tags_test.vim | 52 + .../vim-go/autoload/go/template.vim | 61 + .../vim-go/autoload/go/template_test.vim | 62 + .../vim-go/autoload/go/term.vim | 274 ++ .../vim-go/autoload/go/term_test.vim | 94 + .../autoload/go/test-fixtures/cmd/bad.go | 5 + .../go/test-fixtures/complete/complete.go | 9 + .../config/buildtags/buildtags.go | 5 + .../config/buildtags/constrainedfoo.go | 8 + .../go/test-fixtures/config/buildtags/foo.go | 7 + .../go/test-fixtures/config/buildtags/go.mod | 3 + .../test-fixtures/debug/compilerror/main.go | 7 + .../debug/debugmain/debugmain.go | 7 + .../autoload/go/test-fixtures/def/jump.go | 7 + .../autoload/go/test-fixtures/fmt/hello.go | 7 + .../go/test-fixtures/fmt/hello_golden.go | 7 + .../fmt/src/imports/goimports.go | 8 + .../fmt/src/imports/goimports_golden.go | 15 + .../vendor/gh.com/gi/foo-logging/logger.go | 12 + .../test-fixtures/job/dir has spaces/main.go | 6 + .../errcheck/compilererror/compilererror.go | 7 + .../lint/src/errcheck/errcheck.go | 10 + .../lint/src/errcheck/errcheck_test.go | 11 + .../go/test-fixtures/lint/src/errcheck/go.mod | 3 + .../go/test-fixtures/lint/src/foo/foo.go | 7 + .../go/test-fixtures/lint/src/foo/go.mod | 3 + .../go/test-fixtures/lint/src/lint/baz.go | 3 + .../go/test-fixtures/lint/src/lint/go.mod | 3 + .../golangci-lint/problems/importabs/ok.go | 3 + .../problems/importabs/problems.go | 5 + .../problems/multiple/problems.go | 9 + .../golangci-lint/problems/shadow/problems.go | 5 + .../go/test-fixtures/lint/src/lint/lint.go | 7 + .../go/test-fixtures/lint/src/lint/quux.go | 7 + .../src/vet/compilererror/compilererror.go | 7 + .../go/test-fixtures/lint/src/vet/go.mod | 3 + .../go/test-fixtures/lint/src/vet/vet.go | 8 + .../go/test-fixtures/lsp/fmt/format.go | 7 + .../go/test-fixtures/lsp/fmt/format_golden.go | 7 + .../go/test-fixtures/lsp/fmt/newline.go | 6 + .../go/test-fixtures/lsp/imports/imports.go | 10 + .../lsp/imports/imports_golden.go | 13 + .../package/src/package/bar/.gitkeep | 0 .../package/src/package/baz/.gitkeep | 0 .../test-fixtures/package/src/package/go.mod | 3 + .../package/src/package/package.go | 7 + .../package/src/package/vendor/foo/.gitkeep | 0 .../autoload/go/test-fixtures/term/term.go | 5 + .../autoload/go/test-fixtures/test/.gitignore | 1 + .../test/src/compilerror/compilerror.go | 7 + .../test-fixtures/test/src/compilerror/go.mod | 3 + .../test/src/example/example_test.go | 10 + .../go/test-fixtures/test/src/example/go.mod | 3 + .../go/test-fixtures/test/src/play/go.mod | 3 + .../test/src/play/mock/controller.go | 7 + .../test-fixtures/test/src/play/play_test.go | 59 + .../go/test-fixtures/test/src/showname/go.mod | 3 + .../test/src/showname/showname_test.go | 11 + .../test/src/testcompilerror/go.mod | 3 + .../testcompilerror/testcompilerror_test.go | 11 + .../go/test-fixtures/test/src/timeout/go.mod | 3 + .../test/src/timeout/timeout_test.go | 47 + .../go/test-fixtures/test/src/veterror/go.mod | 3 + .../test/src/veterror/veterror.go | 7 + .../vim-go/autoload/go/test.vim | 326 ++ .../vim-go/autoload/go/test_test.vim | 162 + .../vim-go/autoload/go/textobj.vim | 284 ++ .../vim-go/autoload/go/tool.vim | 156 + .../vim-go/autoload/go/tool_test.vim | 33 + sources_non_forked/vim-go/autoload/go/ui.vim | 122 + sources_non_forked/vim-go/autoload/go/uri.vim | 55 + .../vim-go/autoload/go/uri_test.vim | 56 + .../vim-go/autoload/go/util.vim | 778 +++++ sources_non_forked/vim-go/autoload/gotest.vim | 195 ++ .../vim-go/autoload/unite/sources/decls.vim | 70 + sources_non_forked/vim-go/compiler/go.vim | 48 + sources_non_forked/vim-go/doc/vim-go.txt | 2893 +++++++++++++++++ .../vim-go/ftdetect/gofiletype.vim | 43 + sources_non_forked/vim-go/ftplugin/asm.vim | 37 + sources_non_forked/vim-go/ftplugin/go.vim | 135 + .../vim-go/ftplugin/go/commands.vim | 138 + .../vim-go/ftplugin/go/mappings.vim | 89 + .../vim-go/ftplugin/go/snippets.vim | 67 + .../vim-go/ftplugin/go/tagbar.vim | 65 + .../vim-go/ftplugin/gohtmltmpl.vim | 7 + sources_non_forked/vim-go/ftplugin/gomod.vim | 36 + .../vim-go/ftplugin/gomod/commands.vim | 3 + .../vim-go/ftplugin/gomod/mappings.vim | 1 + .../vim-go/gosnippets/UltiSnips/go.snippets | 565 ++++ .../vim-go/gosnippets/minisnip/_go_eq | 3 + .../vim-go/gosnippets/minisnip/_go_err | 3 + .../vim-go/gosnippets/minisnip/_go_errt | 4 + .../vim-go/gosnippets/minisnip/_go_errw | 3 + .../vim-go/gosnippets/minisnip/_go_f | 3 + .../vim-go/gosnippets/minisnip/_go_ff | 1 + .../vim-go/gosnippets/minisnip/_go_fori | 3 + .../vim-go/gosnippets/minisnip/_go_pkg | 2 + .../vim-go/gosnippets/minisnip/_go_sp | 2 + .../vim-go/gosnippets/minisnip/_go_tt | 17 + .../vim-go/gosnippets/snippets/go.snip | 407 +++ sources_non_forked/vim-go/indent/go.vim | 86 + .../vim-go/indent/gohtmltmpl.vim | 54 + sources_non_forked/vim-go/plugin/go.vim | 276 ++ .../rplugin/python3/denite/source/decls.py | 94 + .../vim-go/scripts/bench-syntax | 44 + sources_non_forked/vim-go/scripts/docker-test | 15 + .../vim-go/scripts/install-tools | 35 + sources_non_forked/vim-go/scripts/install-vim | 100 + sources_non_forked/vim-go/scripts/lint | 88 + sources_non_forked/vim-go/scripts/run-vim | 51 + .../vim-go/scripts/runbench.vim | 37 + sources_non_forked/vim-go/scripts/runtest.vim | 157 + sources_non_forked/vim-go/scripts/test | 108 + sources_non_forked/vim-go/syntax/go.vim | 474 +++ .../vim-go/syntax/godebugoutput.vim | 13 + .../vim-go/syntax/godebugstacktrace.vim | 11 + .../vim-go/syntax/godebugvariables.vim | 23 + .../vim-go/syntax/godefstack.vim | 20 + .../vim-go/syntax/gohtmltmpl.vim | 17 + sources_non_forked/vim-go/syntax/gomod.vim | 108 + sources_non_forked/vim-go/syntax/gosum.vim | 55 + .../vim-go/syntax/gotexttmpl.vim | 83 + sources_non_forked/vim-go/syntax/gowork.vim | 96 + sources_non_forked/vim-go/syntax/vimgo.vim | 13 + .../vim-go/templates/hello_world.go | 7 + .../vim-go/templates/hello_world_test.go | 7 + sources_non_forked/vim-go/test/parse.go | 2096 ++++++++++++ 205 files changed, 29172 insertions(+) create mode 100644 sources_non_forked/vim-go/.codecov.yml create mode 100644 sources_non_forked/vim-go/.coveragerc create mode 100644 sources_non_forked/vim-go/.dockerignore create mode 100644 sources_non_forked/vim-go/.editorconfig create mode 100644 sources_non_forked/vim-go/.github/CONTRIBUTING.md create mode 100644 sources_non_forked/vim-go/.github/FUNDING.yml create mode 100644 sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md create mode 100644 sources_non_forked/vim-go/.github/workflows/git.yml create mode 100644 sources_non_forked/vim-go/.github/workflows/test.yml create mode 100644 sources_non_forked/vim-go/.gitignore create mode 100644 sources_non_forked/vim-go/.vintrc.yaml create mode 100644 sources_non_forked/vim-go/CHANGELOG.md create mode 100644 sources_non_forked/vim-go/Dockerfile create mode 100644 sources_non_forked/vim-go/LICENSE create mode 100644 sources_non_forked/vim-go/Makefile create mode 100644 sources_non_forked/vim-go/README.md create mode 100644 sources_non_forked/vim-go/addon-info.json create mode 100644 sources_non_forked/vim-go/assets/vim-go.png create mode 100644 sources_non_forked/vim-go/assets/vim-go.svg create mode 100644 sources_non_forked/vim-go/autoload/ctrlp/decls.vim create mode 100644 sources_non_forked/vim-go/autoload/fzf/decls.vim create mode 100644 sources_non_forked/vim-go/autoload/go/alternate.vim create mode 100644 sources_non_forked/vim-go/autoload/go/asmfmt.vim create mode 100644 sources_non_forked/vim-go/autoload/go/auto.vim create mode 100644 sources_non_forked/vim-go/autoload/go/calls.vim create mode 100644 sources_non_forked/vim-go/autoload/go/calls_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/cmd.vim create mode 100644 sources_non_forked/vim-go/autoload/go/cmd_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/complete.vim create mode 100644 sources_non_forked/vim-go/autoload/go/complete_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/config.vim create mode 100644 sources_non_forked/vim-go/autoload/go/config_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/coverage.vim create mode 100644 sources_non_forked/vim-go/autoload/go/debug.vim create mode 100644 sources_non_forked/vim-go/autoload/go/debug_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/decls.vim create mode 100644 sources_non_forked/vim-go/autoload/go/def.vim create mode 100644 sources_non_forked/vim-go/autoload/go/def_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/doc.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fillstruct.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fillstruct_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fmt.vim create mode 100644 sources_non_forked/vim-go/autoload/go/fmt_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/guru.vim create mode 100644 sources_non_forked/vim-go/autoload/go/guru_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/highlight_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/iferr.vim create mode 100644 sources_non_forked/vim-go/autoload/go/impl.vim create mode 100644 sources_non_forked/vim-go/autoload/go/impl_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/implements.vim create mode 100644 sources_non_forked/vim-go/autoload/go/import.vim create mode 100644 sources_non_forked/vim-go/autoload/go/import_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/issue.vim create mode 100644 sources_non_forked/vim-go/autoload/go/job.vim create mode 100644 sources_non_forked/vim-go/autoload/go/job_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/keyify.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lint.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lint_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/list.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/completionitemkind.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/filechangetype.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/message.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/mod.vim create mode 100644 sources_non_forked/vim-go/autoload/go/package.vim create mode 100644 sources_non_forked/vim-go/autoload/go/package_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/path.vim create mode 100644 sources_non_forked/vim-go/autoload/go/play.vim create mode 100644 sources_non_forked/vim-go/autoload/go/promise.vim create mode 100644 sources_non_forked/vim-go/autoload/go/promise_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/referrers.vim create mode 100644 sources_non_forked/vim-go/autoload/go/rename.vim create mode 100644 sources_non_forked/vim-go/autoload/go/statusline.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tags.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tags_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/template.vim create mode 100644 sources_non_forked/vim-go/autoload/go/template_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/term.vim create mode 100644 sources_non_forked/vim-go/autoload/go/term_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/cmd/bad.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/buildtags.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/constrainedfoo.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/foo.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/debug/compilerror/main.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/debug/debugmain/debugmain.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports/goimports.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports/goimports_golden.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports/vendor/gh.com/gi/foo-logging/logger.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/job/dir has spaces/main.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/errcheck/compilererror/compilererror.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/errcheck/errcheck.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/errcheck/errcheck_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/errcheck/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/foo.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/baz.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/golangci-lint/problems/importabs/ok.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/golangci-lint/problems/importabs/problems.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/golangci-lint/problems/multiple/problems.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/golangci-lint/problems/shadow/problems.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/lint.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/quux.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/compilererror/compilererror.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/vet.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lsp/fmt/format.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lsp/fmt/format_golden.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lsp/fmt/newline.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lsp/imports/imports.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lsp/imports/imports_golden.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/term/term.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/.gitignore create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/compilerror.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/mock/controller.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/play_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/showname_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/testcompilerror_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/timeout_test.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/veterror.go create mode 100644 sources_non_forked/vim-go/autoload/go/test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/textobj.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tool.vim create mode 100644 sources_non_forked/vim-go/autoload/go/tool_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/ui.vim create mode 100644 sources_non_forked/vim-go/autoload/go/uri.vim create mode 100644 sources_non_forked/vim-go/autoload/go/uri_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/util.vim create mode 100644 sources_non_forked/vim-go/autoload/gotest.vim create mode 100644 sources_non_forked/vim-go/autoload/unite/sources/decls.vim create mode 100644 sources_non_forked/vim-go/compiler/go.vim create mode 100644 sources_non_forked/vim-go/doc/vim-go.txt create mode 100644 sources_non_forked/vim-go/ftdetect/gofiletype.vim create mode 100644 sources_non_forked/vim-go/ftplugin/asm.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/commands.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/mappings.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/snippets.vim create mode 100644 sources_non_forked/vim-go/ftplugin/go/tagbar.vim create mode 100644 sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim 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/UltiSnips/go.snippets create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_eq create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_err create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_errt create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_errw create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_f create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_ff create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_fori create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_sp create mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_tt create mode 100644 sources_non_forked/vim-go/gosnippets/snippets/go.snip create mode 100644 sources_non_forked/vim-go/indent/go.vim create mode 100644 sources_non_forked/vim-go/indent/gohtmltmpl.vim create mode 100644 sources_non_forked/vim-go/plugin/go.vim create mode 100644 sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py create mode 100755 sources_non_forked/vim-go/scripts/bench-syntax create mode 100755 sources_non_forked/vim-go/scripts/docker-test create mode 100755 sources_non_forked/vim-go/scripts/install-tools create mode 100755 sources_non_forked/vim-go/scripts/install-vim create mode 100755 sources_non_forked/vim-go/scripts/lint create mode 100755 sources_non_forked/vim-go/scripts/run-vim create mode 100644 sources_non_forked/vim-go/scripts/runbench.vim create mode 100644 sources_non_forked/vim-go/scripts/runtest.vim create mode 100755 sources_non_forked/vim-go/scripts/test create mode 100644 sources_non_forked/vim-go/syntax/go.vim create mode 100644 sources_non_forked/vim-go/syntax/godebugoutput.vim create mode 100644 sources_non_forked/vim-go/syntax/godebugstacktrace.vim create mode 100644 sources_non_forked/vim-go/syntax/godebugvariables.vim create mode 100644 sources_non_forked/vim-go/syntax/godefstack.vim create mode 100644 sources_non_forked/vim-go/syntax/gohtmltmpl.vim create mode 100644 sources_non_forked/vim-go/syntax/gomod.vim create mode 100644 sources_non_forked/vim-go/syntax/gosum.vim create mode 100644 sources_non_forked/vim-go/syntax/gotexttmpl.vim create mode 100644 sources_non_forked/vim-go/syntax/gowork.vim create mode 100644 sources_non_forked/vim-go/syntax/vimgo.vim create mode 100644 sources_non_forked/vim-go/templates/hello_world.go create mode 100644 sources_non_forked/vim-go/templates/hello_world_test.go create mode 100644 sources_non_forked/vim-go/test/parse.go diff --git a/sources_non_forked/vim-go/.codecov.yml b/sources_non_forked/vim-go/.codecov.yml new file mode 100644 index 00000000..9a8b1bb9 --- /dev/null +++ b/sources_non_forked/vim-go/.codecov.yml @@ -0,0 +1,13 @@ +--- +coverage: + status: + project: + default: + target: auto + threshold: 1 + base: auto + patch: off +comment: false +ignore: + - "!autoload/go/*.vim$" + - "autoload/go/*_test.vim$" diff --git a/sources_non_forked/vim-go/.coveragerc b/sources_non_forked/vim-go/.coveragerc new file mode 100644 index 00000000..8cddf91c --- /dev/null +++ b/sources_non_forked/vim-go/.coveragerc @@ -0,0 +1,3 @@ +[run] +plugins = covimerage +data_file = .coverage_covimerage diff --git a/sources_non_forked/vim-go/.dockerignore b/sources_non_forked/vim-go/.dockerignore new file mode 100644 index 00000000..8a4b0bb5 --- /dev/null +++ b/sources_non_forked/vim-go/.dockerignore @@ -0,0 +1,8 @@ +.local/ +.config/ +.cache/ +.dlv/ +.git/ +.viminfo +issues/ +autoload/go/**/pkg/ diff --git a/sources_non_forked/vim-go/.editorconfig b/sources_non_forked/vim-go/.editorconfig new file mode 100644 index 00000000..2c222811 --- /dev/null +++ b/sources_non_forked/vim-go/.editorconfig @@ -0,0 +1,17 @@ +# http://EditorConfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.go] +indent_style = tab +indent_size = 4 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/sources_non_forked/vim-go/.github/CONTRIBUTING.md b/sources_non_forked/vim-go/.github/CONTRIBUTING.md new file mode 100644 index 00000000..edabf915 --- /dev/null +++ b/sources_non_forked/vim-go/.github/CONTRIBUTING.md @@ -0,0 +1,12 @@ +Thanks for improving vim-go! Before you dive in please read the following: + +1. Please read our + [Documentation](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt), + it might have a solution to your problem. +2. If you add a new feature then please don't forget to update the documentation: + [doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt). +3. If it's a breaking change or exceeds 100 lines of code then please open an + issue first and describe the changes you want to make. +4. See `:help go-development` for instructions on how to run and write tests. If + you add a new feature be sure you also include a test if feasible. + diff --git a/sources_non_forked/vim-go/.github/FUNDING.yml b/sources_non_forked/vim-go/.github/FUNDING.yml new file mode 100644 index 00000000..060026ef --- /dev/null +++ b/sources_non_forked/vim-go/.github/FUNDING.yml @@ -0,0 +1 @@ +patreon: bhcleek diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..74763b06 --- /dev/null +++ b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,50 @@ + +### What did you do? (required: The issue will be **closed** when not provided) + + + +### What did you expect to happen? + +### What happened instead? + +### Configuration (**MUST** fill this out): + +#### vim-go version: + +#### `vimrc` you used to reproduce: + + +
vimrc + +```vim + +``` +
+ +#### Vim version (first three lines from `:version`): + + +#### Go version (`go version`): + + +#### Go environment +
go env Output:
+
+
+
+ +#### gopls version +
gopls version Output:
+
+
+
diff --git a/sources_non_forked/vim-go/.github/workflows/git.yml b/sources_non_forked/vim-go/.github/workflows/git.yml new file mode 100644 index 00000000..e61f3057 --- /dev/null +++ b/sources_non_forked/vim-go/.github/workflows/git.yml @@ -0,0 +1,11 @@ +name: git checks +on: [pull_request] + +jobs: + autosquash-commits-integrated: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2.0.0 + - name: Block Fixup Commit Merge + uses: 13rac1/block-fixup-merge-action@v2.0.0 diff --git a/sources_non_forked/vim-go/.github/workflows/test.yml b/sources_non_forked/vim-go/.github/workflows/test.yml new file mode 100644 index 00000000..95863cf7 --- /dev/null +++ b/sources_non_forked/vim-go/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: test +on: [push, pull_request] +jobs: + lint: + name: lint + runs-on: ubuntu-18.04 + steps: + - name: set up python + uses: actions/setup-python@v2.1.4 + with: + python-version: 3.6 + - name: install vim-vint + run: | + python -m pip install --upgrade pip + pip install vim-vint pathlib + - name: checkout + uses: actions/checkout@v2.1.0 + - name: install vim + run: $GITHUB_WORKSPACE/scripts/install-vim vim-8.2 + - name: install tools + run: $GITHUB_WORKSPACE/scripts/install-tools vim-8.2 + - name: lint + run: $GITHUB_WORKSPACE/scripts/lint vim-8.2 + test: + name: test + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + go: ['1.17','1.18'] + vim: ['vim-8.0', 'vim-8.2', 'nvim'] + steps: + - name: setup Go + uses: actions/setup-go@v2.1.3 + with: + go-version: ${{ matrix.go }} + - name: set up python + uses: actions/setup-python@v2.1.4 + with: + python-version: 3.6 + - name: install covimerage + run: | + python -m pip install --upgrade pip + pip install click==7.1.2 covimerage==0.2.1 codecov pathlib + - name: checkout + uses: actions/checkout@v2.1.0 + - name: install vim + run: $GITHUB_WORKSPACE/scripts/install-vim ${{ matrix.vim }} + - name: install tools + run: $GITHUB_WORKSPACE/scripts/install-tools ${{ matrix.vim }} + - name: test + run: $GITHUB_WORKSPACE/scripts/test -c ${{ matrix.vim }} + - uses: codecov/codecov-action@v1 + with: + # token is not required for public repos + #token: ${{ secrets.CODECOV_TOKEN }} + file: $GITHUB_WORKSPACE/coverage.xml + flags: unittests + name: vim-go + fail_ci_if_error: false diff --git a/sources_non_forked/vim-go/.gitignore b/sources_non_forked/vim-go/.gitignore new file mode 100644 index 00000000..2f7d8333 --- /dev/null +++ b/sources_non_forked/vim-go/.gitignore @@ -0,0 +1,11 @@ +*.pyc +.DS_Store +/.bash_history +/.cache +/.config +/.coverage.covimerage +/.local +/.viminfo +/coverage.xml +/doc/tags +/issues diff --git a/sources_non_forked/vim-go/.vintrc.yaml b/sources_non_forked/vim-go/.vintrc.yaml new file mode 100644 index 00000000..32d7decf --- /dev/null +++ b/sources_non_forked/vim-go/.vintrc.yaml @@ -0,0 +1,7 @@ +policies: + ProhibitUnnecessaryDoubleQuote: + enabled: false + ProhibitEqualTildeOperator: + enabled: false + ProhibitNoAbortFunction: + enabled: false diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md new file mode 100644 index 00000000..f33b6ce8 --- /dev/null +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -0,0 +1,2243 @@ +## unplanned + +BACKWARDS INCOMPATIBILITIES: + +IMPROVEMENTS: +* Update documentation for installing tools. + [[GH-3413]](https://github.com/fatih/vim-go/pull/3413) +* Show diagnostics via go#tool#DescribeBalloon(). + [[GH-3415]](https://github.com/fatih/vim-go/pull/3415) + [[GH-3417]](https://github.com/fatih/vim-go/pull/3417) + +BUG FIXES: + +## v1.26 - (April 23, 2022) + +BACKWARDS INCOMPATIBILITIES: + +IMPROVEMENTS: +* Add mapping for formatting, `(go-fmt)`. + [[GH-3209]](https://github.com/fatih/vim-go/pull/3209) +* Add `tr` snippet for `"testing.T".Run`. + [[GH-3210]](https://github.com/fatih/vim-go/pull/3210) + [[GH-3220]](https://github.com/fatih/vim-go/pull/3220) +* Use `go env GOBIN` to determine `GOBIN`'s value. + [[GH-3207]](https://github.com/fatih/vim-go/pull/3207) +* List register in the debugger. + [[GH-3221]](https://github.com/fatih/vim-go/pull/3221) +* Install the latest release of tools that seem to be using tags to do releases + instead of installing from their master/main branch. + [[GH-3227]](https://github.com/fatih/vim-go/pull/3227) +* Expose error message when `gopls` cannot be found and + `g:go_echo_command_info` is set. + [[GH-3244]](https://github.com/fatih/vim-go/pull/3244) +* Install all tools in module aware mode in preparation for Go 1.17 release. + [[GH-3226]](https://github.com/fatih/vim-go/pull/3226) +* Add `g:go_doc_balloon` to allow godoc to be displayed in hover balloons. + [[GH-3252]](https://github.com/fatih/vim-go/pull/3252) +* Default to using `revive` in place of `golint`. + [[GH-3248]](https://github.com/fatih/vim-go/pull/3248) + [[GH-3401]](https://github.com/fatih/vim-go/pull/3401) +* Teach `:GoDebugPrint` to show function call return values. + [[GH-3256]](https://github.com/fatih/vim-go/pull/3256) +* Do not enable keyify unless in GOPATH. + [[GH-3095]](https://github.com/fatih/vim-go/pull/3095) +* Show LSP messages to users. + [[GH-3058]](https://github.com/fatih/vim-go/pull/3058) +* Check omnifunc's value before executing actions on CompletedDone event. + [[GH-3274]](https://github.com/fatih/vim-go/pull/3274) +* Highlight new form of build constraints. + [[GH-3292]](https://github.com/fatih/vim-go/pull/3292) +* Teach `:GoDiagnostics` to handle package pattern arguments. + [[GH-3297]](https://github.com/fatih/vim-go/pull/3297) +* Add `g:go_debug_subsitute_paths` to support debugging applications when the + source is hosted in a local location that is different from where the binary + was compiled. + [[GH-3301]](https://github.com/fatih/vim-go/pull/3301) +* Wrap text in the fzf preview window by default. + [[GH-3310]](https://github.com/fatih/vim-go/pull/3310) +* Wait for up to five seconds when opening a connection to a remote debugger. + [[GH-3312]](https://github.com/fatih/vim-go/pull/3312) +* Install tools with `go install` instead of `go get`. + [[GH-3317]](https://github.com/fatih/vim-go/pull/3317) + [[GH-3370]](https://github.com/fatih/vim-go/pull/3370) +* Update `:GoPlay` to use `go.dev/play` instead of `play.golang.org`. + [[GH-3331]](https://github.com/fatih/vim-go/pull/3331) + [[GH-3348]](https://github.com/fatih/vim-go/pull/3348) +* Recurse local variables more deeply when debugging. + [[GH-3344]](https://github.com/fatih/vim-go/pull/3344) +* Add syntax elements for `any` and `comparable` types. + [[GH-3351]](https://github.com/fatih/vim-go/pull/3351) +* Add syntax support for go.work files. + [[GH-3375]](https://github.com/fatih/vim-go/pull/3375) +* Show the current goroutine at the top of the list of goroutines when debugging. + [[GH-3379]](https://github.com/fatih/vim-go/pull/3379) +* Add `:GoModReload` and autocmd events to reload go.mod when it changes on + disk and is open in a buffer. + [[GH-3387]](https://github.com/fatih/vim-go/pull/3387) + [[GH-3391]](https://github.com/fatih/vim-go/pull/3391) +* Add syntax support for generics. + [[GH-3397]](https://github.com/fatih/vim-go/pull/3397) +* Remove invalid numeric literal highlighting. + [[GH-3404]](https://github.com/fatih/vim-go/pull/3404) + +BUG FIXES: +* Handle terminating parenthesis on hexadecimal values. + [[GH-3216]](https://github.com/fatih/vim-go/pull/3216) +* Fix applying text edits from gopls. + [[GH-3231]](https://github.com/fatih/vim-go/pull/3231) +* Apply arguments to `:GoCoverageBrowser`. + [[GH-3240]](https://github.com/fatih/vim-go/pull/3240) +* Fix `:GoFillStruct` when `g:go_fillstruct_mode` is `gopls`. + [[GH-3279]](https://github.com/fatih/vim-go/pull/3279) +* Fix example in `g:go_metalinter_enabled` documentation. + [[GH-3291]](https://github.com/fatih/vim-go/pull/3291) +* Fix changing directories in older Vims. + [[GH-3299]](https://github.com/fatih/vim-go/pull/3299) +* Highlight the receive type when method declarations that omit the receiver + identifier. + [[GH-3306]](https://github.com/fatih/vim-go/pull/3306) +* Do not highlight misspellings in import paths. + [[GH-3308]](https://github.com/fatih/vim-go/pull/3308) + [[GH-3321]](https://github.com/fatih/vim-go/pull/3321) +* Handle shell quoting when execing. + [[GH-3323]](https://github.com/fatih/vim-go/pull/3323) +* Do not automatically add directories from the module cache into the LSP + workspace. + [[GH-3343]](https://github.com/fatih/vim-go/pull/3343) +* Resolve symlinks in autocmd events. + [[GH-3353]](https://github.com/fatih/vim-go/pull/3353) +* Fix `:GoRename` in Neovim so that it does not take 10 seconds to complete. + [[GH-3386]](https://github.com/fatih/vim-go/pull/3386) +* Fix `:GoDebugConnect` argument handling. + [[GH-3400]](https://github.com/fatih/vim-go/pull/3400) + +## v1.25 - (April 18, 2021) + +BACKWARDS INCOMPATIBILITIES: +* Remove g:go_autodetect_gopath. + [[GH-3078]](https://github.com/fatih/vim-go/pull/3078) + +IMPROVEMENTS: +* Clarify allowed values for `gopls` related configuration options. + [[GH-3016]](https://github.com/fatih/vim-go/pull/3016) + [[GH-3017]](https://github.com/fatih/vim-go/pull/3017) +* Add `g:go_fillstruct_mode` to allow `:GoFillStruct` to be satisfied by either + `fillstruct` or by `gopls`. + [[GH-3018]](https://github.com/fatih/vim-go/pull/3018) +* Add `:GoDebugTestFunc` to debug the test function surrounding the current + cursor location. + [[GH-3011]](https://github.com/fatih/vim-go/pull/3011) +* Implicitly add a workspace when a file from a module is opened. + [[GH-3028]](https://github.com/fatih/vim-go/pull/3028) +* Add support for using static check as the gometalinter. + [[GH-3036]](https://github.com/fatih/vim-go/pull/3036) + [[GH-3133]](https://github.com/fatih/vim-go/pull/3133) +* Add `g:go_debug_mappings` to allow the debug key mappings to be customized. + [[GH-3035]](https://github.com/fatih/vim-go/pull/3035) + [[GH-3143]](https://github.com/fatih/vim-go/pull/3143) +* Use `gopls` as the default instead of `guru` to satisfy `:GoImplements`. + [[GH-3034]](https://github.com/fatih/vim-go/pull/3034) +* Deprecate g:go_diagnostics_enabled` and add `g:go_diagnostics_level` to allow + more finely grained control of the handling of diagnostics messages. + [[GH-3050]](https://github.com/fatih/vim-go/pull/3050) + [[GH-3052]](https://github.com/fatih/vim-go/pull/3052) + [[GH-3119]](https://github.com/fatih/vim-go/pull/3119) +* Add support for allowing `g:go_gopls_local` to specify different local + imports values per workspace. + [[GH-3053]](https://github.com/fatih/vim-go/pull/3053) +* Improve `:GoDecls` and `:GoDeclsDir` display. + [[GH-3081]](https://github.com/fatih/vim-go/pull/3081) +* Preserve existing window layout when debugging and `g:go_debug_windows` is + empty. + [[GH-3068]](https://github.com/fatih/vim-go/pull/3068) +* Show identifier in fzf's preview window with `:GoDecls` and `:GoDeclsDir`. + [[GH-3083]](https://github.com/fatih/vim-go/pull/3083) +* Use `gopls` for `:GoCallers`. + [[GH-3088]](https://github.com/fatih/vim-go/pull/3088) + [[GH-3090]](https://github.com/fatih/vim-go/pull/3090) + [[GH-3141]](https://github.com/fatih/vim-go/pull/3141) + [[GH-3142]](https://github.com/fatih/vim-go/pull/3142) +* Update denite integration to work with python3.9. + [[GH-3097]](https://github.com/fatih/vim-go/pull/3097) +* Add syntax highlighting for go.sum files. + [[GH-3102]](https://github.com/fatih/vim-go/pull/3102) +* Change the default from metalinter to staticcheck. + [[GH-3126]](https://github.com/fatih/vim-go/pull/3126) +* Add `g:go_debug_preserve_layout` to prevent `:GoDebug` and friends from + closing windows. + [[GH-3125]](https://github.com/fatih/vim-go/pull/3125) +* Add support for `fillstruct`'s new `-tags` flag. + [[GH-3156]](https://github.com/fatih/vim-go/pull/3156) +* Display map key and slice elements more usefully in the local vars window in + debug mode. + [[GH-3170]](https://github.com/fatih/vim-go/pull/3170) +* Add support for go.mod's `retract` directive. + [[GH-3166]](https://github.com/fatih/vim-go/pull/3166) +* Do not execute disabled code actions. + [[GH-3155]](https://github.com/fatih/vim-go/pull/3155) +* Add `:GoDebugConnect` to support connecting to an instance of delve started + outside of vim-go. + [[GH-3179]](https://github.com/fatih/vim-go/pull/3179) +* Use gopls to adjust imports and formatting by default. + [[GH-2986]](https://github.com/fatih/vim-go/pull/2986) +* Set the filetype for .tmpl files to gohtmltmpl even if it's already been set. + [[GH-3146]](https://github.com/fatih/vim-go/pull/3146) + +BUG FIXES: +* Remove implications that terminal mode is only applied for Neovim. + [[GH-3010]](https://github.com/fatih/vim-go/pull/3010) +* Correct documentation to clearly show the default value for + `g:go_gopls_options`. + [[GH-3019]](https://github.com/fatih/vim-go/pull/3019) +* Allow truthy values for `g:go_gopls_gofumpt`. + [[GH-3017]](https://github.com/fatih/vim-go/pull/3017) + [[GH-3022]](https://github.com/fatih/vim-go/pull/3022) +* Fix quickfix title for `:GoMetaLinter`. + [[GH-3040]](https://github.com/fatih/vim-go/pull/3040) +* Change key mapping for (go-debug-halt) to F8 to resolve collision with key + mapping for (go-debug-print). + [[GH-3047]](https://github.com/fatih/vim-go/pull/3047) +* Handle gopls v0.5.2 addition of a prefix on the expected code actions names. + [[GH-3077]](https://github.com/fatih/vim-go/pull/3077) +* Make sure all buffers' mappings are restored when debugging stops. + [[GH-3048]](https://github.com/fatih/vim-go/pull/3048) +* Return early when `g:go_referrers_modes` is `gopls` and `gopls` is disabled. + [[GH-3090]](https://github.com/fatih/vim-go/pull/3090) +* Handle yet another error format produced by golangci-lint. + [[GH-3094]](https://github.com/fatih/vim-go/pull/3094) +* Handle additional ways that gopls can provide links for godoc. + [[GH-3112]](https://github.com/fatih/vim-go/pull/3112) +* Remove implication that `g:go_def_reuse_buffer` only applies to split variant + of jumping to a definition. + [[GH-3128]](https://github.com/fatih/vim-go/pull/3128) +* Organize imports correctly when `gopls` formatting uses `gofumpt`. + [[GH-3154]](https://github.com/fatih/vim-go/pull/3154) +* Rename all instances of an identifier when `g:go_rename_mode` is `gopls`. + [[GH-3181]](https://github.com/fatih/vim-go/pull/3181) + [[GH-3182]](https://github.com/fatih/vim-go/pull/3182) +* Terminate a case statement in the select snippet with a colon. + [[GH-3185]](https://github.com/fatih/vim-go/pull/3185) +* Fix syntax highlighting in template files. + [[GH-3188]](https://github.com/fatih/vim-go/pull/3188) + [[GH-3189]](https://github.com/fatih/vim-go/pull/3189) + +## v1.24 - (September 15, 2020) + +IMPROVEMENTS: +* Clarify how `g:go_imports_autosave` and `g:go_fmt_autosave` interact. + [[GH-2893]](https://github.com/fatih/vim-go/pull/2893) +* Document what the working directory will be for `:GoRun`. + [[GH-2898]](https://github.com/fatih/vim-go/pull/2898) +* Add Ultisnip snippet for wrapping errors. + [[GH-2883]](https://github.com/fatih/vim-go/pull/2883) +* Beautify the godoc pop up window border. + [[GH-2900]](https://github.com/fatih/vim-go/pull/2900) +* Default `g:go_doc_url` to https://pkg.go.dev. + [[GH-2884]](https://github.com/fatih/vim-go/pull/2884) +* Default `g:go_gopls_options` to `[-remote=auto]` to share gopls instances + with other plugins and multiple instances of Vim. + [[GH-2905]](https://github.com/fatih/vim-go/pull/2905) +* Use the module root as the working directory when renaming so that all + references to the symbol will be renamed when in module aware mode and + `g:go_rename_command` is set to `gopls`. + [[GH-2917]](https://github.com/fatih/vim-go/pull/2917) +* Change `g:go_rename_command`'s default to `gopls`. + [[GH-2922]](https://github.com/fatih/vim-go/pull/2922) +* Do not send unnecessary textDocument/didChange notifications to `gopls`. + [[GH-2902]](https://github.com/fatih/vim-go/pull/2902) + [[GH-2930]](https://github.com/fatih/vim-go/pull/2930) +* Stop the debugger when the process being debugged exits. + [[GH-2921]](https://github.com/fatih/vim-go/pull/2921) +* Use the module package cache as a source of packages candidates when trying + to complete package names. + [[GH-2936]](https://github.com/fatih/vim-go/pull/2936) + [[GH-2939]](https://github.com/fatih/vim-go/pull/2939) +* Allow interaction with Vim while waiting for a breakpoint to be hit while + debugging. + [[GH-2932]](https://github.com/fatih/vim-go/pull/2932) +* Refactor Vim signs used for debugging breakpoints to avoid id collision with + other plugins. + [[GH-2943]](https://github.com/fatih/vim-go/pull/2943) +* Refactor debugger's rpc response handling to be asynchronous so that Vim will + be responsive while the program being debugged is executing. + [[GH-2948]](https://github.com/fatih/vim-go/pull/2948) + [[GH-2952]](https://github.com/fatih/vim-go/pull/2952) +* Warn when the debugger breaks in a file that has changed since debugging started. + [[GH-2950]](https://github.com/fatih/vim-go/pull/2950) +* Enable `go-run` mappings that use the terminal to work with Vim in addition to Neovim. + [[GH-2956]](https://github.com/fatih/vim-go/pull/2956) +* Use existing diagnostics for the file when the file hasn't changed and + `g:go_metalinter_command` is `gopls`. + [[GH-2960]](https://github.com/fatih/vim-go/pull/2960) +* Add a new option, `g:go_code_completion_icase`, to allow ignoring case when + filtering completion results. + [[GH-2961]](https://github.com/fatih/vim-go/pull/2961) + * Make sure tools are not cross-compiled with `:GoInstallBinaries` and + `:GoUpdateBinaries`. + [[GH-2982]](https://github.com/fatih/vim-go/pull/2982) + [[GH-2988]](https://github.com/fatih/vim-go/pull/2988) +* Add `:GoDebugHalt` to allow a program being debugged to be paused before it + hits a breakpoint. + [[GH-2983]](https://github.com/fatih/vim-go/pull/2983) +* Clear highlighting of the current line when after resuming when debugging. + [[GH-2984]](https://github.com/fatih/vim-go/pull/2984) +* Add `:GoDebugAttach` to debug a running process. + [[GH-2989]](https://github.com/fatih/vim-go/pull/2989) +* Add `g:go_term_reuse` option to allow the reuse of a terminal window. + [[GH-2990]](https://github.com/fatih/vim-go/pull/2990) +* Add official support for using `gopls`' `gofumpt` workspace setting via + `g:go_gopls_gofumpt`. + [[GH-2994]](https://github.com/fatih/vim-go/pull/2994) + [[GH-3005]](https://github.com/fatih/vim-go/pull/3005) +* Add support for using `gopls`' workspace settings that are otherwise not yet + officially supported by vim-go. + [[GH-2994]](https://github.com/fatih/vim-go/pull/2994) + +BUG FIXES: +* Fix call to non-existent function in terminal mode edge case. + [[GH-2895]](https://github.com/fatih/vim-go/pull/2895) +* Do not show errors when adding a text property for highlighting fails. + [[GH-2892]](https://github.com/fatih/vim-go/pull/2892) +* Include `errcheck` in `g:go_metalinter_enabled`'s default. + [[GH-2903]](https://github.com/fatih/vim-go/pull/2903) +* Fix display of completion selection information on command-line when + `g:go_echo_go_info` is enabled. + [[GH-2907]](https://github.com/fatih/vim-go/pull/2907) +* Prevent `:GoDebugBreakpoint` from causing delve to exit. + [[GH-2908]](https://github.com/fatih/vim-go/pull/2908) +* Use the resolved directory name for `gopls`' working directory when `go.mod` + is in a symlinked path. + [[GH-2913]](https://github.com/fatih/vim-go/pull/2913) +* Fix buffer reuse with `:GoDef`. + [[GH-2928]](https://github.com/fatih/vim-go/pull/2928) +* Handle breakpoints that are already set before calling `:GoDebugStart` or + `:GoDebugTest` in some locales that cause the `sign place` output to vary. + [[GH-2921]](https://github.com/fatih/vim-go/pull/2921) +* Handle diagnostic errors at the end of a .go file. + [[GH-2942]](https://github.com/fatih/vim-go/pull/2942) +* Fix the `go-implements` mapping to use respect `g:go_implements_mode`. + [[GH-2944]](https://github.com/fatih/vim-go/pull/2944) +* Handle null results from `gopls` when getting definitions or type definitions + from virtual files. + [[GH-2951]](https://github.com/fatih/vim-go/pull/2951) +* Fix warning when Neovim is older than v0.4.0. + [[GH-2959]](https://github.com/fatih/vim-go/pull/2959) +* Correct documentation that referred to `g:go_imports_command` to refer to + `g:go_imports_mode` instead. + [[GH-2969]](https://github.com/fatih/vim-go/pull/2969) +* Remove reference to gocode in error message when `g:go_info_mode` is set to + an unsupported value. + [[GH-2978]](https://github.com/fatih/vim-go/pull/2978) +* Make sure debugging commands are configured when debugging a second time + within a single Vim session. + [[GH-2985]](https://github.com/fatih/vim-go/pull/2985) +* Correct documentation in for `:GoModifyTags` when adding a specific tag + value. + [[GH-3001]](https://github.com/fatih/vim-go/pull/3001) +* Fix the path given to `gopls` when `let g:go_metalinter='gopls'` and + `:GoMetaLinter` is called without any arguments. + [[GH-2992]](https://github.com/fatih/vim-go/pull/2992) +* Do not override a user's configuration for `GoDebugBreakpoint` or + `GoDebugCurrent` highlight groups. + [[GH-2998]](https://github.com/fatih/vim-go/pull/2998) +* Apply `gopls` text edits correctly that insert solitary newlines. + [[GH-3000]](https://github.com/fatih/vim-go/pull/3000) + +## v1.23 - (May 16, 2020) + +BACKWARDS INCOMPATIBILITIES: +* Remove support for gocode. + [[GH-2686]](https://github.com/fatih/vim-go/pull/2686) +* Require at least Neovim >= 0.4.0 + [[GH-2853]](https://github.com/fatih/vim-go/pull/2853) + [[GH-2856]](https://github.com/fatih/vim-go/pull/2856) + [[GH-2863]](https://github.com/fatih/vim-go/pull/2863) + +IMPROVEMENTS: +* Make signs for breakpoints configurable. + [[GH-2676]](https://github.com/fatih/vim-go/pull/2676) + [[GH-2690]](https://github.com/fatih/vim-go/pull/2690) +* Enable g:go_gopls_complete_unimported by default to stay aligned with gopls' defaults. + [[GH-2695]](https://github.com/fatih/vim-go/pull/2695) +* Document mappings that were recently added. + [[GH-2699]](https://github.com/fatih/vim-go/pull/2699) +* Handle null arrays better in gopls responses. + [[GH-2703]](https://github.com/fatih/vim-go/pull/2703) +* Use `gopls` defaults by default when they're not otherwise specified in vim-go options. + [[GH-2696]](https://github.com/fatih/vim-go/pull/2696) +* Add support for `gomodifytags --skip-unexported` + [[GH-2660]](https://github.com/fatih/vim-go/pull/2660) +* Show problems that prevent golangci-lint from running linters. + [[GH-2706]](https://github.com/fatih/vim-go/pull/2706) + [[GH-2720]](https://github.com/fatih/vim-go/pull/2720) +* Support golangci-lint config file by not using `--disable-all` when + `g:go_metalinter_enable` or `g:go_metalinter_autosave_enabled` is set to an + empty array. + [[GH-2655]](https://github.com/fatih/vim-go/pull/2655) + [[GH-2715]](https://github.com/fatih/vim-go/pull/2715) +* Add support for Vim8 terminals. + [[GH-2639]](https://github.com/fatih/vim-go/pull/2639) + [[GH-2736]](https://github.com/fatih/vim-go/pull/2736) +* Replace `g:go_gopls_fuzzy_matching` with `g:go_gopls_matcher` in response to + `gopls` deprecation of its `fuzzyMatching` option. + [[GH-2728]](https://github.com/fatih/vim-go/pull/2728) +* Set statuses and progress messages consistently for code quality tools. + [[GH-2727]](https://github.com/fatih/vim-go/pull/2727) +* Add a new supported value to `g:go_fmt_command` to format with `gopls`. + [[GH-2729]](https://github.com/fatih/vim-go/pull/2729) + [[GH-2752]](https://github.com/fatih/vim-go/pull/2752) + [[GH-2852]](https://github.com/fatih/vim-go/pull/2852) +* Handle changes to `go test -v` output. + [[GH-2743]](https://github.com/fatih/vim-go/pull/2743) +* Add `g:go_gopls_mod_tempfile` to configure `gopls`' `tempModfile` + configuration. + [[GH-2747]](https://github.com/fatih/vim-go/pull/2747) +* Add `g:go_gopls_options` to configure `gopls`' commandline options. + [[GH-2747]](https://github.com/fatih/vim-go/pull/2747) +* Improve readability of gopls logs. + [[GH-2773]](https://github.com/fatih/vim-go/pull/2773) +* Introduce `g:go_implements_mode` to allow `:GoImplements` to be satisfied + with `gopls`. + [[GH-2741]](https://github.com/fatih/vim-go/pull/2741) + [[GH-2799]](https://github.com/fatih/vim-go/pull/2799) +* Introduce `g:go_imports_mode` to allow `:GoImports` to be satisfied with + `gopls`. + [[GH-2791]](https://github.com/fatih/vim-go/pull/2791) + [[GH-2794]](https://github.com/fatih/vim-go/pull/2794) + [[GH-2796]](https://github.com/fatih/vim-go/pull/2796) + [[GH-2848]](https://github.com/fatih/vim-go/pull/2848) +* Send LSP synchronization messages to `gopls` when the file does not yet exist + on disk as long as its directory exists. + [[GH-2805]](https://github.com/fatih/vim-go/pull/2805) +* Run `gogetdoc` in the buffer's directory so that it will work regardless of + the user's working directory in module-aware mode. + [[GH-2804]](https://github.com/fatih/vim-go/pull/2804) +* Add `g:go_gopls_analyses` to support `gopls`' analyses options. + [[GH-2820]](https://github.com/fatih/vim-go/pull/2820) +* Add `g:go_gopls_local` to support `gopls`' local option to control how third + party imports are organized. + [[GH-2821]](https://github.com/fatih/vim-go/pull/2821) +* Use gopls to get documentation and documentation links for identifiers under + the cursor. + [[GH-2822]](https://github.com/fatih/vim-go/pull/2822) + [[GH-2839]](https://github.com/fatih/vim-go/pull/2839) +* Clarify documentation for terminal options. + [[GH-2843]](https://github.com/fatih/vim-go/pull/2843) + +BUG FIXES: +* Use the discovered full path for gopls when renaming. + [[GH-2692]](https://github.com/fatih/vim-go/pull/2692) +* Execute commands correctly on windows when `'shell'` is not cmd.exe + [[GH-2713]](https://github.com/fatih/vim-go/pull/2713) + [[GH-2724]](https://github.com/fatih/vim-go/pull/2724) +* Always execute `errcheck` in the current package's directory. + [[GH-2726]](https://github.com/fatih/vim-go/pull/2726) +* Fix errors when highlighting diagnostics after a `:GoImports`. + [[GH-2746]](https://github.com/fatih/vim-go/pull/2746) +* Preserve errors from formatting when both formatting and metalinting happen + on save. + [[GH-2733]](https://github.com/fatih/vim-go/pull/2733) + [[GH-2810]](https://github.com/fatih/vim-go/pull/2810) +* Preserve ordering of gopls messages in the log. + [[GH-2753]](https://github.com/fatih/vim-go/pull/2753) +* Fix `:GoDef` on windows when `g:go_def_mode` is set to `gopls`. + [[GH-2768]](https://github.com/fatih/vim-go/pull/2768) +* Handle null values from `gopls`. + [[GH-2778]](https://github.com/fatih/vim-go/pull/2778) +* Preserve diagnostics highlights after formatting. + [[GH-2779]](https://github.com/fatih/vim-go/pull/2779) +* Fix the decoding and encoding of multi-byte file paths received from and sent + to `gopls`. + [[GH-2784]](https://github.com/fatih/vim-go/pull/2784) +* Fix `:GoRun` so that it works as expected when the current working directory + is neither in GOPATH nor within a module. + [[GH-2782]](https://github.com/fatih/vim-go/pull/2782) + [[GH-2818]](https://github.com/fatih/vim-go/pull/2818) + [[GH-2842]](https://github.com/fatih/vim-go/pull/2842) +* Use absolute file paths for `:GoRun`'s arguments in terminal mode. + [[GH-2844]](https://github.com/fatih/vim-go/pull/2844) +* Show the command executed by `:GoRun` when `g:go_debug` includes `'shell-commands'`. + [[GH-2785]](https://github.com/fatih/vim-go/pull/2785) + [[GH-2817]](https://github.com/fatih/vim-go/pull/2817) +* Clear the list for formatting errors when `g:go_fmt_command` is `gopls`. + [[GH-2790]](https://github.com/fatih/vim-go/pull/2790) +* Handle text edits from gopls that are only line insertions. + [[GH-2802]](https://github.com/fatih/vim-go/pull/2802) + [[GH-2803]](https://github.com/fatih/vim-go/pull/2803) +* Add `g:go_imports_autosave` so that imports can be adjusted on save when + `g:go_imports_mode` is set to `gopls`. + [[GH-2800]](https://github.com/fatih/vim-go/pull/2800) + [[GH-2858]](https://github.com/fatih/vim-go/pull/2858) +* Correct vim-go's help to correctly identify `g:go_referrer_mode`'s default. + [[GH-2832]](https://github.com/fatih/vim-go/pull/2832) +* Clear the quickfix list when `:GoLint` succeeds. + [[GH-2833]](https://github.com/fatih/vim-go/pull/2833) +* Respect arguments to `:GoDocBrowser`. + [[GH-2822]](https://github.com/fatih/vim-go/pull/2822) +* Use the correct path to documentation for struct fields with `:GoDocBrowser`. + [[GH-2822]](https://github.com/fatih/vim-go/pull/2822) +* Do not try parsing errors from terminal jobs when the working directory has + been removed. + [[GH-2824]](https://github.com/fatih/vim-go/pull/2824) +* Document that `g:go_jump_to_error` apples to running the metalinter on save, + too. + [[GH-2854]](https://github.com/fatih/vim-go/pull/2854) +* Ignore commented out import statements when executing `:GoImport`. + [[GH-2862]](https://github.com/fatih/vim-go/pull/2862) +* Interpret file paths in `go vet` errors relative to the current buffer's + directory. + [[GH-2882]](https://github.com/fatih/vim-go/pull/2882) + +## v1.22 - (January 30, 2020) + +BACKWARDS INCOMPATIBILITIES: +* Drop support for Vim 7.4. The minimum required version of Vim is now 8.0.1453. + [[GH-2495]](https://github.com/fatih/vim-go/pull/2495) + [[GH-2497]](https://github.com/fatih/vim-go/pull/2497) +* Drop support for `gometalinter` + [[GH-2494]](https://github.com/fatih/vim-go/pull/2494) + +IMPROVEMENTS: +* Highlight the `go` keyword in go.mod files. + [[GH-2473]](https://github.com/fatih/vim-go/pull/2473) +* Use echo functions consistently. + [[GH-2458]](https://github.com/fatih/vim-go/pull/2458) +* Add support for managing goroutines in debugger. + [[GH-2463]](https://github.com/fatih/vim-go/pull/2463) + [[GH-2527]](https://github.com/fatih/vim-go/pull/2527) +* Document `g:go_doc_popup_window`. + [[GH-2506]](https://github.com/fatih/vim-go/pull/2506) +* Make `g:go_doc_popup_window=1` work for Neovim, too. + [[GH-2451]](https://github.com/fatih/vim-go/pull/2451) + [[GH-2512]](https://github.com/fatih/vim-go/pull/2512) +* Handle errors jumping to a definition in a file open in another Vim process + better. + [[GH-2518]](https://github.com/fatih/vim-go/pull/2518) +* Improve the UX when the gopls binary is missing. + [[GH-2522]](https://github.com/fatih/vim-go/pull/2522) +* Use gopls instead of guru for `:GoSameIds`. + [[GH-2519]](https://github.com/fatih/vim-go/pull/2519) +* Use gopls instead of guru for `:GoReferrers`. + [[GH-2535]](https://github.com/fatih/vim-go/pull/2535) +* Update documentation for `g:go_addtags_transform`. + [[GH-2541]](https://github.com/fatih/vim-go/pull/2541) +* Install most helper tools in module aware mode. + [[GH-2545]](https://github.com/fatih/vim-go/pull/2545) +* Add a new option, `g:go_referrers_mode` to allow the user to choose whether + to use gopls or guru for finding references. + [[GH-2566]](https://github.com/fatih/vim-go/pull/2566) +* Add options to control how gopls responds to completion requests. + [[GH-2567]](https://github.com/fatih/vim-go/pull/2567) + [[GH-2568]](https://github.com/fatih/vim-go/pull/2568) +* Add syntax highlighting for binary literals. + [[GH-2557]](https://github.com/fatih/vim-go/pull/2557) +* Improve highlighting of invalid numeric literals. + [[GH-2571]](https://github.com/fatih/vim-go/pull/2571) + [[GH-2587]](https://github.com/fatih/vim-go/pull/2587) + [[GH-2589]](https://github.com/fatih/vim-go/pull/2589) + [[GH-2584]](https://github.com/fatih/vim-go/pull/2584) + [[GH-2597]](https://github.com/fatih/vim-go/pull/2597) + [[GH-2599]](https://github.com/fatih/vim-go/pull/2599) +* Add highlighting of sections reported by gopls diagnostics' errors + and warnings. + [[GH-2569]](https://github.com/fatih/vim-go/pull/2569) + [[GH-2643]](https://github.com/fatih/vim-go/pull/2643) +* Make the highlighting of fzf decls configurable. + [[GH-2572]](https://github.com/fatih/vim-go/pull/2572) + [[GH-2579]](https://github.com/fatih/vim-go/pull/2579) +* Support renaming with gopls. + [[GH-2577]](https://github.com/fatih/vim-go/pull/2577) + [[GH-2618]](https://github.com/fatih/vim-go/pull/2618) +* Add an option, `g:go_gopls_enabled`, to allow gopls integration to be + disabled. + [[GH-2605]](https://github.com/fatih/vim-go/pull/2605) + [[GH-2609]](https://github.com/fatih/vim-go/pull/2609) + [[GH-2638]](https://github.com/fatih/vim-go/pull/2638) + [[GH-2640]](https://github.com/fatih/vim-go/pull/2640) +* Add a buffer level option, `b:go_fmt_options`, to control formatting options + per buffer. + [[GH-2613]](https://github.com/fatih/vim-go/pull/2613) +* Use build tags when running `:GoVet`. + [[GH-2615]](https://github.com/fatih/vim-go/pull/2615) +* Add new snippets for UltiSnips. + [[GH-2623]](https://github.com/fatih/vim-go/pull/2623) + [[GH-2627]](https://github.com/fatih/vim-go/pull/2627) +* Expand completions as snippets when `g:go_gopls_use_placeholders` is set. + [[GH-2624]](https://github.com/fatih/vim-go/pull/2624) +* Add a new function, `:GoDiagnostics` and an associated mapping for seeing + `gopls` diagnostics. Because of the performance implications on large + projects, `g:go_diagnostics_enabled` controls whether all diagnostics are + processed or only the diagnostics for the current buffer. + [[GH-2612]](https://github.com/fatih/vim-go/pull/2612) +* Explain how to find and detect multiple copies of vim-go in the FAQ. + [[GH-2632]](https://github.com/fatih/vim-go/pull/2632) +* Update the issue template to ask for the gopls version and + `:GoReportGitHubIssue` to provide it. + [[GH-2630]](https://github.com/fatih/vim-go/pull/2630) +* Use text properties when possible for some highlighting cases. + [[GH-2652]](https://github.com/fatih/vim-go/pull/2652) + [[GH-2662]](https://github.com/fatih/vim-go/pull/2662) + [[GH-2663]](https://github.com/fatih/vim-go/pull/2663) + [[GH-2672]](https://github.com/fatih/vim-go/pull/2672) + [[GH-2678]](https://github.com/fatih/vim-go/pull/2678) + + +BUG FIXES: +* Fix removal of missing directories from gopls workspaces. + [[GH-2507]](https://github.com/fatih/vim-go/pull/2507) +* Change to original window before trying to change directories when term job + ends. + [[GH-2508]](https://github.com/fatih/vim-go/pull/2508) +* Swallow errors when the hover info cannot be determined. + [[GH-2515]](https://github.com/fatih/vim-go/pull/2515) +* Fix errors when trying to debug lsp and hover. + [[GH-2516]](https://github.com/fatih/vim-go/pull/2516) +* Reset environment variables on Vim <= 8.0.1831 . + [[GH-2523]](https://github.com/fatih/vim-go/pull/2523) +* Handle empty results from delve. + [[GH-2526]](https://github.com/fatih/vim-go/pull/2526) +* Do not overwrite `updatetime` when `g:go_auto_sameids` or + `g:go_auto_type_info` is set. + [[GH-2529]](https://github.com/fatih/vim-go/pull/2529) +* Fix example for `g:go_debug_log_output` in docs. + [[GH-2547]](https://github.com/fatih/vim-go/pull/2547) +* Use FileChangedShellPost instead of FileChangedShell so that reload messages + are not hidden. + [[GH-2549]](https://github.com/fatih/vim-go/pull/2549) +* Restore cwd after `:GoTest` when `g:go_term_enabled` is set. + [[GH-2556]](https://github.com/fatih/vim-go/pull/2556) +* Expand struct variable correctly in the variables debug window. + [[GH-2574]](https://github.com/fatih/vim-go/pull/2574) +* Show output from errcheck when there are failures other than problems it can + report. + [[GH-2667]](https://github.com/fatih/vim-go/pull/2667) + +## v1.21 - (September 11, 2019) + +BACKWARDS INCOMPATIBILITIES: +* `g:go_metalinter_disabled` has been removed. + [[GH-2375]](https://github.com/fatih/vim-go/pull/2375) + +IMPROVEMENTS: +* Add a new option, `g:go_code_completion_enabled`, to control whether omnifunc + is set. + [[GH-2229]](https://github.com/fatih/vim-go/pull/2229) +* Use build tags with golangci-lint. + [[GH-2261]](https://github.com/fatih/vim-go/pull/2261) +* Allow debugging of packages outside of GOPATH without a go.mod file. + [[GH-2269]](https://github.com/fatih/vim-go/pull/2269) +* Show which example failed when Example tests fail + [[GH-2277]](https://github.com/fatih/vim-go/pull/2277) +* Show function signature and return types in preview window when autocompleting functions and methods. + [[GH-2289]](https://github.com/fatih/vim-go/pull/2289) +* Improve the user experience when using null modules. + [[GH-2300]](https://github.com/fatih/vim-go/pull/2300) +* Modify `:GoReportGitHubIssue` to include vim-go configuration values + [[GH-2323]](https://github.com/fatih/vim-go/pull/2323) +* Respect `g:go_info_mode='gopls'` in go#complete#GetInfo. + [[GH-2313]](https://github.com/fatih/vim-go/pull/2313) +* Allow `:GoLint`, `:GoErrCheck`, and `:GoDebug` to work in null modules. + [[GH-2335]](https://github.com/fatih/vim-go/pull/2335) +* Change default value for `g:go_info_mode` and `g:go_def_mode` to `'gopls'`. + [[GH-2329]](https://github.com/fatih/vim-go/pull/2329) +* Add a new option, `g:go_doc_popup_window` to optionally use a popup window + for godoc in Vim 8.1.1513 and later. + [[GH-2347]](https://github.com/fatih/vim-go/pull/2347) +* Add `:GoAddWorkspace` function to support multiple workspaces with gopls. + [[GH-2356]](https://github.com/fatih/vim-go/pull/2356) +* Install gopls from its stable package. + [[GH-2360]](https://github.com/fatih/vim-go/pull/2360) +* Disambiguate progress message when initializing gopls. + [[GH-2369]](https://github.com/fatih/vim-go/pull/2369) +* Calculate LSP position correctly when on a line that contains multi-byte + characters before the position. + [[GH-2389]](https://github.com/fatih/vim-go/pull/2389) +* Calculate Vim position correctly from LSP text position. + [[GH-2395]](https://github.com/fatih/vim-go/pull/2395) +* Use the statusline to display gopls initialization status messages and only + echo the statuses when `g:go_echo_command_info` is set. + [[GH-2422]](https://github.com/fatih/vim-go/pull/2422) +* Send configuration to gopls so that build tags will be considered and hover + content won't have documentation. + [[GH-2429]](https://github.com/fatih/vim-go/pull/2429) +* Add a new option, `g:go_term_close_on_exit`, to control whether jobs run in a + terminal window will close the terminal window when the job exits. + [[GH-2409]](https://github.com/fatih/vim-go/pull/2409) +* Allow `g:go_template_file` and `g:go_template_test_files` to reside outside + of vim-go's template directory. + [[GH-2434]](https://github.com/fatih/vim-go/pull/2434) +* Add a new command, `:GoLSPDebugBrowser`, to open a browser to gopls debugging + view. + [[GH-2436]](https://github.com/fatih/vim-go/pull/2436) +* Restart gopls automatically when it is updated via `:GoUpdateBinaries`. + [[GH-2453]](https://github.com/fatih/vim-go/pull/2453) +* Reset `'more'` while installing binaries to avoid unnecessary more prompts. + [[GH-2457]](https://github.com/fatih/vim-go/pull/2457) +* Highlight `%w` as a format specifier (for Go 1.13). + [[GH-2433]](https://github.com/fatih/vim-go/pull/2433) +* Handle changes to Go 1.13's go vet output that gometalinter isn't expecting. + [[GH-2475]](https://github.com/fatih/vim-go/pull/2475) +* Make `golangci-lint` the default value for `g:go_metalinter_command`. + [[GH-2478]](https://github.com/fatih/vim-go/pull/2478) +* Parse compiler errors from Go 1.13 `go vet` correctly. + [[GH-2485]](https://github.com/fatih/vim-go/pull/2485) + +BUG FIXES: +* display info about function and function types whose parameters are + `interface{}` without truncating the function signature. + [[GH-2244]](https://github.com/fatih/vim-go/pull/2244) +* install tools that require GOPATH mode when in module mode. + [[GH-2253]](https://github.com/fatih/vim-go/pull/2253) +* Detect GOPATH when starting `gopls` + [[GH-2255]](https://github.com/fatih/vim-go/pull/2255) +* Handle `gopls` responses in the same window from which the respective request + originated. + [[GH-2266]](https://github.com/fatih/vim-go/pull/2266) +* Show completion matches from gocode. + [[GH-2267]](https://github.com/fatih/vim-go/pull/2267) +* Show the completion preview window. + [[GH-2268]](https://github.com/fatih/vim-go/pull/2268) +* Set the anchor for method documentation correctly. + [[GH-2276]](https://github.com/fatih/vim-go/pull/2276) +* Respect the LSP information for determining where candidate matches start. + [[GH-2291]](https://github.com/fatih/vim-go/pull/2291) +* Restore environment variables with backslashes correctly. + [[GH-2292]](https://github.com/fatih/vim-go/pull/2292) +* Modify handling of gopls output for `:GoInfo` to ensure the value will be + displayed. + [[GH-2311]](https://github.com/fatih/vim-go/pull/2311) +* Run `:GoLint` successfully in null modules. + [[GH-2318]](https://github.com/fatih/vim-go/pull/2318) +* Ensure actions on save work in new buffers that have not yet been persisted to disk. + [[GH-2319]](https://github.com/fatih/vim-go/pull/2319) +* Restore population of information in `:GoReportGitHubIssue`. + [[GH-2312]](https://github.com/fatih/vim-go/pull/2312) +* Do not jump back to the originating window when jumping to definitions with + `g:go_def_mode='gopls'`. + [[GH-2327]](https://github.com/fatih/vim-go/pull/2327) +* Fix getting information about a valid identifier for which gopls returns no + information (e.g. calling `:GoInfo` on a package identifier). + [[GH-2339]](https://github.com/fatih/vim-go/pull/2339) +* Fix tab completion of package names on the cmdline in null modules. + [[GH-2342]](https://github.com/fatih/vim-go/pull/2342) +* Display identifier info correctly when the identifier has no godoc. + [[GH-2373]](https://github.com/fatih/vim-go/pull/2373) +* Fix false positives when saving a buffer and `g:go_metalinter_command` is + `golangci-lint`. + [[GH-2367]](https://github.com/fatih/vim-go/pull/2367) +* Fix `:GoDebugRestart`. + [[GH-2390]](https://github.com/fatih/vim-go/pull/2390) +* Do not execute tests twice in terminal mode. + [[GH-2397]](https://github.com/fatih/vim-go/pull/2397) +* Do not open a new buffer in Neovim when there are compilation errors and + terminal mode is enabled. + [[GH-2401]](https://github.com/fatih/vim-go/pull/2401) +* Fix error due to typo in implementation of `:GoAddWorkspace`. + [[GH-2415]](https://github.com/fatih/vim-go/pull/2401) +* Do not format the file automatically when `g:go_format_autosave` is set and + the file being written is not the current file. + [[GH-2442]](https://github.com/fatih/vim-go/pull/2442) +* Fix `go-debug-stepout` mapping. + [[GH-2464]](https://github.com/fatih/vim-go/pull/2464) +* Handle paths with spaces correctly when executing jobs. + [[GH-2472]](https://github.com/fatih/vim-go/pull/2472) +* Remove a space in the default value for `g:go_debug_log_output`, so that + Delve will start on Windows. + [[GH-2480]](https://github.com/fatih/vim-go/pull/2480) + +## 1.20 - (April 22, 2019) + +FEATURES: +* ***gopls support!*** + * use gopls for autocompletion by default in Vim8 and Neovim. + * use gopls for `:GoDef` by setting `g:go_def_mode='gopls'`. + * use gopls for `:GoInfo` by setting `g:go_info_mode='gopls'`. +* Add support for golangci-lint. + * set `g:go_metalinter_command='golangci-lint'` to use golangci-lint instead + of gometalinter. +* New `:GoDefType` command to jump to a type definition from an instance of the + type. + +BACKWARDS INCOMPATIBILITIES: +* `g:go_highlight_function_arguments` is renamed to `g:go_highlight_function_parameters` + [[GH-2117]](https://github.com/fatih/vim-go/pull/2117) + +IMPROVEMENTS: +* Disable `g:go_gocode_propose_source` by default. + [[GH-2050]](https://github.com/fatih/vim-go/pull/2050) +* Don't spam users when Vim is run with vi compatibility. + [[GH-2055]](https://github.com/fatih/vim-go/pull/2055) +* Add bang support to lint commands to allow them to be run without jumping to + errors. + [[GH-2056]](https://github.com/fatih/vim-go/pull/2056) +* Use `go doc` for `:GoDoc` instead of `godoc`. + [[GH-2070]](https://github.com/fatih/vim-go/pull/2070) +* Detach from and shutdown dlv correctly. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Do not require `'autowrite'` or `'autowriteall'` to be set when using + autocompletion in module mode. + [[GH-2091]](https://github.com/fatih/vim-go/pull/2091) +* Fix use of `g:go_metalinter_command` _and_ apply it even when autosaving. + [[GH-2101]](https://github.com/fatih/vim-go/pull/2101) +* Report errors in quickfix when Delve fails to start (e.g. compiler errors). + [[GH-2111]](https://github.com/fatih/vim-go/pull/2111) +* Support `'undo_ftplugin'`, make most autocmds buffer-local, and only do the + bare minimum based on file names alone. + [[GH-2108]](https://github.com/fatih/vim-go/pull/2108) +* Write a message when `:GoInfo` can't display any results when `g:go_info_mode='gocode'`. + [[GH-2122]](https://github.com/fatih/vim-go/pull/2122) +* Highlight fields followed by an operator when `g:go_highlight_fields` is set. + [[GH-1907]](https://github.com/fatih/vim-go/pull/1907) +* Skip autosave actions when the buffer is not a readable file. + [[GH-2143]](https://github.com/fatih/vim-go/pull/2143) +* Run `godef` from the current buffer's directory to make sure it works with modules. + [[GH-2150]](https://github.com/fatih/vim-go/pull/2150) +* Add a function, `go#tool#DescribeBalloon`, to show information in a balloon + with `'balloonexpr'`. (Vim8 only). + [[GH-1975]](https://github.com/fatih/vim-go/pull/1975) +* Add initial support for `gopls`. + [[GH-2163]](https://github.com/fatih/vim-go/pull/2163). +* Add `:GoDefType` to jump to the type definition of the identifier under the + cursor. + [[GH-2165]](https://github.com/fatih/vim-go/pull/2165) +* Notify gopls about changes. + [[GH-2171]](https://github.com/fatih/vim-go/pull/2171) +* Respect `g:go_jump_to_error` when running `gometalinter` automatically on + save. [[GH-2176]](https://github.com/fatih/vim-go/pull/2176) +* Use gopls for code completion by default in Vim8 and Neovim. + [[GH-2172]](https://github.com/fatih/vim-go/pull/2172) +* Add support for golangci-lint. + [[GH-2182]](https://github.com/fatih/vim-go/pull/2182) +* Show hover balloon using gopls instead of gocode. + [[GH-2202]](https://github.com/fatih/vim-go/pull/2202) +* Add a new option, `g:go_debug_log_output`, to control logging with the + debugger. + [[GH-2203]](https://github.com/fatih/vim-go/pull/2203) +* Do not jump to quickfix or location list window when bang is used for async + jobs or linting. + [[GH-2205]](https://github.com/fatih/vim-go/pull/2205) +* Tab complete package names for commands from vendor directories and in + modules. + [[GH-2213]](https://github.com/fatih/vim-go/pull/2213) +* Add support for `gopls` to `g:go_info_mode`. + [[GH-2224]](https://github.com/fatih/vim-go/pull/2224) + +BUG FIXES: +* Fix opening of non-existent file from `:GoDeclsDir` when the current + directory is not the directory containing the current buffer. + [[GH-2048]](https://github.com/fatih/vim-go/pull/2048) +* Fix jumping to an identifier with godef from a modified buffer. + [[GH-2054]](https://github.com/fatih/vim-go/pull/2054) +* Fix errors when `g:go_debug` contains `debugger-commands`. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Fix errors from `:GoDebugStop` in Neovim. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Fix `:GoSameIdsToggle`. + [[GH-2086]](https://github.com/fatih/vim-go/pull/2086) +* Do not set fileencoding or fileformat options or populate from template when + the buffer is not modifiable. + [[GH-2097]](https://github.com/fatih/vim-go/pull/2097) +* Do not clear buffer-local autocmds of other buffers. + [[GH-2109]](https://github.com/fatih/vim-go/pull/2109) +* Highlight return parameter types when g:go_highlight_function_arguments is + set. [[GH-2116]](https://github.com/fatih/vim-go/pull/2116) +* Fix lockup in Neovim when trying to run `:GoDebugTest` when there are no + tests. [[GH-2125]](https://github.com/fatih/vim-go/pull/2125) +* Keep track of breakpoints correctly when buffer is edited after breakpoints + are set. + [[GH-2126]](https://github.com/fatih/vim-go/pull/2126) +* Fix race conditions in `:GoDebugStop`. + [[GH-2127]](https://github.com/fatih/vim-go/pull/2127) +* Fix jumping to module or package using godef. + [[GH-2141]](https://github.com/fatih/vim-go/pull/2141) +* Fix errors caused by redefining functions within functions. + [[GH-2189]](https://github.com/fatih/vim-go/pull/2189) +* Highlight pre-release and metadata in versions in go.mod. + [[GH-2192]](https://github.com/fatih/vim-go/pull/2192) +* Handle runtime panics from `:GoRun` when using Neovim's terminal. + [[GH-2209]](https://github.com/fatih/vim-go/pull/2209) +* Fix adding tag option when a tag is added. + [[GH-2227]](https://github.com/fatih/vim-go/pull/2227) + +## 1.19 - (November 4, 2018) + +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) +* Document Vim and Neovim requirements in README.md and help file. + [[GH-1889]](https://github.com/fatih/vim-go/pull/1889) +* Highlight `context.Context` when `g:go_highlight_extra_types` is set. + [[GH-1903]](https://github.com/fatih/vim-go/pull/1903) +* Run gometalinter asynchronously in Neovim. + [[GH-1901]](https://github.com/fatih/vim-go/pull/1901) +* Run gorename asynchronously in Vim8 and Neovim. + [[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) +* Support the go-debugger features in Neovim. + [[GH-2007]](https://github.com/fatih/vim-go/pull/2007) +* color the statusline for termguicolors and Neovim. + [[GH-2014]](https://github.com/fatih/vim-go/pull/2014) +* add an option to disable highlighting of breakpoints and the current line + when debugging. + [[GH-2025]](https://github.com/fatih/vim-go/pull/2025) +* Update autocompletion to work with Go modules. + [[GH-1988]](https://github.com/fatih/vim-go/pull/1988) +* Add an option to search $GOPATH/bin or $GOBIN _after_ $PATH. + [[GH-2041]](https://github.com/fatih/vim-go/pull/2041) + +BUG FIXES: +* Fix `:GoRun %` on Windows. + [[GH-1900]](https://github.com/fatih/vim-go/pull/1900) +* Fix `go#complete#GetInfo()` to return a description of the identifier. + [[GH-1905]](https://github.com/fatih/vim-go/pull/1905) +* Restore support for running tests in the Neovim terminal. + [[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) +* Run shell commands with shellcmdflag set to `-c`. + [[GH-2006]](https://github.com/fatih/vim-go/pull/2006) +* Use the correct log output option for delve. + [[GH-1992]](https://github.com/fatih/vim-go/pull/1992) +* Pass empty arguments correctly in async jobs on Windows. + [[GH-2011]](https://github.com/fatih/vim-go/pull/2011) +* Don't close godoc scratch window when using arrow keys. + [[GH-2021]](https://github.com/fatih/vim-go/pull/2021) + +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) + +FEATURES: + +* Add **:GoIfErr** command together with the `(go-iferr)` plug key to + create a custom mapping. This command generates an `if err != nil { return ... }` + automatically which infer the type of return values and the numbers. + For example: + + ``` + func doSomething() (string, error) { + f, err := os.Open("file") + } + ``` + + Becomes: + + ``` + func doSomething() (string, error) { + f, err := os.Open("file") + if err != nil { + return "", err + } + } + ``` + +* Two new text objects has been added: + * `ic` (inner comment) selects the content of the comment, excluding the start/end markers (i.e: `//`, `/*`) + * `ac` (a comment) selects the content of the whole commment block, including markers + To use this new feature, make sure you use use the latest version of + [motion](https://github.com/fatih/motion). You can update the tool from Vim + via `:GoUpdateBinaries` + [[GH-1779]](https://github.com/fatih/vim-go/pull/1779) +* Add `:GoPointsTo` to show all variables to which the pointer under the cursor + may point to. + [[GH-1751]](https://github.com/fatih/vim-go/pull/1751) +* Add `:GoReportGitHubIssue` to initialize a new GitHub issue with as much data + that our template requests as possible. + [[GH-1738]](https://github.com/fatih/vim-go/pull/1738) + +IMPROVEMENTS: + +* Add build tags (with `g:go_build_tags`) to all commands that support it. + [[GH-1705]](https://github.com/fatih/vim-go/pull/1705) +* Some command which operate on files (rather than Vim buffers) will now show a + warning if there are unsaved buffers, similar to Vim's `:make`. + [[GH-1754]](https://github.com/fatih/vim-go/pull/1754) +* Don't return an error from `:GoGuru` functions when the import path is + unknown and scope is unneeded. + [[GH-1826]](https://github.com/fatih/vim-go/pull/1826) +* Performance improvements for the `go.vim` syntax file. + [[GH-1799]](https://github.com/fatih/vim-go/pull/1799) +* Allow `GoDebugBreakpoint` and `GoDebugCurrent` highlight groups to be + overridden by user configuration. + [[GH-1850]](https://github.com/vim-go/pull/1850) +* Strip trailing carriage returns from quickfix errors that are parsed + manually. [[GH-1861]](https://github.com/fatih/vim-go/pull/1861). +* Cleanup title of terminal window. + [[GH-1861]](https://github.com/fatih/vim-go/pull/1861). +* Add `:GoImpl` is able to complete interfaces by their full import path in + addition to the current package name (i.e: `:GoImpl t *T github.com/BurntSushi/toml.Unmarshaller` + is now possible) + [[GH-1884]](https://github.com/fatih/vim-go/pull/1884) + +BUG FIXES: + +* Update the correct window's location list after a long running async job + completes, even when the user changes their window layout while the job is + running. + [[GH-1734]](https://github.com/fatih/vim-go/pull/1734) +* Apply debugger mappings only for Go buffers, and not all buffers. + [[GH-1696]](https://github.com/fatih/vim-go/pull/1696) +* The `gohtmltmpl` filetype will now highlight `{{ .. }}` syntax HTML attributes + and some other locations. + [[GH-1790]](https://github.com/fatih/vim-go/pull/1790) +* Use the correct logging flag argument for delve. + [[GH-1809]](https://github.com/fatih/vim-go/pull/1809) +* Fix gocode option string values that would cause gocode settings not to set + correctly + [[GH-1818]](https://github.com/fatih/vim-go/pull/1818) +* Fix Neovim handling of guru output. + [[GH-1846]](https://github.com/fatih/vim-go/pull/1846) +* Execute commands correctly when they are in $GOBIN but not $PATH. + [[GH-1866]](https://github.com/fatih/vim-go/pull/1866) +* Open files correctly with ctrlp. + [[GH-1878]](https://github.com/fatih/vim-go/pull/1878) +* Fix checking guru binary path + [[GH-1886]](https://github.com/fatih/vim-go/pull/1886) +* Add build tags to `:GoDef` if only it's present + [[GH-1882]](https://github.com/fatih/vim-go/pull/1882) + +## 1.17 - (March 27, 2018) + +FEATURES: + +* **Debugger support!** Add integrated support for the + [`delve`](https://github.com/go-delve/delve) debugger. Use + `:GoInstallBinaries` to install `dlv`, and see `:help go-debug` to get + started. + [[GH-1390]](https://github.com/fatih/vim-go/pull/1390) + +IMPROVEMENTS: + +* Add descriptions to neosnippet abbrevations. + [[GH-1639]](https://github.com/fatih/vim-go/pull/1639) +* Show messages in the location list instead of the quickfix list when + `gometalinter` is run automatically when saving a buffer. Whether the + location list or quickfix list is used can be customized in the usual ways. + [[GH-1652]](https://github.com/fatih/vim-go/pull/1652) +* Redraw the screen before executing blocking calls to gocode. + [[GH-1671]](https://github.com/fatih/vim-go/pull/1671) +* Add `fe` -> `fmt.Errorf()` snippet for NeoSnippet and UltiSnippets. + [[GH-1677]](https://github.com/fatih/vim-go/pull/1677) +* Use the async api when calling guru from neovim. + [[GH-1678]](https://github.com/fatih/vim-go/pull/1678) +* Use the async api when calling gocode to get type info. + [[GH-1697]](https://github.com/fatih/vim-go/pull/1697) +* Cache import path lookups to improve responsiveness. + [[GH-1713]](https://github.com/fatih/vim-go/pull/1713) + +BUG FIXES: + +* Create quickfix list correctly when tests timeout. + [[GH-1633]](https://github.com/fatih/vim-go/pull/1633) +* Apply `g:go_test_timeout` when running `:GoTestFunc`. + [[GH-1631]](https://github.com/fatih/vim-go/pull/1631) +* The user's configured `g:go_doc_url` variable wasn't working correctly in the + case when the "gogetdoc" command isn't installed. + [[GH-1629]](https://github.com/fatih/vim-go/pull/1629) +* Highlight format specifiers with an index (e.g. `%[2]d`). + [[GH-1634]](https://github.com/fatih/vim-go/pull/1634) +* Respect `g:go_test_show_name` change for `:GoTest` when it changes during a + Vim session. + [[GH-1641]](https://github.com/fatih/vim-go/pull/1641) +* Show `g:go_test_show_name` value for `:GoTest` failures if it's available. + [[GH-1641]](https://github.com/fatih/vim-go/pull/1641) +* Make sure linter errors for the file being saved are shown in vim74 and nvim. + [[GH-1640]](https://github.com/fatih/vim-go/pull/1640) +* Make sure only linter errors for the file being saved are shown in vim8. + Previously, all linter errors for all files in the current file's directory + were being shown. + [[GH-1640]](https://github.com/fatih/vim-go/pull/1640) +* Make sure gometalinter is run on the given directories when arguments are + given to :GoMetaLinter. + [[GH-1640]](https://github.com/fatih/vim-go/pull/1640) +* Do not run disabled linters with `gometalinter`. + [[GH-1648]](https://github.com/fatih/vim-go/pull/1648) +* Do not prompt user to press enter after when `gometalinter` is called in + autosave mode. + [[GH-1654]](https://github.com/fatih/vim-go/pull/1654) +* Fix potential race conditions when using vim8 jobs. + [[GH-1656]](https://github.com/fatih/vim-go/pull/1656) +* Treat `'autowriteall'` the same as `'autowrite'` when determining whether to + write a buffer before calling some commands. + [[GH-1653]](https://github.com/fatih/vim-go/pull/1653) +* Show the file location of test errors when the message is empty or begins + with a newline. + [[GH-1664]](https://github.com/fatih/vim-go/pull/1664) +* Fix minisnip on Windows. + [[GH-1698]](https://github.com/fatih/vim-go/pull/1698) +* Keep alternate filename when loading an autocreate template. + [[GH-1675]](https://github.com/fatih/vim-go/pull/1675) +* Parse the column number in errors correctly in vim8 and neovim. + [[GH-1716]](https://github.com/fatih/vim-go/pull/1716) +* Fix race conditions in the terminal handling for neovim. + [[GH-1721]](https://github.com/fatih/vim-go/pull/1721) +* Put the user back in the original window regardless of the value of + `splitright` after starting a neovim terminal window. + [[GH-1725]](https://github.com/fatih/vim-go/pull/1725) + +BACKWARDS INCOMPATIBILITIES: + +* Highlighting function and method declarations/calls is fixed. To fix it we + had to remove the meaning of the previous settings. The following setting is + removed: + + * `go_highlight_methods` + + in favor of the following settings and changes: + + * `go_highlight_functions`: This highlights now all function and method + declarations (whereas previously it would also highlight function and + method calls, not anymore) + * `go_highlight_function_calls`: This higlights now all all function and + method calls. + [[GH-1557]](https://github.com/fatih/vim-go/pull/1557) +* Rename g`g:go_metalinter_excludes` to `g:go_metalinter_disabled`. + [[GH-1648]](https://github.com/fatih/vim-go/pull/1648) +* `:GoBuild` doesn't append the `-i` flag anymore due the recent Go 1.10 + changes that introduced a build cache. + [[GH-1701]](https://github.com/fatih/vim-go/pull/1701) + +## 1.16 - (December 29, 2017) + +FEATURES: + +* Add `g:go_doc_url` to change the `godoc` server from `godoc.org` to a custom + private instance. Currently only `godoc -http` instances are supported. + [[GH-1957]](https://github.com/fatih/vim-go/pull/1957). +* New setting `g:go_test_prepend_name` (off by default) to add the failing test + name to the output of `:GoTest` + [[GH-1578]](https://github.com/fatih/vim-go/pull/1578). +* Support [denite.vim](https://github.com/Shougo/denite.nvim) for `:GoDecls[Dir]` + [[GH-1604]](https://github.com/fatih/vim-go/pull/1604). + +IMPROVEMENTS: + +* `:GoRename` is a bit smarter when automatically pre-filling values, and what + gets pre-filled can be configured with `g:go_gorename_prefill` option. + In addition `:GoRename ` now lists some common options. + [[GH-1465]](https://github.com/fatih/vim-go/pull/1465). +* Add support for `g:go_build_tags` to the `:GoTest` family of functions. + [[GH-1562]](https://github.com/fatih/vim-go/pull/1562). +* Pass `--tests` to gometalinter when autosaving and when a custom gometalinter + command has not been set. + [[GH-1563]](https://github.com/fatih/vim-go/pull/1563). +* Do not spam messages when command is run in a directory that does not exist. + [[GH-1527]](https://github.com/fatih/vim-go/pull/1527). +* Run `syntax sync fromstart` after `:GoFmt`; this should make syntax + highlighting break slightly less often after formatting code + [[GH-1582]](https://github.com/fatih/vim-go/pull/1582). +* `:GoDescribe` doesn't require a scope anymore + [[GH-1596]](https://github.com/fatih/vim-go/pull/1596). +* Add some standard snippets for + [vim-minisnip](https://github.com/joereynolds/vim-minisnip) + [[GH-1589]](https://github.com/fatih/vim-go/pull/1589). +* `g:go_snippet_engine` now defaults to `automatic` to use the first installed + snippet engine it can find. + [[GH-1589]](https://github.com/fatih/vim-go/pull/1589). +* Make sure temporary files created for `:GoFmt` end with `.go` suffix as this + is required by some Go formatting tools + [[GH-1601]](https://github.com/fatih/vim-go/pull/1601). + +BUG FIXES: + +* Fix compatibility with Vim version before 7.4.1546 + [[GH-1498]](https://github.com/fatih/vim-go/pull/1498). +* Don't resize godoc window if it's already visible + [[GH-1488]](https://github.com/fatih/vim-go/pull/1488). +* `:GoTestCompile` produces a test binary again. The test binary will be + written to a temporary directory to avoid polluting the user's working + directory. [[GH-1519]](https://github.com/fatih/vim-go/pull/1519) +* Fix incorrect `:GoSameIdsToggle` behavior when there were match groups + present, but none were goSameId. + [[GH-1538]](https://github.com/fatih/vim-go/pull/1538) +* Fix `gpl` snippet for UltiSnips. + [[GH-1535]](https://github.com/fatih/vim-go/pull/1535) +* Fix test output processing to correctly handle panics and log statements. + [[GH-1513]](https://github.com/fatih/vim-go/pull/1513) +* `:GoImpl` tab-completion would sometimes stop working + [[GH-1581]](https://github.com/fatih/vim-go/pull/1581). +* Add `g:go_highlight_function_arguments` to highlight function arguments. + [[GH-1587]](https://github.com/fatih/vim-go/pull/1587). +* Fix installation of `gocode` on MS-Windows. + [[GH-1606]](https://github.com/fatih/vim-go/pull/1606). +* Fix template creation for files in directories that don't exist yet. + [[GH-1618]](https://github.com/fatih/vim-go/pull/1618). +* Fix behavior of terminal windows and resize terminal windows correctly for + all valid `g:go_term_mode` values. + [[GH-1611]](https://github.com/fatih/vim-go/pull/1611). + +BACKWARDS INCOMPATIBILITIES: + +* Display a warning for Vim versions older than 7.4.1689. Older versions may + still work, but are not supported. You can use `let g:go_version_warning = 0` + to disable the warning. + [[GH-1524]](https://github.com/fatih/vim-go/pull/1524). +* `g:go_autodetect_gopath` is *disabled* by default, as support for `vendor` has + been in Go for a while.
+ Also change the implementation for `g:go_autodetect_gopath`; instead of manually + setting it before every command it will now be set with the `BufEnter` event, + and reset with the `BufLeave` event. This means that `$GOPATH` will be + changed for all commands run from Vim. + [[GH-1461]](https://github.com/fatih/vim-go/pull/1461) and + [[GH-1525]](https://github.com/fatih/vim-go/pull/1525). +* Update `:GoFillStruct` to check the current line (vs. the exact cursor + position) for a struct literal to fill. To support this, fillstruct made + [backwards imcompatible + changes](https://github.com/davidrjenni/reftools/pull/8). + [[GH-1607]](https://github.com/fatih/vim-go/pull/1607). + +## 1.15 - (October 3, 2017) + +FEATURES: + +* Add `:GoFillStruct` to fill a struct with all fields; uses + [`fillstruct`](https://github.com/davidrjenni/reftools/tree/master/cmd/fillstruct) + [[GH-1443]](https://github.com/fatih/vim-go/pull/1443). + +IMPROVEMENTS: + +* `:GoAddTags` and `:GoRemoveTags` now continue to process if there are + malformed individual struct tags (run `:GoUpdateBinaries` to update + `gomodifiytags` binary) [[GH-1401]](https://github.com/fatih/vim-go/pull/1401) +* `:GoAddTags` and `:GoRemoveTags` now shows a location list if there are + malformed struct tags (run `:GoUpdateBinaries` to update `gomodifiytags` + binary) [[GH-1401]](https://github.com/fatih/vim-go/pull/1401) +* Add folding of the package-level comment (enabled by default) and/or any + other comments (disabled by default) [[GH-1377]](https://github.com/fatih/vim-go/pull/1377). + [[GH-1428]](https://github.com/fatih/vim-go/pull/1428). +* Allow using :GoImpl on the type and struct parts too. Makes it a wee bit + easier to use [[GH-1386]](https://github.com/fatih/vim-go/pull/1386) +* `:GoDef` sets the path of new buffers as relative to the current directory + when appropriate, instead of always using the full path [[GH-1277]](https://github.com/fatih/vim-go/pull/1277). +* Syntax highlighting for variable declarations and assignments (disabled by default) + [[GH-1426]](https://github.com/fatih/vim-go/pull/1426) and + [[GH-1458]](https://github.com/fatih/vim-go/pull/1458). +* Add support for `:GoDecls[Dir]` in [unite.vim](https://github.com/Shougo/unite.vim) + [[GH-1391]](https://github.com/fatih/vim-go/pull/1391). +* Add support for [fzf.vim](https://github.com/junegunn/fzf.vim) in + `GoDecls[Dir]`. + [[GH-1437]](https://github.com/fatih/vim-go/pull/1437). +* Support relative imports for `:GoImpl` [[GH-1322]](https://github.com/fatih/vim-go/pull/1322). +* A new `g:go_list_type_commands` setting is added to individually set the list type for each command [[GH-1415]](https://github.com/fatih/vim-go/pull/1415). As en example: + + let g:go_list_type_commands = {"GoBuild": "quickfix", "GoTest": "locationlist"} +* Show unexpected errors better by expanding newlines and tabs + [[GH-1456]](https://github.com/fatih/vim-go/pull/1456). +* `:GoInstallBinaries` and `:GoUpdateBinaries` can now install/update only the + selected binaries (e.g. `:GoUpdateBinaries guru golint`) + [[GH-1467]](https://github.com/fatih/vim-go/pull/1467). + +BUG FIXES: + +* `:GoFmt` now (again) uses `locationlist` to show formatting errors instead of + `quickfix`. To change back to `locationlist` you can change it with the + setting `let g:go_list_type_commands = { "GoFmt": locationlist" }` [[GH-1415]](https://github.com/fatih/vim-go/pull/1415) +* Include comments in import block when folding is enabled [[GH-1387]](https://github.com/fatih/vim-go/pull/1387) +* Fix opening definitions in tabs [[GH-1400]](https://github.com/fatih/vim-go/pull/1400) +* Fix accidentally closing quickfix window from other commands if :GoFmt or autosave format was called [[GH-1407]](https://github.com/fatih/vim-go/pull/1407) +* Fix entering into insert mode after for term mode in nvim [[GH-1411]](https://github.com/fatih/vim-go/pull/1411) +* When using :GoImpl on type foo struct{} it would work, but with: + + type foo struct{ + } + + or with a struct with fields, it would create the generated methods inside the + struct [[GH-1386]](https://github.com/fatih/vim-go/pull/1386) +* `:GoImpl` output would include extra newline, and error would include + trailing newline from shell command: `vim-go: invalid receiver: "} *}"<00>`. + Fixed with [[GH-1386]](https://github.com/fatih/vim-go/pull/1386) +* Run `:GoMetaLinter` against the package of the open file [[GH-1414]](https://github.com/fatih/vim-go/pull/1414). +* The `g:go_doc_command` and `g:go_doc_options` to configure the command for + `:GoDoc` were documented but never referenced [[GH-1420]](https://github.com/fatih/vim-go/pull/1420). +* `go#package#FromPath()` didn't work correctly [[GH-1435]](https://github.com/fatih/vim-go/pull/1435). +* Fix race condition for `guru` based commands [[GH-1439]](https://github.com/fatih/vim-go/pull/1439). +* The `gohtmltmpl` filetype now sources the `html` ftplugin, so that `matchit`, + completion, and some other things work better. + [[GH-1442]](https://github.com/fatih/vim-go/pull/1442) +* Fix `:GoBuild` shell escaping [[GH-1450]](https://github.com/fatih/vim-go/pull/1450). +* Ensure fmt list gets closed when title cannot be checked [[GH-1474]](https://github.com/fatih/vim-go/pull/1474). + +BACKWARDS INCOMPATIBILITIES: + +* `:GoMetaLinter` now runs against the package of the open file instead of the + current working directory. This is so all commands behave the same relative + to the current open buffer. [[GH-1414]](https://github.com/fatih/vim-go/pull/1414) + +* `:GoImpl` now requires [`impl`](https://github.com/josharian/impl) version + 3fb19c2c or newer (released June 13, 2017); use `:GoUpdateBinaries` to make + sure that you've got a recent version [[GH-1322]](https://github.com/fatih/vim-go/pull/1322) + +## 1.14 - (August 6, 2017) + +FEATURES: + +* We now have folding support based on Go syntax. To enable it you have to set + the following Vim setting: `set foldmethod=syntax`. Currently it folds blocks + (`{ }`), `import`, `var`, and `const` blocks, and package-level comments. + These can be individually disabled/enabled if desired. For more info please + read the documentation for the `g:go_fold_enable` setting. [[GH-1339]](https://github.com/fatih/vim-go/pull/1339) + [[GH-1377]](https://github.com/fatih/vim-go/pull/1377) +* `:GoFiles` accepts now an argument to change the type of files it can show. + By default it shows`.go source files` but now it can be changed to show + various kind of files. The full list can be seen via `go list --help` under + the `// Source Files` section [[GH-1372]](https://github.com/fatih/vim-go/pull/1372) i.e: + +``` +:GoFiles CgoFiles // shows .go sources files that import "C" +:GoFiles TestGoFiles // shows _test.go files in package +:GoFiles IgnoredGoFiles // shows .go sources ignored due to build constraints +etc.. +``` + +IMPROVEMENTS + +* Files created with `_test.go` extension have a new template with a ready to + go test function. The template can be changed with the + `g:go_template_test_file` setting. [[GH-1318]](https://github.com/fatih/vim-go/pull/1318) +* Improve performance for highly used operations by caching `go env` calls [[GH-1320]](https://github.com/fatih/vim-go/pull/1320) +* `:GoCoverage` can accept arguments now. i.e: `:GoCoverage -run TestFoo` [[GH-1326]](https://github.com/fatih/vim-go/pull/1326) +* `:GoDecls` and `:GoDeclsDir` shows a warning if [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim) is not installed +* `:GoBuild` now compiles the package with the `-i` flag added. This means that subsequent calls are much more faster due caching of packages [[GH-1330]](https://github.com/fatih/vim-go/pull/1330) +* `:GoCoverage` echos now the progress if `g:go_echo_command_info` is enabled [[GH-1333]](https://github.com/fatih/vim-go/pull/1333) +* Add `g:go_doc_max_height` setting to control the maximum height of the window created by `:GoDoc` and `K` mapping [[GH-1335]](https://github.com/fatih/vim-go/pull/1335) +* The `af` text object is able to include the assignment variable for anonymous functions. Can be disabled with `g:go_textobj_include_variable = 0` [[GH-1345]](https://github.com/fatih/vim-go/pull/1345) +* Add `g:go_list_autoclose` setting to prevent closing the quickfix/location list after zero items [[GH-1361]](https://github.com/fatih/vim-go/pull/1361) +* Cursor is now adjusted and locked to the correct line when `goimports` is used for autosave [[GH-1367]](https://github.com/fatih/vim-go/pull/1367) +* Complement the path of command for different situations of Cygwin environment [[GH-1394]](https://github.com/fatih/vim-go/pull/1394) +* Show message when using :GoDef and opening a new buffer [[GH-1385]](https://github.com/fatih/vim-go/pull/1385) + + +BUG FIXES: + +* Fix obtaining package's import path for the current directory. This fixes some issues we had if the user was using multiple GOPATH's [[GH-1321]](https://github.com/fatih/vim-go/pull/1321) +* Fix documentation for vim-go & syntastic integration for errcheck using [[GH-1323]](https://github.com/fatih/vim-go/pull/1323) +* Fix showing an output if a test has finished when `:GoTest` is called [[GH-1327]](https://github.com/fatih/vim-go/pull/1327) +* Fix warning when goimports doesn't support srcdir [[GH-1344]](https://github.com/fatih/vim-go/pull/1344) +* Fix broken code folding with go_highlight_types [[GH-1338]](https://github.com/fatih/vim-go/pull/1338) +* Fix blocking the ui when swapfile is enabled and `:GoFmt` is called (either manually or via autosave) [[GH-1362]](https://github.com/fatih/vim-go/pull/1362) +* Fix getting bin paths for binaries if GOPATH was not set and Go version =>1.7 was used [[GH-1363]](https://github.com/fatih/vim-go/pull/1363) +* Fix picking up the correct list type for showing `:GoFmt` errors [[GH-1365]](https://github.com/fatih/vim-go/pull/1365) +* Fix auto detecting of GOPATH for import paths with string 'src' (i.e: `GOPATH/src/github.com/foo/src/bar`) [[GH-1366]](https://github.com/fatih/vim-go/pull/1366) +* Fix showing an empty window if `gogetdoc` was not found [[GH-1379]](https://github.com/fatih/vim-go/pull/1379) +* Fix commands not being executed if paths would include spaces (binary name, GOPATH, file itself, etc..) [[GH-1374]](https://github.com/fatih/vim-go/pull/1374) +* Fix showing correct message when editing a new file [[GH-1371]](https://github.com/fatih/vim-go/pull/1371) +* Fix filepaths in the quickfix list for :GoVet [[GH-1381]](https://github.com/fatih/vim-go/pull/1381) +* Run :GoLint against the package of the open file [[GH-1382]](https://github.com/fatih/vim-go/pull/1382) + +BACKWARDS INCOMPATIBILITIES: + +* `:GoFmt` now uses `quickfix` to show formatting errors instead of + `locationlist`. To change back to `locationlist` you can change it with the + setting `let g:go_list_type = "locationlist"` [[GH-1365]](https://github.com/fatih/vim-go/pull/1365) +* `:GoLint` now runs against the package of the open file instead of the + current working directory. This is so all commands behave the same relative + to the current open buffer. For more info check the [comment + here](https://github.com/fatih/vim-go/issues/1375#issuecomment-317535953) + [[GH-1382]](https://github.com/fatih/vim-go/pull/1382) + +## 1.13 - (June 6, 2017) + +FEATURES: + +* New `:GoKeyify` command that turns unkeyed struct literals into keyed struct literals. [[GH-1258]](https://github.com/fatih/vim-go/pull/1258). i.e: + +``` +Example{"foo", "bar", "qux"} +``` + +will be converted to: + +``` +Example{ + foo: "foo", + bar: "bar", + qux: "qux", +} +``` + +Checkout the demo here: https://twitter.com/fatih/status/860410299714764802 + + +* New `g:go_addtags_transform` setting to change the transform rule (snakecase, camelcase, etc..) for `:GoAddTags` command [[GH-1275]](https://github.com/fatih/vim-go/pull/1275) +* New snippet shortcut assigned to `ife` that expands to `if err := foo(); err != nil { ... }` [[GH-1268]](https://github.com/fatih/vim-go/pull/1268) + +IMPROVEMENTS + +* :GoMetaLinter can now exclude linters with the new `g:go_metalinter_excludes` option [[GH-1253]](https://github.com/fatih/vim-go/pull/1253) +* Override `` mapping so `:GoDef` is used by default (as we do the same for `CTRL-]`, `gd`, etc. [[GH-1264]](https://github.com/fatih/vim-go/pull/1264) +* add support for `go_list_type` setting in `:GoFmt` and `:GoImports` commands [[GH-1304]](https://github.com/fatih/vim-go/pull/1304) +* add support for `go_list_type` setting in `:GoMetaLinter` commands [[GH-1309]](https://github.com/fatih/vim-go/pull/1309) +* `go_fmt_options` can be now a dictionary to allow us to specifcy the + options for multiple binaries [[GH-1308]](https://github.com/fatih/vim-go/pull/1308). i.e: + +``` + let g:go_fmt_options = { + \ 'gofmt': '-s', + \ 'goimports': '-local mycompany.com', + \ } +``` +* If win-vim(x64) with Cygwin is used, `cygpath` is used for constructing the paths [[GH-1092]](https://github.com/fatih/vim-go/pull/1092) + +BUG FIXES: + +* job: fix race between channel close and job exit [[GH-1247]](https://github.com/fatih/vim-go/pull/1247) +* internal: fix system calls when using tcsh [[GH-1276]](https://github.com/fatih/vim-go/pull/1276) +* path: return the unmodified GOPATH if autodetect is disabled [[GH-1280]](https://github.com/fatih/vim-go/pull/1280) +* fix jumping to quickfix window when autom gometalinter on save was enabled [[GH-1293]](https://github.com/fatih/vim-go/pull/1293) +* fix highlighting for `interface` and `structs` words when `go_highlight_types` is enabled [[GH-1301]](https://github.com/fatih/vim-go/pull/1301) +* fix cwd for running `:GoRun` when used with neovim [[GH-1296]](https://github.com/fatih/vim-go/pull/1296) +* `:GoFmt` handles files that are symlinked into GOPATH better (note that this behaviour is discouraged, but we're trying our best to handle all edge case :)) [[GH-1310]](https://github.com/fatih/vim-go/pull/1310) +* `:GoTest` is able to parse error messages that include a colon `:` [[GH-1316]](https://github.com/fatih/vim-go/pull/1316) +* `:GoTestCompile` under the hood doesn't produces a test binary anymore. Sometimes a race condition would happen which would not delete the test binary. [[GH-1317]](https://github.com/fatih/vim-go/pull/1317) +* `:GoDef` jumps now to definition for build tags defined with `:GoBuildTags` (only guru) [[GH-1319]](https://github.com/fatih/vim-go/pull/1319) + +BACKWARDS INCOMPATIBILITIES: + +* `:GoLint` works on the whole directory instead of the current file. To use it for the current file give it as an argument, i.e `:GoLint foo.go` [[GH-1295]](https://github.com/fatih/vim-go/pull/1295) +* `go_snippet_case_type` is removed in favor of the new `go_addtags_transform` setting [[GH-1299]](https://github.com/fatih/vim-go/pull/1299) +* `go_imports_bin` is removed to avoid confusion as it would lead to race + conditions when set to `gofmt` along with the usage of `go_fmt_command` + [[GH-1212]](https://github.com/fatih/vim-go/pull/1212) [[GH-1308]](https://github.com/fatih/vim-go/pull/1308) +* commands such as `:GoTest` has been refactored for easy maintainability. If + you use any custom script that was using the function `go#cmd#Test`, it + should be renamed to `go#test#Test` + +## 1.12 - (March 29, 2017) + +FEATURES: + +* New `:GoAddTags` and `:GoRemoveTags` command based on the tool + [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old + bugs that were due prior regexp based implementation. For the usage please + read the docs and checkout the demo at: + https://github.com/fatih/vim-go/pull/1204 [[GH-1204]](https://github.com/fatih/vim-go/pull/1204) +* Add new `errl` snippet that expands to [[GH-1185]](https://github.com/fatih/vim-go/pull/1185): + +``` +if err != nil { + log.Fatal(err) +} +``` +* New `:GoBuildTags` command to change build tags for tools such as `guru`, + `gorename`, etc ... There is also a new setting called `g:go_build_tags` + [[GH-1232]](https://github.com/fatih/vim-go/pull/1232) + +IMPROVEMENTS: + +* vim-go works now even if GOPATH is not set (starting with Go 1.8) [[GH-1248]](https://github.com/fatih/vim-go/pull/1248) +* Lowercase `` in mappings examples for consistent documentation across the README [[GH-1192]](https://github.com/fatih/vim-go/pull/1192) +* All of files should be written in utf-8 if the file will be passed to external command. [[GH-1184]](https://github.com/fatih/vim-go/pull/1184) +* `:GoAddTags` is now able to add options to existing tags with the syntax + `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [[GH-985]](https://github.com/fatih/vim-go/pull/985) +* Document 'noshowmode' requirement for echo_go_info [[GH-1197]](https://github.com/fatih/vim-go/pull/1197) +* Improve godoc view for vertical splits [[GH-1195]](https://github.com/fatih/vim-go/pull/1195) +* Set GOPATH for both possible go guru execution paths (sync and async) [[GH-1193]](https://github.com/fatih/vim-go/pull/1193) +* Improve docs for :GoDef usage [[GH-1242]](https://github.com/fatih/vim-go/pull/1242) +* Highlight trimming syntax for Go templates [[GH-1235]](https://github.com/fatih/vim-go/pull/1235) + +BUG FIXES: + +* Honor `g:go_echo_command_info` when dispatching builds in neovim [[GH-1176]](https://github.com/fatih/vim-go/pull/1176) +* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function + signatures (`s:on_stdout`, `s:on_stderr`)[[GH-1176]](https://github.com/fatih/vim-go/pull/1176) +* Update statusline before and after `go#jobcontrol#Spawn` command is executed [[GH-1176]](https://github.com/fatih/vim-go/pull/1176) +* Correctly report the value of the 'g:go_guru_tags' variable [[GH-1177]](https://github.com/fatih/vim-go/pull/1177) +* Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [[GH-1194]](https://github.com/fatih/vim-go/pull/1194) +* Fix `:GoAddTags` to allow modifying existing comments [[GH-984]](https://github.com/fatih/vim-go/pull/984) +* Fix `:GoAddTags` to work with nested structs [[GH-990]](https://github.com/fatih/vim-go/pull/990) +* Fix `:GoAddTags` adding tags twice for existing tags [[GH-1064]](https://github.com/fatih/vim-go/pull/1064) +* Fix `:GoAddTags` not working for fields of types `interface{}` [[GH-1091]](https://github.com/fatih/vim-go/pull/1091) +* Fix `:GoAddTags` not working for fields with one line comments [[GH-1181]](https://github.com/fatih/vim-go/pull/1181) +* Fix `:GoAddTags` not working if any field comment would contain `{}` [[GH-1189]](https://github.com/fatih/vim-go/pull/1189) +* Respect go_fmt_options when running goimports [[GH-1211]](https://github.com/fatih/vim-go/pull/1211) +* Set the filename in the location-list when there is an error with :GoFmt [[GH-1199]](https://github.com/fatih/vim-go/pull/1199) +* Fix `:GoInstall` to accept additional arguments if async mode was enabled [[GH-1246]](https://github.com/fatih/vim-go/pull/1246) + +BACKWARDS INCOMPATIBILITIES: + +* The command `:GoGuruTags` is removed in favour of the new command + `:GoBuildTags`. This command will be used now not just for `guru`, also for + all new commands such as `gorename` [[GH-1232]](https://github.com/fatih/vim-go/pull/1232) +* The setting `g:go_guru_tags` is removed in favour of the new setting + `g:go_build_tags` [[GH-1232]](https://github.com/fatih/vim-go/pull/1232) + + +## 1.11 - (January 9, 2017) + +FEATURES: + +* Travis test integration has been added. Now any file that is added as + `_test.vim` will be automatically tested in for every Pull Request + (just like how we add tests to Go with `_test.go`). Going forward this will + tremendously increase the stability and decrease the maintenance burden of + vim-go. [[GH-1157]](https://github.com/fatih/vim-go/pull/1157) +* Add new `g:go_updatetime` setting to change the default updatetime (which was hardcoded previously) [[GH-1055]](https://github.com/fatih/vim-go/pull/1055) +* Add new `g:go_template_use_pkg` setting to enable to use cwd as package name instead of basic template file [[GH-1124]](https://github.com/fatih/vim-go/pull/1124) + +IMPROVEMENTS: + +* Add `statusline` support for `:GoMetaLinter` [[GH-1120]](https://github.com/fatih/vim-go/pull/1120) +* Quickfix and Location lists contain now a descriptive title (requires at least Vim `7.4.2200`)[[GH-1004]](https://github.com/fatih/vim-go/pull/1004) +* Check `go env GOPATH` as well for `:GoInstallBinaries` as Go has now a default path for GOPATH ("~/go")starting with 1.8 [[GH-1152]](https://github.com/fatih/vim-go/pull/1152) +* `:GoDocBrowser` now also works on import paths [[GH-1174]](https://github.com/fatih/vim-go/pull/1174) + +BUG FIXES: + +* Always use full path to detect packages to be shown in statusline [[GH-1121]](https://github.com/fatih/vim-go/pull/1121) +* Use `echom` to persist errors in case of multiple echos [[GH-1122]](https://github.com/fatih/vim-go/pull/1122) +* Fix a race condition where a quickfix window was not closed if a job has succeeded [[GH-1123]](https://github.com/fatih/vim-go/pull/1123) +* Do not expand coverage arguments for non job execution of `:GoCoverage` [[GH-1127]](https://github.com/fatih/vim-go/pull/1127) +* `:GoCoverage` doesn't mess up custom syntax anymore [[GH-1128]](https://github.com/fatih/vim-go/pull/1128) +* Disable autoformat for `asm` files as they might be non Go ASM format [[GH-1141]](https://github.com/fatih/vim-go/pull/1141) +* Fix indentation broken when using a action with a minus sign like `{{-` [[GH-1143]](https://github.com/fatih/vim-go/pull/1143) +* Fix breaking Neovim change of passing less arguments to callbacks [[GH-1145]](https://github.com/fatih/vim-go/pull/1145) +* Fix `guru` commands if custom build tags were set [[GH-1136]](https://github.com/fatih/vim-go/pull/1136) +* Fix referencing a non defined variable for async commands when bang (!) was used +* Fix `:GoDef` failing for a modified buffer if `hidden` was not set [[GH-1132]](https://github.com/fatih/vim-go/pull/1132) +* Fix `:GoDefStack` to allow popping from jump list when buffer is modified [[GH-1133]](https://github.com/fatih/vim-go/pull/1133) +* Improve internal defining of functions and referencing them for async operations [[GH-1155]](https://github.com/fatih/vim-go/pull/1155) +* Fix `:GoMetaLinter` failing if `go_metalinter_command` is set. [[GH-1160]](https://github.com/fatih/vim-go/pull/1160) +* Fix `:GoMetaLinter`'s `go_metalinter_deadline` setting for async mode [[GH-1146]](https://github.com/fatih/vim-go/pull/1146) + +BACKWARDS INCOMPATIBILITIES: + +* The following syntax options are now disabled by default. If you're using them be sure to set them in your .vimrc [[GH-1167]](https://github.com/fatih/vim-go/pull/1167) + +```viml +g:go_highlight_array_whitespace_error +g:go_highlight_chan_whitespace_error +g:go_highlight_extra_types +g:go_highlight_space_tab_error +g:go_highlight_trailing_whitespace_error +``` + + + +## 1.10 (November 24, 2016) + +FEATURES: + +* **Vim 8.0 support!** This is the initial version to add Vim 8.0 based support to + all basic commands (check out below for more information). With time we'll + going to extend it to other commands. All the features are only enabled if + you have at least Vim 8.0.0087. Backwards compatible with Vim 7.4.x. + If you see any problems, please open an issue. + +* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this. +* `:GoBuild`, `:GoTest`, `:GoTestCompile`, `:GoInstall` commands are now fully + async. Async means it doesn't block your UI anymore. If the command finished + it echoes the status. For a better experience use the statusline information + (more info below) + +* `:GoCoverage` and `:GoCoverageBrowser` commands are fully async. +* `:GoDef` is fully async if `guru` is used as command. +* `:GoRename` is fully async . + +* `:GoMetaLinter` is fully asnyc. Also works with the current autosave linting + feature. As a reminder, to enable auto linting on save either call + `:GoMetaLinterAutoSaveToggle` (temporary) or add `let + g:go_metalinter_autosave = 1` (persistent) to your virmc). + +* All `guru` commands run asynchronously if Vim 8.0 is being used. Current + Commands: + * GoImplements + * GoWhicherrs + * GoCallees + * GoDescribe + * GoCallers + * GoCallstack + * GoFreevars + * GoChannelPeers + * GoReferrers + +* `:GoSameIds` also runs asynchronously. This makes it useful especially for + auto sameids mode. In this mode it constantly evaluates the identifier under the + cursor whenever it's in hold position and then calls :GoSameIds. As a + reminder, to enable auto info either call `:GoSameIdsAutoToggle`(temporary) + or add `let g:go_auto_sameids = 1` (persistent) to your vimrc. + +* `:GoInfo` is now non blocking and works in async mode if `guru` is used in + `g:go_info_mode`. This makes it useful especially for autoinfo mode. In this + mode it constantly evaluates the identifier under the cursor whenever it's in + hold position and then calls :GoInfo. As a reminder, to enable auto info + either call `:GoAutoTypeInfoToggle`(temporary) or add `let + g:go_auto_type_info = 1` (persistent) to your vimrc. To use `guru` instead of + `gocode` add following to your vimrc: `let g:go_info_mode = 'guru'` + + The `guru` is more accurate and reliabed due the usage of `guru` describe. It + doesn't rely on `pkg/` folder like `gocode` does. However it's slower than + `gocode` as there is no caching mechanism in `guru` yet. + +* **New**: Statusline function: `go#statusline#Show()` which can be plugged into + the statusline bar. Works only with vim 8.0. It shows all asynchronously + called functions status real time. Checkout it in action: + https://twitter.com/fatih/status/800473735467847680. To enable it add the + following to your `vimrc`. If you use lightline, airline, .. check out their + respective documentation on how to add a custom function: + +```viml +" go command status (requires vim-go) +set statusline+=%#goStatuslineColor# +set statusline+=%{go#statusline#Show()} +set statusline+=%* +``` + +IMPROVEMENTS: + +* **:GoDocBrowser** is now capable to to understand the identifier under the cursor (just like :GoDoc) +* Function calls are now highlighted as well when `g:go_highlight_functions` is enabled [[GH-1048]](https://github.com/fatih/vim-go/pull/1048) +* Add completion support for un-imported packages. This allows to complete even + if the package is not imported. By default it's disabled, enable by adding + `let g:go_gocode_unimported_packages = 1` [[GH-1084]](https://github.com/fatih/vim-go/pull/1084) +* Tools that embeds GOROOT into their binaries do not work when people update + their Go version and the GOROOT contains the vesion as part of their path + (i.e: `/usr/local/Cellar/go/1.7.2/libexec`, [more + info](https://blog.filippo.io/stale-goroot-and-gorebuild/)) . This is now + fixed by introducing automatic GOROOT set/unset before each tool invoke. + [[GH-954]](https://github.com/fatih/vim-go/pull/954) +* Added new setting `g:go_echo_go_info` to enable/disable printing identifier + information when completion is done [[GH-1101]](https://github.com/fatih/vim-go/pull/1101) +* Added new `go_echo_command_info` setting is added, which is enabled by + default. It's just a switch for disabling messages of commands, such as + `:GoBuild`, `:GoTest`, etc.. Useful to *disable* if `go#statusline#Show()` is + being used in Statusline, to prevent to see duplicates notifications. +* goSameId highlighting is now linked to `Search`, which is much more clear as + it changes according to the users colorscheme +* Add plug mapping `(go-lint)` for :GoLint [[GH-1089]](https://github.com/fatih/vim-go/pull/1089) + + +BUG FIXES: + +* Change back nil and iota highlighting color to the old type [[GH-1049]](https://github.com/fatih/vim-go/pull/1049) +* Fix passing arguments to `:GoBuild` while using NeoVim [[GH-1062]](https://github.com/fatih/vim-go/pull/1062) +* Do not open a split if `:GoDef` is used on a modified file [[GH-1083]](https://github.com/fatih/vim-go/pull/1083) +* Highlight nested structs correctly [[GH-1075]](https://github.com/fatih/vim-go/pull/1075) +* Highlight builtin functions correctly if `g:go_highlight_functions` is enabled [[GH-1070]](https://github.com/fatih/vim-go/pull/1070) +* Fix `:GoSameIds` highlighting if a new buffer is opened in the same window [[GH-1067]](https://github.com/fatih/vim-go/pull/1067) +* Internal: add `abort` to all vim function to return in case of errors [[GH-1100]](https://github.com/fatih/vim-go/pull/1100) +* Fix `:GoCoverage` to be executed if working dir is not inside the test dir [[GH-1033]](https://github.com/fatih/vim-go/pull/1033) + +BACKWARDS INCOMPATIBILITIES: + +* remove vim-dispatch and vimproc.vim support. vim 8.0 has now the necessary + API to invoke async jobs and timers. Going forward we should use those. Also + this will remove the burden to maintain compatibility with those plugins. + +* `go#jobcontrol#Statusline()` is removed in favor of the new, global and + extensible `go#statusline#Show()` + +## 1.9 (September 13, 2016) + +IMPROVEMENTS: + +* **guru** uses now the `-modified` flag, which allows us use guru on modified + buffers as well. This affects all commands where `guru` is used. Such as + `:GoDef`, `:GoReferrers`, etc.. [[GH-944]](https://github.com/fatih/vim-go/pull/944) +* **:GoDoc** uses now the `-modified` flag under the hood (for `gogetdoc), which allows us to get documentation for the identifier under the cursor ina modified buffer. [[GH-1014]](https://github.com/fatih/vim-go/pull/1014) +* Cleanup and improve documentation [[GH-987]](https://github.com/fatih/vim-go/pull/987) +* Add new `g:go_gocode_socket_type` setting to change the underlying socket type passed to `gocode`. Useful to fallback to `tcp` on cases such as Bash on Windows [[GH-1000]](https://github.com/fatih/vim-go/pull/1000) +* `:GoSameIds` is now automatically re-evaluated in cases of buffer reloads (such as `:GoRename`) [[GH-998]](https://github.com/fatih/vim-go/pull/998) +* Improve docs about `go_auto_sameids` [[GH-1017]](https://github.com/fatih/vim-go/pull/1017) +* Improve error message by printing the full path if an incompatible `goimports` is being used [[GH-1006]](https://github.com/fatih/vim-go/pull/1006) +* `iota` and `nil` are now highlighted correctly and are not treated as booleans [[GH-1030]](https://github.com/fatih/vim-go/pull/1030) + +BUG FIXES: + +* Fix system calls on Windows [[GH-988]](https://github.com/fatih/vim-go/pull/988) +* Fix :GoSameIds and :GoCoverage for light background and after changing color schemes [[GH-983]](https://github.com/fatih/vim-go/pull/983) +* Fix TagBar and `GoCallers` for Windows user [[GH-999]](https://github.com/fatih/vim-go/pull/999) +* Set updatetime for for `auto_sameids` feature as well [[GH-1016]](https://github.com/fatih/vim-go/pull/1016) +* Update docs about missing `go_highlight_generate_tags` setting [[GH-1023]](https://github.com/fatih/vim-go/pull/1023) +* Fix updating the jumplist if `:GoDef` is used [[GH-1029]](https://github.com/fatih/vim-go/pull/1029) +* Fix highlighting literal percent sign (`%%`) in strings [[GH-1011]](https://github.com/fatih/vim-go/pull/1011) +* Fix highlighting of nested fields [[GH-1007]](https://github.com/fatih/vim-go/pull/1007) +* Fix checking for `exepath` feature for the upcoming vim 8.0 release [[GH-1046]](https://github.com/fatih/vim-go/pull/1046) + +BACKWARDS INCOMPATIBILITIES: + +* Rename `GoMetalinterAutoSaveToggle` to `GoMetaLinterAutoSaveToggle` to make it compatible with the existing `:GoMetaLinter` command [[GH-1020]](https://github.com/fatih/vim-go/pull/1020) + +## 1.8 (July 31, 2016) + +FEATURES: +* New **`:GoAddTags`** command that adds field tags for the fields of a struct automatically based on the field names. Checkout the demo to see it in action: https://twitter.com/fatih/status/759822857773907968 [[GH-971]](https://github.com/fatih/vim-go/pull/971) +* The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Together with `:GoAddTags` it gives `vim-go` users flexible ways of populating a field tag. Checkout the demo to see it in action: https://twitter.com/fatih/status/754477622042689536 [[GH-927]](https://github.com/fatih/vim-go/pull/927) +* New **`:GoSameIds`** command. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically (with `:GoSameIdsAutoToggle` or `g:go_auto_sameids`). Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [[GH-936]](https://github.com/fatih/vim-go/pull/936) +* New **`:GoWhicherrs`** command. It shows all possible values of the selected error variable. [[GH-948]](https://github.com/fatih/vim-go/pull/948) +* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [[GH-926]](https://github.com/fatih/vim-go/pull/926) +* If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [[GH-918]](https://github.com/fatih/vim-go/pull/918) +* Added new toggle commands to enable/disable feature that run for your + automatic. For example if you have `let g:go_auto_type_info = 1` enabled, you + can now easily enable/disable it on the fly. Support added with the following + commands: `:GoAutoTypeInfoToggle`, `:GoFmtAutoSaveToggle`, + `:GoAsmFmtAutoSaveToggle`, `:GoMetalinterAutoSaveToggle`, + `:GoTemplateAutoCreateToggle` [[GH-945]](https://github.com/fatih/vim-go/pull/945) + + +IMPROVEMENTS: +* `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [[GH-894]](https://github.com/fatih/vim-go/pull/894) +* `:GoDef` works now for modified files as well [[GH-910]](https://github.com/fatih/vim-go/pull/910) +* Internal: pass filename to the `--srcdir` flag to enable upcoming `goimports` features [[GH-957]](https://github.com/fatih/vim-go/pull/957) +* Internal: fix indentations on all files to **2-spaces/no tabs**. This is now the default vim-go style across all VimL files [[GH-915]](https://github.com/fatih/vim-go/pull/915) +* Internal: autocmd settings can be now dynamically enabled/disabled [[GH-939]](https://github.com/fatih/vim-go/pull/939) +* Internal: automatically detect `GOPATH` for :GoInstall [[GH-980]](https://github.com/fatih/vim-go/pull/980) +* Internal: shell executions uses now by default `sh` and then resets it back to the user preference. [[GH-967]](https://github.com/fatih/vim-go/pull/967) +* Syntax: improved syntax highglighting performance for methods, fields, structs and interface type declarations [[GH-917]](https://github.com/fatih/vim-go/pull/917) +* Syntax: moved `:GoCoverage` highlight definition into go's syntax file for more customizability [[GH-962]](https://github.com/fatih/vim-go/pull/962) + + +BUG FIXES: + +* Escape `#` characters when opening URL's, as it's handled as alternative file in vim [[GH-895]](https://github.com/fatih/vim-go/pull/895) +* Fix typos in `doc/vim-go.txt` about usages of syntax highglightings [[GH-897]](https://github.com/fatih/vim-go/pull/897) +* Fix `:GoCoverage` not running for Neovim [[GH-899]](https://github.com/fatih/vim-go/pull/899) +* Fix `:GoFmt` not picking up `-srcdir` if the command was set to use `goimports` [[GH-904]](https://github.com/fatih/vim-go/pull/904) +* Fix `:GoTestCompile` to not leave behind artifacts if the cwd and the test files's directory do not match [[GH-909]](https://github.com/fatih/vim-go/pull/909) +* Fix `:GoDocBrowser` to not fail if godoc doesn't exist [[GH-920]](https://github.com/fatih/vim-go/pull/920) +* Fix `:GoFmt` to not change the permissions of saved file. Now original file permissions are restored [[GH-922]](https://github.com/fatih/vim-go/pull/922) + +BACKWARDS INCOMPATIBILITIES: + +* `g:go_highlight_structs` and `g:go_highlight_interface` are removed in favor of `g:go_highlight_types` [[GH-917]](https://github.com/fatih/vim-go/pull/917) + + +## 1.7.1 (June 7, 2016) + +BUG FIXES: +* Fixed typo in `syntax/go.vim` file from `go:go_highlight_fields` to `g:go_highlight_fields` + +## 1.7 (June 7, 2016) + +FEATURES: + +* New **`:GoImpl`** command that generates method stubs for implementing an interface. Checkout the [demo](https://twitter.com/fatih/status/729991365581545472) to see how it works. [[GH-846]](https://github.com/fatih/vim-go/pull/846) +* `godef` support is added back as an optional setting. By default `:GoDef` still uses `guru`, but can be changed to `godef` by adding the option: `let g:go_def_mode = 'godef'` [[GH-888]](https://github.com/fatih/vim-go/pull/888) +* New `` and `]>` shortcuts to split current window and jumpt to the identifier under cursor. [[GH-838]](https://github.com/fatih/vim-go/pull/838) +* New syntax setting" `g:go_highlight_fields` that highlights struct field references [[GH-854]](https://github.com/fatih/vim-go/pull/854) + +IMPROVEMENTS: + +* Invoking `:GoRename` now reloads all files to reflect new changes automatically [[GH-855]](https://github.com/fatih/vim-go/pull/855) +* Calling `:GoTestCompile` does not create any temporary binary file anymore [[GH-879]](https://github.com/fatih/vim-go/pull/879) +* Enable passing the `-tags` flag to `:GoDef`. Now you can pass build tags to `:GoDef` via `:GoGuruTags` or `g:go_guru_tags` +* Internal refactoring to use custom `system()` function that wraps both the standard `system()` call and `vimproc`. Now all system calls will take advantage and will use `vimproc` if installed. [[GH-801]](https://github.com/fatih/vim-go/pull/801) +* Completion enables now `gocode`'s `autobuild` and `propose-builtins` flags automatically. With these settings packages will be automatically build to get the freshest completion candidates and builtin keywords will be showed as well. By defaults these settings are enabled. Settings can be disabled/enabled via `g:go_gocode_autobuild` and `g:go_gocode_propose_builtins`. [[GH-815]](https://github.com/fatih/vim-go/pull/815) +* Added new `http.HandlerFunc` snippets with `hf` and `hhf` shortcuts [[GH-816]](https://github.com/fatih/vim-go/pull/816) +* Added new `Example` and `Benchmark` snippets with `example` and `benchmark` shortcuts [[GH-836]](https://github.com/fatih/vim-go/pull/836) +* Search tool binaries first in `GOBIN` and then in `PATH` as most of vim-go users installs it to `GOBIN` mostly [[GH-823]](https://github.com/fatih/vim-go/pull/823) +* Improve `guru` based commands by providing automatically detected GOPATHS, such as `gb`, `godep` to be used if possible [[GH-861]](https://github.com/fatih/vim-go/pull/861) +* Add `(go-imports)` mapping to make it assignable to other keys [[GH-878]](https://github.com/fatih/vim-go/pull/878) +* Increase compatibility with tcsh [[GH-869]](https://github.com/fatih/vim-go/pull/869) +* Improve `:GoInstallBinaries` for GOPATH's which don't have packages that work well with `go get -u`. We have a new `g:go_get_update` setting to disable it. By default it's enabled. [[GH-883]](https://github.com/fatih/vim-go/pull/883) + + + +BUG FIXES: +* Fix `(go-freevars)` plug mapping to work as in visual mode instead of noncompatible normal mode [[GH-832]](https://github.com/fatih/vim-go/pull/832) +* Commands based on guru now shows a more meaningful error message instead of just showing the exit status (-1) +* Fix `:GoCoverage` accidentally enabling syntax highlighting for users who don't use syntax (i.e syntax off) [[GH-827]](https://github.com/fatih/vim-go/pull/827) +* Fix `:GoCoverage` colors to work for xterm as well [[GH-863]](https://github.com/fatih/vim-go/pull/863) +* Fix commenting out block of texts for Go templates (filetype gothtmltmpl) [[GH-813]](https://github.com/fatih/vim-go/pull/813) +* Fix `:GoImplements` failing because of an empty scope definition. Now we default to current package to make it usable. +* Fix `:GoPlay` posting to non HTTPS url. [[GH-847]](https://github.com/fatih/vim-go/pull/847) +* Fix escaping the filenames for lint and motion commands [[GH-862]](https://github.com/fatih/vim-go/pull/862) +* Fix escaping the filename to `:GoDef` completely for tcsh [[GH-868]](https://github.com/fatih/vim-go/pull/868) +* Fix showing SUCCESS for `go test` related commands if no test files are available [[GH-859]](https://github.com/fatih/vim-go/pull/859) + + + +## 1.6 (April 25, 2016) + +FEATURES: + +* New `CHANGELOG.md` file (which you're reading now). This will make it easier + for me to track changes and release versions +* **`:GoCoverage`** is now highlighting the current source file for + covered/uncovered lines. If called again it runs the tests and updates the + annotation. Use `:GoCoverageClear` to clear the coverage annotation. + This is a pretty good addition to vim-go and I suggest to check out the gif + that shows it in action: https://twitter.com/fatih/status/716722650383564800 + [[GH-786]](https://github.com/fatih/vim-go/pull/786) +* **`:GoCoverageToggle`** just like `:GoCoverage` but acts as a toggle. If run + again it clears the annotation. +* **`:GoCoverageBrowser`** opens a new annotated HTML page. This is the old + `:GoCoverage` behavior [[GH-786]](https://github.com/fatih/vim-go/pull/786) +* **`:GoDoc`** uses now [gogetdoc](https://github.com/zmb3/gogetdoc) to + lookup and display the comment documentation for the identifier under the + cursor. This is more superior as it support looking up dot imports, named + imports and imports where package name and file name are different [[GH-782]](https://github.com/fatih/vim-go/pull/782) +* **`guru support`**: `oracle` is replaced by the new tool `guru`. `oracle.vim` + is therefore renamed to `guru.vim`. I've also refactored the code to make it + much more easier to maintain and add additional features in future (such as + upcoming JSON decoding). vim-go is now fully compatible with `guru`. Please + be sure you have installed `guru`. You can easily do it with + `:GoInstallBinaries`. +* **`:GoDef`** uses now `guru definition` under the hood instead of `godef`. + This fixes the following issues: 1. dot imports 2. vendor imports 3. folder + != package name imports. The tool `godef` is also deprecated and not used + anymore. +* **`:GoDef`** does have now history of the call stack. This means you can + easily jump back to your last entry. This can be done with the new command + `:GoDefPop` or the mapping `CTRL-t`. To see the stack and jump between entries + you can use the new command `:GoDefStack`, which shows the list of all stack + entries. To reset the stack list anytime you can call `:GoDefStackClear` + [[GH-776]](https://github.com/fatih/vim-go/pull/776) + +IMPROVEMENTS: + +* **`:GoCoverage`** is executed asynchronously when used within Neovim [[GH-686]](https://github.com/fatih/vim-go/pull/686) +* **`:GoTestFunc`** supports now testable examples [[GH-794]](https://github.com/fatih/vim-go/pull/794) +* **`:GoDef`** can jump to existing buffers instead of opening a new window + (split, vsplit or tab). By default it's disabled to not break the old + behavior, can be enabled with `let g:go_def_reuse_buffer = 1` + +BUG FIXES: + +* Fix not showing documentation for dot, named and package/file name being different imports [[GH-332]](https://github.com/fatih/vim-go/pull/332) +* Term mode: fix closing location list if result is successful after a failed attempt [[GH-768]](https://github.com/fatih/vim-go/pull/768) +* Syntax: fix gotexttmpl identifier highlighting [[GH-778]](https://github.com/fatih/vim-go/pull/778) +* Doc: fix wrong wording for `go-run` mapping. It's for the whole main package, + not for the current file + +BACKWARDS INCOMPATIBILITIES: + +* `:GoDef` doesn't accept any identifier as an argument. This is not suported + via `guru definition` and also was not widely used either. Also with this, we + significantly simplified the existing def.vim code +* `:GoOracleScope` and `:GoOracleTags` are deprecated in favor of + `:GoGuruScope` and `:GoGuruTags`. Also `g:go_oracle_scope` is renamed to + `g:go_guru_scope` +* `g:go_guru_scope` accepts a variable in type of `list` instead of `string`. + i.g: `let g:go_guru_scope = ["github.com/fatih/structs", "golang.org/x/tools/..."]` + + +## 1.5 (Mar 16, 2016) + +FEATURES: +* Introducing code name "motion". A new whole way of moving + around and navigating [[GH-765]](https://github.com/fatih/vim-go/pull/765). Checkout the following new changes: + * A vim-go specific tool, called [motion](https://github.com/fatih/motion) is being developed which + provides us the underlying foundation for the following and upcoming + new features. + * `]]` and `[[` motions can be used to jump between functions + * `if` and `af` are improved and implement from scratch. It has now + support for literal functions, comments of functions, better cursor + position support and more stable. + * New `:GoDecls` and `:GoDeclsDir` commands that are available if + `ctrlp.vim` is installed. Once called one can easily jump to any generic declaration available. + * I wrote two blog posts about these new features in more detail. I recommend you to read it: [Treating Go types as objects in Vim](https://medium.com/@farslan/treating-go-types-as-objects-in-vim-ed6b3fad9287#.mbwaisevp) and [Navigation between functions and types in vim-go](https://medium.com/@farslan/navigation-between-functions-and-types-in-vim-go-f9dd7de8ca37#.2sdf8tbbe) +* A new `:GoAlternate` command that toggles to the test + file of the current file. It also has new appropriate mappings to open the + alternate file in split or tabs. [[GH-704]](https://github.com/fatih/vim-go/pull/704) +* Now commands can choose whether they want to open a + `quickfix` or a `location list` via the setting `g:go_list_type`. Also all + the commands have now some sensible settings, some will open a qf window, + some will open a location list [[GH-700]](https://github.com/fatih/vim-go/pull/700) + +IMPROVEMENTS: + +* Add support for goimport's new `-srcdir`. Goimports now succesfully suports `vendor/` folders with this release. [[GH-735]](https://github.com/fatih/vim-go/pull/735) +* Add `g:go_gorename_prefill` setting which disabled pre filling the argument for `:GoRename` [[GH-711]](https://github.com/fatih/vim-go/pull/711) +* Improve `:GoRun` to complete to filenames [[GH-742]](https://github.com/fatih/vim-go/pull/742) +* Highlight `//go:generate` comment directives [[GH-757]](https://github.com/fatih/vim-go/pull/757) +* Indent code in Go HTML templates [[GH-709]](https://github.com/fatih/vim-go/pull/709) +* Improve negative numbers of all types, octals, imaginary numbers with exponents [[GH-752]](https://github.com/fatih/vim-go/pull/752) +* Improved internal usage of retrieving offsets [[GH-762]](https://github.com/fatih/vim-go/pull/762) +* Improve by substitute all backslashes to slashes for filename [[GH-703]](https://github.com/fatih/vim-go/pull/703) +* Improve internal Go package path function [[GH-702]](https://github.com/fatih/vim-go/pull/702) +* Improved typo and grammar errors in docs [[GH-714]](https://github.com/fatih/vim-go/pull/714) +* Improved internal `:GoInfo` automatic call [[GH-759]](https://github.com/fatih/vim-go/pull/759) + +BUG FIXES: + +* Fix oracle scope not working if trailing slash exists in scope [[GH-751]](https://github.com/fatih/vim-go/pull/751) +* Fix `:GoErrCheck` checking abspath [[GH-671]](https://github.com/fatih/vim-go/pull/671) +* Fix `:GoInstall` correctly parsing errors [[GH-692]](https://github.com/fatih/vim-go/pull/692) +* Fix `:GoInstall` correctly parsing errors [[GH-692]](https://github.com/fatih/vim-go/pull/692) +* Fix `:GoTestFunc` for neovim [[GH-695]](https://github.com/fatih/vim-go/pull/695) +* Fix `:GoRun` accepting arguments for neovim [[GH-730]](https://github.com/fatih/vim-go/pull/730) +* Fix `go run` mappings not working [[GH-542]](https://github.com/fatih/vim-go/pull/542) +* Fix autodetect gopath picking up non existing GB vendor folder +* Fix gofmt errors showing per buffer instead of per script [[GH-721]](https://github.com/fatih/vim-go/pull/721) +* Fix some of the neosnippet snippets + +## 1.4 (Jan 18, 2016) + +FEATURES: + +* You waited for it for a long time. And here you have it: **Neovim support!** + This is a huge feature. It's fully compatible with Vim and kicks only in if + vim-go is being used within Neovim. Checkout the full list of changes + [[GH-607]](https://github.com/fatih/vim-go/pull/607): + * An async launcher and base foundation was implemented for the `go` command. + This will be used in the future for all upcoming subcommands of the `go` + tool. + * `:GoBuild` is now called asynchronously (it doesn't block the UI anymore). + * A new `go#jobcontrol#Statusline()` can be used to plug into the statusline. + This will show the status of the job running asynchronously. The statusline + is improved to show the status per package instead of file. Assume you have + three files open, all belonging to the same package, if the package build + (`:GoBuild`) is successful, all statusline's will be empty (means SUCCESS), + if it fails all files statusline's will show `FAILED`. + * `:GoRun` opens a new vertical terminal emulator inside Neovim and runs the + command there. The terminal mode can be changed with `g:go_term_mode`, + which is by default `vsplit`. Current options are `vsplit, split or tab`. + We also have three new mappings to open `:GoRun` command in different + terminal split modes: `(go-run-vertical)`, `(go-run-split)` + and `(go-run-tab)` + * `:GoTest`, `:GoTestFunc` and `:GoTestCompile` opens and runs in a new + terminal. The view mode (split,vertical, tab) is defined with + `g:go_term_mode`. The `g:go_term_enabled` setting can be use to change the + behavior of `:GoTestXXX` commands .If set to `1`, it opens the test + commands inside a terminal, if not it runs them in background just like + `:GoBuild` and displays the result in the statusline. + * We have two settings for terminal sizes: `g:go_term_height` and + `g:go_term_width`. By default a vertical or horizontal view is equally + splitted by vim automatically. However with these settings we can for + example have a terminal with a smaller height when we split it + horizontally. + * If a command inside the term fails (such as `go run`, `go test` ...) we + parse now the errors and list them inside a location list. +* Instead of quickfix window, vim-go now uses the `location list` feature of + Vim. These are associated with each window independently of each other. This + enables us to have multiple, independent location lists per window (example + usages: `:GoBuild` with errors that needs to be fixed, `:GoLint` with + warnings that we want to check, `:GoReferrers` with a list of referred + identifiers) [[GH-626]](https://github.com/fatih/vim-go/pull/626) +* a new **`:AsmFmt`** command which is integrated to work with [asmfmt](https://github.com/klauspost/asmfmt) [[GH-673]](https://github.com/fatih/vim-go/pull/673) +* the full identifier information of a completed identifier is echoed in + statusline. This is very useful to see a function signatures arguments. + [[GH-685]](https://github.com/fatih/vim-go/pull/685) + +IMPROVEMENTS: + +* Improve `:GoFmt` by checking if the binary is indeed installed on the system [[GH-617]](https://github.com/fatih/vim-go/pull/617) +* Improve `:GoMetaLinter` by adding the option to run the metalinter on save + and adding the option to limit the output to the currently active buffer. Set + `let g:go_metalinter_autosave = 1` to enable autosave and use `let + g:go_metalinter_autosave_enabled = ['vet', 'golint']` to change your options. + [[GH-631]](https://github.com/fatih/vim-go/pull/631) +* Improved `:GoDef`. If `vimproc` is installed `godef` will make use of it [[GH-670]](https://github.com/fatih/vim-go/pull/670) +* Improve completion of godoce when vimproc is used [[GH-620]](https://github.com/fatih/vim-go/pull/620) +* Improve internal error matching prodecure to not match false positives [[GH-618]](https://github.com/fatih/vim-go/pull/618) +* A new option to highlight interface variables with `go_highlight_interfaces` [[GH-681]](https://github.com/fatih/vim-go/pull/681) + +BUG FIXES + +* Fix `:GoFmt` changing the fileformat of the current buffer [[GH-615]](https://github.com/fatih/vim-go/pull/615) +* Fix `:GoRename` to output the original error if parsing fails [[GH-675]](https://github.com/fatih/vim-go/pull/675) +* Fix `:GoTest` to output the original error if parsing fails [[GH-676]](https://github.com/fatih/vim-go/pull/676) +* Fixed `fmt.Fprintln` not to highlight as builtin [[GH-628]](https://github.com/fatih/vim-go/pull/628) +* Fixed wrong highlighting of channels of channels [[GH-678]](https://github.com/fatih/vim-go/pull/678) + +## 1.3 (Nov 22, 2015) + +FEATURES: + +* A new `:GoOracleTags` command was added to pass build tags to Oracle's `-tags` flag. [[GH-573]](https://github.com/fatih/vim-go/pull/573) + +IMPROVEMENTS: + +* Change `:GoTest` command to timeout after 10 seconds. Vim UI is blocking and + tests with large running times makes Vim blocking for a long time. This is + also customizable with the new option `g:go_test_timeout`. [[GH-578]](https://github.com/fatih/vim-go/pull/578) +* Improve `:GoRename` to collect and populate quickfix window with errors. + [[GH-577]](https://github.com/fatih/vim-go/pull/577) +* Improve `:GoRun` by dropping bad filenames from quickfix window. This allows + us to have only valid entries which can be jumped to [[GH-547]](https://github.com/fatih/vim-go/pull/547) +* Improve `:GoMetaLinter` quickfix output by using absolute paths. This enables + us to jump to errors for all cases. [[GH-565]](https://github.com/fatih/vim-go/pull/565) +* Improve `:GoMetaLinter` command by adding a new option + `g:go_metalinter_deadline` which cancels the linters after 5 seconds + (previous default). [[GH-576]](https://github.com/fatih/vim-go/pull/576) +* Improve `:GoMetaLinter` by jumping to the first encountered error from the quickfix window. +* Automatically resize quickfix window based on the number of errors [[GH-602]](https://github.com/fatih/vim-go/pull/602) +* Improve build constraints to show invalid cases (such as `// +buildfoo`, not + having an empty line between the package statement, etc..). Also add missing + `GOARCH` values sucha s `arm64`. There are many other useful improvements, + for more detail please have a look at + [[GH-589]](https://github.com/fatih/vim-go/pull/589) +* Add support for all values of `GOARCH` [[GH-601]](https://github.com/fatih/vim-go/pull/601) +* Add note about Syntastic usage as this problem comes up a lot [[GH-580]](https://github.com/fatih/vim-go/pull/580) +* Add note about `:GoUpdateBinaries` [[GH-606]](https://github.com/fatih/vim-go/pull/606) + +BUG FIXES: + +* Fixed `:GoErrCheck` showing the correct output when executed inside the source folder [[GH-564]](https://github.com/fatih/vim-go/pull/564) +* Fixed `:GoBuild` by not using `/dev/null` anymore for build output (not + supported by `go`). We pass a temporary file now. [[GH-567]](https://github.com/fatih/vim-go/pull/567) +* Fixed `:GoFmt` passing `g:go_fmt_options` options to `goimports`. This option + is only valid with `gofmt`. [[GH-590]](https://github.com/fatih/vim-go/pull/590) +* Fix vim-go for `cygwin` users. [[GH-575]](https://github.com/fatih/vim-go/pull/575) +* Fixed identifier in template files to be highlighted correctly [[GH-559]](https://github.com/fatih/vim-go/pull/559) +* Fixed character region in template files to be highlighted correctly [[GH-603]](https://github.com/fatih/vim-go/pull/603) +* Fixed variables in template files to be highlighted correctly [[GH-611]](https://github.com/fatih/vim-go/pull/611) +* Do not treat builtins as keywords. Now `make` will not highlighted but + `make()` will be highlighted (gh-605) + +## 1.2 (Oct 2, 2015) + +FEATURES: + +* A new `:GoMetaLinter` command which invokes [gometalinter](https://github.com/alecthomas/gometalinter). Please check the PR [[GH-553]](https://github.com/fatih/vim-go/pull/553) for more detail on customizing and usage of `:GoMetaLinter`. + +IMPROVEMENTS: + +* Improve `:GoImport` to trim spaces when including import paths of form `"fmt "` +* Avoid setting `filetype` twice. Previously it was doing it twice, which was expensive +* Improve handling of GOPATH's with trailing `/` characters, such as `/home/user/go/` +* Add a new `g:go_highlight_string_spellcheck` feature, which is enabled by feature. Now if spell is enabled, go strings are also checked. +* Specify our limited but functional [gb](http://getgb.io/) support + +BUG FIXES: +* Fixed `:GoRun` to display errors when `g:go_dispatch_enabled` was enabled +* Fixed `:GoDrop` displaying "Not enough arguments" (regression) +* Fixed `:GoErrCheck` not showing `PASS` message if the command was successful +* Fixed `:GoErrCheck` not executing in the directory of the currently edited file +* Close quickfix window after a successful second round of `:GoInstall` +* Fix passing files rather than packages to certain oracle commands. +* Escape files passed to oracle command. This could lead to some serious things. +* Clear `g:go_oracle_scope` when the scope was reseted. Previously it was set to empty string, which was causing false positives. +* Correct various misspellings. + +## 1.1 (Jul 25, 2015) + +With this release the version will now increase in `minor` levels. So the next +release will be `1.2`, the other one `1.3`, etc.. This provides us more +flexibility (like releasing patch versions if needed). + +FEATURES: +* A new `:GoGenerate` command is now available which can be used to invoke `go generate` within vim +* Vim-go didn't had any license, now we use BSD 3-Clause License (the same as Go). This is needed for Linux distributions to package vim-go and is also something that people asked for. + +IMPROVEMENTS: +* Improve commands `GoRun, GoTest{,Func,Compile}, GoCoverage, + GoGenerate, GoErrcheck, GoLint, and GoVet` to handle multiple arguments. + Previously this feature was limited to only certain commands. What this means + is, for example `:GoVet . -all` will invoke `go tool vet . -all` + automatically instead of plan `go vet`. This is one of the big changes in + this release, so give it a try :) +* Improved `:GoFmt` command, which now uses the `-w` flag to + write to the source code directly, instead of outputting it to stdout. This + makes `:GoFmt` much more faster than the current implementation. This is one + of the big changes in this release, so feedback is welcome! +* Improve `:GoImport` to have a `!` feature. Now when when called + with a `!` appended it will go get it. i.e: `:GoImport! + github.com/fatih/color`. Useful if `:GoImport` fails and you want to download + it. +* Automatic GOPATH detections can now detect `gb` vendored folders. Some commands should now work without any problem when invoked on a `gb` project. +* All command arguments are now properly escaped for shell invocation. +* Added the `-f` flag to :GoInstallBinaries command to support `git url..insteadOf` configuration +* Improve width and precision highlighting, such as `%s %5s %-5s %5.5f %.5f` +* Show an error if a region is not selected when `:GoFreeVars` is called + +BUG FIXES: +* Fix`:GoDef` for files containing spaces. We know escape the files before passing to `:GoDef` +* Fix `:GoFmt` not picking up the correct GOPATH when the fmt command was set to `goimports` +* Fix and simplify README.md, add Wiki reference +* Fixed tagbar integration to show correct imports. + + +## 1.0.5 (May 26, 2015) + +FEATURES: +* A new `:GoOracleScope` is added to change the oracle scope on-the-fly. It + accepts import paths as arguments. If no arguments are passed it prints the + current custom oracle scope. `:GoOracleScope` also supports completion of + import paths, so it's very fast and handy to use. `:GoOracleScope ""` clears + the current custom scope. +* A new `:GoPath` command that displays the current `GOPATH`. A path can be + passed to change the `GOPATH` (i.e `:GoPath ~/foo/src`). `:GoPath ""` clears + and resets the `GOPATH` to the initial value. +* A new "autodetect GOPATH" feature is added. This automatically detects if the + project is using `godep` or is under a `src` root directory which is not in + `GOPATH` and changes/modifies the `GOPATH` so all commands work based on this + GOPATH. What this means is, commands such as `:GoDef`, `:GoBuild`, etc.. will + include the Godeps folder. For example any go-to-definition via `:GoDef` will + jump to the source code inside Godeps. This is enabled by default, but can + disabled with `let g:go_autodetect_gopath = 0`. This new feature is also the + foundation for other tools such as `gb` or `wgo`. + +IMPROVEMENTS: +* Improve `:GoFmt` (gofmt and goimports) speed. Now it's 2x faster than the previous implementation. +* Add Dispatch support for `:GoBuild` and `:GoRun`. For more info about + dispatch see https://github.com/tpope/vim-dispatch . By default it's + disabled, to enable it add `let g:go_dispatch_enabled = 1` to your vimrc. +* Add support for the bang `!` attribute for all `go` tool commands. What this + does it, if `:GoBuild` is called it will jump to the error. But `:GoBuild!` + will not jump to any error. This has the same behavior as the internal + `:make` command in vim. We had this feature already for `:GoBuild` and + `:GoRun`. But not for `:GoInstall`, `:GoTest`, etc.. Now all commands are + unified. +* Add autojump to error for `:GoInstall`. +* Add autowrite feature for `:GoInstall`, `:GoTestXXX` functions and `:GoVet` +* Support `git url..insteadOf` and custom import paths of binaries. This + improves the commands `:GoInstallBinaries` and `:GoUpdateBinaries`. +* Add support for highlighting go templates with `*.tmpl` extensions. Based on + the work from @cespare from https://github.com/cespare/vim-go-templates + +BUG FIXES: +* Fix clearing the status bar when `:GoErrCheck` is called +* Fix godocNotFound to not match 'os' pkg contents. This improves the command + `:GoDoc` +* Fix parsing and jumping to error locations when used Vim from a different + directory than the current buffer's directory +* Fix completion showing duplicates paths for completion results, such as + github.com/fatih/color and github.com/fatih/color/. + +## 1.0.4 (Apr 28, 2015) + +FEATURES: + +* A new `:GoTestFunc` command (with appropriate + mappings) is added. Run tests function which surrounds the current cursor + location. Useful to test single tests. +* Highlight all Go operators. Previously not all + operators were highlighted. As previously, to highlight options, enable it + with by setting `g:go_highlight_operators` to 1 in your vimrc. + +IMPROVEMENTS: + +* Improved certain `:GoDoc` usages to show a better error message +* Improved `:GoRename` to have a default value for rename input. Avoids retyping similar words. +* Synced with latest Oracle version. `callgraph` is removed. +* Removed our custom referrers mode. New version of oracle now displays the matching lines. + +BUG FIXES: + +* Fixed the internal `executeInDir` function which was failing when ignorelist was not set properly. +* Fixed trailing slash for package completion with `:GoImport` +* Fixed paths in error list for Windows users. +* Fixed not showing "import cycle not allowed" error message when called `:GoBuild` or `:GoRun` +* Fixed users using vimproc requiring arguments to functions to be escaped. +* Fixed depth for test snippets +* Fixed neosnippet support loading snippet files the second time if necessary. + +## 1.0.3 (Mar 7, 2015) + +FEATURES: +* A new `:GoTestCompile` command (with appropriate mappings) is added. Useful to compile a test binary or show/fix compile errors in quickfix window + +IMPROVEMENTS: +* `referrer` mode is improved to show referring lines in the quickfix window +* A new `errt` snippet is added, which expands to `if err != nil { t.Fatal(err) }` +* A new `errh` snippet is added, useful to be used in a `http.Handler` +* UltiSnips snippets are improved to take advance of Vim's `Visual` mode. For example selecting a block and typing `if` will create an if scope around the block. +* Cleanup README.md + +BUG FIXES: +* Fix trimming brackets if completion was invoked on a previous completion +* Fix Oracle scope settings. Added docs about usage. +* Fixed previously broken `var` and `vars` snippets +* Fix duplicate docs +* Fix fallback binary path for Windows users. The fallback mechanism is used to discover the necessary Go tools, such as `godef`, `gocode`, etc... + +## 1.0.2 (Feb 17, 2015) + +FEATURES: + +* New snippets are added, mostly for testing ( [changes](https://github.com/fatih/vim-go/pull/321/files)) + +IMPROVEMENTS: + +* Enable all Oracle commands. Docs, mappings and commands are also added. It uses Quickfix list instead of a custom UI. +* Clarify installation process in Readme, add instructions for vim-plug, NeoBundle and manual. + +BUG FIXES: + +* Fix shiftwidth parsing, it was broken in the previous release for old Vim versions +* Fix experimantal mode + + +## 1.0.1 (Feb 9, 2015) + +FEATURES: + +* New feature to highlight build constraints (disabled by default) + +IMPROVEMENTS: + +* Updated godef import path +* Updated Readme for possible problems with `csh` +* Documentation for text objects are updated, typo fixes are merged +* If vimproc is installed, Windows users will use it for autocompletion +* Improve UltiSnips snippets to pick Visual selection (demo: http://quick.as/0dvigz5) +* Packages with extensions, like "gopkg.in/yaml.v2" can be now displayed +* Packages with different import paths, like "github.com/bitly/go-simplejson" can be now displayed + +BUG FIXES: + +* Fatal errors are now parsed successfully and populated to quickfix list +* Shiftwidth is changed to use shiftwidth() function. Fixes usage with plugins like vim-sleuth and possible mis usage (like setting shiftwidth to zero) +* Added a new [Donation](https://github.com/fatih/vim-go#donations) section to Readme, for those who ask for it. +* Fix parsing of errcheck error syntax +* Fix consistency between Neosnippet and UltiSnips snippets + + +## 1.0 (Dec 24, 2014) + +We don't tag any changes or releases, so let's start with `1.0`. Our Windows +support is now in a good shape, tons of bugs are fixed, many new features and +improvements is being added and it's getting better with each day (thanks to +the community contributions). + +## 0.0 (Mar 24, 2014) + +Initial commit: https://github.com/fatih/vim-go/commit/78c5caa82c111c50e9c219f222d65b07694f8f5a + + diff --git a/sources_non_forked/vim-go/Dockerfile b/sources_non_forked/vim-go/Dockerfile new file mode 100644 index 00000000..22b29962 --- /dev/null +++ b/sources_non_forked/vim-go/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:1.18.1 + +RUN apt-get update -y --allow-insecure-repositories && \ + apt-get install -y build-essential curl git libncurses5-dev python3-pip && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN pip3 install vim-vint + +RUN useradd -ms /bin/bash -d /vim-go vim-go +USER vim-go + +COPY scripts/install-vim /vim-go/scripts/install-vim +WORKDIR /vim-go + +RUN scripts/install-vim vim-8.0 +RUN scripts/install-vim vim-8.2 +RUN scripts/install-vim nvim + +COPY . /vim-go/ +WORKDIR /vim-go + +RUN scripts/install-tools vim-8.0 +RUN scripts/install-tools vim-8.2 +RUN scripts/install-tools nvim + +ENTRYPOINT ["make"] diff --git a/sources_non_forked/vim-go/LICENSE b/sources_non_forked/vim-go/LICENSE new file mode 100644 index 00000000..d9493d4f --- /dev/null +++ b/sources_non_forked/vim-go/LICENSE @@ -0,0 +1,60 @@ +Copyright (c) 2015, Fatih Arslan +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of vim-go nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +This software includes some portions from Go. Go is used under the terms of the +BSD like license. + +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The Go gopher was designed by Renee French. http://reneefrench.blogspot.com/ The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher diff --git a/sources_non_forked/vim-go/Makefile b/sources_non_forked/vim-go/Makefile new file mode 100644 index 00000000..874a864c --- /dev/null +++ b/sources_non_forked/vim-go/Makefile @@ -0,0 +1,31 @@ +VIMS ?= vim-8.0 vim-8.2 nvim +TEST_FLAGS ?= + +all: install lint test + +install: + @echo "==> Installing Vims: $(VIMS)" + @for vim in $(VIMS); do \ + ./scripts/install-vim $$vim; \ + ./scripts/install-tools $$vim; \ + done + +test: + @echo "==> Running tests for $(VIMS)" + @for vim in $(VIMS); do \ + ./scripts/test $(TEST_FLAGS) $$vim; \ + done + +lint: + @echo "==> Running linting tools" + @./scripts/lint vim-8.2 + +docker: + @echo "==> Building/starting Docker container" + @./scripts/docker-test + +clean: + @echo "==> Cleaning /tmp/vim-go-test" + @rm -rf /tmp/vim-go-test + +.PHONY: all test install clean lint docker diff --git a/sources_non_forked/vim-go/README.md b/sources_non_forked/vim-go/README.md new file mode 100644 index 00000000..1e0ba551 --- /dev/null +++ b/sources_non_forked/vim-go/README.md @@ -0,0 +1,104 @@ +# vim-go [![GitHub Actions Status](https://github.com/fatih/vim-go/workflows/test/badge.svg)](https://github.com/fatih/vim-go/actions) + + + +

+ Vim-go logo +

+ +## Features + +This plugin adds Go language support for Vim, with the following main features: + +* Compile your package with `:GoBuild`, install it with `:GoInstall` or test it + with `:GoTest`. Run a single test with `:GoTestFunc`). +* Quickly execute your current file(s) with `:GoRun`. +* Improved syntax highlighting and folding. +* Debug programs with integrated [`delve`](https://github.com/go-delve/delve) support with `:GoDebugStart`. +* Completion and many other features support via `gopls`. +* formatting on save keeps the cursor position and undo history. +* Go to symbol/declaration with `:GoDef`. +* Look up documentation with `:GoDoc` or `:GoDocBrowser`. +* Easily import packages via `:GoImport`, remove them via `:GoDrop`. +* Precise type-safe renaming of identifiers with `:GoRename`. +* See which code is covered by tests with `:GoCoverage`. +* Add or remove tags on struct fields with `:GoAddTags` and `:GoRemoveTags`. +* Call [`staticcheck`](https://staticcheck.io/) with `:GoMetaLinter` to invoke all possible linters + (e.g. `golint`, `vet`, `errcheck`, `deadcode`, etc.) and put the result in the + quickfix or location list. +* Lint your code with `:GoLint`, run your code through `:GoVet` to catch static + errors, or make sure errors are checked with `:GoErrCheck`. +* Advanced source analysis tools utilizing `guru`, such as `:GoImplements`, + `:GoCallees`, and `:GoReferrers`. +* ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more + information. +* Integration with [`gopls`](https://github.com/golang/tools/blob/master/gopls/README.md). +* The `gopls` instance can be shared with other Vim plugins. +* Vim-go's use of `gopls` can be disabled and alternative tools can be used when desired. +* Integration with [`Tagbar`](https://github.com/preservim/tagbar) via [`gotags`](https://github.com/jstemmer/gotags). +* Integration with [`Ultisnips`](https://github.com/SirVer/ultisnips) and other snippet engines. + +## Install + +vim-go requires at least Vim 8.0.1453 or Neovim 0.4.0. + +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, +please do so with caution; it is a _development_ branch. + + +vim-go follows the standard runtime path structure. Below are some helper lines +for popular package managers: + +* [Vim 8 packages](http://vimhelp.appspot.com/repeat.txt.html#packages) + * `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go` +* [Neovim packages](https://neovim.io/doc/user/repeat.html#packages) + * `git clone https://github.com/fatih/vim-go.git ~/.local/share/nvim/site/pack/plugins/start/vim-go` +* [Pathogen](https://github.com/tpope/vim-pathogen) + * `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go` +* [vim-plug](https://github.com/junegunn/vim-plug) + * `Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }` +* [Vundle](https://github.com/VundleVim/Vundle.vim) + * `Plugin 'fatih/vim-go'` + +You will also need to install all the necessary binaries. vim-go makes it easy +to install all of them by providing a command, `:GoInstallBinaries`, which will +`go install` all the required binaries. + +Check out the Install section in [the documentation](doc/vim-go.txt) for more +detailed instructions (`:help go-install`). + +## Usage + +The full documentation can be found at [doc/vim-go.txt](doc/vim-go.txt). You can +display it from within Vim with `:help vim-go`. + +Depending on your installation method, you may have to generate the plugin's +[`help tags`](http://vimhelp.appspot.com/helphelp.txt.html#%3Ahelptags) +manually (e.g. `:helptags ALL`). + +We also have a [tutorial](https://github.com/fatih/vim-go/wiki/Tutorial) in the [official vim-go wiki](https://github.com/fatih/vim-go/wiki). + +## FAQ and troubleshooting + +The FAQ and troubleshooting tips are in the documentation and can be quickly +accessed using `:help go-troubleshooting`. If you believe you've found a bug or +shortcoming in vim-go that is neither addressed by help nor in [existing +issues](https://github.com/fatih/vim-go/issues), please open an issue with +clear reproduction steps. `:GoReportGitHubIssue` can be used pre-populate a lot +of the information needed when creating a new issue. + +## Contributing + +All PRs are welcome. If you are planning to contribute a large patch or to +integrate a new tool, please create an issue first to get any upfront questions +or design decisions out of the way first. + +You can run the tests locally by running `make`. It will lint the VimL for you, +lint the documentation, and run the tests against the minimum required version +of Vim, other versions of Vim that may be critical to support, and Neovim. + +## License + +The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details + diff --git a/sources_non_forked/vim-go/addon-info.json b/sources_non_forked/vim-go/addon-info.json new file mode 100644 index 00000000..145d961c --- /dev/null +++ b/sources_non_forked/vim-go/addon-info.json @@ -0,0 +1,6 @@ +{ + "name": "vim-go", + "description": "Full featured Go (golang) support for Vim.", + "author": "Fatih Arslan ", + "repository" : {"type": "git", "url": "https://github.com/fatih/vim-go.git"} +} diff --git a/sources_non_forked/vim-go/assets/vim-go.png b/sources_non_forked/vim-go/assets/vim-go.png new file mode 100644 index 0000000000000000000000000000000000000000..cb26e2c073ecba2bf5f97686dc3b8184868ab12f GIT binary patch literal 29252 zcmb??1y@{Mv}EJ%5D4zU-95Ow1`h-Y?(XjH?!iNFhu|LE-QBg3x!;?4|6qEpUNpU$ zW}kDn)Tyc)p{yu{f{2d@0)bFuq{UT1AP5oQi4G47ywgiutq=Twb`q6QhX)?s@TTFw z?+EtNI!+)E9LIl82vqs-UEs~n&Jxum`>J6>ciw?gkO5LXUW|^+3LnwoFHYd$C@H#uY z`6L9&|BuHeg}04=XsDzXHA5>c4g8pRL?UDHc)WDdY4i-dV;<^y(|x5O^KErXACv-! zljGGNDOE48YRE&-9)^X81zw^qD^Tpzg|AbsqGD!Y4ZV~vhgwA9rVf3l4yAHK?^Jgz zj4KoL)8Z*UL#|ezviKF^xA-){%Fds`xiX~;9HKPNNjz+f81yosLRHz!ic#J_#x8vY zD3vaXS&Yg(eH4G6<|A?Fv%9=-#c==o|K2_0C5s9ezv9SRS!e{>9A9TD1KCR_QRY6! z__S@VtPLMB3#h93>{ulK7Xkfd$7UZjnj8nj+`lXG*4D8J=&>&tJBn&X_UF;3w%lck z<0ypEx~dw_S7?t~^C_Ps=vDRFeDAYJT30u=W2yb|@eRn`rf;rkIzrKloIV+-2w(45 z6*=?0<*!&**Y4+R`Y!G`^SRl5Yb0M(D9zWq8a~Bim2Pf@V{vnVY)j` zRrobOjZ!Psc|SYqdsLF$jqj5E)IS{}@w2`UQ4nPHnx6lx*zXodZlV;M-AGyU$nQBc zqdt{@lDFf$G}2)tR8YqhR@>DeEs-K=l*a$UoA(de9)26KC_YWL-x@+KpK-%uQ1&~z z%^s7E0U5N^*S*T$d_6yP8_g!#eNTz@nDmKhHCSOyn+k`mixcS*5JU*kk%Ch>j3B`} zj|*7x7m52I8-JMJ5R9T*A~Te|2pqB&=)ema-jx@y#R5x6nMM)8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a82ujkfbv?+LiNu~OC5#c!c`49F2G(jao} z{FfoRl-mmm;Nj6g)!JiP-~8iM`&zTCAR{W>4~q9(070H@*T-vL{W>RkYK`MsM}k0^ z-npmz-CV;D^Oe;yh!j~#$xP0P&B(oGKO|d!(#Go&p($&XzF|KkSbHPoSTtP3Gjdob zT0^J$DlW&_@c_=9d`l}iqL{jkFID!Iup4^VAaI;vmE z{mzw`Yv}{u-+ki1Y2&qAIr4qA0v|{bU>w9$;uXk(78hk4x7hqW)fR z;QGFrO1n`Vl#=ST03LcY$tRcEH~%uPeJ%Kz!TCDFBnDRBj&_0*?6TM!R_UFxEv{b+ z!7=1J$}cI|m9aC2k0rcKXDVXMAamKrk4k4(^b(KJ3j+o9z&bk*Cj~ z>#d&ZdlZ$B!d_dEP@B${Fk+*ZiL7)%-Z|b~`Do|p^kGfDAxziln&O@0Cc+G5)*gdJ zY))npkn$t3Jn_fe8~!SG_D{8WIt)y;+IzX + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim new file mode 100644 index 00000000..32886984 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim @@ -0,0 +1,152 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +let s:go_decls_var = { + \ 'init': 'ctrlp#decls#init()', + \ 'exit': 'ctrlp#decls#exit()', + \ 'enter': 'ctrlp#decls#enter()', + \ 'accept': 'ctrlp#decls#accept', + \ 'lname': 'declarations', + \ 'sname': 'decls', + \ 'type': 'tabs', + \} + +if exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) + let g:ctrlp_ext_vars = add(g:ctrlp_ext_vars, s:go_decls_var) +else + let g:ctrlp_ext_vars = [s:go_decls_var] +endif + +function! ctrlp#decls#init() abort + cal s:enable_syntax() + return s:decls +endfunction + +function! ctrlp#decls#exit() abort + unlet! s:decls s:target +endfunction + +" The action to perform on the selected string +" Arguments: +" a:mode the mode that has been chosen by pressing or +" the values are 'e', 'v', 't' and 'h', respectively +" a:str the selected string +function! ctrlp#decls#accept(mode, str) abort + try + let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|') + + " i.e: main.go + let filename = vals[1] + let line = vals[2] + let col = vals[3] + + " i.e: /Users/fatih/vim-go/main.go + let filepath = fnamemodify(filename, ":p") + + " acceptile is a very versatile method, + call ctrlp#acceptfile(a:mode, filepath) + call cursor(line, col) + silent! norm! zvzz + endtry +endfunction + +function! ctrlp#decls#enter() abort + let s:decls = [] + + let l:cmd = ['motion', + \ '-format', 'vim', + \ '-mode', 'decls', + \ '-include', go#config#DeclsIncludes(), + \ ] + + call go#cmd#autowrite() + + if s:mode == 0 + " current file mode + let l:fname = expand("%:p") + if exists('s:target') + let l:fname = s:target + endif + + let cmd += ['-file', l:fname] + else + " all functions mode + let l:dir = expand("%:p:h") + if exists('s:target') + let l:dir = s:target + endif + + let cmd += ['-dir', l:dir] + endif + + let [l:out, l:err] = go#util#Exec(l:cmd) + if l:err + call go#util#EchoError(l:out) + return + endif + + let result = eval(out) + if type(result) != 4 || !has_key(result, 'decls') + return + endif + + let decls = result.decls + + " find the maximum function name + let max_len = 0 + for decl in decls + if len(decl.ident)> max_len + let max_len = len(decl.ident) + endif + endfor + + for decl in decls + " paddings + let space = " " + for i in range(max_len - len(decl.ident)) + let space .= " " + endfor + + call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", + \ decl.ident . space, + \ decl.keyword, + \ fnamemodify(decl.filename, ":p"), + \ decl.line, + \ decl.col, + \ decl.full, + \)) + endfor +endfunc + +function! s:enable_syntax() abort + if !(has('syntax') && exists('g:syntax_on')) + return + endif + + syntax match CtrlPIdent '\zs\h\+\ze\s' + syntax match CtrlPKeyword '\zs[^\t|]\+\ze|[^|]\+:\d\+:\d\+|' + syntax match CtrlPFilename '|\zs[^|]\+:\d\+:\d\+\ze|' + syntax match CtrlPSignature '\zs\t.*\ze$' contains=CtrlPKeyWord,CtrlPFilename + + highlight link CtrlPIdent Function + highlight link CtrlPKeyword Keyword + highlight link CtrlPFilename SpecialComment + highlight link CtrlPSignature Comment +endfunction + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) + +function! ctrlp#decls#cmd(mode, ...) abort + let s:mode = a:mode + if a:0 && !empty(a:1) + let s:target = a:1 + endif + return s:id +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/fzf/decls.vim b/sources_non_forked/vim-go/autoload/fzf/decls.vim new file mode 100644 index 00000000..6182e0ee --- /dev/null +++ b/sources_non_forked/vim-go/autoload/fzf/decls.vim @@ -0,0 +1,155 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! s:code(group, attr) abort + let code = synIDattr(synIDtrans(hlID(a:group)), a:attr, "cterm") + if code =~ '^[0-9]\+$' + return code + endif +endfunction + +function! s:color(str, group) abort + let fg = s:code(a:group, "fg") + let bg = s:code(a:group, "bg") + let bold = s:code(a:group, "bold") + let italic = s:code(a:group, "italic") + let reverse = s:code(a:group, "reverse") + let underline = s:code(a:group, "underline") + let color = (empty(fg) ? "" : ("38;5;".fg)) . + \ (empty(bg) ? "" : (";48;5;".bg)) . + \ (empty(bold) ? "" : ";1") . + \ (empty(italic) ? "" : ";3") . + \ (empty(reverse) ? "" : ";7") . + \ (empty(underline) ? "" : ";4") + return printf("\x1b[%sm%s\x1b[m", color, a:str) +endfunction + +function! s:sink(str) abort + if len(a:str) < 2 + return + endif + try + " we jump to the file directory so we can get the fullpath via fnamemodify + " below + let l:dir = go#util#Chdir(s:current_dir) + + let vals = matchlist(a:str[1], '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|') + + " i.e: main.go + let filename = vals[1] + let line = vals[2] + let col = vals[3] + + " i.e: /Users/fatih/vim-go/main.go + let filepath = fnamemodify(filename, ":p") + + let cmd = get({'ctrl-x': 'split', + \ 'ctrl-v': 'vertical split', + \ 'ctrl-t': 'tabe'}, a:str[0], 'e') + execute cmd fnameescape(filepath) + call cursor(line, col) + silent! norm! zvzz + finally + "jump back to old dir + call go#util#Chdir(l:dir) + endtry +endfunction + +function! s:source(mode,...) abort + let s:current_dir = expand('%:p:h') + let ret_decls = [] + + let l:cmd = ['motion', + \ '-format', 'vim', + \ '-mode', 'decls', + \ '-include', go#config#DeclsIncludes(), + \ ] + + call go#cmd#autowrite() + + if a:mode == 0 + " current file mode + let l:fname = expand("%:p") + if a:0 && !empty(a:1) + let l:fname = a:1 + endif + + let cmd += ['-file', l:fname] + else + " all functions mode + if a:0 && !empty(a:1) + let s:current_dir = a:1 + endif + + let l:cmd += ['-dir', s:current_dir] + endif + + let [l:out, l:err] = go#util#Exec(l:cmd) + if l:err + call go#util#EchoError(l:out) + return + endif + + let result = eval(out) + if type(result) != 4 || !has_key(result, 'decls') + return ret_decls + endif + + let decls = result.decls + + " find the maximum function name + let max_len = 0 + for decl in decls + if len(decl.ident)> max_len + let max_len = len(decl.ident) + endif + endfor + + for decl in decls + " paddings + let space = " " + for i in range(max_len - len(decl.ident)) + let space .= " " + endfor + + let pos = printf("|%s:%s:%s|", + \ fnamemodify(decl.filename, ":t"), + \ decl.line, + \ decl.col + \) + call add(ret_decls, printf("%s\t%s\t%s\t%s", + \ s:color(decl.ident . space, "goDeclsFzfFunction"), + \ s:color(decl.keyword, "goDeclsFzfKeyword"), + \ s:color(decl.full, "goDeclsFzfComment"), + \ s:color(pos, "goDeclsFzfSpecialComment"), + \)) + endfor + + return sort(ret_decls) +endfunc + +function! fzf#decls#cmd(...) abort + let normal_fg = s:code("Normal", "fg") + let normal_bg = s:code("Normal", "bg") + let cursor_fg = s:code("CursorLine", "fg") + let cursor_bg = s:code("CursorLine", "bg") + let colors = printf(" --color %s%s%s%s%s", + \ &background, + \ empty(normal_fg) ? "" : (",fg:".normal_fg), + \ empty(normal_bg) ? "" : (",bg:".normal_bg), + \ empty(cursor_fg) ? "" : (",fg+:".cursor_fg), + \ empty(cursor_bg) ? "" : (",bg+:".cursor_bg), + \) + call fzf#run(fzf#wrap('GoDecls', { + \ 'source': call('source', a:000), + \ 'options': printf('-n 1 --with-nth 1,2 --delimiter=$''\t'' --preview "echo {3}" --preview-window "wrap" --ansi --prompt "GoDecls> " --expect=ctrl-t,ctrl-v,ctrl-x%s', colors), + \ 'sink*': function('s:sink') + \ })) +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/alternate.vim b/sources_non_forked/vim-go/autoload/go/alternate.vim new file mode 100644 index 00000000..a0671905 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/alternate.vim @@ -0,0 +1,35 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +" Test alternates between the implementation of code and the test code. +function! go#alternate#Switch(bang, cmd) abort + let file = expand('%') + if empty(file) + call go#util#EchoError("no buffer name") + return + elseif file =~# '^\f\+_test\.go$' + let l:root = split(file, '_test.go$')[0] + let l:alt_file = l:root . ".go" + elseif file =~# '^\f\+\.go$' + let l:root = split(file, ".go$")[0] + let l:alt_file = l:root . '_test.go' + else + call go#util#EchoError("not a go file") + return + endif + if !filereadable(alt_file) && !bufexists(alt_file) && !a:bang + call go#util#EchoError("couldn't find ".alt_file) + return + elseif empty(a:cmd) + execute ":" . go#config#AlternateMode() . " " . alt_file + else + execute ":" . a:cmd . " " . alt_file + endif +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/asmfmt.vim b/sources_non_forked/vim-go/autoload/go/asmfmt.vim new file mode 100644 index 00000000..9aa5f470 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/asmfmt.vim @@ -0,0 +1,76 @@ +" asmfmt.vim: Vim command to format Go asm files with asmfmt +" (github.com/klauspost/asmfmt). +" +" This filetype plugin adds new commands for asm buffers: +" +" :Fmt +" +" Filter the current asm buffer through asmfmt. +" It tries to preserve cursor position and avoids +" replacing the buffer with stderr output. +" +" Options: +" +" g:go_asmfmt_autosave [default=0] +" +" Flag to automatically call :Fmt when file is saved. + +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +let s:got_fmt_error = 0 + +" This is a trimmed-down version of the logic in fmt.vim. + +function! go#asmfmt#Format() abort + " Save state. + let l:curw = winsaveview() + + " Write the current buffer to a tempfile. + let l:tmpname = tempname() + call writefile(go#util#GetLines(), l:tmpname) + + " Run asmfmt. + let [l:out, l:err] = go#util#Exec(['asmfmt', '-w', l:tmpname]) + if l:err + call go#util#EchoError(l:out) + return + endif + + " Remove undo point caused by BufWritePre. + try | silent undojoin | catch | endtry + + " Replace the current file with the temp file; then reload the buffer. + let old_fileformat = &fileformat + + " save old file permissions + let original_fperm = getfperm(expand('%')) + call rename(l:tmpname, expand('%')) + + " restore old file permissions + call setfperm(expand('%'), original_fperm) + silent edit! + let &fileformat = old_fileformat + let &syntax = &syntax + + " Restore the cursor/window positions. + call winrestview(l:curw) +endfunction + +function! go#asmfmt#ToggleAsmFmtAutoSave() abort + if go#config#AsmfmtAutosave() + call go#config#SetAsmfmtAutosave(1) + call go#util#EchoProgress("auto asmfmt enabled") + return + end + + call go#config#SetAsmfmtAutosave(0) + call go#util#EchoProgress("auto asmfmt disabled") +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/auto.vim b/sources_non_forked/vim-go/autoload/go/auto.vim new file mode 100644 index 00000000..8c25271e --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/auto.vim @@ -0,0 +1,203 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! go#auto#template_autocreate() + if !go#config#TemplateAutocreate() || !&modifiable + return + endif + + " create new template from scratch + call go#template#create() +endfunction + +function! go#auto#complete_done() + if &omnifunc isnot 'go#complete#Complete' + return + endif + + call s:echo_go_info() + call s:ExpandSnippet() +endfunction + +function! s:ExpandSnippet() abort + if !exists('v:completed_item') || empty(v:completed_item) || !go#config#GoplsUsePlaceholders() + return + endif + + + let l:engine = go#config#SnippetEngine() + + if l:engine is 'ultisnips' + if !get(g:, 'did_plugin_ultisnips', 0) + return + endif + " the snippet may have a '{\}' in it. For UltiSnips, that should be spelled + " \{}. fmt.Printf is such a snippet that can be used to demonstrate. + let l:snippet = substitute(v:completed_item.word, '{\\}', '\{}', 'g') + call UltiSnips#Anon(l:snippet, v:completed_item.word, '', 'i') +" elseif l:engine is 'neosnippet' +" " TODO(bc): make the anonymous expansion for neosnippet work +" +" if !get(g:, 'loaded_neosnippet') is 1 +" return +" endif +" +" " neosnippet#anonymous doesn't need a trigger, so replace the +" " completed_item.word with an empty string before calling neosnippet#anonymous +" let l:snippet = substitute(v:completed_item.word, '{\\}', '\{\}', 'g') +" call setline('.', substitute(getline('.'), substitute(v:completed_item.word, '\', '\\', 'g'), '', '')) +" call neosnippet#anonymous(l:snippet) + endif +endfunction + +function! s:echo_go_info() + if !go#config#EchoGoInfo() + return + endif + + if !exists('v:completed_item') || empty(v:completed_item) + return + endif + let item = v:completed_item + + if !has_key(item, "user_data") + return + endif + + if empty(item.user_data) + return + endif + + redraws! | echo "vim-go: " | echohl Function | echon item.user_data | echohl None +endfunction + +let s:timer_id = 0 + +" go#auto#update_autocmd() will be called on BufEnter,CursorHold. This +" configures the augroup according to conditions below. +" +" | # | has_timer | should_enable | do | +" |---|-----------|---------------|------------------------------------| +" | 1 | false | false | return early | +" | 2 | true | true | return early | +" | 3 | true | false | clear the group and stop the timer | +" | 4 | false | true | configure the group | +function! go#auto#update_autocmd() + let has_timer = get(b:, 'has_timer') + let should_enable = go#config#AutoTypeInfo() || go#config#AutoSameids() + if (!has_timer && !should_enable) || (has_timer && should_enable) + return + endif + + if has_timer + augroup vim-go-buffer-auto + autocmd! * + augroup END + let b:has_timer = 0 + call s:timer_stop() + return + endif + + augroup vim-go-buffer-auto + autocmd! * + autocmd CursorMoved call s:timer_restart() + autocmd BufLeave call s:timer_stop() + augroup END + let b:has_timer = 1 + call s:timer_start() +endfunction + +function! s:timer_restart() + if isdirectory(expand('%:p:h')) + call s:timer_stop() + call s:timer_start() + endif +endfunction + +function! s:timer_stop() + if s:timer_id + call timer_stop(s:timer_id) + let s:timer_id = 0 + endif +endfunction + +function! s:timer_start() + let s:timer_id = timer_start(go#config#Updatetime(), function('s:handler')) +endfunction + +function! s:handler(timer_id) + if go#config#AutoTypeInfo() + call go#tool#Info(0) + endif + if go#config#AutoSameids() + call go#guru#SameIds(0) + endif + let s:timer_id = 0 +endfunction + +function! go#auto#fmt_autosave() + if !(isdirectory(expand('%:p:h')) && resolve(expand(':p')) == expand('%:p')) + return + endif + + if !(go#config#FmtAutosave() || go#config#ImportsAutosave()) + return + endif + + " Order matters when formatting and adjusting imports, because of gopls' + " support for gofumpt. Gofumpt formatting will group all imports that look + " like a stdlib package (e.g. there's no '.' in the package path) together. + " When the local setting is provided, the only way to get the local imports + " grouped separately when gofumpt is used to format is to format first and + " then organize imports. + + if go#config#FmtAutosave() && !(go#config#ImportsAutosave() && go#config#ImportsMode() == 'goimports') + call go#fmt#Format(0) + + " return early when the imports mode is goimports, because there's no need + " to format again when goimports was run + if go#config#FmtCommand() == 'goimports' + return + endif + endif + + if !go#config#ImportsAutosave() + return + endif + + call go#fmt#Format(1) +endfunction + +function! go#auto#metalinter_autosave() + if !go#config#MetalinterAutosave() || !isdirectory(expand('%:p:h')) + return + endif + + " run gometalinter on save + call go#lint#Gometa(!g:go_jump_to_error, 1) +endfunction + +function! go#auto#modfmt_autosave() + if !(go#config#ModFmtAutosave() && isdirectory(expand('%:p:h')) && resolve(expand(':p')) == expand('%:p')) + return + endif + + " go.mod code formatting on save + call go#mod#Format() +endfunction + +function! go#auto#asmfmt_autosave() + if !(go#config#AsmfmtAutosave() && isdirectory(expand('%:p:h')) && resolve(expand(':p')) == expand('%:p')) + return + endif + + " Go asm formatting on save + call go#asmfmt#Format() +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/calls.vim b/sources_non_forked/vim-go/autoload/go/calls.vim new file mode 100644 index 00000000..0585b9ce --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/calls.vim @@ -0,0 +1,32 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! go#calls#Callers() abort + if !go#config#GoplsEnabled() + call go#util#EchoError("gopls is disabled") + return + endif + let [l:line, l:col] = getpos('.')[1:2] + let [l:line, l:col] = go#lsp#lsp#Position(l:line, l:col) + let l:fname = expand('%:p') + call go#lsp#Callers(l:fname, l:line, l:col, funcref('s:parse_output', ['callers'])) + return +endfunction + +" This uses Vim's errorformat to parse the output and put it into a quickfix +" or locationlist. +function! s:parse_output(mode, output) abort + let errformat = ",%f:%l:%c:\ %m" + let l:listtype = go#list#Type("GoCallers") + call go#list#ParseFormat(l:listtype, errformat, a:output, a:mode, 0) + + let errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(errors)) +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/calls_test.vim b/sources_non_forked/vim-go/autoload/go/calls_test.vim new file mode 100644 index 00000000..a8a8377b --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/calls_test.vim @@ -0,0 +1,48 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +scriptencoding utf-8 + +func! Test_Callers() abort + try + let l:tmp = gotest#write_file('calls/caller.go', [ + \ 'package main', + \ '', + \ 'import "fmt"', + \ '', + \ 'func Quux() {}', + \ '', + \ 'func main() {', + \ "\tQ\x1fuux()", + \ "\tQuux()", + \ '', + \ "\tfmt.Println(\"vim-go\")", + \ '}', + \ ]) + + let l:expected = [ + \ {'lnum': 8, 'bufnr': bufnr(''), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'main'}, + \ {'lnum': 9, 'bufnr': bufnr(''), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'main'}, + \ ] + + call go#calls#Callers() + + let l:actual = getloclist(0) + let l:start = reltime() + while len(l:actual) != len(l:expected) && reltimefloat(reltime(l:start)) < 10 + sleep 100m + let l:actual = getloclist(0) + endwhile + + call gotest#assert_quickfix(l:actual, l:expected) + finally + call delete(l:tmp, 'rf') + endtry +endfunc + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim new file mode 100644 index 00000000..dfef3d03 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -0,0 +1,375 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! go#cmd#autowrite() abort + if &autowrite == 1 || &autowriteall == 1 + silent! wall + else + for l:nr in range(0, bufnr('$')) + if buflisted(l:nr) && getbufvar(l:nr, '&modified') + " Sleep one second to make sure people see the message. Otherwise it is + " often immediately overwritten by the async messages (which also + " doesn't invoke the "hit ENTER" prompt). + call go#util#EchoWarning('[No write since last change]') + sleep 1 + return + endif + endfor + endif +endfunction + +" Build builds the source code without producing any output binary. We live in +" an editor so the best is to build it to catch errors and fix them. By +" default it tries to call simply 'go build', but it first tries to get all +" dependent files for the current folder and passes it to go build. +function! go#cmd#Build(bang, ...) abort + " Create our command arguments. go build discards any results when it + " compiles multiple packages. So we pass the `errors` package just as an + " placeholder with the current folder (indicated with '.'). + let l:args = + \ ['build', '-tags', go#config#BuildTags()] + + \ map(copy(a:000), "expand(v:val)") + + \ [".", "errors"] + + " Vim and Neovim async + if go#util#has_job() + call s:cmd_job({ + \ 'cmd': ['go'] + args, + \ 'bang': a:bang, + \ 'for': 'GoBuild', + \ 'statustype': 'build' + \}) + + " Vim without async + else + let l:status = { + \ 'desc': 'current status', + \ 'type': 'build', + \ 'state': "started", + \ } + call go#statusline#Update(expand('%:p:h'), l:status) + + let default_makeprg = &makeprg + let &makeprg = "go " . join(go#util#Shelllist(args), ' ') + + let l:listtype = go#list#Type("GoBuild") + " execute make inside the source folder so we can parse the errors + " correctly + try + let l:dir = go#util#Chdir(expand("%:p:h")) + if l:listtype == "locationlist" + silent! exe 'lmake!' + else + silent! exe 'make!' + endif + redraw! + finally + call go#util#Chdir(l:dir) + let &makeprg = default_makeprg + endtry + + let errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(errors)) + if !empty(errors) && !a:bang + call go#list#JumpToFirst(l:listtype) + let l:status.state = 'failed' + else + let l:status.state = 'success' + if go#config#EchoCommandInfo() + call go#util#EchoSuccess("[build] SUCCESS") + endif + endif + call go#statusline#Update(expand('%:p:h'), l:status) + endif + +endfunction + + +" BuildTags sets or shows the current build tags used for tools +function! go#cmd#BuildTags(bang, ...) abort + if a:0 + let v = a:1 + if v == '""' || v == "''" + let v = "" + endif + call go#config#SetBuildTags(v) + let tags = go#config#BuildTags() + if empty(tags) + call go#util#EchoSuccess("build tags are cleared") + else + call go#util#EchoSuccess("build tags are changed to: " . tags) + endif + + return + endif + + let tags = go#config#BuildTags() + if empty(tags) + call go#util#EchoSuccess("build tags are not set") + else + call go#util#EchoSuccess("current build tags: " . tags) + endif +endfunction + + +" Run runs the current file (and their dependencies if any) in a new terminal. +function! go#cmd#RunTerm(bang, mode, files) abort + let cmd = ["go", "run"] + if len(go#config#BuildTags()) > 0 + call extend(cmd, ["-tags", go#config#BuildTags()]) + endif + + if empty(a:files) + call extend(cmd, go#tool#Files()) + else + call extend(cmd, map(copy(a:files), funcref('s:expandRunArgs'))) + endif + call go#term#newmode(a:bang, cmd, s:runerrorformat(), a:mode) +endfunction + +" Run runs the current file (and their dependencies if any) and outputs it. +" This is intended to test small programs and play with them. It's not +" suitable for long running apps, because vim is blocking by default and +" calling long running apps will block the whole UI. +function! go#cmd#Run(bang, ...) abort + if go#config#TermEnabled() + call go#cmd#RunTerm(a:bang, '', a:000) + return + endif + + if go#util#has_job() + " NOTE(arslan): 'term': 'open' case is not implement for +jobs. This means + " executions waiting for stdin will not work. That's why we don't do + " anything. Once this is implemented we're going to make :GoRun async + endif + + let l:status = { + \ 'desc': 'current status', + \ 'type': 'run', + \ 'state': "started", + \ } + + call go#statusline#Update(expand('%:p:h'), l:status) + + let l:cmd = ['go', 'run'] + let l:tags = go#config#BuildTags() + if len(l:tags) > 0 + let l:cmd = l:cmd + ['-tags', l:tags] + endif + + if a:0 == 0 + let l:files = go#tool#Files() + else + let l:files = map(copy(a:000), funcref('s:expandRunArgs')) + endif + + let l:cmd = l:cmd + l:files + + if go#util#IsWin() + if go#util#HasDebug('shell-commands') + call go#util#EchoInfo(printf('shell command: %s', string(l:cmd))) + endif + try + let l:dir = go#util#Chdir(expand("%:p:h")) + exec printf('!%s', go#util#Shelljoin(l:cmd, 1)) + finally + call go#util#Chdir(l:dir) + endtry + + let l:status.state = 'success' + if v:shell_error + let l:status.state = 'failed' + if go#config#EchoCommandInfo() + redraws! + call go#util#EchoError('[run] FAILED') + endif + else + if go#config#EchoCommandInfo() + redraws! + call go#util#EchoSuccess('[run] SUCCESS') + endif + endif + + call go#statusline#Update(expand('%:p:h'), l:status) + return + endif + + " :make expands '%' and '#' wildcards, so they must also be escaped + let l:default_makeprg = &makeprg + let &makeprg = go#util#Shelljoin(l:cmd, 1) + + let l:listtype = go#list#Type("GoRun") + + let l:status.state = 'success' + + let l:dir = go#util#Chdir(expand("%:p:h")) + try + " backup user's errorformat, will be restored once we are finished + let l:old_errorformat = &errorformat + let &errorformat = s:runerrorformat() + + if go#util#HasDebug('shell-commands') + call go#util#EchoInfo(printf('shell command: %s', string(l:cmd))) + endif + + if l:listtype == "locationlist" + exe 'lmake!' + else + exe 'make!' + endif + finally + call go#util#Chdir(l:dir) + let &errorformat = l:old_errorformat + let &makeprg = l:default_makeprg + endtry + + let l:errors = go#list#Get(l:listtype) + + call go#list#Window(l:listtype, len(l:errors)) + if !empty(l:errors) + let l:status.state = 'failed' + if !a:bang + call go#list#JumpToFirst(l:listtype) + endif + endif + call go#statusline#Update(expand('%:p:h'), l:status) +endfunction + +" Install installs the package by simple calling 'go install'. If any argument +" is given(which are passed directly to 'go install') it tries to install +" those packages. Errors are populated in the location window. +function! go#cmd#Install(bang, ...) abort + " use vim's job functionality to call it asynchronously + if go#util#has_job() + " expand all wildcards(i.e: '%' to the current file name) + let goargs = map(copy(a:000), "expand(v:val)") + + call s:cmd_job({ + \ 'cmd': ['go', 'install', '-tags', go#config#BuildTags()] + goargs, + \ 'bang': a:bang, + \ 'for': 'GoInstall', + \ 'statustype': 'install' + \}) + return + endif + + let default_makeprg = &makeprg + + " :make expands '%' and '#' wildcards, so they must also be escaped + let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) + let &makeprg = "go install " . goargs + + let l:listtype = go#list#Type("GoInstall") + " execute make inside the source folder so we can parse the errors + " correctly + try + let l:dir = go#util#Chdir(expand("%:p:h")) + if l:listtype == "locationlist" + silent! exe 'lmake!' + else + silent! exe 'make!' + endif + redraw! + finally + call go#util#Chdir(l:dir) + let &makeprg = default_makeprg + endtry + + let errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(errors)) + if !empty(errors) && !a:bang + call go#list#JumpToFirst(l:listtype) + else + call go#util#EchoSuccess("installed to ". go#path#Default()) + endif +endfunction + +" Generate runs 'go generate' in similar fashion to go#cmd#Build() +function! go#cmd#Generate(bang, ...) abort + let default_makeprg = &makeprg + + " :make expands '%' and '#' wildcards, so they must also be escaped + let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) + if go#util#ShellError() != 0 + let &makeprg = "go generate " . goargs + else + let gofiles = go#util#Shelljoin(go#tool#Files(), 1) + let &makeprg = "go generate " . goargs . ' ' . gofiles + endif + + let l:status = { + \ 'desc': 'current status', + \ 'type': 'generate', + \ 'state': "started", + \ } + call go#statusline#Update(expand('%:p:h'), l:status) + + if go#config#EchoCommandInfo() + call go#util#EchoProgress('generating ...') + endif + + let l:listtype = go#list#Type("GoGenerate") + + try + if l:listtype == "locationlist" + silent! exe 'lmake!' + else + silent! exe 'make!' + endif + finally + redraw! + let &makeprg = default_makeprg + endtry + + let errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(errors)) + if !empty(errors) + let l:status.status = 'failed' + if !a:bang + call go#list#JumpToFirst(l:listtype) + endif + else + let l:status.status = 'success' + if go#config#EchoCommandInfo() + redraws! + call go#util#EchoSuccess('[generate] SUCCESS') + endif + endif + call go#statusline#Update(expand(':%:p:h'), l:status) +endfunction + +function! s:runerrorformat() + let l:panicaddress = "%\\t%#%f:%l +0x%[0-9A-Fa-f]%\\+" + let l:errorformat = '%A' . l:panicaddress . "," . &errorformat + return l:errorformat +endfunction + +" s:expandRunArgs expands arguments for go#cmd#Run according to the +" documentation of :GoRun. When val is a readable file, it is expanded to the +" full path so that go run can be executed in the current buffer's directory. +" val is return unaltered otherwise to support non-file arguments to go run. +function! s:expandRunArgs(idx, val) abort + let l:val = expand(a:val) + if !filereadable(l:val) + return l:val + endif + + return fnamemodify(l:val, ':p')") +endfunction +" --------------------- +" | Vim job callbacks | +" --------------------- + +function! s:cmd_job(args) abort + " autowrite is not enabled for jobs + call go#cmd#autowrite() + + call go#job#Spawn(a:args.cmd, a:args) +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/cmd_test.vim b/sources_non_forked/vim-go/autoload/go/cmd_test.vim new file mode 100644 index 00000000..bd813845 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/cmd_test.vim @@ -0,0 +1,37 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +func! Test_GoBuildErrors() + try + let l:filename = 'cmd/bad.go' + let l:tmp = gotest#load_fixture(l:filename) + + " set the compiler type so that the errorformat option will be set + " correctly. + compiler go + + let expected = [{'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'undefined: notafunc'}] + " clear the quickfix lists + call setqflist([], 'r') + + call go#cmd#Build(1) + + let actual = getqflist() + let start = reltime() + while len(actual) == 0 && reltimefloat(reltime(start)) < 10 + sleep 100m + let actual = getqflist() + endwhile + + call gotest#assert_quickfix(actual, l:expected) + finally + call delete(l:tmp, 'rf') + endtry +endfunc + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim new file mode 100644 index 00000000..b256e8cf --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -0,0 +1,67 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +" go#complete#GoInfo returns the description of the identifier under the +" cursor. +function! go#complete#GetInfo() abort + return go#lsp#GetInfo() +endfunction + +function! go#complete#Complete(findstart, base) abort + if !go#config#GoplsEnabled() + return -3 + endif + + let l:state = {'done': 0, 'matches': [], 'start': -1} + + function! s:handler(state, start, matches) abort dict + let a:state.start = a:start + let a:state.matches = a:matches + let a:state.done = 1 + endfunction + + "findstart = 1 when we need to get the start of the match + if a:findstart == 1 + let [l:line, l:col] = getpos('.')[1:2] + let [l:line, l:col] = go#lsp#lsp#Position(l:line, l:col) + let l:completion = go#lsp#Completion(expand('%:p'), l:line, l:col, funcref('s:handler', [l:state])) + if l:completion + return -3 + endif + + while !l:state.done + sleep 10m + endwhile + + if len(l:state.matches) == 0 + " no matches. cancel and leave completion mode. + call go#util#EchoInfo("no matches") + return -3 + endif + + let s:completions = l:state.matches + + return go#lsp#lsp#PositionOf(getline(l:line+1), l:state.start-1) + + else "findstart = 0 when we need to return the list of completions + return s:completions + endif +endfunction + +function! go#complete#ToggleAutoTypeInfo() abort + if go#config#AutoTypeInfo() + call go#config#SetAutoTypeInfo(0) + call go#util#EchoProgress("auto type info disabled") + else + call go#config#SetAutoTypeInfo(1) + call go#util#EchoProgress("auto type info enabled") + endif + call go#auto#update_autocmd() +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/complete_test.vim b/sources_non_forked/vim-go/autoload/go/complete_test.vim new file mode 100644 index 00000000..ee00056c --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/complete_test.vim @@ -0,0 +1,29 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +func! Test_GetInfo_gopls() + let g:go_info_mode = 'gopls' + call s:getinfo() + unlet g:go_info_mode +endfunction + +func! s:getinfo() + let l:filename = 'complete/complete.go' + let l:tmp = gotest#load_fixture(l:filename) + try + call cursor(8, 3) + + let expected = 'func Example(s string)' + let actual = go#complete#GetInfo() + call assert_equal(expected, actual) + finally + call delete(l:tmp, 'rf') + endtry +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/config.vim b/sources_non_forked/vim-go/autoload/go/config.vim new file mode 100644 index 00000000..ea51f0d7 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/config.vim @@ -0,0 +1,632 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! go#config#ListTypeCommands() abort + return get(g:, 'go_list_type_commands', {}) +endfunction + +function! go#config#VersionWarning() abort + return get(g:, 'go_version_warning', 1) +endfunction + +function! go#config#BuildTags() abort + return get(g:, 'go_build_tags', '') +endfunction + +function! go#config#SetBuildTags(value) abort + if a:value is '' + silent! unlet g:go_build_tags + call go#lsp#ResetWorkspaceDirectories() + return + endif + + let g:go_build_tags = a:value + call go#lsp#ResetWorkspaceDirectories() +endfunction + +function! go#config#TestTimeout() abort + return get(g:, 'go_test_timeout', '10s') +endfunction + +function! go#config#TestShowName() abort + return get(g:, 'go_test_show_name', 0) +endfunction + +function! go#config#TermHeight() abort + return get(g:, 'go_term_height', winheight(0)) +endfunction + +function! go#config#TermWidth() abort + return get(g:, 'go_term_width', winwidth(0)) +endfunction + +function! go#config#TermMode() abort + return get(g:, 'go_term_mode', 'vsplit') +endfunction + +function! go#config#TermCloseOnExit() abort + return get(g:, 'go_term_close_on_exit', 1) +endfunction + +function! go#config#TermReuse() abort + return get(g:, 'go_term_reuse', 0) +endfunction + +function! go#config#SetTermCloseOnExit(value) abort + let g:go_term_close_on_exit = a:value +endfunction + +function! go#config#TermEnabled() abort + " nvim always support + " vim will support if terminal feature exists + let l:support = has('nvim') || has('terminal') + return support && get(g:, 'go_term_enabled', 0) +endfunction + +function! go#config#SetTermEnabled(value) abort + let g:go_term_enabled = a:value +endfunction + +function! go#config#TemplateUsePkg() abort + return get(g:, 'go_template_use_pkg', 0) +endfunction + +function! go#config#TemplateTestFile() abort + return get(g:, 'go_template_test_file', "hello_world_test.go") +endfunction + +function! go#config#TemplateFile() abort + return get(g:, 'go_template_file', "hello_world.go") +endfunction + +function! go#config#StatuslineDuration() abort + return get(g:, 'go_statusline_duration', 60000) +endfunction + +function! go#config#SnippetEngine() abort + let l:engine = get(g:, 'go_snippet_engine', 'automatic') + if l:engine is? "automatic" + if get(g:, 'did_plugin_ultisnips') is 1 + let l:engine = 'ultisnips' + elseif get(g:, 'loaded_neosnippet') is 1 + let l:engine = 'neosnippet' + elseif get(g:, 'loaded_minisnip') is 1 + let l:engine = 'minisnip' + endif + endif + + return l:engine +endfunction + +function! go#config#PlayBrowserCommand() abort + if go#util#IsWin() + let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' + elseif go#util#IsMac() + let go_play_browser_command = 'open %URL%' + elseif executable('xdg-open') + let go_play_browser_command = 'xdg-open %URL%' + elseif executable('firefox') + let go_play_browser_command = 'firefox %URL% &' + elseif executable('chromium') + let go_play_browser_command = 'chromium %URL% &' + else + let go_play_browser_command = '' + endif + + return get(g:, 'go_play_browser_command', go_play_browser_command) +endfunction + +function! go#config#MetalinterDeadline() abort + " gometalinter has a default deadline of 5 seconds only when asynchronous + " jobs are not supported. + + let deadline = '5s' + if go#util#has_job() && has('lambda') + let deadline = '' + endif + + return get(g:, 'go_metalinter_deadline', deadline) +endfunction + +function! go#config#ListType() abort + return get(g:, 'go_list_type', '') +endfunction + +function! go#config#ListAutoclose() abort + return get(g:, 'go_list_autoclose', 1) +endfunction + +function! go#config#InfoMode() abort + return get(g:, 'go_info_mode', 'gopls') +endfunction + +function! go#config#GuruScope() abort + let scope = get(g:, 'go_guru_scope', []) + + if !empty(scope) + " strip trailing slashes for each path in scope. bug: + " https://github.com/golang/go/issues/14584 + let scopes = go#util#StripTrailingSlash(scope) + endif + + return scope +endfunction + +function! go#config#SetGuruScope(scope) abort + if empty(a:scope) + if exists('g:go_guru_scope') + unlet g:go_guru_scope + endif + else + let g:go_guru_scope = a:scope + endif +endfunction + +function! go#config#EchoCommandInfo() abort + return get(g:, 'go_echo_command_info', 1) +endfunction + +function! go#config#DocUrl() abort + let godoc_url = get(g:, 'go_doc_url', 'https://pkg.go.dev') + if godoc_url isnot 'https://pkg.go.dev' + " strip last '/' character if available + let last_char = strlen(godoc_url) - 1 + if godoc_url[last_char] == '/' + let godoc_url = strpart(godoc_url, 0, last_char) + endif + " custom godoc installations expect /pkg before package names + let godoc_url .= "/pkg" + endif + return godoc_url +endfunction + +function! go#config#DocPopupWindow() abort + return get(g:, 'go_doc_popup_window', 0) +endfunction +function! go#config#DefReuseBuffer() abort + return get(g:, 'go_def_reuse_buffer', 0) +endfunction + +function! go#config#DefMode() abort + return get(g:, 'go_def_mode', 'gopls') +endfunction + +function! go#config#DeclsIncludes() abort + return get(g:, 'go_decls_includes', 'func,type') +endfunction + +function! go#config#Debug() abort + return get(g:, 'go_debug', []) +endfunction + +function! go#config#DebugWindows() abort + return get(g:, 'go_debug_windows', { + \ 'vars': 'leftabove 30vnew', + \ 'stack': 'leftabove 20new', + \ 'goroutines': 'botright 10new', + \ 'out': 'botright 5new', + \ } + \ ) + +endfunction + +function! go#config#DebugSubstitutePaths() abort + return get(g:, 'go_debug_substitute_paths', []) +endfunction + +function! go#config#DebugPreserveLayout() abort + return get(g:, 'go_debug_preserve_layout', 0) +endfunction + +function! go#config#DebugAddress() abort + return get(g:, 'go_debug_address', '127.0.0.1:8181') +endfunction + +function! go#config#DebugCommands() abort + " make sure g:go_debug_commands is set so that it can be added to easily. + let g:go_debug_commands = get(g:, 'go_debug_commands', []) + return g:go_debug_commands +endfunction + +function! go#config#DebugLogOutput() abort + return get(g:, 'go_debug_log_output', 'debugger,rpc') +endfunction + +function! go#config#LspLog() abort + " make sure g:go_lsp_log is set so that it can be added to easily. + let g:go_lsp_log = get(g:, 'go_lsp_log', []) + return g:go_lsp_log +endfunction + +function! go#config#SetDebugDiag(value) abort + let g:go_debug_diag = a:value +endfunction + +function! go#config#AutoSameids() abort + return get(g:, 'go_auto_sameids', 0) +endfunction + +function! go#config#SetAutoSameids(value) abort + let g:go_auto_sameids = a:value +endfunction + +function! go#config#AddtagsTransform() abort + return get(g:, 'go_addtags_transform', "snakecase") +endfunction + +function! go#config#AddtagsSkipUnexported() abort + return get(g:, 'go_addtags_skip_unexported', 0) +endfunction + +function! go#config#TemplateAutocreate() abort + return get(g:, "go_template_autocreate", 1) +endfunction + +function! go#config#SetTemplateAutocreate(value) abort + let g:go_template_autocreate = a:value +endfunction + +let s:default_metalinter = 'staticcheck' +function! go#config#MetalinterCommand() abort + return get(g:, 'go_metalinter_command', s:default_metalinter) +endfunction + +function! go#config#MetalinterAutosaveEnabled() abort + let l:default = [] + if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint' + let l:default = ['govet', 'revive'] + endif + + return get(g:, 'go_metalinter_autosave_enabled', l:default) +endfunction + +function! go#config#MetalinterEnabled() abort + let l:default = [] + if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint' + let l:default = ['vet', 'revive', 'errcheck'] + endif + + return get(g:, 'go_metalinter_enabled', l:default) +endfunction + +function! go#config#GolintBin() abort + return get(g:, "go_golint_bin", "revive") +endfunction + +function! go#config#ErrcheckBin() abort + return get(g:, "go_errcheck_bin", "errcheck") +endfunction + +function! go#config#MetalinterAutosave() abort + return get(g:, "go_metalinter_autosave", 0) +endfunction + +function! go#config#SetMetalinterAutosave(value) abort + let g:go_metalinter_autosave = a:value +endfunction + +function! go#config#ListHeight() abort + return get(g:, "go_list_height", 0) +endfunction + +function! go#config#FmtAutosave() abort + return get(g:, "go_fmt_autosave", 1) +endfunction + +function! go#config#ImportsAutosave() abort + return get(g:, 'go_imports_autosave', 1) +endfunction + +function! go#config#SetFmtAutosave(value) abort + let g:go_fmt_autosave = a:value +endfunction + +function! go#config#AsmfmtAutosave() abort + return get(g:, "go_asmfmt_autosave", 0) +endfunction + +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 + +function! go#config#AutoTypeInfo() abort + return get(g:, "go_auto_type_info", 0) +endfunction + +function! go#config#SetAutoTypeInfo(value) abort + let g:go_auto_type_info = a:value +endfunction + +function! go#config#AlternateMode() abort + return get(g:, "go_alternate_mode", "edit") +endfunction + +function! go#config#DeclsMode() abort + return get(g:, "go_decls_mode", "") +endfunction + +function! go#config#FmtCommand() abort + return get(g:, "go_fmt_command", go#config#GoplsEnabled() ? 'gopls' : 'gofmt') +endfunction + +function! go#config#ImportsMode() abort + return get(g:, "go_imports_mode", go#config#GoplsEnabled() ? 'gopls' : 'goimports') +endfunction + +function! go#config#FmtOptions() abort + return get(b:, "go_fmt_options", get(g:, "go_fmt_options", {})) +endfunction + +function! go#config#FmtFailSilently() abort + return get(g:, "go_fmt_fail_silently", 0) +endfunction + +function! go#config#FmtExperimental() abort + return get(g:, "go_fmt_experimental", 0 ) +endfunction + +function! go#config#PlayOpenBrowser() abort + return get(g:, "go_play_open_browser", 1) +endfunction + +function! go#config#RenameCommand() abort + " delegate to go#config#GorenameBin for backwards compatability. + return get(g:, "go_rename_command", go#config#GorenameBin()) +endfunction + +function! go#config#GorenameBin() abort + return get(g:, "go_gorename_bin", 'gopls') +endfunction + +function! go#config#GorenamePrefill() abort + return get(g:, "go_gorename_prefill", 'expand("") =~# "^[A-Z]"' . + \ '? go#util#pascalcase(expand(""))' . + \ ': go#util#camelcase(expand(""))') +endfunction + +function! go#config#TextobjIncludeFunctionDoc() abort + return get(g:, "go_textobj_include_function_doc", 1) +endfunction + +function! go#config#TextobjIncludeVariable() abort + return get(g:, "go_textobj_include_variable", 1) +endfunction + +function! go#config#BinPath() abort + return get(g:, "go_bin_path", "") +endfunction + +function! go#config#SearchBinPathFirst() abort + return get(g:, 'go_search_bin_path_first', 1) +endfunction + +function! go#config#HighlightArrayWhitespaceError() abort + return get(g:, 'go_highlight_array_whitespace_error', 0) +endfunction + +function! go#config#HighlightChanWhitespaceError() abort + return get(g:, 'go_highlight_chan_whitespace_error', 0) +endfunction + +function! go#config#HighlightExtraTypes() abort + return get(g:, 'go_highlight_extra_types', 0) +endfunction + +function! go#config#HighlightSpaceTabError() abort + return get(g:, 'go_highlight_space_tab_error', 0) +endfunction + +function! go#config#HighlightTrailingWhitespaceError() abort + return get(g:, 'go_highlight_trailing_whitespace_error', 0) +endfunction + +function! go#config#HighlightOperators() abort + return get(g:, 'go_highlight_operators', 0) +endfunction + +function! go#config#HighlightFunctions() abort + return get(g:, 'go_highlight_functions', 0) +endfunction + +function! go#config#HighlightFunctionParameters() abort + " fallback to highlight_function_arguments for backwards compatibility + return get(g:, 'go_highlight_function_parameters', get(g:, 'go_highlight_function_arguments', 0)) +endfunction + +function! go#config#HighlightFunctionCalls() abort + return get(g:, 'go_highlight_function_calls', 0) +endfunction + +function! go#config#HighlightFields() abort + return get(g:, 'go_highlight_fields', 0) +endfunction + +function! go#config#HighlightTypes() abort + return get(g:, 'go_highlight_types', 0) +endfunction + +function! go#config#HighlightBuildConstraints() abort + return get(g:, 'go_highlight_build_constraints', 0) +endfunction + +function! go#config#HighlightStringSpellcheck() abort + return get(g:, 'go_highlight_string_spellcheck', 1) +endfunction + +function! go#config#HighlightFormatStrings() abort + return get(g:, 'go_highlight_format_strings', 1) +endfunction + +function! go#config#HighlightGenerateTags() abort + return get(g:, 'go_highlight_generate_tags', 0) +endfunction + +function! go#config#HighlightVariableAssignments() abort + return get(g:, 'go_highlight_variable_assignments', 0) +endfunction + +function! go#config#HighlightVariableDeclarations() abort + return get(g:, 'go_highlight_variable_declarations', 0) +endfunction + +function! go#config#HighlightDiagnosticErrors() abort + return get(g:, 'go_highlight_diagnostic_errors', 1) +endfunction + +function! go#config#HighlightDiagnosticWarnings() abort + return get(g:, 'go_highlight_diagnostic_warnings', 1) +endfunction + +function! go#config#HighlightDebug() abort + return get(g:, 'go_highlight_debug', 1) +endfunction + +function! go#config#DebugBreakpointSignText() abort + return get(g:, 'go_debug_breakpoint_sign_text', '>') +endfunction + +function! go#config#FoldEnable(...) abort + if a:0 > 0 + return index(go#config#FoldEnable(), a:1) > -1 + endif + return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment']) +endfunction + +function! go#config#EchoGoInfo() abort + return get(g:, "go_echo_go_info", 1) +endfunction + +function! go#config#CodeCompletionEnabled() abort + return get(g:, "go_code_completion_enabled", 1) +endfunction + +function! go#config#CodeCompletionIcase() abort + return get(g:, "go_code_completion_icase", 0) +endfunction + +function! go#config#Updatetime() abort + let go_updatetime = get(g:, 'go_updatetime', 800) + return go_updatetime == 0 ? &updatetime : go_updatetime +endfunction + +function! go#config#ReferrersMode() abort + return get(g:, 'go_referrers_mode', 'gopls') +endfunction + +function! go#config#ImplementsMode() abort + return get(g:, 'go_implements_mode', 'gopls') +endfunction + +function! go#config#GoplsCompleteUnimported() abort + return get(g:, 'go_gopls_complete_unimported', v:null) +endfunction + +function! go#config#GoplsDeepCompletion() abort + return get(g:, 'go_gopls_deep_completion', v:null) +endfunction + +function! go#config#GoplsMatcher() abort + if !exists('g:go_gopls_matcher') && get(g:, 'g:go_gopls_fuzzy_matching', v:null) is 1 + return 'fuzzy' + endif + return get(g:, 'go_gopls_matcher', v:null) +endfunction + +function! go#config#GoplsStaticCheck() abort + return get(g:, 'go_gopls_staticcheck', v:null) +endfunction + +function! go#config#GoplsUsePlaceholders() abort + return get(g:, 'go_gopls_use_placeholders', v:null) +endfunction + +function! go#config#GoplsTempModfile() abort + return get(g:, 'go_gopls_temp_modfile', v:null) +endfunction + +function! go#config#GoplsAnalyses() abort + return get(g:, 'go_gopls_analyses', v:null) +endfunction + +function! go#config#GoplsLocal() abort + return get(g:, 'go_gopls_local', v:null) +endfunction + +function! go#config#GoplsGofumpt() abort + return get(g:, 'go_gopls_gofumpt', v:null) +endfunction + +function! go#config#GoplsSettings() abort + return get(g:, 'go_gopls_settings', v:null) +endfunction + +function! go#config#GoplsEnabled() abort + return get(g:, 'go_gopls_enabled', 1) +endfunction + +" TODO(bc): remove support for g:go_diagnostics_enabled; +" g:go_diagnostics_level is the replacement. +function! go#config#DiagnosticsEnabled() abort + return get(g:, 'go_diagnostics_enabled', 0) +endfunction + +function! go#config#DiagnosticsLevel() abort + let l:default = 0 + if has_key(g:, 'go_diagnostics_enabled') && g:go_diagnostics_enabled + let l:default = 2 + endif + + return get(g:, 'go_diagnostics_level', l:default) +endfunction + +function! go#config#GoplsOptions() abort + return get(g:, 'go_gopls_options', ['-remote=auto']) +endfunction + +function! go#config#FillStructMode() abort + return get(g:, 'go_fillstruct_mode', 'fillstruct') +endfunction + +function! go#config#DebugMappings() abort + let l:default = { + \ '(go-debug-continue)': {'key': ''}, + \ '(go-debug-print)': {'key': ''}, + \ '(go-debug-breakpoint)': {'key': ''}, + \ '(go-debug-next)': {'key': ''}, + \ '(go-debug-step)': {'key': ''}, + \ '(go-debug-halt)': {'key': ''}, + \ } + + let l:user = deepcopy(get(g:, 'go_debug_mappings', {})) + + return extend(l:user, l:default, 'keep') +endfunction + +function! go#config#DocBalloon() abort + return get(g:, 'go_doc_balloon', 0) +endfunction + +" Set the default value. A value of "1" is a shortcut for this, for +" compatibility reasons. +if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 + unlet g:go_gorename_prefill +endif + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/config_test.vim b/sources_non_forked/vim-go/autoload/go/config_test.vim new file mode 100644 index 00000000..6ac3eedd --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/config_test.vim @@ -0,0 +1,107 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +scriptencoding utf-8 + +func! Test_SetBuildTags() abort + if !go#util#has_job() + return + endif + + try + let g:go_def_mode = 'gopls' + let l:dir = 'test-fixtures/config/buildtags' + let l:jumpstart = [0, 4, 2, 0] + + execute 'e ' . printf('%s/buildtags.go', l:dir) + let l:jumpstartbuf = bufnr('') + + call setpos('.', [l:jumpstartbuf, l:jumpstart[1], l:jumpstart[2], 0]) + + let l:expectedfilename = printf('%s/foo.go', l:dir) + + let l:expected = [0, 5, 1, 0] + call assert_notequal(l:expected, l:jumpstart) + + call go#def#Jump('', 0) + + let l:start = reltime() + while getpos('.') != l:expected && reltimefloat(reltime(l:start)) < 10 + sleep 100m + endwhile + + call assert_equal(l:expectedfilename, bufname("%")) + call assert_equal(l:expected, getpos('.')) + + execute 'e ' . printf('%s/buildtags.go', l:dir) + + " prepare to wait for the workspace/configuration request + let g:go_debug=['lsp'] + + " set the build constraint + call go#config#SetBuildTags('constrained') + + " wait for the workspace/configuration request + let l:lsplog = getbufline('__GOLSP_LOG__', 1, '$') + let l:start = reltime() + while match(l:lsplog, 'workspace/configuration') == -1 && reltimefloat(reltime(l:start)) < 10 + sleep 50m + let l:lsplog = getbufline('__GOLSP_LOG__', 1, '$') + endwhile + unlet g:go_debug + " close the __GOLSP_LOG__ window + only + + " verify the cursor position within buildtags.go + call setpos('.', [l:jumpstartbuf, l:jumpstart[1], l:jumpstart[2], 0]) + call assert_equal(l:jumpstart, getpos('.')) + + let l:expectedfilename = printf('%s/constrainedfoo.go', l:dir) + let l:expected = [0, 6, 1, 0] + call assert_notequal(l:expected, l:jumpstart) + + call go#def#Jump('', 0) + + let l:start = reltime() + while getpos('.') != l:expected && reltimefloat(reltime(l:start)) < 10 + sleep 100m + endwhile + + call assert_equal(l:expectedfilename, bufname("%")) + call assert_equal(l:expected, getpos('.')) + + let l:lsplog = getbufline('__GOLSP_LOG__', 1, '$') + + finally + call go#config#SetBuildTags('') + unlet g:go_def_mode + endtry +endfunc + +func! Test_GoplsEnabled_Clear() abort + if !go#util#has_job() + return + endif + + try + let g:go_gopls_enabled = 0 + + let l:tmp = gotest#write_file('gopls_disabled.go', [ + \ 'package example', + \ '', + \ 'func Example() {', + \ "\tprintln(" . '"hello, world!")', + \ '}', + \ ] ) + + finally + unlet g:go_gopls_enabled + call delete(l:tmp, 'rf') + endtry +endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim new file mode 100644 index 00000000..828ed878 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -0,0 +1,295 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +let s:toggle = 0 + +" Buffer creates a new cover profile with 'go test -coverprofile' and changes +" the current buffers highlighting to show covered and uncovered sections of +" the code. If run again it clears the annotation. +function! go#coverage#BufferToggle(bang, ...) abort + if s:toggle + call go#coverage#Clear() + return + endif + + if a:0 == 0 + return call(function('go#coverage#Buffer'), [a:bang]) + endif + + return call(function('go#coverage#Buffer'), [a:bang] + a:000) +endfunction + +" Buffer creates a new cover profile with 'go test -coverprofile' and changes +" the current buffers highlighting to show covered and uncovered sections of +" the code. Calling it again reruns the tests and shows the last updated +" coverage. +function! go#coverage#Buffer(bang, ...) abort + + " check if the version of Vim being tested supports matchaddpos() + if !exists("*matchaddpos") + call go#util#EchoError("GoCoverage is not supported by your version of Vim.") + return -1 + endif + + " check if there is any test file, if not we just return + try + let l:dir = go#util#Chdir(expand("%:p:h")) + if empty(glob("*_test.go")) + call go#util#EchoError("no test files available") + return + endif + finally + call go#util#Chdir(l:dir) + endtry + + let s:toggle = 1 + let l:tmpname = tempname() + + 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]), + \ 'bang': a:bang, + \ 'for': 'GoTest', + \ 'statustype': 'coverage', + \ }) + 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) + endif + + let id = call('go#test#Test', args) + + if go#util#ShellError() == 0 + call go#coverage#overlay(l:tmpname) + endif + + call delete(l:tmpname) +endfunction + +" Clear clears and resets the buffer annotation matches +function! go#coverage#Clear() abort + call clearmatches() + + if exists("s:toggle") | let s:toggle = 0 | endif + + " remove the autocmd we defined + augroup vim-go-coverage + autocmd! * + augroup end +endfunction + +" Browser creates a new cover profile with 'go test -coverprofile' and opens +" 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() + call s:coverage_job({ + \ 'cmd': ['go', 'test', '-tags', go#config#BuildTags(), '-coverprofile', l:tmpname] + a:000, + \ 'complete': function('s:coverage_browser_callback', [l:tmpname]), + \ 'bang': a:bang, + \ 'for': 'GoTest', + \ 'statustype': 'coverage', + \ }) + return + endif + + let args = [a:bang, 0, "-coverprofile", l:tmpname] + if a:0 + call extend(args, a:000) + endif + + let id = call('go#test#Test', args) + + if go#util#ShellError() == 0 + call go#util#ExecInDir(['go', 'tool', 'cover', '-html=' . l:tmpname]) + endif + + call delete(l:tmpname) +endfunction + +" Parses a single line from the cover file generated via go test -coverprofile +" and returns a single coverage profile block. +function! go#coverage#parsegocoverline(line) abort + " file:startline.col,endline.col numstmt count + let mx = '\([^:]\+\):\(\d\+\)\.\(\d\+\),\(\d\+\)\.\(\d\+\)\s\(\d\+\)\s\(\d\+\)' + let tokens = matchlist(a:line, mx) + let ret = {} + let ret.file = tokens[1] + let ret.startline = str2nr(tokens[2]) + let ret.startcol = str2nr(tokens[3]) + let ret.endline = str2nr(tokens[4]) + let ret.endcol = str2nr(tokens[5]) + let ret.numstmt = tokens[6] + let ret.cnt = tokens[7] + return ret +endfunction + +" Generates matches to be added to matchaddpos for the given coverage profile +" block +function! go#coverage#genmatch(cov) abort + let color = 'goCoverageCovered' + if a:cov.cnt == 0 + let color = 'goCoverageUncover' + endif + + let matches = [] + + " if start and end are the same, also specify the byte length + " example: foo.go:92.2,92.65 1 0 + if a:cov.startline == a:cov.endline + call add(matches, { + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, a:cov.endcol - a:cov.startcol]], + \ 'priority': 2, + \ }) + return matches + endif + + " add start columns. Because we don't know the length of the of + " the line, we assume it is at maximum 200 bytes. I know this is hacky, + " but that's only way of fixing the issue + call add(matches, { + \ 'group': color, + \ 'pos': [[a:cov.startline, a:cov.startcol, 200]], + \ 'priority': 2, + \ }) + + " and then the remaining lines + let start_line = a:cov.startline + while start_line < a:cov.endline + let start_line += 1 + call add(matches, { + \ 'group': color, + \ 'pos': [[start_line]], + \ 'priority': 2, + \ }) + endwhile + + " finally end columns + call add(matches, { + \ 'group': color, + \ 'pos': [[a:cov.endline, a:cov.endcol-1]], + \ 'priority': 2, + \ }) + + return matches +endfunction + +" Reads the given coverprofile file and annotates the current buffer +function! go#coverage#overlay(file) abort + if !filereadable(a:file) + return + endif + let lines = readfile(a:file) + + " cover mode, by default it's 'set'. Just here for debugging purposes + let mode = lines[0] + + " contains matches for matchaddpos() + let matches = [] + + " first mark all lines as goCoverageNormalText. We use a custom group to not + " interfere with other buffers highlightings. Because the priority is + " lower than the cover and uncover matches, it'll be overridden. + let cnt = 1 + while cnt <= line('$') + call add(matches, {'group': 'goCoverageNormalText', 'pos': [cnt], 'priority': 1}) + let cnt += 1 + endwhile + + let fname = expand('%') + + " when called for a _test.go file, run the coverage for the actuall file + " file + if fname =~# '^\f\+_test\.go$' + let l:root = split(fname, '_test.go$')[0] + let fname = l:root . ".go" + + if !filereadable(fname) + call go#util#EchoError("couldn't find ".fname) + return + endif + + " open the alternate file to show the coverage + exe ":edit ". fnamemodify(fname, ":p") + endif + + " cov.file includes only the filename itself, without full path + let fname = fnamemodify(fname, ":t") + + for line in lines[1:] + let cov = go#coverage#parsegocoverline(line) + + " TODO(arslan): for now only include the coverage for the current + " buffer + if fname != fnamemodify(cov.file, ':t') + continue + endif + + call extend(matches, go#coverage#genmatch(cov)) + endfor + + " clear the matches if we leave the buffer + augroup vim-go-coverage + autocmd! * + autocmd BufWinLeave call go#coverage#Clear() + augroup end + + for m in matches + call matchaddpos(m.group, m.pos) + endfor +endfunction + + +" --------------------- +" | Vim job callbacks | +" --------------------- +" +function s:coverage_job(args) + " autowrite is not enabled for jobs + call go#cmd#autowrite() + + let disabled_term = 0 + if go#config#TermEnabled() + let disabled_term = 1 + call go#config#SetTermEnabled(0) + endif + + call go#job#Spawn(a:args.cmd, a:args) + + if disabled_term + call go#config#SetTermEnabled(1) + endif +endfunction + +" coverage_callback is called when the coverage execution is finished +function! s:coverage_callback(coverfile, job, exit_status, data) + if a:exit_status == 0 + call go#coverage#overlay(a:coverfile) + endif + + call delete(a:coverfile) +endfunction + +function! s:coverage_browser_callback(coverfile, job, exit_status, data) + if a:exit_status == 0 + call go#util#ExecInDir(['go', 'tool', 'cover', '-html=' . a:coverfile]) + endif + + call delete(a:coverfile) +endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/debug.vim b/sources_non_forked/vim-go/autoload/go/debug.vim new file mode 100644 index 00000000..879fa8f7 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/debug.vim @@ -0,0 +1,1771 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +scriptencoding utf-8 + +if !exists('s:state') + let s:state = { + \ 'rpcid': 1, + \ 'running': 0, + \ 'currentThread': {}, + \ 'localVars': {}, + \ 'functionArgs': {}, + \ 'registers': {}, + \ 'message': [], + \ 'resultHandlers': {}, + \ 'kill_on_detach': v:true, + \ } + + if go#util#HasDebug('debugger-state') + call go#config#SetDebugDiag(s:state) + endif +endif + +if !exists('s:start_args') + let s:start_args = [] +endif + +if !exists('s:mapargs') + let s:mapargs = {} +endif + +function! s:goroutineID() abort + return s:state['currentThread'].goroutineID +endfunction + +function! s:complete(job, exit_status, data) abort + let l:gotready = get(s:state, 'ready', 0) + " copy messages to a:data _only_ when dlv exited non-zero and it was never + " detected as ready (e.g. there was a compiler error). + if a:exit_status > 0 && !l:gotready + " copy messages to data so that vim-go's usual handling of errors from + " async jobs will occur. + call extend(a:data, s:state['message']) + endif + + " return early instead of clearing any variables when the current job is not + " a:job + if has_key(s:state, 'job') && s:state['job'] != a:job + return + endif + + if has_key(s:state, 'job') + call remove(s:state, 'job') + endif + + if has_key(s:state, 'ready') + call remove(s:state, 'ready') + endif + + if has_key(s:state, 'ch') + call remove(s:state, 'ch') + endif + + call s:clearState() +endfunction + +function! s:logger(prefix, ch, msg) abort + let l:cur_win = bufwinnr('') + let l:log_win = bufwinnr(bufnr('__GODEBUG_OUTPUT__')) + if l:log_win == -1 + return + endif + exe l:log_win 'wincmd w' + + try + setlocal modifiable + if getline(1) == '' + call setline('$', a:prefix . a:msg) + else + call append('$', a:prefix . a:msg) + endif + normal! G + setlocal nomodifiable + finally + exe l:cur_win 'wincmd w' + endtry +endfunction + +" s:call_jsonrpc will call method, passing all of s:call_jsonrpc's optional +" arguments in the rpc request's params field. + +" The first argument to s:call_jsonrpc should be a function that takes two +" arguments. The first argument will be a function that takes no arguments and will +" throw an exception if the response to the request is an error response. The +" second argument is the response itself. +function! s:call_jsonrpc(handle_result, method, ...) abort + if go#util#HasDebug('debugger-commands') + call go#util#EchoInfo('sending to dlv ' . a:method) + endif + + let l:args = a:000 + let s:state['rpcid'] += 1 + let l:reqid = s:state['rpcid'] + let l:req_json = json_encode({ + \ 'id': l:reqid, + \ 'method': a:method, + \ 'params': l:args, + \}) + + try + let l:ch = s:state['ch'] + if has('nvim') + call chansend(l:ch, l:req_json) + else + call ch_sendraw(l:ch, req_json) + endif + + let s:state.resultHandlers[l:reqid] = a:handle_result + + if go#util#HasDebug('debugger-commands') + let g:go_debug_commands = add(go#config#DebugCommands(), { + \ 'request': l:req_json, + \ }) + endif + + redraw + catch + throw substitute(v:exception, '^Vim', '', '') + endtry +endfunction + +function! s:exited(res) abort + if type(a:res) ==# type(v:null) + return 0 + endif + + let state = a:res.result.State + return state.exited == v:true +endfunction + +" Update the location of the current breakpoint or line we're halted on based on +" response from dlv. +function! s:update_breakpoint(res) abort + if type(a:res) ==# type(v:null) + return + endif + + let state = a:res.result.State + if !has_key(state, 'currentThread') + return + endif + + let s:state['currentThread'] = state.currentThread + let bufs = filter(map(range(1, winnr('$')), '[v:val,bufname(winbufnr(v:val))]'), 'v:val[1]=~"\.go$"') + if len(bufs) == 0 + return + endif + + exe bufs[0][0] 'wincmd w' + let filename = s:substituteRemotePath(state.currentThread.file) + let linenr = state.currentThread.line + let oldfile = fnamemodify(expand('%'), ':p:gs!\\!/!') + if oldfile != filename + silent! exe 'edit' filename + endif + silent! exe 'norm!' linenr.'G' + silent! normal! zvzz + " TODO(bc): convert to use s:sign_unplace() + silent! sign unplace 9999 + " TODO(bc): convert to use s:sign_place() + silent! exe 'sign place 9999 line=' . linenr . ' name=godebugcurline file=' . filename + call s:warn_when_stale(fnamemodify(l:filename, ':p')) +endfunction + +" Populate the stacktrace window. +function! s:show_stacktrace(check_errors, res) abort + try + call a:check_errors() + catch + call go#util#EchoError(printf('could not update stack: %s', v:exception)) + return + endtry + + if type(a:res) isnot type({}) || !has_key(a:res, 'result') || empty(a:res.result) + return + endif + + let l:stack_win = bufwinnr(bufnr('__GODEBUG_STACKTRACE__')) + if l:stack_win == -1 + return + endif + + let l:cur_win = bufwinnr('') + exe l:stack_win 'wincmd w' + + try + setlocal modifiable + silent %delete _ + for i in range(len(a:res.result.Locations)) + let loc = a:res.result.Locations[i] + if loc.file is# '?' || !has_key(loc, 'function') + continue + endif + call setline(i+1, printf('%s - %s:%d', loc.function.name, s:substituteRemotePath(fnamemodify(loc.file, ':p')), loc.line)) + endfor + finally + setlocal nomodifiable + exe l:cur_win 'wincmd w' + endtry +endfunction + +" Populate the variable window. +function! s:show_variables() abort + let l:var_win = bufwinnr(bufnr('__GODEBUG_VARIABLES__')) + if l:var_win == -1 + return + endif + + let l:cur_win = bufwinnr('') + exe l:var_win 'wincmd w' + try + setlocal modifiable + silent %delete _ + + let v = [] + let v += ['# Local Variables'] + if type(get(s:state, 'localVars', [])) is type([]) + for c in s:state['localVars'] + let v += split(s:eval_tree(c, 0, 0), "\n") + endfor + endif + + let v += [''] + let v += ['# Function Arguments'] + if type(get(s:state, 'functionArgs', [])) is type([]) + for c in s:state['functionArgs'] + let v += split(s:eval_tree(c, 0, 0), "\n") + endfor + endif + + let v += [''] + let v += ['# Registers'] + if type(get(s:state, 'registers', [])) is type([]) + for c in s:state['registers'] + let v += [printf("%s = %s", c.Name, c.Value)] + endfor + endif + + call setline(1, v) + finally + setlocal nomodifiable + exe l:cur_win 'wincmd w' + endtry +endfunction + +function! s:clearState() abort + let s:state['running'] = 0 + let s:state['currentThread'] = {} + let s:state['localVars'] = {} + let s:state['functionArgs'] = {} + let s:state['registers'] = {} + let s:state['message'] = [] + + silent! sign unplace 9999 +endfunction + +function! s:stop() abort + call s:call_jsonrpc(function('s:noop'), 'RPCServer.Detach', {'kill': s:state['kill_on_detach']}) + + if has_key(s:state, 'job') + call go#job#Wait(s:state['job']) + + " while waiting, the s:complete may have already removed job from s:state. + if has_key(s:state, 'job') + call remove(s:state, 'job') + endif + endif + + if has_key(s:state, 'ready') + call remove(s:state, 'ready') + endif + + if has_key(s:state, 'ch') + call remove(s:state, 'ch') + endif + call s:clearState() +endfunction + +function! go#debug#Stop() abort + " Remove all commands and add back the default commands. + for k in map(split(execute('command GoDebug'), "\n")[1:], 'matchstr(v:val, "^\\s*\\zs\\S\\+")') + exe 'delcommand' k + endfor + command! -nargs=* -complete=customlist,go#package#Complete GoDebugStart call go#debug#Start('debug', ) + command! -nargs=* -complete=customlist,go#package#Complete GoDebugTest call go#debug#Start('test', ) + command! -nargs=? GoDebugConnect call go#debug#Start('connect', ) + command! -nargs=* GoDebugTestFunc call go#debug#TestFunc() + command! -nargs=1 GoDebugAttach call go#debug#Start('attach', ) + command! -nargs=? GoDebugBreakpoint call go#debug#Breakpoint() + + " Restore mappings configured prior to debugging. + call s:restoreMappings() + + " remove plug mappings + for k in map(split(execute('nmap (go-debug-'), "\n"), 'matchstr(v:val, "^n\\s\\+\\zs\\S\\+")') + execute(printf('nunmap %s', k)) + endfor + + call s:stop() + + let bufs = filter(map(range(1, winnr('$')), '[v:val,bufname(winbufnr(v:val))]'), 'v:val[1]=~"\.go$"') + if len(bufs) > 0 + exe bufs[0][0] 'wincmd w' + else + wincmd p + endif + + let stackbufnr = bufnr('__GODEBUG_STACKTRACE__') + if stackbufnr != -1 + silent! exe bufwinnr(stackbufnr) 'wincmd c' + endif + + let varbufnr = bufnr('__GODEBUG_VARIABLES__') + if varbufnr != -1 + silent! exe bufwinnr(varbufnr) 'wincmd c' + endif + + let outbufnr = bufnr('__GODEBUG_OUTPUT__') + if outbufnr != -1 + silent! exe bufwinnr(outbufnr) 'wincmd c' + endif + + let gorobufnr = bufnr('__GODEBUG_GOROUTINES__') + if gorobufnr != -1 + silent! exe bufwinnr(gorobufnr) 'wincmd c' + endif + + if has('balloon_eval') + let &ballooneval=s:ballooneval + let &balloonexpr=s:balloonexpr + endif + + augroup vim-go-debug + autocmd! + augroup END + augroup! vim-go-debug +endfunction + +function! s:goto_file() abort + let m = matchlist(getline('.'), ' - \(.*\):\([0-9]\+\)$') + if m[1] == '' + return + endif + let bufs = filter(map(range(1, winnr('$')), '[v:val,bufname(winbufnr(v:val))]'), 'v:val[1]=~"\.go$"') + if len(bufs) == 0 + return + endif + exe bufs[0][0] 'wincmd w' + let filename = s:substituteLocalPath(m[1]) + let linenr = m[2] + let oldfile = fnamemodify(expand('%'), ':p:gs!\\!/!') + if oldfile != filename + silent! exe 'edit' filename + endif + silent! exe 'norm!' linenr.'G' + silent! normal! zvzz +endfunction + +function! s:delete_expands() + let nr = line('.') + while 1 + let l = getline(nr+1) + if empty(l) || l =~ '^\S' + return + endif + silent! exe (nr+1) . 'd _' + endwhile + silent! exe 'norm!' nr.'G' +endfunction + +function! s:expand_var() abort + " Get name from struct line. + let name = matchstr(getline('.'), '^[^:]\+\ze: \*\?[a-zA-Z0-9-_/\.]\+\({\.\.\.}\)\?$') + " Anonymous struct + if name == '' + let name = matchstr(getline('.'), '^[^:]\+\ze: \*\?struct {.\{-}}$') + endif + + if name != '' + setlocal modifiable + let not_open = getline(line('.')+1) !~ '^ ' + let l = line('.') + call s:delete_expands() + + if not_open + call append(l, split(s:eval(name), "\n")[1:]) + endif + silent! exe 'norm!' l.'G' + setlocal nomodifiable + return + endif + + " Expand maps + let m = matchlist(getline('.'), '^[^:]\+\ze: map.\{-}\[\(\d\+\)\]$') + if len(m) > 0 && m[1] != '' + setlocal modifiable + let not_open = getline(line('.')+1) !~ '^ ' + let l = line('.') + call s:delete_expands() + if not_open + " TODO: Not sure how to do this yet... Need to get keys of the map. + " let vs = '' + " for i in range(0, min([10, m[1]-1])) + " let vs .= ' ' . s:eval(printf("%s[%s]", m[0], )) + " endfor + " call append(l, split(vs, "\n")) + endif + + silent! exe 'norm!' l.'G' + setlocal nomodifiable + return + endif + + " Expand string. + let m = matchlist(getline('.'), '^\([^:]\+\)\ze: \(string\)\[\([0-9]\+\)\]\(: .\{-}\)\?$') + if len(m) > 0 && m[1] != '' + setlocal modifiable + let not_open = getline(line('.')+1) !~ '^ ' + let l = line('.') + call s:delete_expands() + + if not_open + let vs = '' + for i in range(0, min([10, m[3]-1])) + let vs .= ' ' . s:eval(m[1] . '[' . i . ']') + endfor + call append(l, split(vs, "\n")) + endif + + silent! exe 'norm!' l.'G' + setlocal nomodifiable + return + endif + + " Expand slice. + let m = matchlist(getline('.'), '^\([^:]\+\)\ze: \(\[\]\w\{-}\)\[\([0-9]\+\)\]$') + if len(m) > 0 && m[1] != '' + setlocal modifiable + let not_open = getline(line('.')+1) !~ '^ ' + let l = line('.') + call s:delete_expands() + + if not_open + let vs = '' + for i in range(0, min([10, m[3]-1])) + let vs .= ' ' . s:eval(m[1] . '[' . i . ']') + endfor + call append(l, split(vs, "\n")) + endif + silent! exe 'norm!' l.'G' + setlocal nomodifiable + return + endif +endfunction + +function! s:start_cb() abort + let l:winid = win_getid() + let l:debugwindows = go#config#DebugWindows() + let l:debugpreservelayout = go#config#DebugPreserveLayout() + + if !(empty(l:debugwindows) || l:debugpreservelayout) + silent! only! + endif + + let winnum = bufwinnr(bufnr('__GODEBUG_STACKTRACE__')) + if winnum != -1 + return + endif + + if has_key(l:debugwindows, "vars") && l:debugwindows['vars'] != '' + exe 'silent ' . l:debugwindows['vars'] + silent file `='__GODEBUG_VARIABLES__'` + setlocal buftype=nofile bufhidden=wipe nomodified nobuflisted noswapfile nowrap nonumber nocursorline + setlocal filetype=godebugvariables + call append(0, ["# Local Variables", "", "# Function Arguments", "", "# Registers"]) + nmap :call expand_var() + nmap q (go-debug-stop) + endif + + if has_key(l:debugwindows, "stack") && l:debugwindows['stack'] != '' + exe 'silent ' . l:debugwindows['stack'] + silent file `='__GODEBUG_STACKTRACE__'` + setlocal buftype=nofile bufhidden=wipe nomodified nobuflisted noswapfile nowrap nonumber nocursorline + setlocal filetype=godebugstacktrace + nmap :call goto_file() + nmap q (go-debug-stop) + endif + + if has_key(l:debugwindows, "goroutines") && l:debugwindows['goroutines'] != '' + exe 'silent ' . l:debugwindows['goroutines'] + silent file `='__GODEBUG_GOROUTINES__'` + setlocal buftype=nofile bufhidden=wipe nomodified nobuflisted noswapfile nowrap nonumber nocursorline + setlocal filetype=godebugvariables + call append(0, ["# Goroutines"]) + nmap :call go#debug#Goroutine() + endif + + if has_key(l:debugwindows, "out") && l:debugwindows['out'] != '' + exe 'silent ' . l:debugwindows['out'] + silent file `='__GODEBUG_OUTPUT__'` + setlocal buftype=nofile bufhidden=wipe nomodified nobuflisted noswapfile nowrap nonumber nocursorline + setlocal filetype=godebugoutput + nmap q (go-debug-stop) + endif + call win_gotoid(l:winid) + + silent! delcommand GoDebugStart + silent! delcommand GoDebugTest + silent! delcommand GoDebugTestFunc + silent! delcommand GoDebugAttach + silent! delcommand GoDebugConnect + + command! -nargs=0 GoDebugContinue call go#debug#Stack('continue') + command! -nargs=0 GoDebugStop call go#debug#Stop() + + nnoremap (go-debug-breakpoint) :call go#debug#Breakpoint() + nnoremap (go-debug-continue) :call go#debug#Stack('continue') + nnoremap (go-debug-stop) :call go#debug#Stop() + + augroup vim-go-debug + autocmd! * + call s:configureMappings('(go-debug-breakpoint)', '(go-debug-continue)') + augroup END + doautocmd vim-go-debug BufWinEnter *.go +endfunction + +function! s:continue() + command! -nargs=0 GoDebugNext call go#debug#Stack('next') + command! -nargs=0 GoDebugStep call go#debug#Stack('step') + command! -nargs=0 GoDebugStepOut call go#debug#Stack('stepOut') + command! -nargs=0 GoDebugRestart call go#debug#Restart() + command! -nargs=* GoDebugSet call go#debug#Set() + command! -nargs=1 GoDebugPrint call go#debug#Print() + command! -nargs=0 GoDebugHalt call go#debug#Stack('halt') + + nnoremap (go-debug-next) :call go#debug#Stack('next') + nnoremap (go-debug-step) :call go#debug#Stack('step') + nnoremap (go-debug-stepout) :call go#debug#Stack('stepOut') + nnoremap (go-debug-print) :call go#debug#Print(expand('')) + nnoremap (go-debug-halt) :call go#debug#Stack('halt') + + if has('balloon_eval') + let s:balloonexpr=&balloonexpr + let s:ballooneval=&ballooneval + + set balloonexpr=go#debug#BalloonExpr() + set ballooneval + endif + + " Some debug mappings were already added. Restore any mappings the user had + " before the complete mappings are configured so that the mappings are + " returned to the user's original state after the debugger is stopped. + call s:restoreMappings() + augroup vim-go-debug + autocmd! * + call s:configureMappings('(go-debug-breakpoint)', '(go-debug-continue)', '(go-debug-halt)', '(go-debug-next)', '(go-debug-print)', '(go-debug-step)', '(go-debug-stepout)') + augroup END + doautocmd vim-go-debug BufWinEnter *.go +endfunction + +function! s:err_cb(ch, msg) abort + if get(s:state, 'ready', 0) != 0 + call s:logger('ERR: ', a:ch, a:msg) + return + endif + + let s:state['message'] += [a:msg] +endfunction + +function! s:out_cb(ch, msg) abort + if get(s:state, 'ready', 0) != 0 + call s:logger('OUT: ', a:ch, a:msg) + return + endif + + let s:state['message'] += [a:msg] + + if stridx(a:msg, go#config#DebugAddress()) != -1 + call s:connect(go#config#DebugAddress()) + endif +endfunction + +function! s:connect(addr) abort + let s:state['data'] = [] + let l:state = {'databuf': ''} + + " explicitly bind callback to state so that within it, self will + " always refer to state. See :help Partial for more information. + let l:state.on_data = function('s:on_data', [], l:state) + + if has('nvim') + let l:ch = sockconnect('tcp', a:addr, {'on_data': l:state.on_data, 'state': l:state}) + if l:ch == 0 + call go#util#EchoError("could not connect to debugger") + if has_key(s:state, 'job') + call go#job#Stop(s:state['job']) + endif + return + endif + else + let l:ch = ch_open(a:addr, {'mode': 'raw', 'waittime': 5000, 'timeout': 20000, 'callback': l:state.on_data}) + if ch_status(l:ch) !=# 'open' + call go#util#EchoError("could not connect to debugger") + if has_key(s:state, 'job') + call go#job#Stop(s:state['job']) + endif + return + endif + endif + + let s:state['ch'] = l:ch + + " After this block executes, Delve will be running with all the + " breakpoints setup, so this callback doesn't have to run again; just log + " future messages. + let s:state['ready'] = 1 + + " replace all the breakpoints set before delve started so that the ids won't overlap. + for l:bt in s:list_breakpoints() + call s:sign_unplace(l:bt.id, l:bt.file) + call go#debug#Breakpoint(l:bt.line, l:bt.file) + endfor + + call s:start_cb() +endfunction + +" s:on_data's third optional argument is provided, but not used, so that the +" same function can be used for Vim's 'callback' and Neovim's 'data'. +function! s:on_data(ch, data, ...) dict abort + let l:data = s:message(self.databuf, a:data) + + let l:messages = split(l:data, "\n") + for l:msg in l:messages + let l:data = l:messages[0] + try + let l:res = json_decode(l:data) + " remove the decoded message + call remove(l:messages, 0) + catch + return + finally + " Rejoin messages and assign to databuf so that any messages that come + " in if s:handleRPCResult sleeps will be appended correctly. + " + " Because the current message is removed in the try immediately after + " decoding, that l:messages contains all the messages that have not + " yet been decoded including the current message if decoding it + " failed. + let self.databuf = join(l:messages, "\n") + endtry + + if go#util#HasDebug('debugger-commands') + let g:go_debug_commands = add(go#config#DebugCommands(), { + \ 'response': l:data, + \ }) + endif + call s:handleRPCResult(l:res) + endfor +endfunction + +function! s:message(buf, data) abort + if has('nvim') + " dealing with the channel lines of Neovim is awful. 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']`. + " + " Thankfully, though, this is explained a bit better in an issue: + " https://github.com/neovim/neovim/issues/3555. Specifically in these two + " comments: + " * https://github.com/neovim/neovim/issues/3555#issuecomment-152290804 + " * https://github.com/neovim/neovim/issues/3555#issuecomment-152588749 + " + " The key is + " Every item in the list passed to job control callbacks represents a + " string after a newline(Except the first, of course). If the program + " outputs: "hello\nworld" the corresponding list is ["hello", "world"]. + " If the program outputs "hello\nworld\n", the corresponding list is + " ["hello", "world", ""]. In other words, you can always determine if + " the last line received is complete or not. + " and + " for every list you receive in a callback, all items except the first + " represent newlines. + + let l:data = printf('%s%s', a:buf, a:data[0]) + for l:msg in a:data[1:] + let l:data = printf("%s\n%s", l:data, l:msg) + endfor + + return l:data + endif + + return printf('%s%s', a:buf, a:data) +endfunction + +" s:check_errors will be curried and injected into rpc result handlers so that +" those result handlers can consistently check for errors in the response by +" catching exceptions and handling the error appropriately. +function! s:check_errors(resp_json) abort + if type(a:resp_json) == v:t_dict && has_key(a:resp_json, 'error') && !empty(a:resp_json.error) + throw a:resp_json.error + endif +endfunction + +function! s:handleRPCResult(resp) abort + try + let l:id = a:resp.id + " call the result handler with its first argument set to a curried + " s:check_errors value so that the result handler can call s:check_errors + " without passing any arguments to check whether the response is an error + " response. + call call(s:state.resultHandlers[l:id], [function('s:check_errors', [a:resp]), a:resp]) + catch + throw v:exception + finally + if has_key(s:state.resultHandlers, l:id) + call remove(s:state.resultHandlers, l:id) + endif + endtry +endfunction + +function! go#debug#TestFunc(...) abort + let l:test = go#util#TestName() + if l:test is '' + call go#util#Warn("vim-go: [debug] no test found immediate to cursor") + return + endif + call call('go#debug#Start', extend(['test', '.', '-test.run', printf('%s$', l:test)], a:000)) +endfunction + +" Start the debug mode. The first variadic argument is the package name to +" compile and debug, anything else will be passed to the running program. +function! go#debug#Start(mode, ...) abort + call go#cmd#autowrite() + + if !go#util#has_job() + call go#util#EchoError('This feature requires either Vim 8.0.0087 or newer with +job or Neovim.') + return + endif + + " It's already running. + if has_key(s:state, 'job') + return s:state['job'] + endif + + let s:start_args = [a:mode] + a:000 + + if go#util#HasDebug('debugger-state') + call go#config#SetDebugDiag(s:state) + endif + + let dlv = go#path#CheckBinPath("dlv") + if empty(dlv) + return + endif + + try + if a:mode is 'connect' + let l:addr = go#config#DebugAddress() + if a:0 > 0 + let l:addr = a:1 + endif + let s:state['kill_on_detach'] = v:false + + call s:connect(l:addr) + else + let l:cmd = [dlv, a:mode] + + let s:state['kill_on_detach'] = v:true + if a:mode is 'debug' || a:mode is 'test' + let l:cmd = extend(l:cmd, s:package(a:000)) + let l:cmd = extend(l:cmd, ['--output', tempname()]) + elseif a:mode is 'attach' + let l:cmd = add(l:cmd, a:1) + let s:state['kill_on_detach'] = v:false + else + call go#util#EchoError('Unknown dlv command') + endif + + let l:cmd += [ + \ '--headless', + \ '--api-version', '2', + \ '--listen', go#config#DebugAddress(), + \] + let l:debugLogOutput = go#config#DebugLogOutput() + if l:debugLogOutput != '' + let cmd += ['--log', '--log-output', l:debugLogOutput] + endif + + let l:buildtags = go#config#BuildTags() + if buildtags isnot '' + let l:cmd += ['--build-flags', '--tags=' . buildtags] + endif + + if len(a:000) > 1 + let l:cmd += ['--'] + a:000[1:] + endif + + let s:state['message'] = [] + let l:opts = { + \ 'for': 'GoDebug', + \ '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) + return s:state['job'] + endif + catch + call go#util#EchoError(printf('could not start debugger: %s', v:exception)) + endtry +endfunction + +" s:package returns the import path of package name of a :GoDebug(Start|Test) +" call as a list so that the package can be appended to a command list using +" extend(). args is expected to be a (potentially empty) list. The first +" element in args (if there are any) is expected to be a package path. An +" empty list is returned when either args is an empty list or the import path +" cannot be determined. +function! s:package(args) + if len(a:args) == 0 + return [] + endif + + " append the package when it's given. + let l:pkgname = a:args[0] + if l:pkgname[0] == '.' + let l:pkgabspath = fnamemodify(l:pkgname, ':p') + + let l:dir = go#util#Chdir(expand('%:p:h')) + try + let l:pkgname = go#package#FromPath(l:pkgabspath) + if type(l:pkgname) == type(0) + call go#util#EchoError('could not determine package name') + return [] + endif + finally + call go#util#Chdir(l:dir) + endtry + endif + + return [l:pkgname] +endfunction + + " Translate a reflect kind constant to a human string. +function! s:reflect_kind(k) + " Kind constants from Go's reflect package. + return [ + \ 'Invalid Kind', + \ 'Bool', + \ 'Int', + \ 'Int8', + \ 'Int16', + \ 'Int32', + \ 'Int64', + \ 'Uint', + \ 'Uint8', + \ 'Uint16', + \ 'Uint32', + \ 'Uint64', + \ 'Uintptr', + \ 'Float32', + \ 'Float64', + \ 'Complex64', + \ 'Complex128', + \ 'Array', + \ 'Chan', + \ 'Func', + \ 'Interface', + \ 'Map', + \ 'Ptr', + \ 'Slice', + \ 'String', + \ 'Struct', + \ 'UnsafePointer', + \ ][a:k] +endfunction + +function! s:eval_tree(var, nest, isMapOrSliceChild) abort + if a:var.name =~ '^\~' + return '' + endif + let nest = a:nest + let v = '' + let kind = s:reflect_kind(a:var.kind) + + if !empty(a:var.name) || a:isMapOrSliceChild is 1 + if a:isMapOrSliceChild == 0 + let v .= repeat(' ', nest) . a:var.name . ': ' + endif + + if kind == 'Bool' + let v .= printf("%s", a:var.value) + + elseif kind == 'Struct' + " Anonymous struct + if a:var.type[:8] == 'struct { ' + let v .= printf("%s", a:var.type) + else + let v .= printf("%s{...}", a:var.type) + endif + + elseif kind == 'String' + let v .= printf("%s[%d]%s", a:var.type, a:var.len, + \ len(a:var.value) > 0 ? ': ' . a:var.value : '') + + elseif kind == 'Slice' || kind == 'String' || kind == 'Map' || kind == 'Array' + let v .= printf("%s[%d]", a:var.type, a:var.len) + + elseif kind == 'Chan' || kind == 'Func' || kind == 'Interface' + let v .= printf("%s", a:var.type) + + elseif kind == 'Ptr' + " TODO: We can do something more useful here. + let v .= printf("%s", a:var.type) + + elseif kind == 'Complex64' || kind == 'Complex128' + let v .= printf("%s%s", a:var.type, a:var.value) + + " Int, Float + else + let v .= printf("%s(%s)", a:var.type, a:var.value) + endif + if a:isMapOrSliceChild == 0 + let v = printf("%s\n", v) + endif + else + let nest -= 1 + endif + + if index(['Chan', 'Complex64', 'Complex128'], kind) == -1 && a:var.type != 'error' + let l:idx = 0 + for c in a:var.children + if kind == 'Map' + " Maps alternate children between keys and values. Keys will be even + " number indexes. + let l:isMapKey = (l:idx % 2) is 0 + if l:isMapKey == 1 + let v .= printf("%s%s:\n", repeat(' ', nest + 1), s:eval_tree(c, 0, 1)) + else + let v .= printf("%s%s\n", repeat(' ', nest + 2), s:eval_tree(c, 0, 1)) + endif + elseif kind == 'Slice' + let v .= printf("%d: %s\n", l:idx, s:eval_tree(c, nest + 1, 1)) + else + let v .= s:eval_tree(c, nest + 1, 0) + endif + let l:idx += 1 + endfor + endif + return v +endfunction + +function! s:eval(arg) abort + try + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.State') + let l:res = l:promise.await() + + let l:cmd = 'RPCServer.Eval' + let l:args = { + \ 'expr': a:arg, + \ 'scope': {'GoroutineID': l:res.result.State.currentThread.goroutineID} + \ } + + let l:ResultFn = funcref('s:evalResult', []) + if a:arg =~ '^call ' + let l:cmd = 'RPCServer.Command' + let l:args = { + \ 'name': 'call', + \ 'Expr': a:arg[5:], + \ 'ReturnInfoLoadConfig': { + \ 'FollowPointers': v:false, + \ 'MaxVariableRecurse': 10, + \ 'MaxStringLen': 80, + \ 'MaxArrayValues': 10, + \ 'MaxStructFields': 10, + \ }, + \ } + + let l:ResultFn = funcref('s:callResult', []) + endif + + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, l:cmd, l:args) + + let l:res = l:promise.await() + + let l:result = call(l:ResultFn, [l:res.result]) + + " l:result will be a list when evaluating a call expression. + if type(l:result) is type([]) + let l:result = map(l:result, funcref('s:renameEvalReturnValue')) + if len(l:result) isnot 1 + return map(l:result, 's:eval_tree(v:val, 0, 0)') + endif + let l:result = l:result[0] + endif + return s:eval_tree(l:result, 0, 0) + catch + call go#util#EchoError(printf('evaluation failed: %s', v:exception)) + return '' + endtry +endfunction + +function! s:callResult(res) abort + return a:res.State.currentThread.ReturnValues +endfunction + +function! s:evalResult(res) abort + return a:res.Variable +endfunction + +function! s:renameEvalReturnValue(key, val) abort + let a:val.name = printf('[%s]', string(a:key)) + return a:val +endfunction + +function! go#debug#BalloonExpr() abort + silent! let l:v = s:eval(v:beval_text) + return l:v +endfunction + +function! go#debug#Print(arg) abort + try + let l:result = s:eval(a:arg) + if type(l:result) is type([]) + echo join(map(l:result, 'substitute(v:val, "\n$", "", '''')'), "\n") + return + elseif type(l:result) isnot type('') + throw 'unexpected result' + endif + echo substitute(l:result, "\n$", "", '') + catch + call go#util#EchoError(printf('could not print: %s', v:exception)) + endtry +endfunction + +function! s:update_goroutines() abort + call s:call_jsonrpc(function('s:update_goroutines_state_handler'), 'RPCServer.State') +endfunction + +function! s:update_goroutines_state_handler(check_errors, res) abort + try + call a:check_errors() + + let l:currentGoroutineID = 0 + try + if type(a:res) is type({}) && has_key(a:res, 'result') && !empty(a:res['result']) + let l:currentGoroutineID = a:res["result"]["State"]["currentGoroutine"]["id"] + endif + catch + call go#util#EchoWarning("current goroutine not found...") + endtry + + call s:call_jsonrpc(function('s:list_goroutines_handler', [l:currentGoroutineID]), 'RPCServer.ListGoroutines') + catch + call go#util#EchoError(printf('could not list goroutines: %s', v:exception)) + endtry +endfunction + +function s:list_goroutines_handler(currentGoroutineID, check_errors, res) abort + try + call a:check_errors() + call s:show_goroutines(a:currentGoroutineID, a:res) + catch + call go#util#EchoError(printf('could not show goroutines: %s', v:exception)) + endtry +endfunction + +function! s:show_goroutines(currentGoroutineID, res) abort + let l:goroutines_winid = bufwinid('__GODEBUG_GOROUTINES__') + if l:goroutines_winid == -1 + return + endif + + let l:winid = win_getid() + call win_gotoid(l:goroutines_winid) + + try + setlocal modifiable + silent %delete _ + + let v = [] + + if type(a:res) isnot type({}) || !has_key(a:res, 'result') || empty(a:res['result']) + call setline(1, v) + return + endif + + let l:goroutines = a:res["result"]["Goroutines"] + if len(l:goroutines) == 0 + call go#util#EchoWarning("No Goroutines Running Now...") + call setline(1, v) + return + endif + + for l:idx in range(len(l:goroutines)) + let l:goroutine = l:goroutines[l:idx] + let l:goroutineType = "" + let l:loc = 0 + if l:goroutine.startLoc.file != "" + let l:loc = l:goroutine.startLoc + let l:goroutineType = "Start" + endif + if l:goroutine.goStatementLoc.file != "" + let l:loc = l:goroutine.goStatementLoc + let l:goroutineType = "Go" + endif + if l:goroutine.currentLoc.file != "" + let l:loc = l:goroutine.currentLoc + let l:goroutineType = "Runtime" + endif + if l:goroutine.userCurrentLoc.file != "" + let l:loc=l:goroutine.userCurrentLoc + let l:goroutineType = "User" + endif + + " The current goroutine can be changed by pressing enter on one of the + " lines listing a non-active goroutine. If the format of either of these + " lines is modified, then make sure that go#debug#Goroutine is also + " changed if needed. + if l:goroutine.id == a:currentGoroutineID + let l:g = printf("* Goroutine %s - %s: %s:%s %s (thread: %s)", l:goroutine.id, l:goroutineType, s:substituteRemotePath(l:loc.file), l:loc.line, l:loc.function.name, l:goroutine.threadID) + let l:currentGoroutine = [l:g] + continue + else + let l:g = printf(" Goroutine %s - %s: %s:%s %s (thread: %s)", l:goroutine.id, l:goroutineType, s:substituteRemotePath(l:loc.file), l:loc.line, l:loc.function.name, l:goroutine.threadID) + endif + let v += [l:g] + endfor + + let v = ['# Goroutines'] + l:currentGoroutine + v + + call setline(1, v) + finally + setlocal nomodifiable + call win_gotoid(l:winid) + endtry +endfunction + +function! s:update_variables() abort + " FollowPointers requests pointers to be automatically dereferenced. + " MaxVariableRecurse is how far to recurse when evaluating nested types. + " MaxStringLen is the maximum number of bytes read from a string + " MaxArrayValues is the maximum number of elements read from an array, a slice or a map. + " MaxStructFields is the maximum number of fields read from a struct, -1 will read all fields. + let l:cfg = { + \ 'scope': {'GoroutineID': s:goroutineID()}, + \ 'cfg': {'MaxStringLen': 20, 'MaxArrayValues': 20, 'MaxVariableRecurse': 10} + \ } + + try + call s:call_jsonrpc(function('s:handle_list_local_vars'), 'RPCServer.ListLocalVars', l:cfg) + catch + call go#util#EchoError(printf('could not list variables: %s', v:exception)) + endtry + + try + call s:call_jsonrpc(function('s:handle_list_function_args'), 'RPCServer.ListFunctionArgs', l:cfg) + catch + call go#util#EchoError(printf('could not list function arguments: %s', v:exception)) + endtry + + try + call s:call_jsonrpc(function('s:handle_list_registers'), 'RPCServer.ListRegisters', l:cfg) + catch + call go#util#EchoError(printf('could not list registers: %s', v:exception)) + endtry + +endfunction + +function! s:handle_list_local_vars(check_errors, res) abort + let s:state['localVars'] = {} + try + call a:check_errors() + if type(a:res) is type({}) && has_key(a:res, 'result') && !empty(a:res.result) + let s:state['localVars'] = a:res.result['Variables'] + endif + catch + call go#util#EchoWarning(printf('could not list variables: %s', v:exception)) + endtry + + call s:show_variables() +endfunction + +function! s:handle_list_function_args(check_errors, res) abort + let s:state['functionArgs'] = {} + try + call a:check_errors() + if type(a:res) is type({}) && has_key(a:res, 'result') && !empty(a:res.result) + let s:state['functionArgs'] = a:res.result['Args'] + endif + catch + call go#util#EchoWarning(printf('could not list function arguments: %s', v:exception)) + endtry + + call s:show_variables() +endfunction + +function! s:handle_list_registers(check_errors, res) abort + let s:state['registers'] = {} + try + call a:check_errors() + if type(a:res) is type({}) && has_key(a:res, 'result') && !empty(a:res.result) + let s:state['registers'] = a:res.result['Regs'] + endif + catch + call go#util#EchoWarning(printf('could not list registers: %s', v:exception)) + endtry + + call s:show_variables() +endfunction + +function! go#debug#Set(symbol, value) abort + try + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.State') + let l:res = l:promise.await() + + call s:call_jsonrpc(function('s:handle_set'), 'RPCServer.Set', { + \ 'symbol': a:symbol, + \ 'value': a:value, + \ 'scope': {'GoroutineID': l:res.result.State.currentThread.goroutineID} + \ }) + catch + call go#util#EchoError(printf('could not set symbol value: %s', v:exception)) + endtry + + call s:update_variables() +endfunction + +function! s:handle_set(check_errors, res) abort + try + call a:check_errors() + catch + call go#util#EchoError(printf('could not set symbol value: %s', v:exception)) + endtry + + call s:update_variables() +endfunction + +function! s:update_stacktrace() abort + try + call s:call_jsonrpc(function('s:show_stacktrace'), 'RPCServer.Stacktrace', {'id': s:goroutineID(), 'depth': 5}) + catch + call go#util#EchoError(printf('could not update stack: %s', v:exception)) + endtry +endfunction + +function! s:stack_cb(res) abort + let s:stack_name = '' + + if type(a:res) isnot type({}) || !has_key(a:res, 'result') || empty(a:res.result) + return + endif + + if s:exited(a:res) + call go#debug#Stop() + return + endif + call s:update_breakpoint(a:res) + call s:update_goroutines() + call s:update_stacktrace() + call s:update_variables() +endfunction + +" Send a command to change the cursor location to Delve. +" +" a:name must be one of continue, next, step, or stepOut. +function! go#debug#Stack(name) abort + let l:name = a:name + + " Run continue if the program hasn't started yet. + if s:state.running is 0 + let s:state.running = 1 + let l:name = 'continue' + call s:continue() + endif + + " Add a breakpoint to the main.Main if the user didn't define any. + " TODO(bc): actually set the breakpoint in main.Main + if len(s:list_breakpoints()) is 0 + if go#debug#Breakpoint() isnot 0 + let s:state.running = 0 + return + endif + endif + + try + " s:stack_name is reset in s:stack_cb(). While its value is 'next', the + " current operation being performed by delve is a next operation and it + " must be cancelled before another next operation can start. See + " https://github.com/go-delve/delve/blob/ab5713d3ec5d12754f4b2edf85e4b36a08b67c48/Documentation/api/ClientHowto.md#special-continue-commands-and-asynchronous-breakpoints + " for more information. + if l:name is# 'next' && get(s:, 'stack_name', '') is# 'next' + " use s:rpc_response so that the any errors will be checked instead of + " completely discarding the result with s:noop. + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.CancelNext') + call l:promise.await() + endif + let s:stack_name = l:name + try + silent! sign unplace 9999 + call s:call_jsonrpc(function('s:handle_stack_response', [l:name]), 'RPCServer.Command', {'name': l:name}) + catch + call go#util#EchoError(printf('rpc failure: %s', v:exception)) + call s:clearState() + call go#util#EchoInfo('restarting debugger') + call go#debug#Restart() + endtry + catch + call go#util#EchoError(printf('CancelNext RPC call failed: %s', v:exception)) + endtry +endfunction + +function! s:handle_stack_response(command, check_errors, res) abort + try + call a:check_errors() + + if a:command is# 'next' + call s:handleNextInProgress(a:res) + endif + + call s:stack_cb(a:res) + catch + call go#util#EchoError(printf('rpc failure: %s', v:exception)) + call s:clearState() + call go#util#EchoInfo('restarting debugger') + call go#debug#Restart() + endtry +endfunction + +function! s:handleNextInProgress(res) + try + let l:res = a:res + let l:w = 0 + while l:w < 1 + if l:res.result.State.NextInProgress == v:true + " TODO(bc): message the user that a breakpoint was hit in a different + " goroutine while trying to resume. + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.Command', {'name': 'continue'}) + let l:res = l:promise.await() + else + return + endif + endwhile + catch + throw v:exception + endtry +endfunction + +function! go#debug#Restart() abort + call go#cmd#autowrite() + + try + call s:restoreMappings() + call s:stop() + + let s:state = { + \ 'rpcid': 1, + \ 'running': 0, + \ 'currentThread': {}, + \ 'localVars': {}, + \ 'functionArgs': {}, + \ 'registers': {}, + \ 'message': [], + \ 'resultHandlers': {}, + \ 'kill_on_detach': s:state['kill_on_detach'], + \ } + + call call('go#debug#Start', s:start_args) + catch + call go#util#EchoError(printf('restart failed: %s', v:exception)) + endtry +endfunction + +" Report if debugger mode is ready. +function! s:isReady() + return get(s:state, 'ready', 0) != 0 +endfunction + +" Change Goroutine +function! go#debug#Goroutine() abort + let l:goroutineID = str2nr(substitute(getline('.'), '^ Goroutine \(.\{-1,\}\) - .*', '\1', 'g')) + + if l:goroutineID <= 0 + return + endif + + try + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.Command', {'Name': 'switchGoroutine', 'GoroutineID': l:goroutineID}) + let l:res = l:promise.await() + call s:stack_cb(l:res) + call go#util#EchoInfo("Switched goroutine to: " . l:goroutineID) + catch + call go#util#EchoError(printf('could not switch goroutine: %s', v:exception)) + endtry +endfunction + +" Toggle breakpoint. Returns 0 on success and 1 on failure. +function! go#debug#Breakpoint(...) abort + let l:filename = fnamemodify(expand('%'), ':p:gs!\\!/!') + let l:linenr = line('.') + + " Get line number from argument. + if len(a:000) > 0 + let l:linenr = str2nr(a:1) + if l:linenr is 0 + call go#util#EchoError('not a number: ' . a:1) + return 0 + endif + if len(a:000) > 1 + let l:filename = a:2 + endif + endif + + try + " Check if we already have a breakpoint for this line. + let l:found = {} + for l:bt in s:list_breakpoints() + if l:bt.file is# l:filename && l:bt.line is# l:linenr + let l:found = l:bt + break + endif + endfor + + " Remove breakpoint. + if type(l:found) == v:t_dict && !empty(l:found) + call s:sign_unplace(l:found.id, l:found.file) + if s:isReady() + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.ClearBreakpoint', {'id': l:found.id}) + let res = l:promise.await() + endif + else " Add breakpoint + if s:isReady() + let l:promise = go#promise#New(function('s:rpc_response'), 20000, {}) + call s:call_jsonrpc(l:promise.wrapper, 'RPCServer.CreateBreakpoint', {'Breakpoint': {'file': s:substituteLocalPath(l:filename), 'line': l:linenr}}) + let l:res = l:promise.await() + let l:bt = l:res.result.Breakpoint + call s:sign_place(l:bt.id, s:substituteRemotePath(l:bt.file), l:bt.line) + else + let l:id = len(s:list_breakpoints()) + 1 + call s:sign_place(l:id, l:filename, l:linenr) + endif + endif + catch + call go#util#EchoError(printf('could not toggle breakpoint: %s', v:exception)) + return 1 + endtry + + return 0 +endfunction + +function! s:sign_unplace(id, file) abort + if !exists('*sign_unplace') + exe 'sign unplace ' . a:id .' file=' . a:file + return + endif + + call sign_unplace('vim-go-debug', {'buffer': a:file, 'id': a:id}) +endfunction + +function! s:sign_place(id, expr, lnum) abort + if !exists('*sign_place') + exe 'sign place ' . a:id . ' line=' . a:lnum . ' name=godebugbreakpoint file=' . a:expr + return + endif + + call sign_place(a:id, 'vim-go-debug', 'godebugbreakpoint', a:expr, {'lnum': a:lnum}) +endfunction + +function! s:list_breakpoints() + let l:breakpoints = [] + let l:signs = s:sign_getplaced() + for l:item in l:signs + let l:file = fnamemodify(bufname(l:item.bufnr), ':p') + for l:sign in l:item.signs + call add(l:breakpoints, { + \ 'id': l:sign.id, + \ 'file': l:file, + \ 'line': l:sign.lnum, + \ }) + endfor + endfor + + return l:breakpoints +endfunction + +function! s:sign_getplaced() abort + if !exists('*sign_getplaced') " sign_getplaced was introduced in Vim 8.1.0614 + " :sign place + " --- Signs --- + " Signs for a.go: + " line=15 id=2 name=godebugbreakpoint + " line=16 id=1 name=godebugbreakpoint + " Signs for a_test.go: + " line=6 id=3 name=godebugbreakpoint + + " l:signs should be the same sam form as the return value for + " sign_getplaced(), a list with the following entries: + " * bufnr - number of the buffer with the sign + " * signs = list of signs placed in bufnr + let l:signs = [] + let l:file = '' + for l:line in split(execute('sign place'), '\n')[1:] + if l:line =~# '^Signs for ' + let l:file = l:line[10:-2] + continue + else + " sign place's output may end with Signs instead of starting with Signs. + " See + " https://github.com/fatih/vim-go/issues/2920#issuecomment-644885774. + let l:idx = match(l:line, '\.go .* Signs:$') + if l:idx >= 0 + let l:file = l:line[0:l:idx+2] + continue + endif + endif + + if l:line !~# 'name=godebugbreakpoint' + continue + endif + + let l:sign = matchlist(l:line, '\vline\=(\d+) +id\=(\d+)') + call add(l:signs, { + \ 'bufnr': bufnr(l:file), + \ 'signs': [{ + \ 'id': str2nr(l:sign[2]), + \ 'lnum': str2nr(l:sign[1]), + \ }], + \ }) + endfor + + return l:signs + endif + + " it would be nice to use lambda's here, but vim-vimparser currently fails + " to parse lamdas as map() arguments. + " TODO(bc): return flatten(map(filter(copy(getbufinfo()), { _, val -> val.listed }), { _, val -> sign_getplaced(val.bufnr, {'group': 'vim-go-debug', 'name': 'godebugbreakpoint'})})) + let l:bufinfo = getbufinfo() + let l:listed = [] + for l:info in l:bufinfo + if l:info.listed + let l:listed = add(l:listed, l:info) + endif + endfor + + let l:signs = [] + for l:buf in l:listed + let l:signs = add(l:signs, sign_getplaced(l:buf.bufnr, {'group': 'vim-go-debug', 'name': 'godebugbreakpoint'})[0]) + endfor + return l:signs +endfunction + +exe 'sign define godebugbreakpoint text='.go#config#DebugBreakpointSignText().' texthl=GoDebugBreakpoint' +sign define godebugcurline text== texthl=GoDebugCurrent linehl=GoDebugCurrent + +" s:rpc_response is a convenience function to check for errors and return +" a:res when a:res is not an error response. +function! s:rpc_response(check_errors, res) abort + call a:check_errors() + return a:res +endfunction + +" s:noop is a noop function. It takes any number of arguments and does +" nothing. +function s:noop(...) abort +endfunction + +function! s:warn_when_stale(filename) abort + let l:bufinfo = getbufinfo(a:filename) + if len(l:bufinfo) == 0 + return + endif + + if l:bufinfo[0].changed + call s:warn_stale() + return + endif + + call s:call_jsonrpc(function('s:handle_staleness_check_response', [fnamemodify(a:filename, ':p')]), 'RPCServer.LastModified') +endfunction + +function! s:handle_staleness_check_response(filename, check_errors, res) abort + try + call a:check_errors() + catch + " swallow any errors + return + endtry + + let l:ftime = strftime('%Y-%m-%dT%H:%M:%S', getftime(a:filename)) + if l:ftime < a:res.result.Time[0:(len(l:ftime) - 1)] + return + endif + call s:warn_stale(a:filename) +endfunction + +function! s:warn_stale(filename) abort + call go#util#EchoWarning(printf('file locations may be incorrect, because %s has changed since debugging started', a:filename)) +endfunction + + +function! s:configureMappings(...) abort + if a:0 == 0 + return + endif + + let l:debug_mappings = go#config#DebugMappings() + + for l:arg in a:000 + if !has_key(l:debug_mappings, l:arg) + continue + endif + + let l:config = l:debug_mappings[l:arg] + + " do not attempt to apply the mapping when the key is empty or missing. + if get(l:config, 'key', '') == '' + continue + endif + + let l:lhs = l:config.key + try + call execute(printf('autocmd BufWinEnter *.go call s:save_maparg_for(expand(''%%''), ''%s'')', l:lhs)) + call execute('autocmd BufWinLeave *.go call s:restoreMappings()') + + let l:mapping = 'autocmd BufWinEnter *.go nmap ' + if has_key(l:config, 'arguments') + let l:mapping = printf('%s %s', l:mapping, l:config.arguments) + endif + let l:mapping = printf('%s %s %s', l:mapping, l:lhs, l:arg) + call execute(l:mapping) + catch + call go#util#EchoError(printf('could not configure mapping for %s: %s', l:lhs, v:exception)) + endtry + endfor +endfunction + +function! s:save_maparg_for(bufname, lhs) abort + " make sure bufname is the active buffer. + if fnamemodify(a:bufname, ':p') isnot expand('%:p') + call go#util#EchoWarning('buffer must be active to save its mappings') + return + endif + + " only normal-mode buffer-local mappings are needed, because all + " vim-go-debug mappings are normal-mode buffer-local mappings. Therefore, + " we only need to retrieve normal mode mappings that need to be saved. + let l:maparg = maparg(a:lhs, 'n', 0, 1) + if empty(l:maparg) + return + endif + + if l:maparg.buffer + let l:bufmapargs = get(s:mapargs, a:bufname, []) + let l:bufmapargs = add(l:bufmapargs, l:maparg) + let s:mapargs[a:bufname] = l:bufmapargs + endif +endfunction + +function! s:restoreMappings() abort + " Remove all debugging mappings. + for l:mapping in values(go#config#DebugMappings()) + let l:lhs = get(l:mapping, 'key', '') + if l:lhs == '' + continue + endif + let l:maparg = maparg(l:lhs, 'n', 0, 1) + if empty(l:maparg) + continue + endif + if l:maparg.buffer + call execute(printf('nunmap %s', l:lhs)) + endif + endfor + + call s:restoremappingfor(bufname('')) +endfunction + +function! s:restoremappingfor(bufname) abort + if !has_key(s:mapargs, a:bufname) + return + endif + + for l:maparg in s:mapargs[a:bufname] + call s:restore_mapping(l:maparg) + endfor + call remove(s:mapargs, a:bufname) +endfunction + +function! s:restore_mapping(maparg) + if empty(a:maparg) + return + endif + if !exists('*mapset') + " see :h :map-arguments + let l:silent_attr = get(a:maparg, 'silent', 0) ? '' : '' + let l:nowait_attr = get(a:maparg, 'no_wait', 0) ? '' : '' + let l:buffer_attr = get(a:maparg, 'buffer', 0) ? '' : '' + let l:expr_attr = get(a:maparg, 'expr', 0) ? '' : '' + let l:unique_attr = get(a:maparg, 'unique', 0) ? '' : '' + let l:script_attr = get(a:maparg, 'script', 0) ? '