From 8c6f4bdf7f7919a67e201b472f932e05ddb8787e Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Sun, 17 Nov 2019 16:45:35 +0100 Subject: [PATCH] Removed vim-go --- sources_non_forked/vim-go/.codecov.yml | 13 - sources_non_forked/vim-go/.coveragerc | 3 - sources_non_forked/vim-go/.dockerignore | 6 - 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 | 30 - sources_non_forked/vim-go/.gitignore | 5 - sources_non_forked/vim-go/.travis.yml | 22 - sources_non_forked/vim-go/.vintrc.yaml | 7 - sources_non_forked/vim-go/CHANGELOG.md | 1711 ----------- sources_non_forked/vim-go/Dockerfile | 19 - sources_non_forked/vim-go/LICENSE | 60 - sources_non_forked/vim-go/Makefile | 29 - sources_non_forked/vim-go/README.md | 85 - sources_non_forked/vim-go/addon-info.json | 6 - sources_non_forked/vim-go/assets/vim-go.png | Bin 29252 -> 0 bytes sources_non_forked/vim-go/assets/vim-go.svg | 821 ------ .../vim-go/autoload/ctrlp/decls.vim | 154 - .../vim-go/autoload/fzf/decls.vim | 157 - .../vim-go/autoload/go/alternate.vim | 35 - .../vim-go/autoload/go/asmfmt.vim | 76 - .../vim-go/autoload/go/auto.vim | 139 - sources_non_forked/vim-go/autoload/go/cmd.vim | 353 --- .../vim-go/autoload/go/cmd_test.vim | 38 - .../vim-go/autoload/go/complete.vim | 306 -- .../vim-go/autoload/go/complete_test.vim | 41 - .../vim-go/autoload/go/config.vim | 531 ---- .../vim-go/autoload/go/config_test.vim | 86 - .../vim-go/autoload/go/coverage.vim | 297 -- .../vim-go/autoload/go/debug.vim | 1126 -------- .../vim-go/autoload/go/debug_test.vim | 114 - .../vim-go/autoload/go/decls.vim | 26 - sources_non_forked/vim-go/autoload/go/def.vim | 358 --- .../vim-go/autoload/go/def_test.vim | 223 -- sources_non_forked/vim-go/autoload/go/doc.vim | 247 -- .../vim-go/autoload/go/fillstruct.vim | 72 - .../vim-go/autoload/go/fillstruct_test.vim | 98 - sources_non_forked/vim-go/autoload/go/fmt.vim | 214 -- .../vim-go/autoload/go/fmt_test.vim | 57 - .../vim-go/autoload/go/guru.vim | 731 ----- .../vim-go/autoload/go/guru_test.vim | 23 - .../vim-go/autoload/go/highlight_test.vim | 145 - .../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/import.vim | 232 -- .../vim-go/autoload/go/indent_test.vim | 72 - .../vim-go/autoload/go/issue.vim | 52 - sources_non_forked/vim-go/autoload/go/job.vim | 528 ---- .../vim-go/autoload/go/job_test.vim | 53 - .../vim-go/autoload/go/keyify.vim | 64 - .../vim-go/autoload/go/lint.vim | 279 -- .../vim-go/autoload/go/lint_test.vim | 206 -- .../vim-go/autoload/go/list.vim | 173 -- sources_non_forked/vim-go/autoload/go/lsp.vim | 1062 ------- .../autoload/go/lsp/completionitemkind.vim | 63 - .../vim-go/autoload/go/lsp/lsp.vim | 58 - .../vim-go/autoload/go/lsp/lsp_test.vim | 32 - .../vim-go/autoload/go/lsp/message.vim | 221 -- .../vim-go/autoload/go/lsp_test.vim | 49 - sources_non_forked/vim-go/autoload/go/mod.vim | 147 - .../vim-go/autoload/go/package.vim | 309 -- .../vim-go/autoload/go/package_test.vim | 58 - .../vim-go/autoload/go/path.vim | 248 -- .../vim-go/autoload/go/play.vim | 76 - .../vim-go/autoload/go/promise.vim | 50 - .../vim-go/autoload/go/promise_test.vim | 41 - .../vim-go/autoload/go/rename.vim | 140 - .../vim-go/autoload/go/statusline.vim | 124 - .../vim-go/autoload/go/tags.vim | 219 -- .../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 | 177 -- .../vim-go/autoload/go/term_test.vim | 60 - .../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 - .../go/test-fixtures/fmt/imports/goimports.go | 13 - .../fmt/imports/goimports_golden.go | 15 - .../vendor/gh.com/gi/foo-logging/logger.go | 12 - .../autoload/go/test-fixtures/fmt/src/imports | 1 - .../test-fixtures/job/dir has spaces/main.go | 6 - .../go/test-fixtures/lint/src/foo/foo.go | 7 - .../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/vet.go | 8 - .../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/src/example/example_test.go | 10 - .../test/src/play/mock/controller.go | 7 - .../test-fixtures/test/src/play/play_test.go | 59 - .../test/src/showname/showname_test.go | 11 - .../testcompilerror/testcompilerror_test.go | 11 - .../test/src/timeout/timeout_test.go | 47 - .../test/src/veterror/veterror.go | 7 - .../vim-go/autoload/go/test.vim | 329 --- .../vim-go/autoload/go/test_test.vim | 143 - .../vim-go/autoload/go/textobj.vim | 284 -- .../vim-go/autoload/go/tool.vim | 147 - .../vim-go/autoload/go/tool_test.vim | 31 - sources_non_forked/vim-go/autoload/go/ui.vim | 122 - sources_non_forked/vim-go/autoload/go/uri.vim | 38 - .../vim-go/autoload/go/util.vim | 596 ---- sources_non_forked/vim-go/autoload/gotest.vim | 155 - .../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 | 2534 ----------------- .../vim-go/ftdetect/gofiletype.vim | 40 - sources_non_forked/vim-go/ftplugin/asm.vim | 37 - sources_non_forked/vim-go/ftplugin/go.vim | 128 - .../vim-go/ftplugin/go/commands.vim | 126 - .../vim-go/ftplugin/go/mappings.vim | 86 - .../vim-go/ftplugin/go/snippets.vim | 75 - .../vim-go/ftplugin/go/tagbar.vim | 65 - .../vim-go/ftplugin/gohtmltmpl.vim | 7 - sources_non_forked/vim-go/ftplugin/gomod.vim | 33 - .../vim-go/ftplugin/gomod/commands.vim | 3 - .../vim-go/ftplugin/gomod/mappings.vim | 1 - .../vim-go/gosnippets/UltiSnips/go.snippets | 485 ---- .../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 | 401 --- sources_non_forked/vim-go/indent/go.vim | 86 - .../vim-go/indent/gohtmltmpl.vim | 54 - sources_non_forked/vim-go/plugin/go.vim | 313 -- .../rplugin/python3/denite/source/decls.py | 93 - .../vim-go/scripts/bench-syntax | 44 - sources_non_forked/vim-go/scripts/docker-test | 15 - sources_non_forked/vim-go/scripts/install-vim | 107 - 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 | 133 - sources_non_forked/vim-go/scripts/test | 101 - sources_non_forked/vim-go/syntax/go.vim | 425 --- .../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 | 92 - .../vim-go/syntax/gotexttmpl.vim | 85 - sources_non_forked/vim-go/syntax/vimgo.vim | 13 - .../vim-go/templates/hello_world.go | 7 - .../vim-go/templates/hello_world_test.go | 7 - .../vim-go/test/gopath_test.vim | 65 - sources_non_forked/vim-go/test/parse.go | 2096 -------------- 172 files changed, 24061 deletions(-) delete mode 100644 sources_non_forked/vim-go/.codecov.yml delete mode 100644 sources_non_forked/vim-go/.coveragerc delete mode 100644 sources_non_forked/vim-go/.dockerignore delete mode 100644 sources_non_forked/vim-go/.editorconfig delete mode 100644 sources_non_forked/vim-go/.github/CONTRIBUTING.md delete mode 100644 sources_non_forked/vim-go/.github/FUNDING.yml delete mode 100644 sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md delete mode 100644 sources_non_forked/vim-go/.gitignore delete mode 100644 sources_non_forked/vim-go/.travis.yml delete mode 100644 sources_non_forked/vim-go/.vintrc.yaml delete mode 100644 sources_non_forked/vim-go/CHANGELOG.md delete mode 100644 sources_non_forked/vim-go/Dockerfile delete mode 100644 sources_non_forked/vim-go/LICENSE delete mode 100644 sources_non_forked/vim-go/Makefile delete mode 100644 sources_non_forked/vim-go/README.md delete mode 100644 sources_non_forked/vim-go/addon-info.json delete mode 100644 sources_non_forked/vim-go/assets/vim-go.png delete mode 100644 sources_non_forked/vim-go/assets/vim-go.svg delete mode 100644 sources_non_forked/vim-go/autoload/ctrlp/decls.vim delete mode 100644 sources_non_forked/vim-go/autoload/fzf/decls.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/alternate.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/asmfmt.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/auto.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/cmd.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/cmd_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/complete.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/complete_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/config.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/config_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/coverage.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/debug.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/debug_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/decls.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/def.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/def_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/doc.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/fillstruct.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/fillstruct_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/fmt.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/fmt_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/guru.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/guru_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/highlight_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/iferr.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/impl.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/impl_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/import.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/indent_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/issue.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/job.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/job_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/keyify.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lint.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lint_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/list.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp/completionitemkind.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp/message.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/lsp_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/mod.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/package.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/package_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/path.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/play.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/promise.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/promise_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/rename.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/statusline.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/tags.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/tags_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/template.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/template_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/term.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/term_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/cmd/bad.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/buildtags.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/constrainedfoo.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/foo.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/go.mod delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/debug/compilerror/main.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/debug/debugmain/debugmain.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports_golden.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/vendor/gh.com/gi/foo-logging/logger.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/job/dir has spaces/main.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/foo.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/lint.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/quux.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/compilererror/compilererror.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/vet.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/term/term.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/.gitignore delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/compilerror.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/mock/controller.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/play_test.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/showname_test.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/testcompilerror_test.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/timeout_test.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/veterror.go delete mode 100644 sources_non_forked/vim-go/autoload/go/test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/test_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/textobj.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/tool.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/tool_test.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/ui.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/uri.vim delete mode 100644 sources_non_forked/vim-go/autoload/go/util.vim delete mode 100644 sources_non_forked/vim-go/autoload/gotest.vim delete mode 100644 sources_non_forked/vim-go/autoload/unite/sources/decls.vim delete mode 100644 sources_non_forked/vim-go/compiler/go.vim delete mode 100644 sources_non_forked/vim-go/doc/vim-go.txt delete mode 100644 sources_non_forked/vim-go/ftdetect/gofiletype.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/asm.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/go.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/go/commands.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/go/mappings.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/go/snippets.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/go/tagbar.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/gomod.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/gomod/commands.vim delete mode 100644 sources_non_forked/vim-go/ftplugin/gomod/mappings.vim delete mode 100644 sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_eq delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_err delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_errt delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_errw delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_f delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_ff delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_fori delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_sp delete mode 100644 sources_non_forked/vim-go/gosnippets/minisnip/_go_tt delete mode 100644 sources_non_forked/vim-go/gosnippets/snippets/go.snip delete mode 100644 sources_non_forked/vim-go/indent/go.vim delete mode 100644 sources_non_forked/vim-go/indent/gohtmltmpl.vim delete mode 100644 sources_non_forked/vim-go/plugin/go.vim delete mode 100644 sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py delete mode 100644 sources_non_forked/vim-go/scripts/bench-syntax delete mode 100644 sources_non_forked/vim-go/scripts/docker-test delete mode 100644 sources_non_forked/vim-go/scripts/install-vim delete mode 100644 sources_non_forked/vim-go/scripts/lint delete mode 100644 sources_non_forked/vim-go/scripts/run-vim delete mode 100644 sources_non_forked/vim-go/scripts/runbench.vim delete mode 100644 sources_non_forked/vim-go/scripts/runtest.vim delete mode 100644 sources_non_forked/vim-go/scripts/test delete mode 100644 sources_non_forked/vim-go/syntax/go.vim delete mode 100644 sources_non_forked/vim-go/syntax/godebugoutput.vim delete mode 100644 sources_non_forked/vim-go/syntax/godebugstacktrace.vim delete mode 100644 sources_non_forked/vim-go/syntax/godebugvariables.vim delete mode 100644 sources_non_forked/vim-go/syntax/godefstack.vim delete mode 100644 sources_non_forked/vim-go/syntax/gohtmltmpl.vim delete mode 100644 sources_non_forked/vim-go/syntax/gomod.vim delete mode 100644 sources_non_forked/vim-go/syntax/gotexttmpl.vim delete mode 100644 sources_non_forked/vim-go/syntax/vimgo.vim delete mode 100644 sources_non_forked/vim-go/templates/hello_world.go delete mode 100644 sources_non_forked/vim-go/templates/hello_world_test.go delete mode 100644 sources_non_forked/vim-go/test/gopath_test.vim delete 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 deleted file mode 100644 index 9a8b1bb9..00000000 --- a/sources_non_forked/vim-go/.codecov.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -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 deleted file mode 100644 index 8cddf91c..00000000 --- a/sources_non_forked/vim-go/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -plugins = covimerage -data_file = .coverage_covimerage diff --git a/sources_non_forked/vim-go/.dockerignore b/sources_non_forked/vim-go/.dockerignore deleted file mode 100644 index 286d0891..00000000 --- a/sources_non_forked/vim-go/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.local/ -.config/ -.cache/ -.dlv/ -.git/ -.viminfo diff --git a/sources_non_forked/vim-go/.editorconfig b/sources_non_forked/vim-go/.editorconfig deleted file mode 100644 index 2c222811..00000000 --- a/sources_non_forked/vim-go/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -# 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 deleted file mode 100644 index edabf915..00000000 --- a/sources_non_forked/vim-go/.github/CONTRIBUTING.md +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 060026ef..00000000 --- a/sources_non_forked/vim-go/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -patreon: bhcleek diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 7d584256..00000000 --- a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,30 +0,0 @@ -### 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 (use a *minimal* vimrc with other plugins disabled; do not link to a 2,000 line vimrc): -
vimrc
-
-
- -#### Vim version (first three lines from `:version`): - - -#### Go version (`go version`): - - -#### Go environment -
go env Output:
-
-
-
diff --git a/sources_non_forked/vim-go/.gitignore b/sources_non_forked/vim-go/.gitignore deleted file mode 100644 index 5c648492..00000000 --- a/sources_non_forked/vim-go/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.DS_Store -/doc/tags -/.coverage.covimerage -/coverage.xml -*.pyc diff --git a/sources_non_forked/vim-go/.travis.yml b/sources_non_forked/vim-go/.travis.yml deleted file mode 100644 index d18bf2b6..00000000 --- a/sources_non_forked/vim-go/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go -go: - - 1.13 -notifications: - email: false -matrix: - include: - - env: SCRIPT="test -c" VIM_VERSION=vim-8.0 - - env: SCRIPT="test -c" VIM_VERSION=nvim - - env: ENV=vimlint SCRIPT=lint VIM_VERSION=vim-8.0 - language: python - python: 3.6 -install: - - ./scripts/install-vim $VIM_VERSION - - | - if [ "$ENV" = "vimlint" ]; then - pip install vim-vint covimerage==0.1.6 codecov pathlib - else - pip install --user vim-vint covimerage==0.1.6 codecov pathlib - fi -script: - - ./scripts/$SCRIPT $VIM_VERSION diff --git a/sources_non_forked/vim-go/.vintrc.yaml b/sources_non_forked/vim-go/.vintrc.yaml deleted file mode 100644 index 32d7decf..00000000 --- a/sources_non_forked/vim-go/.vintrc.yaml +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 01f1ae83..00000000 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ /dev/null @@ -1,1711 +0,0 @@ -## unplanned - -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) -* Add highlighting of sections reported by gopls diagnostics' errors - and warnings. - [[GH-2569]](https://github.com/fatih/vim-go/pull/2569) -* 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) - -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) - -## 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 deleted file mode 100644 index 15a158b7..00000000 --- a/sources_non_forked/vim-go/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM golang:1.13 - -RUN apt-get update -y && \ - 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 . /vim-go/ -WORKDIR /vim-go - -RUN scripts/install-vim vim-8.0 -RUN scripts/install-vim nvim - -ENTRYPOINT ["make"] diff --git a/sources_non_forked/vim-go/LICENSE b/sources_non_forked/vim-go/LICENSE deleted file mode 100644 index d9493d4f..00000000 --- a/sources_non_forked/vim-go/LICENSE +++ /dev/null @@ -1,60 +0,0 @@ -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 deleted file mode 100644 index c4982375..00000000 --- a/sources_non_forked/vim-go/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -VIMS ?= vim-8.0 nvim - -all: install lint test - -install: - @echo "==> Installing Vims: $(VIMS)" - @for vim in $(VIMS); do \ - ./scripts/install-vim $$vim; \ - done - -test: - @echo "==> Running tests for $(VIMS)" - @for vim in $(VIMS); do \ - ./scripts/test $$vim; \ - done - -lint: - @echo "==> Running linting tools" - @./scripts/lint vim-8.0 - -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 deleted file mode 100644 index 23d0d88c..00000000 --- a/sources_non_forked/vim-go/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# vim-go [![Build Status](http://img.shields.io/travis/fatih/vim-go.svg?style=flat-square)](https://travis-ci.org/fatih/vim-go) - -

- 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` support with `:GoDebugStart`. -* Completion support via `gocode` and `gopls`. -* `gofmt` or `goimports` on save keeps the cursor position and undo history. -* Go to symbol/declaration with `:GoDef`. -* Look up documentation with `:GoDoc` or `:GoDocBrowser`. -* 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 `gometalinter` with `:GoMetaLinter` to invoke all possible linters - (`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. - -## Install - -vim-go requires at least Vim 8.0.1453 or Neovim 0.3.1. - -The [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) is the -recommended version to use. If you choose to use the master branch instead, -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` -* [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 get` 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 an [official vim-go tutorial](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. - -## 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 deleted file mode 100644 index 145d961c..00000000 --- a/sources_non_forked/vim-go/addon-info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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 deleted file mode 100644 index cb26e2c073ecba2bf5f97686dc3b8184868ab12f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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)8XN&F6tBQ5(iRi+?W#x%p3FV^n) zEGIJ;e^~!d$FLDwn8D+)aG%oVBo}(D?Q1kemXP^-vu`+W!>K^wtl4f%o=^Sswmso$ z!_R@@uP)BSg&zLCUg3&$Kh#U)2?!>F*t$hdXGXM%BV$n*DJIKa7c?sx=P z`zIdq1SxDDXmUeDSDWz(+U!)XD^25i`q#{VgEh? z;c90-!aC_(e0kwR`b@Z^u<^W)2~cI-vkrPQA{k-Pfu1Q5|3@O}fDyiZ7FSeAU`*xd z&0;MFk4=+NParm0*l8B=Z9n0+i^BcgX$PuA`ha=?te_Ej`4{OOwn6lqR0VBO!~^u^ z=udDVv&TIvbK#AR2y!MwsiB^krxg~}m8Fecp{XzUnO5`;D^tX=&9ji$P(@PFIcoy@ ze+Yv5c9QVIahFsL`vw<3WEY}gu+LYd#lPcQCOIL*C_w8)k=VVxHbpk2QZM64X7Yz# z91>)LUOuy@`Ut8!tO&v0kV~0zOm=Kf{_FWI-Q37bgc^IUx7YwqYPMggB9lfXZS~zP zqklkcI$uunW)yW=VzC#JUj z%%mH$_(fM%{wI2HlXZeW?qUIum#CN9hdjD0&rn7&<>^O0d|?~+qc91wRDrHY+>M$r|zDB}bP z>?O31ZTw>Bxe>YcE7jIshx?;Dow_CvQP?|KS(;tX2O=w@`p);J*!%50C?bc0zB!6Y zufGr|m9iCgh7oc|JcDRKoeo9148;^iSbxgJs%SYzSL{kzSlJ#q#sKT&azaKZ zqK@bBB;Q6DF>j>M_!72I{rzt3$NIzlb5z`?)Qinrrn|{I6q2{*;d8qK0TC<_VRF0U z8)4}YADP`!j;W6K8l&Pn3qMi#$VXet<%S&zsERqcr;Sn#`uCZ#ED~?!j8@|hM~F?h z8%1H9G|tqy2zD7f_Rm4I`L`{Fv&JkLD$a+CpYB4FO4L6cw7>JGDmmScFdd2&?nr0w z1SKP|hs#c!+}c0igY9bSbQq~tc7}SUq5mnRx8AkUidN{#_mbJ9tvz1lAAn!ve3n@c zahZiS4xE>QC~tZdDmPwSloqG-9M6A1KBKdA?WQZ1nTt=VOHSy^YOgI51AEYqZsgj1 zEf#-}DLaaGUa;5WI(qY%&!;%?1vXSFkD=WO&w=%g z-(Eb02>E&O?WWJ*o)V{S59YcIlgishti)+04g>u<;xxo5F76-F^f0PKSC~V6kWh?BjrKqjN4&oE*8yivXKB z10`w8>1C7sZCdrIp%<4jx!qdBNwrpo&7=KS;Bw@568B&G$Nx^1^Ly=Y)#yiB`j++l zR1SA?p1NSa)f7{y*#Vv7aYhWo_oX=cfYgzxBk-=g-YfebcP3QWo@f}e{fagA<>uh^ z`6&&53sTuEg#V-wsm+b`;AD5P)7QP-FTSce`l@*Q|B@Q+i*UXnRzU#kCW&v}%WS9I zS&qQfKON3(Tq>)}NDak*9#QMIaN#@il&GjL`KM2pAPf_|g@0l;WibAW7uPLglOH$p z35C$giakWPd+(}EgF`dLjW})sPhzm)+1m5gBLdydM(_EcQHaB7xCllR451pC0Uthz zcYNC&#>*f(-f@BY_M(-`SuR>tR8L6}J)H5kII33IT;w7H4{{v%Zb&sF7Lx=0zelaO zY7V9(Qe57n5rSFe3H#~gfR9W^IEAS`!r4MQfk7W6Wp$T_IL z8v4AlFuHJh`u~11Jy`Qbqj174xEweQdVq-&(kq+h7ljuEGBYPxZY5cV$42vnKJu$< zj)-1Dc1Aq|6?@t5maQIE!&N?PAVtxnCx=^+dc*6Gn8j3Hca<%Y}?KJ)MR9&ZAw;<{)WsWcxwamY~Q;Ld~RjO#=;N@SFB>tJs@yCZr0x;+xN>HrwiGN3jv~6XibL4gqQ?P5 z4Raa^Y`%PhJzEBs7?FX~gd9g*oSuUgsN}TfbjNDuCN?&u1s!;#SbIb=874()PJb3~ zN%)FwqE4ZJehM*?VR9Ihp3LJ38L&O=(=|1tt~5Ov11%w5$esR+me%Ow#ErM@*l8t` z06vN&pqJxnsl92CuOccIJvCiaTvWDpF>Cy5OVPhL$xUGLC9xU90u4u5%`v*E)Kh}g zOgilSV6Uofo(cxe6}%$pCj}%lDX+;IJTxv`a46@1S@dx|k_8J4dKPQu)src?WHIaa zGj+Do2?-j$$Vcn#txU8!op0fa6Ox}ro+Yg0uu8yg=sDRAny78;(*z1fZ$|Go-oX6L zJnN7M?(bLAa7PcD_yoB#x)+^|5OG{2L@$_XcifqBi=_a1^WQtGbLn}^`boDcInipN zTnXn{6p?N(aVd_(7UTM-$bB7C|Z)Fp`f=k??=@qpWJ5&&A7b9x-b+ z5sQ~_0v{3SG{$q&V}3cku-4NbRr})*u6BAsTgmz$T?k1-*%Z0RjQQ9>?vwur;SqNf z_aVQh38*~D43jud{JEf$hv)$vf}7er7Ui=ro6GrhkyK7+v*UZdV56_7teGN(z0D6} z-`U|c35f43PL`^FE@#~=DwxbK7=XoK#`op{=g*+*~O;*;5{mB?v=k6ezb*zp={ zY<;EOz1b|)%v5ysq~-J*K?#f0F}N{!yf3>mMQ~G-%PzV9bwOqC*~Vwu0gW_1>jmea zkvYPYM9zGK#-;zB4@;qFw{Yp}}?3GeG26QCL)q$wY5^*VQyuu|8sO-mV-zU)D3XgCJPBZ%My zg47A&@zDzv^NADerNe9=+tygUJg&aZ57}A%vw%Db+XLeK5x>b27QDdJavLD+R@(1| z%NGP;;&12bt&M*|Bit4@S_H?VWA6_Hw+BiZI*FDnRQnS?fhT7DVgZ~j3)zu31;@K;ruO$8etq6V{*C`lNRq|y2&HG(E(EFs0C6V#3r^Nxz7yHFN6${)o?wI8FO)p+{-p<>zA@VH zD&V2cB(iRm9 zL_mhmpZHl)UJ~;1A{iMu#-ph|-rEPm!P%U>QH3)SCVl;PP-#=|_@0{+9>@)~R7PF1 z3ODHP@GWZpp5Mcx*K)O}vZERJl-`7n-yVB8B($ZGv|0<5&{UWL3F(Q zMglq8Ixb7JOKqt^RzmsPrdr0b#0fneIN=B!^jL+7 z>>VeVo{rZ=rkk!!owrJvKNWFM5fM;#W=fD+-LD1MX1z9(1hlI(2?(0bwt`X&e_O8B zC{C%_A(EQ+{@7#a!py-9`v@wrSd{E~S)7%gAK61N@wj@w#KJm%_t?)|;WO|#h1z(t z$4TX)_ZJ^t)Ck+&n8@pN{nHHg383~D3*R40JC()XV?%F-Nc)%jkBg1A^DMB^HUcd| z=ISZ2s&LlBlxNBQPja>0N6t-O*(g>Sb=+2HCG(Gwzsu0+-dNW9?j7k`n=d4l-P&>M z+p;PopST0p2)e}NSB4EP9t0byhP0o{40nF(>Tvjd>VDeRx4q45-!;`h@q0NH)~UC3 z8Y-Y8Yx&VPibLYrunUoou!TwoEj8?fk*0}SAEdYJ)dpYJDqLE z1EM_j2lDTYCMRY;?+X$_eicX&>jS)l4R58qQE2z99FnfVuKCOObo3$NJdfb52OI~x znSV?DVt($iE?G@(gx^Y_wQF@gx<5EQ*3+G~NDOQ7p-MZh{2KvGbU32JYe$M#vSPCv z^=PYs*jyt)f-Yhq-?94B37%|CbG5mvBYl4AHFE`1D>1PuTAlb~LP@*B=#yvXhfrz+ zf`gvxwCK0h6(0K|8pcKq!p+uz;Dp`l`NFx@-yHL|^J7Y68YzaaM_#5s?y~>=RfA5K zXUG&rN}3*i&E(J~wr6Yid(z`D&9 zDVt?=TA>7*$#0h-;!J#e0FFViT2dffn2)k5Ik>OOj-pC7_lpv zBtRZ;pVd@U@speem#Q?zb9S*6krRT@jM9964aroZ%q)SA3eCxaN79M(Al_co1Peam z*sEhPMD;Zr(u+$rxQ+aQ@?W*p8Cs*UKvkzbf#{XhvV>va7hg zGrA13pa><$wOut5cjj;)WH%POrFM=YY;F90yZDaXxLpry5=*%(ApjL0*X`$DSM+Di zqQLH#oyE>jw`Z~s99j`~y0-J;RD=x4KD*bqQ!5W}uN~HBj6tv3*Lk~7iF{8#cQt(< zR=?=CJ3`YZiMIA@AyJ53T4@#OIxDUZ_Tby&5VJ@N+AB3JD9jI+XI` zW#~sE6<`Q1BYA_t8j9&PZoUCxDS9`Jm^v%x^M&`P#Tt6fd4d=p>GaRr0NX60C6<)L z+;DgOk-+LP4o+r(k^U@l=C><1lLfzToHE z!&3}Bc=WV=h)X+vCudYE0xJVg$o3MLPJ}E~PDsQha_-*Ppv)SCZyJhaX1q0i3#q8(5Oeiwabxx>v8?b0&VdYv~GbH&a zm{!dE@7VeE<;%xnLfsen!?`yi=2|(R)ytztwqcVpkbPFm2SXXa?LedwFZBWkLI~|P zd(@B1#DNR0F=iPhg^TRnmHS>RgFH0nr4@8hbev!X?D>eSeRm~l zQA2P#A#xP2PyKIZbv(BT52kV<{F8UkW|=!?tZFKO4Td5!A{VI&`^)@t3UTpr1zy&r*ob?)PaOkK1L| zYk!hfyB&zkoIoPMinSjh&DNj!czrn9s4jOZRf~h9{llR*mAsqhG@ML>=uy`0%CSbW zga(E_J%?`Pi(I@-az8(d`I#PqYZJM6r|7A~Q6S7H-;)G8pxXO-PwjkqbT55GHC$}c zoB&**=P(^|w&vw8CKb2N`S$lTclBnOAWYCE30Mxua#7)H3$eGFG#;@`&SsoM{99gE z)aCVsx&NP63r?G0pC_96*My&A}?i!Ne7 zN%H=AMgkp7WKJHPA?K~^qOJMfx_}6uUf(8@4Ra}f`3O7e`veVvPmp31Cf4qQ;HEHz za}E}*hecGlVmvr>{7bN49*l0cxJ%1SA#?Zl zjJWD+w85CqBhi*vmR7b~SDsVm;b;-g=MpvdSP=Ac z*xqH7R!b4Ku1JYU83vsomlk5 zT32va1~rmhp%3Nr@zo=y_X*%VZ^EJd-Wm4oN#W%6=2;ln7Lxb9slI}k+U%J;J7clhxeFdt^L>8zn?;j-*cV8FkC4pYs};){ z=l@RmfhifQ^_>bA7C5hx3?gY&TVEpK+UN!9!* z7YD)OQ~|z0uTZ@iPV(CiQtIM4d~R8?@O`}XVugDu{i){{4v%K?cWL@;sXp(du&>|D z-8Pnk$%=vh{gI@i!pbMpa&<`#rfnU3)B2w3)nYMCC`sAx(6Ys2ShMQ*g6R4RgUcMZ z`7#}uJ2VC*j@3gJD>4X~F4m`C=P863R4(KTU0wl-b~HH}L;7&<)V+pkxu}qPb=|ns zlh5M|Ao6-pbG1*Cf?=Vfg(~8We+!Fc5%vrndO41XzS|=X>)opO@;aLJar)5FJEAVY zfxHmfBSuJO%HvNqUer6#8Dk6~X_W$09hJ{y7 z{~_eJq$x+Da#=64YA3A)l0$#Cq?OhvDfly2llj;X?hR`WiWZ~7U*X5bp z&-dqga~9(@i$ye1Plg_i|27@{C$#@gsAG!YG;8-F(ZYcwC=e2k*%xGJv$jxnDx}ld zv}gsiE$!>cFF~9mHm1dGm?VoSIY;}Wy~c>BRD7IS6RQIJYZoyQyF*uF;O<3pjBGaA zFvHiU_Wr>J^MOQn2DJtN;}X$ALflcKA>}6vdIl(#LHXyCK4L2hI~UuL5gK|oMl_x_ zyLuUDXb}6Hz}%qWwp7GFLmZ#;lb(zT())vCc-59WeA0%%$1wv)X4il7d>2guT!VUh zs<{pNNc=w7#}7b%MMe1(J*sv(nh*u%5{@wPX>xHyv<&~OR>SIOvjT^w5KvLeZ9J}=!`LIB1UFva$wN6e;Q1^$ZiOQ03i%^Jjgu0hyR zmiih89emhlSgek*j*QO->1D&!uKS`2uFE%Z<8eP}^}D&LykznCs~s3Po}8Lv`q=f# zWRSNq#j^pC!WOVGuou3-$vT_z48`I;p60f_zzP|*UuPd;lZ6WmrP3Rs z&*T!VuFSkKA-E;-QN_(0Ry`s?oS~KZ7<-(p>H~oCWvSqi1;_2*?9jNU;s1I8M5RTf zX?k>4Ght=hvc4nmOUugk0L7IFWM zICy2zjR12(ufTW?Ny7;-cLWlcU(&pQC^;JZOV}gDqja z{5|fX{1TVwwm1^EvZ+KNW8j2&!K+%>O(=r}<^d z=~w+~89q^p$U;3@WwQ>4)r)9tME-KAlV1eqO$tok1{b=Zirb&nmEwgwJ`psZ7q<@F z8YW-th&@l;FkR6DSDe*jNfmrV!>uyN7RiK_wJLjmd;p>LkEsxdc06=2w>&7^bYk z%DVM!{aeDwp(1g+6g+Br_jP}?k?6nYu2^g+dLUsqJAv!Wye7$W?2Qc4^Upi-9M(#4jqyZei(09-7r(c`;!b2Sfs z4D9>U6_lRKa-uKFwbP*K?V~vf8Rzn2Na1AhnJJZhg=bc?bRJh2lvJ$4(-CX!13x+{ zA>RtC){11(m9``tkcd2y&aMZ7b~Y!g7ZJVxW<{k{W9h9DCd|yIARZM~fy1ls)7z^1 z_VK1eZ}K&bAiS}xBYAhnhnK)d*(L_jelPNJP<}_DK8T{QbETG+Cb+mR$>S2J&6P`$ zC6Axjb+)^MI2RGsd~oj=cqObx$gYPfmDBfvW|qGwc*qxu-efc+WIYt^7%X2onmWO3 zAS-U`?LZ-M@MBo^^z!TRw4t)rW)E-;2jUo^>(XR*6Vd;yCqUXXa6PgLX}6eklV-&K50eypTKmEsZXmA zi=yE?L(sm`>V$waH;lcC6r=YYZ7Z{fi%E2#PU%)e=J$*rapo#g75%9qo**{*VHmmuj zy7G+stT4^3YHl7CRY@N)ibzE%^+d2N+#OEA(SKLxqpN#n_dWt{G_#h=%{pkc(RY6p zEV!KZAB2Ty2jN$AsKIHvxH9`Mv*S8boBLdveB@c(aCtodtl01#va=+!=@l$rDFP8Km>8wP!|2A|)SZ~Y0D-`pT z%La~=+NOBQ8XgeDnE1oe-aG$ZcJ!=+QC$VtHNycgG>$#S6ZcSYPmg`emVMr z8FZbMtEQI~F$N+-RW)LOV^myhL_};xSZjl|?vnB81;{c0o}6Z_DHWJ3z*?X)j%g1& z9=vxdV|445&(g*Ih7*{|jJM6~0{U)gS0S{V7^7$zI^HJz4mw77*>mR5cU(JngufLWgLWH*2WP5A;x@;gO>#h4_bd zeGnnqh)?3hsY{&P-+rpk%cwZe;xgx6I%K`(lo>wZ{=i8wHDHM=c7Uq9bN@bN*5&!E zbf)wC31BT$wKT<@6sQ#DzmzlbN*=!x{l{@IOx*YXh?O{|hS3fS>#{m8lh0*I4R)Uj zRk{z^6nJN#`hg?8SDB^N{l;x~SB?@8hEV84{JUpY2BW7Db8Yrj#r{72N zS5m73Ncn)?*L{-O7jGu}*(QDK<3yP!4xz~t9d!Ox>SKfQ=5-TH%) zm|AnUj(9-tuRGoAsSGYOH<#R-60$Ptj?{IZ-=gNLn3)e|&Hco-n>OgTaugLD$oMxe zeaSTJSQ1ja$iQgC#`}kc_mwtoGc!N8r-eH~{vtvh7qd9IwV&nzOH&_o=bn?j2V$oO z{Ka3(%hva>4GVHWgvSt7*3cir@_QKlHF!xwTe)@Hm<1Ycy}A)v2ekFE3nk5~?y$@K zHz~iKk-q^{=`?F?O+($YOE76BEEygbC0gF8bf?FMh6koUID34H7?@^0LlO> z1P(uu-N_b`917@Am}X=NIiHQ%D0t{n0jB|gnSpa1bOb`3sd=%-8kgUWo05PWaNT>S z9mZP@nuyD27!**>UamN~I$juX!XCfdSc;Y{lFbL8sA$Z~$PdzpnoQ>CY1(mYJ1_Ax zxxsNZx{Oa`3FZ63j*d=s?S!Olf__&-dQQJ68QxkqKC%B3=-D1H2YrbABQQ?WZ)62!eNo$$`#B8B{i(bg zk~IF&=6%nmc4*Inc#DOc%E_7~+=@Zr9+2K1WdAA@%oZGZ`bJ~t#P&}o@id*&uYA*8 zZm_|P!X0rMBJasNUB?1cpASVbv)9#Y;5AEpL1W ziW6ikJ^jBLFsxVopesB5ZrhPcmGV0(QVRuj5hBCM*l5qIteice0x+html`8bbY0oL zxZz`L8^8H>zio@l@IJntk!5D-f(%w#PO1&v8~SVkV-{XQHg5%HG6{JJF#X7R=q7<` z^+XLj?g3O*2BC;TeF95s>+e9JFm&3ZdJ31%9U$a-UtC&mbPKc0$9W#7Dz_lc%++YoAI1zw%ynZqxoKrw3Vl2-y|PKwCsspo zB#$!FX25X8_>T`A$>7z3awzRF+L1zKNOJUxuZY~RIGK&-=io}n566>zuqmo2O)bRw zF`mTTO>Qn#nhnbw+cQHcnnWczGlLPuibnLV!WS^*0*2gJtV(}rC=?m;B7J?a%sG; z+Uy7_PjX!2B7EN*%DcV|%PlNv#Gxd~Jo~CurE^=MRLOyoSEdLBqTQ4A2Ye`iBdT-8 z+;10EYN|c`I;s}Z=sdJ~?W1xiRB!s?;#W=iZWo-dlA04zD2Uz3t_w~d&8aT6t%k}@ zOi;bM*o4QXzG0`q<<9aYuCSyzi+y2nwB7m}`^K}qiLA~c`YUKk`*hS@r?dB!Z2Ev z^qbf9}26x4{DXoCxFQ4#Wl1crx}+2 zE^3{ZwAQ3k-SKC~$M+d5>72P+3WsrVwz5Y9N+C+> z+=dYkbrNBDD>24;F$C`ytF&%=Q%t*&z|FLFT=hSF^pK#M-G4RHTfHtX~Z<##emcWyLI z5RC^3%Vq3)Gwi$2^@?pXfs!sSdC`8V$<%I9ki~dM_(gWK#O)<-UU7vMo0`OiuFpTI)jnq&OlE}fkD1jl@@STNqC2bfFt zo?`F+gAFk$P?4K!CDPYDFY|W3bKsH8ZL{AYOEpd1%y`MEXl_SYlYPbdgR}`{bp9ctt+%%$wvgZ zTp;@>054zh&Xs|B8I*=B*V$y*gqexy3H;qlfRDV5E8NHP5z;&OSQ2Rb9ko7b!75lU z^P%X0;r-Z>Q?22}+2zoo5=Mx~UrFNwb7kv%E2JGBL+9yz)%99FhW$7Eae;wmEDLyD zr2@vQJ|m?&A1?xZ0kEMi<{#xM=P0`R-0{J6xs#Mv1c!uPb*|cdU*7Q$O#OQYfK@e&If*AqB|JdmFt zqhlymI&W&y(P{S~A@ObvIeDQDB>z6#xxGpm?QECQg=(GpNxdwna6N1J&)>#PUBo)~ z*-`GdF6ux(K@EIclY>O7Je=Wn$iBjsJ*hZPs`Z2oi@!$rujG>YIv50oU?k3g5K#1} z?BNA}S8sAe?v&FKZqwz;5Xr|48e$wSRL#?1EBB^Ye|Up$qe*kqHcwwrqN-|ccNUc4 zYuwAt&g5<+dbB)2@2>_*wxrz%cob?58uS3UtCOs6JeuD|3JNhFhy(-rwtKJ%M~{}} zKDTeN-Pu01-%0kSGA~`77=qC4w?j4Pg&y6@f&hlicyxSVj2SoZ5ugko$pR?^^R85B z5Fx($+^Twtx$rH2Jbx@b9`olQL3_-WUES}eu>;gZ^WC)J=%~`oc+`jS#LGm^&>u5~ zt-wkS@`WAxC`;jc?up!caD$t@HvJ`MZz~^3gKqObJ$ZRG3zRk`Hh>W$}ZxDu6tI_p7NZ%~1 zA=PT1U}bor#?FxMzV*tD*vR)01 zmNvT!97Bkb5t%0VM-XjL%XcWiC|q1f=ZkSLLy!r_6P?j&`g{oai83}rdSkKcFhyvc z6Im$fV1@3%?}aI3b-@*tAP90|d@^V7FK_F3HrI5u#FCPxX1!~l=6`*xD=3UVj$r(& zytX4}(SgC7iNBK}kkeJw6M_cyZ#lRbc|-%}%^Nf4oZNn=uAy~W_JeK zZ^AjRwL-?HtA21IDk*FCd0llQm9WSlp!Wl)u_{@W>6bueoHHM~!7%Eq+Qe2bI^pNO zXe&GO(S2@5?;%fA-)Azwc&78btX1`TMn4WgJs3UuU3Ai7Fz)ln@R@TV`Csswugq{Hid$y}|5)wNW9v2zXIM%4lBr|Hm8m-OB2m zJdn{vV=g&u*O_lR$K*$6d3glx$2%H1=B$ddCvfLQttrH1ER)!?WT-fT2mn!eMThUD z0l#u#V?k)o>_MbJNb-!$Hp?MWq#^)B@Vs>CCm)#OTgC~Ss@!9(Y@hg+b##KE;f(7V zjNO*%8XD`&rwkZSQ$jYMC-U94TY_exm2KBrM6;mgt^}zoeUj!alp#tE#32H91)2S~ z@KK*%pm>2>j*K|qS|8w7tAYp097p2v3SPHdE3#4PY+QqB5#{sakd1DRU;szcSLNVC z69I7G#0u|8BdDvoVM7XF?hXJ@XX|sZv;Pb~xR8=V>e1mgN?g&2t+04RylAf(mz>x# zUe{k5C&bC|39^9Z$oWl4_`vckRT1s?Mw;s#KzmI=1sl}{*TsC1>sTlg9)|+xJM^xI zLjuw=lz>xjODVsr+FEp!xct8c{-H@5l|%F;XKE8hG220%)lTpNrUJmuO+jIkJwj;X zpH7Yn?Z`A3Up%Ha0==lYfj>FN>Z2mTA~ z!G9NHADl$a0p+iuy=S}%@v(-`R0tgm%B-#}kwE4(dayZ=F7y%v0G>;LHiV?(z0y48SVB%=N@ z9`9R-u=N}y2U_hogn*QufD&Nl@ge!G4&0j4_hFBaKhdts!HIVD+G8t7GOZT z%KPgu7pUCREvody*|UT^C)Dm3J^ICux1Uwpin?+pLt`)JtA@Y9 zGpX-DMcbFkzJJ~6z$p^d4G%K$xL4O%j9=o)i}rUgU>D=dVR3%AvqA=0IjIeebmhu(*cGn7((yeqc?I3QWp-iBf4xeTwRE{R zt5v6~sjSw*B_NFcBlEi8cO`C~iym{&FMo3QX$cnYJK0iLL+M{N;J^Gq67XL|>@6;F zei*{xE+uAE{pYCq3@&pdn?Ep7^&!BE zPmKdEdN#s`&N-*(?V9Ek6S1)BYuGItr7Oj;c(!Y6OW=VnfSlhRpY_NPU37(x=*jml zc$->ZR2C@_gFnU=_h-@Ph!}Lnj6SBsXP0Iv#VU!DVs5L20j#fpmlyTo4H>Jd0w%1% z#DU8sP4lcGh0B~C)w+RKx31iVr#MH`91GR5ucm3bv}s5AyrG=&{Bh~`F9q!!n}%|x zuU2Y4dXZYP_K>bP*_f8!F}Q8t#+xPYqd&p2M`J|p|1bsjXX(T6GqJKC>wRCy()u-8 zv)F+2J*XxT)(Z!YQMX->xEP5-9#^JCDAit{gRD&&(uE9~CLleTR5WKgJ%x0<%?Q%@ zD_(E}XrR52rX*6rC{xXBR&u@ zfBdsd>^I>|fI{QH1M30WbM3j*2cat9qddjc^*LlQd&x^959Y-ZP*MBx`>L|Zz9D{l|I-G;;r>OK7bBYz~| zulfGq@+OL8$sS@=gJ4UXSfM>JBoKHg^#|u7?S0^rA0GI`RqhyKKbhB`hSZmXqh4{A znXtoWeR0a(6x#@$>ZhjFoNmS!{{X(D%+8$4fO<(-Q4AWfHysnfRo<^+K!v6&?teU`pYgk?z{ybP9oIY8&+gR)}QjYcOkU zYuzFX`-v*@X#A7Fy=-mo)_S(^TUY%G&l_P`S1@0#)rXez^JDU_`;nSic<#aL90#TA zy^GafO|I?ti<>^CB0wDvQ3b1+QEv5_jUia|l3Ypr1n+__m_B2UtpmynMR35BO37st zw=07uGI~8za0vo;60Q#~Uk*ghhJWF#%e{7frCZT9`{2Oj57T9ARPJ-0(`@vcJ!N|c zKu>29V86Fi&p57sha>Za>`fk)(Bs-s6jhi$ilMeyT|)<)JbU>thu9(-8g$-9s@(un z!E?1XCl{Q&c{?)POtJUFA9WetiF&d4)jxTQ6;B=_^9qG^W?wp(E`IbgS{^wXc(Cxj z0MLC8H=QuW#l}{j$bWTGEZC7YBNE-3q}6k5XW_*J;K`fWX!AqYEpTHl85L9gUAYfd zMt%B!e|hlruCUJKi_wkeCZDGs^if2xzjKY;8>>tJ#q{z03h_3XJfIEq-kT%j=a~7# zv9i4f0@^wrhTsnZ)j^NO+1~McgpiQB#d^wZGiT8_bjYBQGXpS3hpfqu&#L+{4O}Eig(}qf{^VH7Q&o-PTrzXb2dEW?GQz1zG=XMXsISr=|mw-d~9U9 zEdbPOaY9D{+4_T~3KXP?WomJ=mV6kJ9M!pCDD@`@BGOQE*z|(nO%(Tf_W1q?rH`Uz znW&@tA?@{HAYzZ?@$^hZKVEf4T_a%U=*8%ls`mv&(n|~wdW?Cg5V`urmAf$HqClPj z@)IqF=yqYSZY%pOt0;T9f2`j(iimrIvcP~cNG8|Sm7*Vob%)_1VSD)UCugrXXcQmY3{*VhDFjp{f4G z+i${rSO>oH5^8!_wkn7f zU}U^@zm|E;59xeZLte&?r|kS~E1=JEcfhTt?9an5xiicnr5tR?gpBB6d02^mW;S~v zfmHFV|LX<#U^-mq6n2secrIO#MU-1ttNv4S2MtPP$*K(X&kyHsx^$M?H4yc}f6F*5 z-C!twL4)0WMp!#ocL@WoiqDA>9*I!<&?&NHHC=XcqLxrwQlEqssQ`3>gRN4=leBpF zXOAnMnV%-}gG02HD^rYV-OEuMY`dyVG7A z(?CryD<~k*n+j|(3KUH^;I1h8|8he5eq^#x63RG!S?5JGnKnUp#!s$;w|eOGPBN+K z3c|bLz1e!>kp!NDOtR$RbpYE`Qhr>Lm@Y8X?1AVlTGiF^;qyyX`5i9CZ| z*IPlx;9l-$i}lMMBa!F{kPiu4+UL9QY~;NNM4IyAiW>i+56-MCCXa*&irV}JM`oCT zQ(l9nfLD{eS<`YVPU;-q<@y$z7v^+MwzzBz6Nslba9m;{OH8>*D%wjYAXhhcCw?mb zKb2ioTO3`p9h|`(26uONcY+2DERxry# z@J);p{?1SIY`iePWU&*Bwc-=ziioGuaQnyH+wS2L5_lOBj?|@I#io|*tryI9>^{wX zq(&=cTGa(4WkM57$#3~zXA{$%TO^^j-&IvCwAb}OiYFMcuMFniD7Zxt(qVz_?Y4Zu zmp@RnjfO{vKYEj6)*JNlB!PJjt1*3mA`9J&1U#Sais~D+YN%9egz?S^TJx|n^y2ki zCpmFaeus#a+Y2ywiH8rbuRP9cY`ot}q9LG4mriQ|liUz<<2KSYSE7QgjMj`|hZA2D zd~o4A5&pV9-XeNfjttfMW|f#y$-2NzXD1n3v&Apc8#~*7`@$FSo_1@V%b~57N=2A8m_JBiE97T++izq}*yvS@AtOuPG-m-nF zAy%*BrR45we8ThGr@M~cSFKomRpDw^(;i<|B(7l9wH+^ElU;siE_sZ0)<6V#)kW+K z2u9f;_K=~z;D?{=?-q{AziL0$JveH()|m$vw}%t^)fku{4<-L)MaNLQrIME?kmny` z%zK*bx+~nE$pnToX68*~oOW9_bgJ5)N$oRE1n&h+`gMr8TzqeH@jr=V0sk?0Int|Y zy-n+)7X9)U0PxGm8YH`Wr;mDuDu~%AVdC$GZw*JYGC$bCAN`w*1RBkCS6ntQ|>)~U92s{r60Tnv`(H82CgPk{kt76X7W|Q)h(MM?aMPs}7L^33 zbMeW*-Z1ouQTWs!Y5IbfA7S`dgKY(Z^Id zszu?rLU+%dj`4He}aKGeqW6ryulj=gd_P=S9Al*&6!t?7B9}( z*a*%-uMj4>;3d3qeFItjL-WDU4%%1Q1B^WsfBSZlm?0NY;RF3}>?j-i#k*!ZZ^aM; z*UjFo{0TG<-G^1~RD7;uTtH0HWaRi^qqPbXHxJqTb1-GBid#v%Ojj$S(~@nPIaqgY zPliI>K;PsJhLpk~yygGbev$I;C>bvnX=)o@i}{@>H@N`PPHYO2inz4>9hcGHxMd1K^a6xU3AaMO)iDR zFf0GkAO*gptqnFT!bcdEVw>6MiDa$6fsGZAp0gJm`#K3&cX}HHHV{O-)MLySla)c6j<=vPv#zU zmg_5JDA|tH)Ahgyzg{h&bvLHY(EPN&AKLWDF%kIuVeT_}T5Q#$GeV5KIU&EKIA;({ z0iDX<8)V!15bdn%l+jm>0keCZEvxex9zN+Hk~cBa3ro~2xMzw>DZiiF08WEZg};eo zaqj8Ke^AWyTiN_BtJx=rJ_XorQ4Qk3kP3FZ*G1+;F>q5uK?+Gr_^Crfr7b*k$bZ}d z02Crmaa|*>at&Q~EVk)Uj+6M zEpww35z25vU@)}T<{&!d55~sQH8swBP6Uo7Ql2P=V{!R6U()A?Nfc3Vuxri&Hb6+_ zX^nft4)@l0VpwdhPDa#qUenL^8E#R-l#fEDVNoC$$-0P4V!tvji<=_qp>>J1Ds?25 z8$DQ^#4=nx(lC>ORaubDmRuzdYb}rZAfYITfE7U2$uwsqq&r z2UQ%6Cwvw$TJ-ftl;D}LqAK|B;ceVdQ<`s;UAMI|9OL4( z9T0KQMh*Tr`ZZ|cB^MxNVb&~g;6qZ5v#(8+I#6J!;(CTuS?AFhD8noxg%Ukw5#wx` zn^?kywUO7L!_;|cCoGZi9w)4W&7U~Ok~@^Bdk(ob*l=d4k1f<$XD(cixWpY!`1})& z>ffnp{ngY{!c^TVnWhLq9-X^Dn)~kS{@KJRg@7Ox7R6M@$=-}L_VRB>L^4c^ykLn> z-o$vy5U;|PPRcDlzs2%a;j2%=QWEs!MsZ&)llM`~1kV>1e;(6jhrK1gUe-^HYaicS zh#K(8ffK)kJc{@q6&JyN4OHgxKQoJVr8JJ{){sBEd@t)awn)7@4-#>lJbwtGfc{+< zg1)c#5hhm#Vm$XAdy-O-9@tnfiaBaWqHE~b8zk()a!L>bLaOUGW?{S8M% zvnVmomgfvgu9gm7Fum)Sk`!uHP-;NR%l)Gl-ahY({NjHne>z^ske1$ z^#{k2R81{oGa{b#haNee$AJWg>C(55EWAmu7$UzXtLh{#1kXPN=L`G+II0e&b4c3y z7aI2S5e_^p37DUgKn4u%fQWiXy`vmGATu^w|77shi!tsWM2Wdvf5R%AT73pH&DEVT zi3!j!d1WV2a^y?W;$ApIK?R|lL&W>Z5EC9Ng)!jCVgOz|QmoZBu{rLZ8*al?xKWNd zZpSfET0WNH272mLB(j41sI88=1gWgLHG9KA$K4YJiNeTahQi<2i_3PSEh!dB6)eRU z(~VN?!6%VWtRlQlb2;;Se1A&KP0_{+F@$%(0R7 z<-Pm`xH@MR7sk`O3%^-;?( z>aJF=Qi}}1U-h}HTK~t)6H*Im}1 z_)8^i&o7)o+>H}9jw#sPcow$^H{&6Xd)!VfozF}9r;jr-EJ}YAu4JGVl0q#P5nkV8 zt120DQz#oQI-9&Rv3lj@p2;5M+i5fb4DaRo_M@8W6xy4`inxmDtw}P#$8jvY%pM;m z_7fIv?_4IvYFZB_E#*ALHXDm09MxsFd+Bsb91hzpZKr0Yo^YaP1`s-AFegs0qJ&by zeo_8&nca%18H+V4!8+46)`z2}2!4!AIWBF|3xe4-hKwL64QU#6MKzh^M0=awbBD2r zAzq@Dl)0F89QJ;7?vVhCK_~&r02Lr~B3nqqFuFVUOogzw{!&kiev43}*H}w+!RrFs z9RcDkjC_|8K+U$j**Zb0>F#MXUBES6P+kC|v3i;(g=&t~LFAA@1%J(Q`(Ga0E1y~#5$Qc-D%RvrXksGs2I;Kp4ND42 ze(BrKjk~78oL>T7tB$pR4b0sPaFMF%AtW8(z zv!FY=Q6w&i*tKE#2^83SIQ*~4%j0xHCN_BEB11FWy~mlPha~Vj3?Uy7gND=>0dD~= z2J(7`9t>o*?l0pJk3NOseeAH^OExa(u=|CmUYHRsWU)-sjcvEEMl>W@ueE&PVS za-8M@NFk^BhKy8Z7ga`BR2|Ix3X+}uKR6L5tUg?Z35Q_pC%WY)&0|{-*6xIA< zmL5dnYKT#PMJFvi*0k!0^Po$cJBS-f#dOsa zem_xc%WdGv4zsR5U*qV{pIydwV4ZJLegxCfg4MQwrRr15h(U}8&L{roJbiTwCpC+S zBEsF+Q-gTNIPFZ03cH)=u^sj1NuQ7gj$4mDd{KGt1;eCcY_IeQM9&8l|Birr04x}! zg^@U;LaBn`mwu)SM6xb+c&n~Mn*0w|O$D@VMQN*Uamuz541-phA%lo!?YDd<(%&!| zb7egvi42&YSNFlqy-9q$!;>&mrmTgn`+}F4iL8_X6V`Ir{qfZ%RX+K<3w;yR70V-B zzqZTwg_&2GX$xeVqkBHj`4O_o`Z;i?MWky)K?JPE#!an$s3;l5aad`lh?hvzPe3S3 z>||f57p$e@ln%6;eO}c3Rux2EWWV?nt|_rD>oJBHwtlksCEKezWz%1p6TwBTz&SMF z;;(QL1uw?kM5n|-2v37~+|J~OMm|uHHUYX{dT{GWr{&f*98KQB@|U;)ib@NtpbKAq zor}$c(a%$(p&|@(GoofdcFqAffL+QdC=eeR_KU*7HdY6eDD~{WM#KBT3d+9f*W)7-d>HQ#v*``skO9sKSuK`&c})4d9P0T{ zE3@6!TY_L7f9G##lzP7F;eHB3-^`%LpSSIyr@b3+r2$#|%ywHm;+KUYMns0^h_4^{ zBJZ*>M&brGpgSM-Eq-aDBE#IrUGaKVvTgfR7J7GFFOAfI<$40gWq^!jR6A4U%^8!v zx1%!m7jJ|8;6bB=3aq~1aa4Vibi1+MNRfJUj@3$`U5OTCei=Yan6Fcsh5QDw?91&f zUq6`YLuxWWw%;&AR6^7rxVaWOf(mTt*P|$mr#|SS52hB$|4^GI$l3{weIDGNI*O3ige_NqbfQ#%eU+sj)LR1=h@ggi5#Z@&PO^Qy{ z2nY*%dP^qbZ8q&3_Whq9I4^*rY*)#&x;t#bL(6lQpSIvBoK(Abe;*3~$b*fu zj2ha zXDZ(D;-k}O9QjZCn428?7TC}p`d$>kcg4QE*hlGs>I|WwG>}c%HeP$M6PcomVuCjNw zpvofq4`Drl2p`wQ8}a2*xX5}_3=w@vne8m2P3@KD6IHV%7dt*zii}QjIp^F29OE9; z{I#->ks)k&^9v^Vp#pAqlkew20)80umhQ}8mnN}hG!Zfv%Wy5vbYOUI0Cxo4`O7t6a# zO=D*kGeIyvYcXM7YQ$+v%gMSSC>(^sdwqqc_01fgMf#;Xq8_@wi?c*7_F7ec;x%{} z(sI8^H2*J_e_5I?)kZY)bgE zUqp$PN@Sr1Pcd%y0X1jm$N~-br_K;1-T{jy;~w43QV_Cf+s5g7$p-E;NKm9Z^^3u& zih@==<&P*}xxU1x9NY*Sz1W2xBprtHR9o#NRr@VR@CfE*IHE&+1+U@TgJY0l&=pBD zE+v9QhPe((k4=u-6KbvY(Z7^YE9>UC6YMv6V9ZdjedP*lM=dtV_ed*2SkN&5jRm`z z%A%C7WGf86^_!lAblJs2FHUwiWb;fcF*QBUEUe0pF>dS4(0_X$W^j*=Po}tq^ z7V0cpF2hpJ0G;k2=QsOrKT1PuW^nS5uAm(O8@9o>oG(beq>E?e5bc<#rDJXi2xIc^ULzFY4bdTYHoLSB*}qbTXfQyzp2-io%3 zTQEY1F#~X|&A#K5q&7d|*&>xdH7AVxlwIUu$nr{O!7197=n>JC+b*YxPIN2Y9^m?B zzYHHkPJ7rzwNF7LB<2{SpcF$nW6hpoA#Rz^;`JFN2n#Y7H1|@ zEAu!Z7q2}}j@<)8Mcf7SGQR<6Pim(To*(WvJk)<8IgOo4PqAww7*fPkBoFY^2gz)M zNdeUjqA_chT-b2O%35&PVC1ddHVXtR%BwC20NwKc5RX{v#cN-E6ZHPZ2TMGM*?()B zPyKaQZ&YBj{L=NYQkmG(+m$wv_>PVA)|2l%-w)vZ8{)H6hxm29>OGNY0Mw?_%-5y5MK}#qmh|6IuV6uI z0FhxN>A9G}2?}q1{!UF>X#QgIU@~3sAbNq{OFA{h^rpLs@ZyTVig>qGsnu^KFs->B zV+Brg0yqJTi<1w+UM~4jEJSngg+aYU08&KNeZE*#AnHkfqtb}5n9^Wa|Bn5{8n zNTPaq!{wgv1XA=Q&W?0vvrP{vtcIuK&xVc#L?B_Eps2RvE-}c!c7)E3AIyq-&g+qN zfV9vtWrE^jL23*?K6DP`QDOk9cSy{-rjNZ8XR89j&6P zf$Y?B!oIb{_%1-VkXX?@*j!@j#E$l55R!hr^SQD~QpjOa=5!g&iUwk&t3PO}Oe0nj zK7k6xHckVaNXLE2v8I@d`|%cO(?ihaE{EpRX1heWbSnEVEBfRyk`9(n?j*gFoU*UL zi-CmnKtaL!P)rDg6`2rXWA0>U9N(*X15xS!(JA3Egwhi~PF{z5*5ADAjuNWh3%Hab?P-WcR%#faHG-ZSst9SOrmQJD5PGpE zdfuO1p&1D&kf)jDpv!G}blMTdq)d%$&TQQzVWSMO$T`GmYfPTWZ{BPMd@|>0EMtc~ z$nued-MMpabR%vCs2&2X0>r=t%X<&sX4Ok);#apwcN}yv{F<_nTyV$xdwYunK!6#S_Eh4r538+#<5 zuekZ-SU8r`h_;alQsFmi@DbVS$ra`@0DxcgUyXpU0e81RDjRrxbI@} zM$oKfyL!eKN8zAcem{%3$Xpa%noNP=;=z|re#)GrHUMf7u+BFWRUY}@u0>=gpBJC- zF@Ni-kAKL}Z`Q95>tT_)xct71c#Vk14QB23qZ-+LV_C|+T{l+Kxj?bTO_0$~%v2*0w}Vb?1g zw!gE(U^JTnX{&E!8_-s~h{Ux9%VkU>PbQr38>*fM`My|QQ!+YeFqMAHQ)~4&oXsu% zd8htRXh7&pP$DjpQ?q)LH0=!F$9|sJUB}RH6g(Xh&*n?#1yfG#WCVr9BIvqROdfmV zVSk?FIjL;z6wbXKdxmdnEw-PBbiV9HroGqp!jZ(4XFKcMqbd~HnvYxXyqtCmzM8+P zYU%352qJJ>YVoe&Sqyn1e#PN>`Fm)S)xCx3{*gn>fwWB>3q*((018l_k^WY8z_X#J z&BGUp5*yku#8;Z_IE}L)%6KG!GVz-AECBbQVP;5CLVl6)54iH2$bCn{@4S1g`uu0b z!JXp8F5&``9)EGdSnDQ>=Jhq2z##9}{>q2oK%0oN5`=`rzQt(TR)8$a6V^@yq7{$z zqAbv4=klOuNT#Kb>P3k=*JmdP`QJXkO105yZ>=YqNlI0ql$VYYEm90#j~YUpQ$_7w z--!+UEVwG<;Gvj8|7v@Mbzw*tc7;7)y>nk7ON_%Qw!lIPaiQ#?_9j>t7BbhtNdI3uZ_z&TM~4S@hJW3NW~qz zw(GMBXB{BhMbm3Uh@u5yA)#B3Vev+Sk+B@?dIaQ)q6pAL7lBMT5Mh9s5aHa8JuXLG zK&YQ6u%@EAI&LNPsqWKw2D$>>R~^zUZ6=G$!LA|Z8Q+F&Xii4JZa zK7u~NaM#bldy(PXdq}_1brk`aAqyOkN&W+qYm5Hd8NaasXrU8 zyitF3n|~!Dz5uQ3bxm*nxe8=HGQPh1IMxrX^S6PaEgo*;fBr}G@8wz;3nal-=IUXI zn;ef~@EA6jooW$TRYM0&QfgedWQOH(V-0J<6_iUNVr?{5iB&^gIMqG-ugqP)b5Onwtd4-4O9wqu|y*kY^QR0->g7%w+ZIcEc{y=xw~Z?!4fkC0ls7=xZb7 zJ3K0|R-;(0^zcDth(d3f3n3n2vEGQ$ZgPJbpEqbGM!oSN{TgCXmXb|f70BRo&X@dC z;XCp`nGuGSb2wOzh0H%aXOm?6J@L}o{Dnc@McNcusE)#8o5_KXI zx(_z|x{?GAn_Zm~iJiUvpBT`T{K_%tbB1Fkm=uFEAV2&S(MPQ9`i97YE?jamA_Z^G z0KW+&36%}9++Ii|q#yC9g9Z*q`g}RSQf@|CXKv@x{azEhf`a;PPK5h4GYC?b$@5rj ztgLux2NW1JOQ{_WFvApRFetQfjKIhSu4|gnBoHDG8m3 zMaYmYp=K_{Su6ACDbf&WMNudl zr(+1Ea5=XVnq2;eNG`tII5-#wqjupS5olJ|yGj~2P`61I^7)7leRsc+Hk~6~89DF` zA7h{3C-aZY^HA<$_U|J6F3qJ@q2@;j^&{}Lf6HDplZ2l+IRaJtla`U^GaN!3)cnbA zcf}tzY0_%dpXcO9M44hmltSMg4GJW=N5~hnrx@H* zPSn7&gxv6<;LOH{r607R5?}Yl-@$g@=+?4b6MSjEn@7d2c`)fEk$h0L&l!lMw|^Ap z&%;0#a(gwV5JSfih8m+;h-i@B^iWylaiu*qP?)!~Oo0Pv#1WwTbncSOR7F*}BCdq|lAbB@y0Ued}#`D{>LPZ&do@+ZjiJ z=f7g`KC|RV%&6MWcS^ap@pU&JLjvS7-h4#Hc^970ouVPuwt{jp&v6(gaLBbl2=)SQ zy(8CQ%OLe?;5yKO1FQz>-!VGah4anV>FwK%MK0T->3X@y)ZV@U-%f#Mw)``Pu@#)&KY3HJK=}>&F}$qVnX3H#2p|vOu+(SSVB|*h;K`aXHcA7* zx`q-upkYD9yA5RM=Wwh^VUN$p=v(JPM@qkv*xIPp9sD$mTdXNQuU)V*<{*hjHjOkd zc?%iO=orN0|0jjFjEliYpW_N{z_2kPg9}yUxkldS_6_iwjKpcf4gsN{FjuBC3us-PeSqsWeV-4KsVwx;X^Hh(AiTVrdC&PA9aW!Cy@hZ3l>hv>Z_*|99WpLpBmTIr zPs>F^?#$?y(Ru69tB*B3ce>f?OIfv5QaGRD+`@npm>l4UxR_9lX=QEwNr!G(&tK^< z4^5bSEv6VdUrlt9Un)$$BS^}`@Sv~@|K|Cnm(sUd37`XY+TMM`$OW= zv>PzbU?@n(+3Nsw@JqUNa?w4oEe5q=8OjB5pX#2P(3?fJq1Hm?Pt#dPlqUeiGN$w) zg5#|i)A4+j!$?p)m21i9Ci+-^>h-&n{-CxJ9F><=D5v4L>;XHEB7C=sAn zRwjABJ&=IiEI~uchlSxt;+yuz_ewW>pSw?$hj`ve7`7ww1X9dIV!&^S=)VDcm{sU= zN!F|I5hWXtkiI0l{?VhLqCSx_Ljk-oAU7Hcag{=k7iWwYFW$B;o>EkwjH5WAM-3M` zn~x}6VWR)_d-Ko8+9iYJh<}l+#KWbo(#QB(&2C1IWZJOD`low5ke_o>qIgarLXU!FBm-4iQImNJo(|E{$P1{8oD84->C5S9t> z`j=|0W*O5G6Ol&wcIGkF1e%et*{I2%uZ6#kwuzk3)tXvGMcn@(Rh|={LnxWVrAv_6%6L-J}f8=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 deleted file mode 100644 index 5d652998..00000000 --- a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim +++ /dev/null @@ -1,154 +0,0 @@ -" 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 - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - 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 deleted file mode 100644 index 02bf462a..00000000 --- a/sources_non_forked/vim-go/autoload/fzf/decls.vim +++ /dev/null @@ -1,157 +0,0 @@ -" 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 - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - try - " we jump to the file directory so we can get the fullpath via fnamemodify - " below - execute cd . fnameescape(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 - execute cd . fnameescape(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 %s\t%s", - \ s:color(decl.ident . space, "goDeclsFzfFunction"), - \ s:color(decl.keyword, "goDeclsFzfKeyword"), - \ s:color(pos, "goDeclsFzfSpecialComment"), - \ s:color(decl.full, "goDeclsFzfComment"), - \)) - endfor - - return 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': '-n 1 --ansi --prompt "GoDecls> " --expect=ctrl-t,ctrl-v,ctrl-x'.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 deleted file mode 100644 index a0671905..00000000 --- a/sources_non_forked/vim-go/autoload/go/alternate.vim +++ /dev/null @@ -1,35 +0,0 @@ -" 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 deleted file mode 100644 index 9aa5f470..00000000 --- a/sources_non_forked/vim-go/autoload/go/asmfmt.vim +++ /dev/null @@ -1,76 +0,0 @@ -" 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 deleted file mode 100644 index f4f69fc6..00000000 --- a/sources_non_forked/vim-go/autoload/go/auto.vim +++ /dev/null @@ -1,139 +0,0 @@ -" 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#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, "info") - return - endif - - if empty(item.info) - return - endif - - redraws! | echo "vim-go: " | echohl Function | echon item.info | 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 !(go#config#FmtAutosave() && isdirectory(expand('%:p:h')) && expand(':p') == expand('%:p')) - return - endif - - " Go code formatting on save - 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')) && 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')) && 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/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim deleted file mode 100644 index d74a4c4d..00000000 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ /dev/null @@ -1,353 +0,0 @@ -" 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 - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - try - execute cd . fnameescape(expand("%:p:h")) - if l:listtype == "locationlist" - silent! exe 'lmake!' - else - silent! exe 'make!' - endif - redraw! - finally - execute cd . fnameescape(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 " - let tags = go#config#BuildTags() - if len(tags) > 0 - let cmd .= "-tags " . go#util#Shellescape(tags) . " " - endif - - if empty(a:files) - let cmd .= go#util#Shelljoin(go#tool#Files()) - else - let cmd .= go#util#Shelljoin(map(copy(a:files), "expand(v:val)"), 1) - 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 has('nvim') - 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 cmd = "go run " - let tags = go#config#BuildTags() - if len(tags) > 0 - let cmd .= "-tags " . go#util#Shellescape(tags) . " " - endif - - if go#util#IsWin() - if a:0 == 0 - exec '!' . cmd . go#util#Shelljoin(go#tool#Files(), 1) - else - exec '!' . cmd . go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) - endif - - 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 default_makeprg = &makeprg - if a:0 == 0 - let &makeprg = cmd . go#util#Shelljoin(go#tool#Files(), 1) - else - let &makeprg = cmd . go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) - endif - - let l:listtype = go#list#Type("GoRun") - - let l:status.state = 'success' - try - " backup user's errorformat, will be restored once we are finished - let l:old_errorformat = &errorformat - let &errorformat = s:runerrorformat() - if l:listtype == "locationlist" - exe 'lmake!' - else - exe 'make!' - endif - finally - "restore errorformat - let &errorformat = l:old_errorformat - let &makeprg = default_makeprg - endtry - - let 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 - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - try - execute cd . fnameescape(expand("%:p:h")) - if l:listtype == "locationlist" - silent! exe 'lmake!' - else - silent! exe 'make!' - endif - redraw! - finally - execute cd . fnameescape(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 - -" --------------------- -" | 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 deleted file mode 100644 index 708a3ab9..00000000 --- a/sources_non_forked/vim-go/autoload/go/cmd_test.vim +++ /dev/null @@ -1,38 +0,0 @@ -" 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) - exe 'cd ' . l:tmp . '/src/cmd' - - " 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 deleted file mode 100644 index cf646ea1..00000000 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ /dev/null @@ -1,306 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! s:gocodeCommand(cmd, args) abort - let l:gocode_bin = "gocode" - let l:gomod = go#util#gomod() - if filereadable(l:gomod) - let l:gocode_bin = "gocode-gomod" - endif - - let bin_path = go#path#CheckBinPath(l:gocode_bin) - if empty(bin_path) - return [] - endif - - let socket_type = go#config#GocodeSocketType() - - let cmd = [bin_path] - let cmd = extend(cmd, ['-sock', socket_type]) - let cmd = extend(cmd, ['-f', 'vim']) - - if go#config#GocodeProposeBuiltins() - let cmd = extend(cmd, ['-builtin']) - endif - - if go#config#GocodeProposeSource() - let cmd = extend(cmd, ['-source']) - else - let cmd = extend(cmd, ['-fallback-to-source', '-cache']) - endif - - if go#config#GocodeUnimportedPackages() - let cmd = extend(cmd, ['-unimported-packages']) - endif - - let cmd = extend(cmd, [a:cmd]) - let cmd = extend(cmd, a:args) - - return cmd -endfunction - -function! s:sync_gocode(cmd, args, input) abort - " We might hit cache problems, as gocode doesn't handle different GOPATHs - " well. See: https://github.com/nsf/gocode/issues/239 - let old_goroot = $GOROOT - let $GOROOT = go#util#env("goroot") - - try - let cmd = s:gocodeCommand(a:cmd, a:args) - " gocode can sometimes be slow, so redraw now to avoid waiting for gocode - " to return before redrawing automatically. - redraw - - let [l:result, l:err] = go#util#Exec(cmd, a:input) - finally - let $GOROOT = old_goroot - endtry - - if l:err != 0 - return "[0, []]" - endif - - if &encoding != 'utf-8' - let l:result = iconv(l:result, 'utf-8', &encoding) - endif - - return l:result -endfunction - -function! s:gocodeAutocomplete() abort - " use the offset as is, because the cursor position is the position for - " which autocomplete candidates are needed. - return s:sync_gocode('autocomplete', - \ [expand('%:p'), go#util#OffsetCursor()], - \ go#util#GetLines()) -endfunction - -" go#complete#GoInfo returns the description of the identifier under the -" cursor. -function! go#complete#GetInfo() abort - let l:mode = go#config#InfoMode() - if l:mode == 'gopls' && go#util#has_job() - return go#lsp#GetInfo() - else - return s:sync_info(0) - endif -endfunction - -function! go#complete#Info(showstatus) abort - if go#util#has_job(1) - return s:async_info(1, a:showstatus) - else - return s:sync_info(1) - endif -endfunction - -function! s:async_info(echo, showstatus) - let state = {'echo': a:echo} - - " explicitly bind complete to state so that within it, self will - " always refer to state. See :help Partial for more information. - let state.complete = function('s:complete', [], state) - - " add 1 to the offset, so that the position at the cursor will be included - " in gocode's search - let offset = go#util#OffsetCursor()+1 - - " We might hit cache problems, as gocode doesn't handle different GOPATHs - " well. See: https://github.com/nsf/gocode/issues/239 - let env = { - \ "GOROOT": go#util#env("goroot") - \ } - - let opts = { - \ 'bang': 1, - \ 'complete': state.complete, - \ 'for': '_', - \ } - - if a:showstatus - let opts.statustype = 'gocode' - endif - - let opts = go#job#Options(l:opts) - - let cmd = s:gocodeCommand('autocomplete', - \ [expand('%:p'), offset]) - - " TODO(bc): Don't write the buffer to a file; pass the buffer directly to - " gocode's stdin. It shouldn't be necessary to use {in_io: 'file', in_name: - " s:gocodeFile()}, but unfortunately {in_io: 'buffer', in_buf: bufnr('%')} - " doesn't work. - call extend(opts, { - \ 'env': env, - \ 'in_io': 'file', - \ 'in_name': s:gocodeFile(), - \ }) - - call go#job#Start(cmd, opts) -endfunction - -function! s:complete(job, exit_status, messages) abort dict - if a:exit_status != 0 - return - endif - - if &encoding != 'utf-8' - let i = 0 - while i < len(a:messages) - let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding) - let i += 1 - endwhile - endif - - let result = s:info_filter(self.echo, join(a:messages, "\n")) - call s:info_complete(self.echo, result) -endfunction - -function! s:gocodeFile() - let file = tempname() - call writefile(go#util#GetLines(), file) - return file -endfunction - -function! s:sync_info(echo) - " add 1 to the offset, so that the position at the cursor will be included - " in gocode's search - let offset = go#util#OffsetCursor()+1 - - let result = s:sync_gocode('autocomplete', - \ [expand('%:p'), offset], - \ go#util#GetLines()) - - let result = s:info_filter(a:echo, result) - return s:info_complete(a:echo, result) -endfunction - -function! s:info_filter(echo, result) abort - if empty(a:result) - return "" - endif - - let l:result = eval(a:result) - if len(l:result) != 2 - return "" - endif - - let l:candidates = l:result[1] - if len(l:candidates) == 1 - " When gocode panics in vim mode, it returns - " [0, [{'word': 'PANIC', 'abbr': 'PANIC PANIC PANIC', 'info': 'PANIC PANIC PANIC'}]] - if a:echo && l:candidates[0].info ==# "PANIC PANIC PANIC" - return "" - endif - - return l:candidates[0].info - endif - - let filtered = [] - let wordMatch = '\<' . expand("") . '\>' - " escape single quotes in wordMatch before passing it to filter - let wordMatch = substitute(wordMatch, "'", "''", "g") - let filtered = filter(l:candidates, "v:val.info =~ '".wordMatch."'") - - if len(l:filtered) == 0 - return "no matches" - elseif len(l:filtered) > 1 - return "ambiguous match" - endif - - return l:filtered[0].info -endfunction - -function! s:info_complete(echo, result) abort - if a:echo - call go#util#ShowInfo(a:result) - endif - - return a:result -endfunction - -function! s:trim_bracket(val) abort - let a:val.word = substitute(a:val.word, '[(){}\[\]]\+$', '', '') - return a:val -endfunction - -let s:completions = [] - -function! go#complete#GocodeComplete(findstart, base) abort - "findstart = 1 when we need to get the text length - if a:findstart == 1 - let l:completions = [] - execute "silent let l:completions = " . s:gocodeAutocomplete() - - if len(l:completions) == 0 || len(l:completions) >= 2 && len(l:completions[1]) == 0 - " no matches. cancel and leave completion mode. - call go#util#EchoInfo("no matches") - return -3 - endif - - let s:completions = l:completions[1] - return col('.') - l:completions[0] - 1 - "findstart = 0 when we need to return the list of completions - else - let s = getline(".")[col('.') - 1] - if s =~ '[(){}\{\}]' - return map(copy(s:completions), 's:trim_bracket(v:val)') - endif - return s:completions - endif -endfunction - -function! go#complete#Complete(findstart, base) abort - 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 deleted file mode 100644 index 6c9fadba..00000000 --- a/sources_non_forked/vim-go/autoload/go/complete_test.vim +++ /dev/null @@ -1,41 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_GetInfo_gocode() - let g:go_info_mode = 'gocode' - call s:getinfo() - unlet g:go_info_mode -endfunction - -func! Test_GetInfo_guru() - let g:go_info_mode = 'guru' - call s:getinfo() - unlet g:go_info_mode -endfunction - -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 deleted file mode 100644 index b49de449..00000000 --- a/sources_non_forked/vim-go/autoload/go/config.vim +++ /dev/null @@ -1,531 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#config#AutodetectGopath() abort - return get(g:, 'go_autodetect_gopath', 0) -endfunction - -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#SetTermCloseOnExit(value) abort - let g:go_term_close_on_exit = a:value -endfunction - -function! go#config#TermEnabled() abort - return has('nvim') && 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 - return get(g:, 'go_snippet_engine', 'automatic') -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#GocodeUnimportedPackages() abort - return get(g:, 'go_gocode_unimported_packages', 0) -endfunction - -let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix' -function! go#config#GocodeSocketType() abort - return get(g:, 'go_gocode_socket_type', s:sock_type) -endfunction - -function! go#config#GocodeProposeBuiltins() abort - return get(g:, 'go_gocode_propose_builtins', 1) -endfunction - -function! go#config#GocodeProposeSource() abort - return get(g:, 'go_gocode_propose_source', 0) -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://godoc.org') - if godoc_url isnot 'https://godoc.org' - " 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#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#TemplateAutocreate() abort - return get(g:, "go_template_autocreate", 1) -endfunction - -function! go#config#SetTemplateAutocreate(value) abort - let g:go_template_autocreate = a:value -endfunction - -function! go#config#MetalinterCommand() abort - return get(g:, "go_metalinter_command", "golangci-lint") -endfunction - -function! go#config#MetalinterAutosaveEnabled() abort - let l:default_enabled = ["vet", "golint"] - - if go#config#MetalinterCommand() == "golangci-lint" - let l:default_enabled = ["govet", "golint"] - endif - - return get(g:, "go_metalinter_autosave_enabled", default_enabled) -endfunction - -function! go#config#MetalinterEnabled() abort - let l:default_enabled = ["vet", "golint", "errcheck"] - - if go#config#MetalinterCommand() == "golangci-lint" - let l:default_enabled = ["govet", "golint"] - endif - - return get(g:, "go_metalinter_enabled", default_enabled) -endfunction - -function! go#config#GolintBin() abort - return get(g:, "go_golint_bin", "golint") -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#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", "gofmt") -endfunction - -function! go#config#FmtOptions() abort - return 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#GorenameCommand() abort - " delegate to go#config#GorenameBin for backwards compatability. - return get(g:, "go_gorename_command", go#config#GorenameBin()) -endfunction - -function! go#config#GorenameBin() abort - return get(g:, "go_gorename_bin", "gorename") -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#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#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#GoplsCompleteUnimported() abort - return get(g:, 'go_gopls_complete_unimported', 0) -endfunction - -function! go#config#GoplsDeepCompletion() abort - return get(g:, 'go_gopls_deep_completion', 1) -endfunction - -function! go#config#GoplsFuzzyMatching() abort - return get(g:, 'go_gopls_fuzzy_matching', 1) -endfunction - -function! go#config#GoplsUsePlaceholders() abort - return get(g:, 'go_gopls_use_placeholders', 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 deleted file mode 100644 index 1d85e3fc..00000000 --- a/sources_non_forked/vim-go/autoload/go/config_test.vim +++ /dev/null @@ -1,86 +0,0 @@ -" 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 - -" 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 deleted file mode 100644 index 01456e59..00000000 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ /dev/null @@ -1,297 +0,0 @@ -" 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 - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - try - execute cd . fnameescape(expand("%:p:h")) - if empty(glob("*_test.go")) - call go#util#EchoError("no test files available") - return - endif - finally - execute cd . fnameescape(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], - \ '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 deleted file mode 100644 index 06b981d1..00000000 --- a/sources_non_forked/vim-go/autoload/go/debug.vim +++ /dev/null @@ -1,1126 +0,0 @@ -" 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': {}, - \ 'message': [], - \} - - if go#util#HasDebug('debugger-state') - call go#config#SetDebugDiag(s:state) - endif -endif - -if !exists('s:start_args') - let s:start_args = [] -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 - -function! s:call_jsonrpc(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:req_json = json_encode({ - \ 'id': s:state['rpcid'], - \ 'method': a:method, - \ 'params': l:args, - \}) - - try - let l:ch = s:state['ch'] - if has('nvim') - call chansend(l:ch, l:req_json) - while len(s:state.data) == 0 - sleep 50m - if get(s:state, 'ready', 0) == 0 - return - endif - endwhile - let resp_json = s:state.data[0] - let s:state.data = s:state.data[1:] - else - call ch_sendraw(l:ch, req_json) - let l:resp_raw = ch_readraw(l:ch) - let resp_json = json_decode(l:resp_raw) - endif - - if go#util#HasDebug('debugger-commands') - let g:go_debug_commands = add(go#config#DebugCommands(), { - \ 'request': l:req_json, - \ 'response': l:resp_json, - \ }) - endif - - if type(l:resp_json) == v:t_dict && has_key(l:resp_json, 'error') && !empty(l:resp_json.error) - throw l:resp_json.error - endif - return l:resp_json - catch - throw substitute(v:exception, '^Vim', '', '') - endtry -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 = 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 - silent! sign unplace 9999 - silent! exe 'sign place 9999 line=' . linenr . ' name=godebugcurline file=' . filename -endfunction - -" Populate the stacktrace window. -function! s:show_stacktrace(res) abort - 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] - call setline(i+1, printf('%s - %s:%d', loc.function.name, 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), "\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), "\n") - endfor - endif - - call setline(1, v) - finally - setlocal nomodifiable - exe l:cur_win 'wincmd w' - endtry -endfunction - -function! s:clearState() abort - let s:state['currentThread'] = {} - let s:state['localVars'] = {} - let s:state['functionArgs'] = {} - let s:state['message'] = [] - - silent! sign unplace 9999 -endfunction - -function! s:stop() abort - let l:res = s:call_jsonrpc('RPCServer.Detach', {'kill': v:true}) - - 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(0, ) - command! -nargs=* -complete=customlist,go#package#Complete GoDebugTest call go#debug#Start(1, ) - command! -nargs=? GoDebugBreakpoint call go#debug#Breakpoint() - - " Remove all mappings. - for k in map(split(execute('map (go-debug-'), "\n")[1:], 'matchstr(v:val, "^n\\s\\+\\zs\\S\\+")') - exe 'unmap' 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 - silent! exe bufwinnr(bufnr('__GODEBUG_STACKTRACE__')) 'wincmd c' - silent! exe bufwinnr(bufnr('__GODEBUG_VARIABLES__')) 'wincmd c' - silent! exe bufwinnr(bufnr('__GODEBUG_OUTPUT__')) 'wincmd c' - silent! exe bufwinnr(bufnr('__GODEBUG_GOROUTINES__')) 'wincmd c' - - 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 = 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() - silent! only! - - let winnum = bufwinnr(bufnr('__GODEBUG_STACKTRACE__')) - if winnum != -1 - return - endif - - let debugwindows = go#config#DebugWindows() - if has_key(debugwindows, "vars") && debugwindows['vars'] != '' - exe 'silent ' . 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"]) - nmap :call expand_var() - nmap q (go-debug-stop) - endif - - if has_key(debugwindows, "stack") && debugwindows['stack'] != '' - exe 'silent ' . 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(debugwindows, "goroutines") && debugwindows['goroutines'] != '' - exe 'silent ' . 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(debugwindows, "out") && debugwindows['out'] != '' - exe 'silent ' . 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 - command! -nargs=0 GoDebugContinue call go#debug#Stack('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=0 GoDebugStop call go#debug#Stop() - command! -nargs=* GoDebugSet call go#debug#Set() - command! -nargs=1 GoDebugPrint call go#debug#Print() - - nnoremap (go-debug-breakpoint) :call go#debug#Breakpoint() - 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-continue) :call go#debug#Stack('continue') - nnoremap (go-debug-stop) :call go#debug#Stop() - nnoremap (go-debug-print) :call go#debug#Print(expand('')) - - if has('balloon_eval') - let s:balloonexpr=&balloonexpr - let s:ballooneval=&ballooneval - - set balloonexpr=go#debug#BalloonExpr() - set ballooneval - endif - - augroup vim-go-debug - autocmd! * - autocmd FileType go nmap (go-debug-continue) - autocmd FileType go nmap (go-debug-print) - autocmd FileType go nmap (go-debug-breakpoint) - autocmd FileType go nmap (go-debug-next) - autocmd FileType go nmap (go-debug-step) - augroup END - doautocmd vim-go-debug FileType 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 - if has('nvim') - let s:state['data'] = [] - let l:state = {'databuf': ''} - - " explicitly bind callback to state so that within it, self will - " always refer to state. See :help Partial for more information. - let l:state.on_data = function('s:on_data', [], l:state) - let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': l:state.on_data, 'state': l:state}) - if l:ch == 0 - call go#util#EchoError("could not connect to debugger") - call go#job#Stop(s:state['job']) - return - endif - else - let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000}) - if ch_status(l:ch) !=# 'open' - call go#util#EchoError("could not connect to debugger") - call go#job#Stop(s:state['job']) - return - endif - endif - - let s:state['ch'] = l:ch - - " After this block executes, Delve will be running with all the - " breakpoints setup, so this callback doesn't have to run again; just log - " future messages. - let s:state['ready'] = 1 - - " replace all the breakpoints set before delve started so that the ids won't overlap. - let l:breakpoints = s:list_breakpoints() - for l:bt in s:list_breakpoints() - exe 'sign unplace '. l:bt.id - call go#debug#Breakpoint(l:bt.line, l:bt.file) - endfor - - call s:start_cb() - endif -endfunction - -function! s:on_data(ch, data, event) dict abort - let l:data = self.databuf - for l:msg in a:data - let l:data .= l:msg - endfor - - try - let l:res = json_decode(l:data) - let s:state['data'] = add(s:state['data'], l:res) - let self.databuf = '' - catch - " there isn't a complete message in databuf: buffer l:data and try - " again when more data comes in. - let self.databuf = l:data - finally - endtry -endfunction - -" Start the debug mode. The first argument is the package name to compile and -" debug, anything else will be passed to the running program. -function! go#debug#Start(is_test, ...) 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:is_test] + 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 - let l:cmd = [ - \ dlv, - \ (a:is_test ? 'test' : 'debug'), - \] - - " append the package when it's given. - if len(a:000) > 0 - let l:pkgname = a:1 - if l:pkgname[0] == '.' - let l:pkgabspath = fnamemodify(l:pkgname, ':p') - - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - let l:dir = getcwd() - execute l:cd fnameescape(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 - execute l:cd fnameescape(l:dir) - endtry - endif - - let l:cmd += [l:pkgname] - endif - - let l:cmd += [ - \ '--output', tempname(), - \ '--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) - catch - call go#util#EchoError(v:exception) - endtry - - return s:state['job'] -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) 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) - let v .= repeat(' ', nest) . a:var.name . ': ' - - if kind == 'Bool' - let v .= printf("%s\n", a:var.value) - - elseif kind == 'Struct' - " Anonymous struct - if a:var.type[:8] == 'struct { ' - let v .= printf("%s\n", a:var.type) - else - let v .= printf("%s{...}\n", a:var.type) - endif - - elseif kind == 'String' - let v .= printf("%s[%d]%s\n", 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]\n", a:var.type, a:var.len) - - elseif kind == 'Chan' || kind == 'Func' || kind == 'Interface' - let v .= printf("%s\n", a:var.type) - - elseif kind == 'Ptr' - " TODO: We can do something more useful here. - let v .= printf("%s\n", a:var.type) - - elseif kind == 'Complex64' || kind == 'Complex128' - let v .= printf("%s%s\n", a:var.type, a:var.value) - - " Int, Float - else - let v .= printf("%s(%s)\n", a:var.type, a:var.value) - endif - else - let nest -= 1 - endif - - if index(['Chan', 'Complex64', 'Complex128'], kind) == -1 && a:var.type != 'error' - for c in a:var.children - let v .= s:eval_tree(c, nest+1) - endfor - endif - return v -endfunction - -function! s:eval(arg) abort - try - let l:res = s:call_jsonrpc('RPCServer.State') - let l:res = s:call_jsonrpc('RPCServer.Eval', { - \ 'expr': a:arg, - \ 'scope': {'GoroutineID': l:res.result.State.currentThread.goroutineID} - \ }) - return s:eval_tree(l:res.result.Variable, 0) - catch - call go#util#EchoError(v:exception) - return '' - endtry -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 - echo substitute(s:eval(a:arg), "\n$", "", 0) - catch - call go#util#EchoError(v:exception) - endtry -endfunction - -function! s:update_goroutines() abort - try - let l:res = s:call_jsonrpc('RPCServer.State') - let l:currentGoroutineID = 0 - try - if type(l:res) is type({}) && has_key(l:res, 'result') && !empty(l:res['result']) - let l:currentGoroutineID = l:res["result"]["State"]["currentGoroutine"]["id"] - endif - catch - call go#util#EchoWarning("current goroutine not found...") - endtry - - let l:res = s:call_jsonrpc('RPCServer.ListGoroutines') - call s:show_goroutines(l:currentGoroutineID, l:res) - catch - call go#util#EchoError(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 = ['# Goroutines'] - - 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, l:loc.file, l:loc.line, l:loc.function.name, l:goroutine.threadID) - else - let l:g = printf(" Goroutine %s - %s: %s:%s %s (thread: %s)", l:goroutine.id, l:goroutineType, l:loc.file, l:loc.line, l:loc.function.name, l:goroutine.threadID) - endif - let v += [l:g] - endfor - - 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} - \ } - - try - let res = s:call_jsonrpc('RPCServer.ListLocalVars', l:cfg) - - let s:state['localVars'] = {} - if type(l:res) is type({}) && has_key(l:res, 'result') && !empty(l:res.result) - let s:state['localVars'] = l:res.result['Variables'] - endif - catch - call go#util#EchoError(v:exception) - endtry - - try - let res = s:call_jsonrpc('RPCServer.ListFunctionArgs', l:cfg) - let s:state['functionArgs'] = {} - if type(l:res) is type({}) && has_key(l:res, 'result') && !empty(l:res.result) - let s:state['functionArgs'] = res.result['Args'] - endif - catch - call go#util#EchoError(v:exception) - endtry - - call s:show_variables() -endfunction - -function! go#debug#Set(symbol, value) abort - try - let l:res = s:call_jsonrpc('RPCServer.State') - call s:call_jsonrpc('RPCServer.Set', { - \ 'symbol': a:symbol, - \ 'value': a:value, - \ 'scope': {'GoroutineID': l:res.result.State.currentThread.goroutineID} - \ }) - catch - call go#util#EchoError(v:exception) - endtry - - call s:update_variables() -endfunction - -function! s:update_stacktrace() abort - try - let l:res = s:call_jsonrpc('RPCServer.Stacktrace', {'id': s:goroutineID(), 'depth': 5}) - call s:show_stacktrace(l:res) - catch - call go#util#EchoError(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 - - 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' - endif - - " Add a breakpoint to the main.Main if the user didn't define any. - if len(s:list_breakpoints()) is 0 - if go#debug#Breakpoint() isnot 0 - let s:state.running = 0 - return - endif - endif - - try - " TODO: document why this is needed. - if l:name is# 'next' && get(s:, 'stack_name', '') is# 'next' - call s:call_jsonrpc('RPCServer.CancelNext') - endif - let s:stack_name = l:name - try - let l:res = s:call_jsonrpc('RPCServer.Command', {'name': l:name}) - - if l:name is# 'next' - let l:res2 = l:res - let l:w = 0 - while l:w < 1 - if l:res2.result.State.NextInProgress == v:true - let l:res2 = s:call_jsonrpc('RPCServer.Command', {'name': 'continue'}) - else - break - endif - endwhile - endif - call s:stack_cb(l:res) - catch - call go#util#EchoError(v:exception) - call s:clearState() - call go#debug#Restart() - endtry - catch - call go#util#EchoError(v:exception) - endtry -endfunction - -function! go#debug#Restart() abort - call go#cmd#autowrite() - - try - call s:stop() - - let s:state = { - \ 'rpcid': 1, - \ 'running': 0, - \ 'currentThread': {}, - \ 'localVars': {}, - \ 'functionArgs': {}, - \ 'message': [], - \} - - call call('go#debug#Start', s:start_args) - catch - call go#util#EchoError(v:exception) - endtry -endfunction - -" Report if debugger mode is active. -function! s:isActive() - return len(s:state['message']) > 0 -endfunction - -" Change Goroutine -function! go#debug#Goroutine() abort - let l:goroutineID = substitute(getline('.'), '^ Goroutine \(.\{-1,\}\) - .*', '\1', 'g') - - if l:goroutineID <= 0 - return - endif - - try - let l:res = s:call_jsonrpc('RPCServer.Command', {'Name': 'switchGoroutine', 'GoroutineID': str2nr(l:goroutineID)}) - call s:stack_cb(l:res) - call go#util#EchoInfo("Switched goroutine to: " . l:goroutineID) - catch - call go#util#EchoError(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) - exe 'sign unplace '. l:found.id .' file=' . l:found.file - if s:isActive() - let res = s:call_jsonrpc('RPCServer.ClearBreakpoint', {'id': l:found.id}) - endif - " Add breakpoint. - else - if s:isActive() - let l:res = s:call_jsonrpc('RPCServer.CreateBreakpoint', {'Breakpoint': {'file': l:filename, 'line': l:linenr}}) - let l:bt = res.result.Breakpoint - exe 'sign place '. l:bt.id .' line=' . l:bt.line . ' name=godebugbreakpoint file=' . l:bt.file - else - let l:id = len(s:list_breakpoints()) + 1 - exe 'sign place ' . l:id . ' line=' . l:linenr . ' name=godebugbreakpoint file=' . l:filename - endif - endif - catch - call go#util#EchoError(v:exception) - return 1 - endtry - - return 0 -endfunction - -function! s:list_breakpoints() - " :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 - - 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 - endif - - if l:line !~# 'name=godebugbreakpoint' - continue - endif - - let l:sign = matchlist(l:line, '\vline\=(\d+) +id\=(\d+)') - call add(l:signs, { - \ 'id': l:sign[2], - \ 'file': fnamemodify(l:file, ':p'), - \ 'line': str2nr(l:sign[1]), - \ }) - endfor - - return l:signs -endfunction - -sign define godebugbreakpoint text=> texthl=GoDebugBreakpoint -sign define godebugcurline text== texthl=GoDebugCurrent linehl=GoDebugCurrent - -" 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_test.vim b/sources_non_forked/vim-go/autoload/go/debug_test.vim deleted file mode 100644 index 36ba6b42..00000000 --- a/sources_non_forked/vim-go/autoload/go/debug_test.vim +++ /dev/null @@ -1,114 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! Test_GoDebugStart_Empty() abort - call s:debug() -endfunction - -function! Test_GoDebugStart_RelativePackage() abort - call s:debug('./debug/debugmain') -endfunction - -function! Test_GoDebugStart_RelativePackage_NullModule() abort - call s:debug('./debug/debugmain', 1) -endfunction - -function! Test_GoDebugStart_Package() abort - call s:debug('debug/debugmain') -endfunction - -function! Test_GoDebugStart_Errors() abort - if !go#util#has_job() - return - endif - - try - let l:tmp = gotest#load_fixture('debug/compilerror/main.go') - - let l:expected = [ - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# debug/compilerror'}, - \ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'} - \] - call setqflist([], 'r') - - call assert_false(exists(':GoDebugStop')) - - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - execute l:cd . ' debug/compilerror' - - call go#debug#Start(0) - - let l:actual = getqflist() - let l:start = reltime() - while len(l:actual) == 0 && reltimefloat(reltime(l:start)) < 10 - sleep 100m - let l:actual = getqflist() - endwhile - - call gotest#assert_quickfix(l:actual, l:expected) - call assert_false(exists(':GoDebugStop')) - - finally - call delete(l:tmp, 'rf') - " clear the quickfix lists - call setqflist([], 'r') - endtry -endfunction - -" s:debug takes 2 optional arguments. The first is a package to debug. The -" second is a flag to indicate whether to reset GOPATH after -" gotest#load_fixture is called in order to test behavior outside of GOPATH. -function! s:debug(...) abort - if !go#util#has_job() - return - endif - - try - let $oldgopath = $GOPATH - let l:tmp = gotest#load_fixture('debug/debugmain/debugmain.go') - - if a:0 > 1 && a:2 == 1 - let $GOPATH = $oldgopath - endif - - call go#debug#Breakpoint(6) - - call assert_false(exists(':GoDebugStop')) - - if a:0 == 0 - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - execute l:cd . ' debug/debugmain' - let l:job = go#debug#Start(0) - else - let l:job = go#debug#Start(0, a:1) - endif - - let l:start = reltime() - while !exists(':GoDebugStop') && reltimefloat(reltime(l:start)) < 10 - sleep 100m - endwhile - - call assert_true(exists(':GoDebugStop')) - call gotest#assert_quickfix(getqflist(), []) - - call go#debug#Stop() - - if !has('nvim') - call assert_equal(job_status(l:job), 'dead') - endif - - call assert_false(exists(':GoDebugStop')) - - finally - call go#debug#Breakpoint(6) - 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/decls.vim b/sources_non_forked/vim-go/autoload/go/decls.vim deleted file mode 100644 index 15743187..00000000 --- a/sources_non_forked/vim-go/autoload/go/decls.vim +++ /dev/null @@ -1,26 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#decls#Decls(mode, ...) abort - let decls_mode = go#config#DeclsMode() - if decls_mode == 'ctrlp' - call ctrlp#init(call("ctrlp#decls#cmd", [a:mode] + a:000)) - elseif decls_mode == 'fzf' - call call("fzf#decls#cmd", [a:mode] + a:000) - else - if globpath(&rtp, 'plugin/ctrlp.vim') != "" - call ctrlp#init(call("ctrlp#decls#cmd", [a:mode] + a:000)) - elseif globpath(&rtp, 'plugin/fzf.vim') != "" - call call("fzf#decls#cmd", [a:mode] + a:000) - else - call go#util#EchoError("neither ctrlp.vim nor fzf.vim are installed. Please install either one") - end - end -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/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim deleted file mode 100644 index 7cbce4a7..00000000 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ /dev/null @@ -1,358 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:go_stack = [] -let s:go_stack_level = 0 - -function! go#def#Jump(mode, type) abort - let l:fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - - " so guru right now is slow for some people. previously we were using - " godef which also has it's own quirks. But this issue come up so many - " times I've decided to support both. By default we still use guru as it - " covers all edge cases, but now anyone can switch to godef if they wish - let bin_name = go#config#DefMode() - if bin_name == 'godef' - let l:cmd = ['godef', - \ '-f=' . l:fname, - \ '-o=' . go#util#OffsetCursor(), - \ '-t'] - - if &modified - let l:stdin_content = join(go#util#GetLines(), "\n") - call add(l:cmd, "-i") - let [l:out, l:err] = go#util#ExecInDir(l:cmd, l:stdin_content) - else - let [l:out, l:err] = go#util#ExecInDir(l:cmd) - endif - elseif bin_name == 'guru' - let cmd = [go#path#CheckBinPath(bin_name)] - let buildtags = go#config#BuildTags() - if buildtags isnot '' - let cmd += ['-tags', buildtags] - endif - - let stdin_content = "" - - if &modified - let content = join(go#util#GetLines(), "\n") - let stdin_content = fname . "\n" . strlen(content) . "\n" . content - call add(cmd, "-modified") - endif - - call extend(cmd, ["definition", fname . ':#' . go#util#OffsetCursor()]) - - if go#util#has_job() - let l:state = {} - let l:spawn_args = { - \ 'cmd': cmd, - \ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name], l:state), - \ 'for': '_', - \ 'statustype': 'searching declaration', - \ } - - if &modified - let l:spawn_args.input = stdin_content - endif - - call s:def_job(spawn_args, l:state) - return - endif - - if &modified - let [l:out, l:err] = go#util#ExecInDir(l:cmd, l:stdin_content) - else - let [l:out, l:err] = go#util#ExecInDir(l:cmd) - endif - elseif bin_name == 'gopls' - let [l:line, l:col] = go#lsp#lsp#Position() - " delegate to gopls, with an empty job object and an exit status of 0 - " (they're irrelevant for gopls). - if a:type - call go#lsp#TypeDef(l:fname, l:line, l:col, function('s:jump_to_declaration_cb', [a:mode, 'gopls', {}, 0])) - else - call go#lsp#Definition(l:fname, l:line, l:col, function('s:jump_to_declaration_cb', [a:mode, 'gopls', {}, 0])) - endif - return - else - call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, guru, gopls]') - return - endif - - if l:err - call go#util#EchoError(out) - return - endif - - call go#def#jump_to_declaration(out, a:mode, bin_name) -endfunction - -function! s:jump_to_declaration_cb(mode, bin_name, job, exit_status, data) abort dict - if a:exit_status != 0 - return - endif - - call go#def#jump_to_declaration(a:data[0], a:mode, a:bin_name) - - " capture the active window so that callbacks for jobs, exit_cb and - " close_cb, and callbacks for gopls can return to it when a:mode caused a - " split. - let self.winid = win_getid(winnr()) -endfunction - -" go#def#jump_to_declaration parses out (expected to be -" 'filename:line:col: message'). -function! go#def#jump_to_declaration(out, mode, bin_name) abort - let final_out = a:out - if a:bin_name == "godef" - " append the type information to the same line so it will be parsed - " correctly using guru's output format. - " This makes it compatible with guru output. - let final_out = join(split(a:out, '\n'), ':') - endif - - " strip line ending - let out = split(final_out, go#util#LineEnding())[0] - if go#util#IsWin() - let parts = split(out, '\(^[a-zA-Z]\)\@ 1 - let line = parts[1] - endif - if len(parts) > 2 - let col = parts[2] - endif - if len(parts) > 3 - let ident = parts[3] - endif - - " Remove anything newer than the current position, just like basic - " vim tag support - if s:go_stack_level == 0 - let s:go_stack = [] - else - let s:go_stack = s:go_stack[0:s:go_stack_level-1] - endif - - " increment the stack counter - let s:go_stack_level += 1 - - " push it on to the jumpstack - let stack_entry = {'line': line("."), 'col': col("."), 'file': expand('%:p'), 'ident': ident} - call add(s:go_stack, stack_entry) - - " needed for restoring back user setting this is because there are two - " modes of switchbuf which we need based on the split mode - let old_switchbuf = &switchbuf - - normal! m' - if filename != fnamemodify(expand("%"), ':p:gs?\\?/?') - " jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded - " and 3. there is buffer window number we switch to - if go#config#DefReuseBuffer() && bufwinnr(filename) != -1 - " jump to existing buffer if it exists - call win_gotoid(bufwinnr(filename)) - else - if &modified - let cmd = 'hide edit' - else - let cmd = 'edit' - endif - - if a:mode == "tab" - let &switchbuf = "useopen,usetab,newtab" - if bufloaded(filename) == 0 - tab split - else - let cmd = 'sbuf' - endif - elseif a:mode == "split" - split - elseif a:mode == "vsplit" - vsplit - endif - - " open the file and jump to line and column - try - exec cmd fnameescape(fnamemodify(filename, ':.')) - catch - if stridx(v:exception, ':E325:') < 0 - call go#util#EchoError(v:exception) - endif - endtry - endif - endif - call cursor(line, col) - - " also align the line to middle of the view - normal! zz - - let &switchbuf = old_switchbuf -endfunction - -function! go#def#SelectStackEntry() abort - let target_window = go#ui#GetReturnWindow() - if empty(target_window) - let target_window = winnr() - endif - - let highlighted_stack_entry = matchstr(getline("."), '^..\zs\(\d\+\)') - if !empty(highlighted_stack_entry) - execute target_window . "wincmd w" - call go#def#Stack(str2nr(highlighted_stack_entry)) - endif - - call go#ui#CloseWindow() -endfunction - -function! go#def#StackUI() abort - if len(s:go_stack) == 0 - call go#util#EchoError("godef stack empty") - return - endif - - let stackOut = ['" ,:navigate :jump ,q:exit'] - - let i = 0 - while i < len(s:go_stack) - let entry = s:go_stack[i] - let prefix = "" - - if i == s:go_stack_level - let prefix = ">" - else - let prefix = " " - endif - - call add(stackOut, printf("%s %d %s|%d col %d|%s", - \ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"])) - let i += 1 - endwhile - - if s:go_stack_level == i - call add(stackOut, "> ") - endif - - call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack") - - noremap :call go#def#SelectStackEntry() - noremap :call go#ui#CloseWindow() - noremap q :call go#ui#CloseWindow() -endfunction - -function! go#def#StackClear(...) abort - let s:go_stack = [] - let s:go_stack_level = 0 -endfunction - -function! go#def#StackPop(...) abort - if len(s:go_stack) == 0 - call go#util#EchoError("godef stack empty") - return - endif - - if s:go_stack_level == 0 - call go#util#EchoError("at bottom of the godef stack") - return - endif - - if !len(a:000) - let numPop = 1 - else - let numPop = a:1 - endif - - let newLevel = str2nr(s:go_stack_level) - str2nr(numPop) - call go#def#Stack(newLevel + 1) -endfunction - -function! go#def#Stack(...) abort - if len(s:go_stack) == 0 - call go#util#EchoError("godef stack empty") - return - endif - - if !len(a:000) - " Display interactive stack - call go#def#StackUI() - return - else - let jumpTarget = a:1 - endif - - if jumpTarget !~ '^\d\+$' - if jumpTarget !~ '^\s*$' - call go#util#EchoError("location must be a number") - endif - return - endif - - let jumpTarget = str2nr(jumpTarget) - 1 - - if jumpTarget >= 0 && jumpTarget < len(s:go_stack) - let s:go_stack_level = jumpTarget - let target = s:go_stack[s:go_stack_level] - - " jump - if expand('%:p') != target["file"] - if &modified - exec 'hide edit' target["file"] - else - exec 'edit' target["file"] - endif - endif - call cursor(target["line"], target["col"]) - normal! zz - else - call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries") - endif -endfunction - -function s:def_job(args, state) abort - let l:start_options = go#job#Options(a:args) - - let l:state = a:state - function! s:exit_cb(next, job, exitval) dict - call call(a:next, [a:job, a:exitval]) - if has_key(self, 'winid') - call win_gotoid(self.winid) - endif - endfunction - let l:start_options.exit_cb = funcref('s:exit_cb', [l:start_options.exit_cb], l:state) - - function! s:close_cb(next, ch) dict - call call(a:next, [a:ch]) - if has_key(self, 'winid') - call win_gotoid(self.winid) - endif - endfunction - let l:start_options.close_cb = funcref('s:close_cb', [l:start_options.close_cb], l:state) - - if &modified - let l:tmpname = tempname() - call writefile(split(a:args.input, "\n"), l:tmpname, "b") - let l:start_options.in_io = "file" - let l:start_options.in_name = l:tmpname - endif - - call go#job#Start(a:args.cmd, l:start_options) -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/def_test.vim b/sources_non_forked/vim-go/autoload/go/def_test.vim deleted file mode 100644 index 6a855417..00000000 --- a/sources_non_forked/vim-go/autoload/go/def_test.vim +++ /dev/null @@ -1,223 +0,0 @@ -" 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_jump_to_declaration_guru() abort - try - let l:filename = 'def/jump.go' - let l:lnum = 5 - let l:col = 6 - let l:tmp = gotest#load_fixture(l:filename) - - let l:guru_out = printf("%s:%d:%d: defined here as func main", l:filename, l:lnum, l:col) - call go#def#jump_to_declaration(l:guru_out, "", 'guru') - - call assert_equal(l:filename, bufname("%")) - call assert_equal(l:lnum, getcurpos()[1]) - call assert_equal(l:col, getcurpos()[2]) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_jump_to_declaration_godef() abort - try - let l:filename = 'def/jump.go' - let l:lnum = 5 - let l:col = 6 - let l:tmp = gotest#load_fixture(l:filename) - - let l:godef_out = printf("%s:%d:%d\ndefined here as func main", l:filename, l:lnum, l:col) - call go#def#jump_to_declaration(godef_out, "", 'godef') - - call assert_equal(l:filename, bufname("%")) - call assert_equal(l:lnum, getcurpos()[1]) - call assert_equal(l:col, getcurpos()[2]) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_Jump_leaves_lists() abort - try - let l:filename = 'def/jump.go' - let l:tmp = gotest#load_fixture(l:filename) - - let l:expected = [{'lnum': 10, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'quux'}] - - call setloclist(winnr(), copy(l:expected), 'r' ) - call setqflist(copy(l:expected), 'r' ) - - let l:bufnr = bufnr('%') - call cursor(6, 7) - - if !go#util#has_job() - let g:go_def_mode='godef' - endif - call go#def#Jump('', 0) - - if !go#util#has_job() - unlet g:go_def_mode - endif - - let l:start = reltime() - while bufnr('%') == l:bufnr && reltimefloat(reltime(l:start)) < 10 - sleep 100m - endwhile - - let l:actual = getloclist(winnr()) - call gotest#assert_quickfix(l:actual, l:expected) - - let l:actual = getqflist() - call gotest#assert_quickfix(l:actual, l:expected) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_DefJump_gopls_simple_first() abort - if !go#util#has_job() - return - endif - - try - let g:go_def_mode = 'gopls' - - let l:tmp = gotest#write_file('simple/firstposition/firstposition.go', [ - \ 'package firstposition', - \ '', - \ 'func Example() {', - \ "\tid := " . '"foo"', - \ "\tprintln(" . '"id:", id)', - \ '}', - \ ] ) - - let l:expected = [0, 4, 2, 0] - - call assert_notequal(l:expected, getpos('.')) - - 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:expected, getpos('.')) - finally - call delete(l:tmp, 'rf') - unlet g:go_def_mode - endtry -endfunc - -func! Test_DefJump_gopls_simple_last() abort - if !go#util#has_job() - return - endif - - try - let g:go_def_mode = 'gopls' - - let l:tmp = gotest#write_file('simple/lastposition/lastposition.go', [ - \ 'package lastposition', - \ '', - \ 'func Example() {', - \ "\tid := " . '"foo"', - \ "\tprintln(" . '"id:", id)', - \ '}', - \ ] ) - - let l:expected = [0, 4, 2, 0] - - call assert_notequal(l:expected, getpos('.')) - - 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:expected, getpos('.')) - finally - call delete(l:tmp, 'rf') - unlet g:go_def_mode - endtry -endfunc - -func! Test_DefJump_gopls_MultipleCodeUnit_first() abort - if !go#util#has_job() - return - endif - - try - let g:go_def_mode = 'gopls' - - let l:tmp = gotest#write_file('multiplecodeunit/firstposition/firstposition.go', [ - \ 'package firstposition', - \ '', - \ 'func Example() {', - \ "\t𐐀, id := " . '"foo", "bar"', - \ "\tprintln(" . '"(𐐀, id):", 𐐀, id)', - \ '}', - \ ] ) - - let l:expected = [0, 4, 8, 0] - call assert_notequal(l:expected, getpos('.')) - - 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:expected, getpos('.')) - finally - call delete(l:tmp, 'rf') - unlet g:go_def_mode - endtry -endfunc - - -func! Test_DefJump_gopls_MultipleCodeUnit_last() abort - if !go#util#has_job() - return - endif - - try - let g:go_def_mode = 'gopls' - - let l:tmp = gotest#write_file('multiplecodeunit/lastposition/lastposition.go', [ - \ 'package lastposition', - \ '', - \ 'func Example() {', - \ "\t𐐀, id := " . '"foo", "bar"', - \ "\tprintln(" . '"(𐐀, id):", 𐐀, id)', - \ '}', - \ ] ) - - let l:expected = [0, 4, 8, 0] - call assert_notequal(l:expected, getpos('.')) - - 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:expected, getpos('.')) - finally - call delete(l:tmp, 'rf') - unlet g:go_def_mode - 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/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim deleted file mode 100644 index 04860752..00000000 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ /dev/null @@ -1,247 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:buf_nr = -1 - -function! go#doc#OpenBrowser(...) abort - " check if we have gogetdoc as it gives us more and accurate information. - " Only supported if we have json_decode as it's not worth to parse the plain - " non-json output of gogetdoc - let bin_path = go#path#CheckBinPath('gogetdoc') - if !empty(bin_path) && exists('*json_decode') - let [l:json_out, l:err] = s:gogetdoc(1) - if l:err - call go#util#EchoError(json_out) - return - endif - - let out = json_decode(json_out) - if type(out) != type({}) - call go#util#EchoError("gogetdoc output is malformed") - endif - - let import = out["import"] - let name = out["name"] - let decl = out["decl"] - - let godoc_url = go#config#DocUrl() - let godoc_url .= "/" . import - if decl !~ '^package' - let anchor = name - if decl =~ '^func (' - let anchor = substitute(decl, '^func ([^ ]\+ \*\?\([^)]\+\)) ' . name . '(.*', '\1', '') . "." . name - endif - let godoc_url .= "#" . anchor - endif - - call go#util#OpenBrowser(godoc_url) - return - endif - - let pkgs = s:godocWord(a:000) - if empty(pkgs) - return - endif - - let pkg = pkgs[0] - let exported_name = pkgs[1] - - " example url: https://godoc.org/github.com/fatih/set#Set - let godoc_url = go#config#DocUrl() . "/" . pkg . "#" . exported_name - call go#util#OpenBrowser(godoc_url) -endfunction - -function! go#doc#Open(newmode, mode, ...) abort - " With argument: run "godoc [arg]". - if len(a:000) - let [l:out, l:err] = go#util#Exec(['go', 'doc'] + a:000) - else " Without argument: run gogetdoc on cursor position. - let [l:out, l:err] = s:gogetdoc(0) - if out == -1 - return - endif - endif - - if l:err - call go#util#EchoError(out) - return - endif - - call s:GodocView(a:newmode, a:mode, out) -endfunction - -function! s:GodocView(newposition, position, content) abort - " popup window - if go#config#DocPopupWindow() - if exists('*popup_atcursor') && exists('*popup_clear') - call popup_clear() - - call popup_atcursor(split(a:content, '\n'), { - \ 'padding': [1, 1, 1, 1], - \ 'borderchars': ['-','|','-','|','+','+','+','+'], - \ "border": [1, 1, 1, 1], - \ }) - elseif has('nvim') && exists('*nvim_open_win') - let lines = split(a:content, '\n') - let height = 0 - let width = 0 - for line in lines - let lw = strdisplaywidth(line) - if lw > width - let width = lw - endif - let height += 1 - endfor - let width += 1 " right margin - let max_height = go#config#DocMaxHeight() - if height > max_height - let height = max_height - endif - - let buf = nvim_create_buf(v:false, v:true) - call nvim_buf_set_lines(buf, 0, -1, v:true, lines) - let opts = { - \ 'relative': 'cursor', - \ 'row': 1, - \ 'col': 0, - \ 'width': width, - \ 'height': height, - \ 'style': 'minimal', - \ } - call nvim_open_win(buf, v:true, opts) - setlocal nomodified nomodifiable filetype=godoc - - " close easily with CR, Esc and q - noremap :close - noremap :close - noremap q :close - endif - return - endif - - " reuse existing buffer window if it exists otherwise create a new one - let is_visible = bufexists(s:buf_nr) && bufwinnr(s:buf_nr) != -1 - if !bufexists(s:buf_nr) - execute a:newposition - sil file `="[Godoc]"` - let s:buf_nr = bufnr('%') - elseif bufwinnr(s:buf_nr) == -1 - execute a:position - execute s:buf_nr . 'buffer' - elseif bufwinnr(s:buf_nr) != bufwinnr('%') - execute bufwinnr(s:buf_nr) . 'wincmd w' - endif - - " if window was not visible then resize it - if !is_visible - if a:position == "split" - " cap window height to 20, but resize it for smaller contents - let max_height = go#config#DocMaxHeight() - let content_height = len(split(a:content, "\n")) - if content_height > max_height - exe 'resize ' . max_height - else - exe 'resize ' . content_height - endif - else - " set a sane maximum width for vertical splits. In this case the minimum - " that fits the godoc for package http without extra linebreaks and line - " numbers on - exe 'vertical resize 84' - endif - endif - - setlocal filetype=godoc - setlocal bufhidden=delete - setlocal buftype=nofile - setlocal noswapfile - setlocal nobuflisted - setlocal nocursorline - setlocal nocursorcolumn - setlocal iskeyword+=: - setlocal iskeyword-=- - - setlocal modifiable - %delete _ - call append(0, split(a:content, "\n")) - sil $delete _ - setlocal nomodifiable - sil normal! gg - - " close easily with enter - noremap :close - noremap :close - " make sure any key that sends an escape as a prefix (e.g. the arrow keys) - " don't cause the window to close. - nnoremap [ [ -endfunction - -function! s:gogetdoc(json) abort - let l:cmd = [ - \ 'gogetdoc', - \ '-tags', go#config#BuildTags(), - \ '-pos', expand("%:p:gs!\\!/!") . ':#' . go#util#OffsetCursor()] - if a:json - let l:cmd += ['-json'] - endif - - if &modified - let l:cmd += ['-modified'] - return go#util#Exec(l:cmd, go#util#archive()) - endif - - return go#util#Exec(l:cmd) -endfunction - -" returns the package and exported name. exported name might be empty. -" ie: fmt and Println -" ie: github.com/fatih/set and New -function! s:godocWord(args) abort - if !executable('godoc') - let msg = "godoc command not found." - let msg .= " install with: go get golang.org/x/tools/cmd/godoc" - call go#util#EchoWarning(msg) - return [] - endif - - if !len(a:args) - let oldiskeyword = &iskeyword - setlocal iskeyword+=. - let word = expand('') - let &iskeyword = oldiskeyword - let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g') - let words = split(word, '\.\ze[^./]\+$') - else - let words = a:args - endif - - if !len(words) - return [] - endif - - let pkg = words[0] - if len(words) == 1 - let exported_name = "" - else - let exported_name = words[1] - endif - - let packages = go#tool#Imports() - - if has_key(packages, pkg) - let pkg = packages[pkg] - endif - - return [pkg, exported_name] -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/fillstruct.vim b/sources_non_forked/vim-go/autoload/go/fillstruct.vim deleted file mode 100644 index 1e406d75..00000000 --- a/sources_non_forked/vim-go/autoload/go/fillstruct.vim +++ /dev/null @@ -1,72 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#fillstruct#FillStruct() abort - let l:cmd = ['fillstruct', - \ '-file', bufname(''), - \ '-offset', go#util#OffsetCursor(), - \ '-line', line('.')] - " Needs: https://github.com/davidrjenni/reftools/pull/14 - "\ '-tags', go#config#BuildTags()] - - " Read from stdin if modified. - if &modified - call add(l:cmd, '-modified') - let [l:out, l:err] = go#util#Exec(l:cmd, go#util#archive()) - else - let [l:out, l:err] = go#util#Exec(l:cmd) - endif - - if l:err - call go#util#EchoError(l:out) - return - endif - - try - let l:json = json_decode(l:out) - catch - call go#util#EchoError(l:out) - return - endtry - - " Output is array: - "[ - " {"start": 92, "end": 106, "code": "mail.Address{\n\tName: \"\",\n\tAddress: \"\",\n}"}, - " {...second struct...} - " ] - - let l:pos = getpos('.') - - try - for l:struct in l:json - let l:code = split(l:struct['code'], "\n") - - " Add any code before/after the struct. - exe l:struct['start'] . 'go' - let l:code[0] = getline('.')[:col('.')-1] . l:code[0] - exe l:struct['end'] . 'go' - let l:code[len(l:code)-1] .= getline('.')[col('.'):] - - " Indent every line except the first one; makes it look nice. - let l:indent = repeat("\t", indent('.') / &tabstop) - for l:i in range(1, len(l:code)-1) - let l:code[l:i] = l:indent . l:code[l:i] - endfor - - " Out with the old ... - exe 'normal! ' . l:struct['start'] . 'gov' . l:struct['end'] . 'gox' - " ... in with the new. - call setline('.', l:code[0]) - call append('.', l:code[1:]) - endfor - finally - call setpos('.', l:pos) - 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/fillstruct_test.vim b/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim deleted file mode 100644 index 73ed0891..00000000 --- a/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim +++ /dev/null @@ -1,98 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_fillstruct() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ 'import "net/mail"', - \ "var addr = mail.\x1fAddress{}"]) - - call go#fillstruct#FillStruct() - call gotest#assert_buffer(1, [ - \ 'var addr = mail.Address{', - \ '\tName: "",', - \ '\tAddress: "",', - \ '}']) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_fillstruct_line() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ 'import "net/mail"', - \ "\x1f" . 'var addr = mail.Address{}']) - - call go#fillstruct#FillStruct() - call gotest#assert_buffer(1, [ - \ 'var addr = mail.Address{', - \ '\tName: "",', - \ '\tAddress: "",', - \ '}']) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_fillstruct_two_line() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ 'import (', - \ '"fmt"', - \ '"net/mail"', - \ ')', - \ "\x1f" . 'func x() { fmt.Println(mail.Address{}, mail.Address{}) }']) - - call go#fillstruct#FillStruct() - call gotest#assert_buffer(1, [ - \ 'import (', - \ '"fmt"', - \ '"net/mail"', - \ ')', - \ 'func x() { fmt.Println(mail.Address{', - \ '\tName: "",', - \ '\tAddress: "",', - \ '}, mail.Address{', - \ '\tName: "",', - \ '\tAddress: "",', - \ '}) }']) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_fillstruct_two_cursor() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ 'import (', - \ '"fmt"', - \ '"net/mail"', - \ ')', - \ "func x() { fmt.Println(mail.Address{}, mail.Ad\x1fdress{}) }"]) - - call go#fillstruct#FillStruct() - call gotest#assert_buffer(1, [ - \ 'import (', - \ '"fmt"', - \ '"net/mail"', - \ ')', - \ 'func x() { fmt.Println(mail.Address{}, mail.Address{', - \ '\tName: "",', - \ '\tAddress: "",', - \ '}) }']) - 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/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim deleted file mode 100644 index 54d773be..00000000 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ /dev/null @@ -1,214 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible -" toorls, such as goimports). - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" we have those problems : -" http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree -" http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1 -" -" The below function is an improved version that aims to fix all problems. -" it doesn't undo changes and break undo history. If you are here reading -" this and have VimL experience, please look at the function for -" improvements, patches are welcome :) -function! go#fmt#Format(withGoimport) abort - if go#config#FmtExperimental() - " Using winsaveview to save/restore cursor state has the problem of - " closing folds on save: - " https://github.com/fatih/vim-go/issues/502 - " One fix is to use mkview instead. Unfortunately, this sometimes causes - " other bad side effects: - " https://github.com/fatih/vim-go/issues/728 - " and still closes all folds if foldlevel>0: - " https://github.com/fatih/vim-go/issues/732 - let l:curw = {} - try - mkview! - catch - let l:curw = winsaveview() - endtry - - " save our undo file to be restored after we are done. This is needed to - " prevent an additional undo jump due to BufWritePre auto command and also - " restore 'redo' history because it's getting being destroyed every - " BufWritePre - let tmpundofile = tempname() - exe 'wundo! ' . tmpundofile - else - " Save cursor position and many other things. - let l:curw = winsaveview() - endif - - " Write current unsaved buffer to a temp file - let l:tmpname = tempname() . '.go' - call writefile(go#util#GetLines(), l:tmpname) - if go#util#IsWin() - let l:tmpname = tr(l:tmpname, '\', '/') - endif - - let bin_name = go#config#FmtCommand() - if a:withGoimport == 1 - let bin_name = "goimports" - endif - - let current_col = col('.') - let [l:out, l:err] = go#fmt#run(bin_name, l:tmpname, expand('%')) - let diff_offset = len(readfile(l:tmpname)) - line('$') - - if l:err == 0 - call go#fmt#update_file(l:tmpname, expand('%')) - elseif !go#config#FmtFailSilently() - let errors = s:parse_errors(expand('%'), out) - call s:show_errors(errors) - endif - - " We didn't use the temp file, so clean up - call delete(l:tmpname) - - if go#config#FmtExperimental() - " restore our undo history - silent! exe 'rundo ' . tmpundofile - call delete(tmpundofile) - - " Restore our cursor/windows positions, folds, etc. - if empty(l:curw) - silent! loadview - else - call winrestview(l:curw) - endif - else - " Restore our cursor/windows positions. - call winrestview(l:curw) - endif - - " be smart and jump to the line the new statement was added/removed - call cursor(line('.') + diff_offset, current_col) - - " Syntax highlighting breaks less often. - syntax sync fromstart -endfunction - -" update_file updates the target file with the given formatted source -function! go#fmt#update_file(source, target) - " remove undo point caused via BufWritePre - try | silent undojoin | catch | endtry - - let old_fileformat = &fileformat - if exists("*getfperm") - " save file permissions - let original_fperm = getfperm(a:target) - endif - - call rename(a:source, a:target) - - " restore file permissions - if exists("*setfperm") && original_fperm != '' - call setfperm(a:target , original_fperm) - endif - - " reload buffer to reflect latest changes - silent edit! - - let &fileformat = old_fileformat - let &syntax = &syntax - - let l:listtype = go#list#Type("GoFmt") - - " clean up previous list - if l:listtype == "quickfix" - let l:list_title = getqflist({'title': 1}) - else - let l:list_title = getloclist(0, {'title': 1}) - endif - - if has_key(l:list_title, "title") && l:list_title['title'] == "Format" - call go#list#Clean(l:listtype) - endif -endfunction - -" run runs the gofmt/goimport command for the given source file and returns -" the output of the executed command. Target is the real file to be formatted. -function! go#fmt#run(bin_name, source, target) - let l:cmd = s:fmt_cmd(a:bin_name, a:source, a:target) - if empty(l:cmd) - return - endif - return go#util#Exec(l:cmd) -endfunction - -" fmt_cmd returns the command to run as a list. -function! s:fmt_cmd(bin_name, source, target) - let l:cmd = [a:bin_name, '-w'] - - " add the options for binary (if any). go_fmt_options was by default of type - " string, however to allow customization it's now a dictionary of binary - " name mapping to options. - let opts = go#config#FmtOptions() - if type(opts) == type({}) - let opts = has_key(opts, a:bin_name) ? opts[a:bin_name] : "" - endif - call extend(cmd, split(opts, " ")) - if a:bin_name is# 'goimports' - call extend(cmd, ["-srcdir", a:target]) - endif - - call add(cmd, a:source) - return cmd -endfunction - -" parse_errors parses the given errors and returns a list of parsed errors -function! s:parse_errors(filename, content) abort - let splitted = split(a:content, '\n') - - " list of errors to be put into location list - let errors = [] - for line in splitted - let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') - if !empty(tokens) - call add(errors,{ - \"filename": a:filename, - \"lnum": tokens[2], - \"col": tokens[3], - \"text": tokens[4], - \ }) - endif - endfor - - return errors -endfunction - -" show_errors opens a location list and shows the given errors. If the given -" errors is empty, it closes the the location list -function! s:show_errors(errors) abort - let l:listtype = go#list#Type("GoFmt") - if !empty(a:errors) - call go#list#Populate(l:listtype, a:errors, 'Format') - endif - - " this closes the window if there are no errors or it opens - " it if there is any - call go#list#Window(l:listtype, len(a:errors)) -endfunction - -function! go#fmt#ToggleFmtAutoSave() abort - if go#config#FmtAutosave() - call go#config#SetFmtAutosave(0) - call go#util#EchoProgress("auto fmt disabled") - return - end - - call go#config#SetFmtAutosave(1) - call go#util#EchoProgress("auto fmt enabled") -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fmt_test.vim b/sources_non_forked/vim-go/autoload/go/fmt_test.vim deleted file mode 100644 index b1b740ae..00000000 --- a/sources_non_forked/vim-go/autoload/go/fmt_test.vim +++ /dev/null @@ -1,57 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_run_fmt() abort - let actual_file = tempname() - call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file) - - let expected = join(readfile("test-fixtures/fmt/hello_golden.go"), "\n") - - " run our code - call go#fmt#run("gofmt", actual_file, "test-fixtures/fmt/hello.go") - - " this should now contain the formatted code - let actual = join(readfile(actual_file), "\n") - - call assert_equal(expected, actual) -endfunc - -func! Test_update_file() abort - let expected = join(readfile("test-fixtures/fmt/hello_golden.go"), "\n") - let source_file = tempname() - call writefile(readfile("test-fixtures/fmt/hello_golden.go"), source_file) - - let target_file = tempname() - call writefile([""], target_file) - - " update_file now - call go#fmt#update_file(source_file, target_file) - - " this should now contain the formatted code - let actual = join(readfile(target_file), "\n") - - call assert_equal(expected, actual) -endfunc - -func! Test_goimports() abort - let $GOPATH = 'test-fixtures/fmt/' - let actual_file = tempname() - call writefile(readfile("test-fixtures/fmt/src/imports/goimports.go"), actual_file) - - let expected = join(readfile("test-fixtures/fmt/src/imports/goimports_golden.go"), "\n") - - " run our code - call go#fmt#run("goimports", actual_file, "test-fixtures/fmt/src/imports/goimports.go") - - " this should now contain the formatted code - let actual = join(readfile(actual_file), "\n") - - call assert_equal(expected, actual) -endfunc - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim deleted file mode 100644 index 463ce375..00000000 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ /dev/null @@ -1,731 +0,0 @@ -" guru.vim -- Vim integration for the Go guru. - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" guru_cmd returns a dict that contains the command to execute guru. args -" is dict with following options: -" mode : guru mode, such as 'implements' -" format : output format, either 'plain' or 'json' -" needs_scope : if 1, adds the current package to the scope -" selected : if 1, means it's a range of selection, otherwise it picks up the -" offset under the cursor -" example output: -" {'cmd' : ['guru', '-json', 'implements', 'demo/demo.go:#66']} -function! s:guru_cmd(args) range abort - let mode = a:args.mode - let format = a:args.format - let needs_scope = a:args.needs_scope - let selected = a:args.selected - let postype = get(a:args, 'postype', 'cursor') - - let result = {} - - "return with a warning if the binary doesn't exist - let bin_path = go#path#CheckBinPath("guru") - if empty(bin_path) - return {'err': "bin path not found"} - endif - - " start constructing the command - let cmd = [bin_path, '-tags', go#config#BuildTags()] - - if &modified - let result.stdin_content = go#util#archive() - call add(cmd, "-modified") - endif - - " enable outputting in json format - if format == "json" - call add(cmd, "-json") - endif - - let scopes = go#config#GuruScope() - if empty(scopes) - " some modes require scope to be defined (such as callers). For these we - " choose a sensible setting, which is using the current file's package - if needs_scope - let pkg = go#package#ImportPath() - if pkg == -1 - return {'err': "current directory is not inside of a valid GOPATH"} - endif - let scopes = [pkg] - endif - endif - - " Add the scope. - if !empty(scopes) - " guru expect a comma-separated list of patterns. - let l:scope = join(scopes, ",") - let result.scope = l:scope - call extend(cmd, ["-scope", l:scope]) - endif - - if postype == 'balloon' - let pos = printf("#%s", go#util#Offset(v:beval_lnum, v:beval_col)) - else - let pos = printf("#%s", go#util#OffsetCursor()) - if selected != -1 - " means we have a range, get it - let pos1 = go#util#Offset(line("'<"), col("'<")) - let pos2 = go#util#Offset(line("'>"), col("'>")) - let pos = printf("#%s,#%s", pos1, pos2) - endif - endif - - let l:filename = fnamemodify(expand("%"), ':p:gs?\\?/?') . ':' . pos - call extend(cmd, [mode, l:filename]) - - let result.cmd = cmd - return result -endfunction - -" sync_guru runs guru in sync mode with the given arguments -function! s:sync_guru(args) abort - let result = s:guru_cmd(a:args) - if has_key(result, 'err') - call go#util#EchoError(result.err) - return -1 - endif - - if !has_key(a:args, 'disable_progress') - if a:args.needs_scope - call go#util#EchoProgress("analysing with scope ". result.scope . - \ " (see ':help go-guru-scope' if this doesn't work)...") - elseif a:args.mode !=# 'what' - " the query might take time, let us give some feedback - call go#util#EchoProgress("analysing ...") - endif - endif - - " run, forrest run!!! - if has_key(l:result, 'stdin_content') - let [l:out, l:err] = go#util#Exec(l:result.cmd, l:result.stdin_content) - else - let [l:out, l:err] = go#util#Exec(l:result.cmd) - endif - - if has_key(a:args, 'custom_parse') - call a:args.custom_parse(l:err, l:out, a:args.mode) - else - call s:parse_guru_output(l:err, l:out, a:args.mode) - endif - - return l:out -endfunc - -" async_guru runs guru in async mode with the given arguments -function! s:async_guru(args) abort - let result = s:guru_cmd(a:args) - if has_key(result, 'err') - call go#util#EchoError(result.err) - return - endif - - let state = { - \ 'mode': a:args.mode, - \ 'parse' : get(a:args, 'custom_parse', funcref("s:parse_guru_output")) - \ } - - " explicitly bind complete to state so that within it, self will - " always refer to state. See :help Partial for more information. - let state.complete = function('s:complete', [], state) - - let opts = { - \ 'statustype': get(a:args, 'statustype', a:args.mode), - \ 'for': '_', - \ 'errorformat': "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m", - \ 'complete': state.complete, - \ } - - if has_key(a:args, 'disable_progress') - let opts.statustype = '' - endif - - let opts = go#job#Options(l:opts) - - if has_key(result, 'stdin_content') - let l:tmpname = tempname() - call writefile(split(result.stdin_content, "\n"), l:tmpname, "b") - let l:opts.in_io = "file" - let l:opts.in_name = l:tmpname - endif - - call go#job#Start(result.cmd, opts) - - if a:args.needs_scope && go#config#EchoCommandInfo() && !has_key(a:args, 'disable_progress') - call go#util#EchoProgress("analysing with scope " . result.scope . - \ " (see ':help go-guru-scope' if this doesn't work)...") - endif -endfunc - -function! s:complete(job, exit_status, messages) dict abort - let output = join(a:messages, "\n") - call self.parse(a:exit_status, output, self.mode) -endfunction - -" run_guru runs the given guru argument -function! s:run_guru(args) abort - if go#util#has_job() - let res = s:async_guru(a:args) - else - let res = s:sync_guru(a:args) - endif - - return res -endfunction - -" Show 'implements' relation for selected package -function! go#guru#Implements(selected) abort - let args = { - \ 'mode': 'implements', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -" Shows the set of possible objects to which a pointer may point. -function! go#guru#PointsTo(selected) abort - let l:args = { - \ 'mode': 'pointsto', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(l:args) -endfunction - -" Report the possible constants, global variables, and concrete types that may -" appear in a value of type error -function! go#guru#Whicherrs(selected) abort - let args = { - \ 'mode': 'whicherrs', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - - " TODO(arslan): handle empty case for both sync/async - " if empty(out.out) - " call go#util#EchoSuccess("no error variables found. Try to change the scope with :GoGuruScope") - " return - " endif - call s:run_guru(args) -endfunction - -" Describe selected syntax: definition, methods, etc -function! go#guru#Describe(selected) abort - let args = { - \ 'mode': 'describe', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -function! go#guru#DescribeInfo(showstatus) abort - - " check if the version of Vim being tested supports json_decode() - if !exists("*json_decode") - call go#util#EchoError("GoDescribeInfo requires 'json_decode'. Update your Vim/Neovim version.") - return - endif - - let args = { - \ 'mode': 'describe', - \ 'format': 'json', - \ 'selected': -1, - \ 'needs_scope': 0, - \ 'custom_parse': function('s:info'), - \ 'disable_progress': a:showstatus == 0, - \ } - - call s:run_guru(args) -endfunction - -function! s:info(exit_val, output, mode) - if a:exit_val != 0 - return - endif - - if a:output[0] !=# '{' - return - endif - - if empty(a:output) || type(a:output) != type("") - return - endif - - let result = json_decode(a:output) - if type(result) != type({}) - call go#util#EchoError(printf("malformed output from guru: %s", a:output)) - return - endif - - if !has_key(result, 'detail') - " if there is no detail check if there is a description and print it - if has_key(result, "desc") - call go#util#EchoInfo(result["desc"]) - return - endif - - call go#util#EchoError("detail key is missing. Please open a bug report on vim-go repo.") - return - endif - - let detail = result['detail'] - let info = "" - - " guru gives different information based on the detail mode. Let try to - " extract the most useful information - - if detail == "value" - if !has_key(result, 'value') - call go#util#EchoError("value key is missing. Please open a bug report on vim-go repo.") - return - endif - - let val = result["value"] - if !has_key(val, 'type') - call go#util#EchoError("type key is missing (value.type). Please open a bug report on vim-go repo.") - return - endif - - let info = val["type"] - elseif detail == "type" - if !has_key(result, 'type') - call go#util#EchoError("type key is missing. Please open a bug report on vim-go repo.") - return - endif - - let type = result["type"] - if !has_key(type, 'type') - call go#util#EchoError("type key is missing (type.type). Please open a bug report on vim-go repo.") - return - endif - - let info = type["type"] - elseif detail == "package" - if !has_key(result, 'package') - call go#util#EchoError("package key is missing. Please open a bug report on vim-go repo.") - return - endif - - let package = result["package"] - if !has_key(package, 'path') - call go#util#EchoError("path key is missing (package.path). Please open a bug report on vim-go repo.") - return - endif - - let info = printf("package %s", package["path"]) - elseif detail == "unknown" - let info = result["desc"] - else - call go#util#EchoError(printf("unknown detail mode found '%s'. Please open a bug report on vim-go repo", detail)) - return - endif - - call go#util#ShowInfo(info) -endfunction - -" Show possible targets of selected function call -function! go#guru#Callees(selected) abort - let args = { - \ 'mode': 'callees', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -" Show possible callers of selected function -function! go#guru#Callers(selected) abort - let args = { - \ 'mode': 'callers', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -" Show path from callgraph root to selected function -function! go#guru#Callstack(selected) abort - let args = { - \ 'mode': 'callstack', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -" Show free variables of selection -function! go#guru#Freevars(selected) abort - " Freevars requires a selection - if a:selected == -1 - call go#util#EchoError("GoFreevars requires a selection (range) of code") - return - endif - - let args = { - \ 'mode': 'freevars', - \ 'format': 'plain', - \ 'selected': 1, - \ 'needs_scope': 0, - \ } - - call s:run_guru(args) -endfunction - -" Show send/receive corresponding to selected channel op -function! go#guru#ChannelPeers(selected) abort - let args = { - \ 'mode': 'peers', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 1, - \ } - - call s:run_guru(args) -endfunction - -" Show all refs to entity denoted by selected identifier -function! go#guru#Referrers(selected) abort - let l:mode = go#config#ReferrersMode() - if l:mode == 'guru' - let args = { - \ 'mode': 'referrers', - \ 'format': 'plain', - \ 'selected': a:selected, - \ 'needs_scope': 0, - \ } - - call s:run_guru(args) - return - elseif l:mode == 'gopls' - 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#Referrers(l:fname, l:line, l:col, funcref('s:parse_guru_output')) - return - else - call go#util#EchoWarning('unknown value for g:go_referrers_mode') - endif -endfunction - -function! go#guru#SameIds(showstatus) abort - - " check if the version of Vim being tested supports matchaddpos() - if !exists("*matchaddpos") - call go#util#EchoError("GoSameIds requires 'matchaddpos'. Update your Vim/Neovim version.") - return - endif - - " check if the version of Vim being tested supports json_decode() - if !exists("*json_decode") - call go#util#EchoError("GoSameIds requires 'json_decode'. Update your Vim/Neovim version.") - return - endif - - let [l:line, l:col] = getpos('.')[1:2] - let [l:line, l:col] = go#lsp#lsp#Position(l:line, l:col) - call go#lsp#SameIDs(0, expand('%:p'), l:line, l:col, funcref('s:same_ids_highlight')) -endfunction - -function! s:same_ids_highlight(exit_val, output, mode) abort - call go#guru#ClearSameIds() " run after calling guru to reduce flicker. - - if a:output[0] !=# '{' - if !go#config#AutoSameids() - call go#util#EchoError(a:output) - endif - return - endif - - let result = json_decode(a:output) - if type(result) != type({}) && !go#config#AutoSameids() - call go#util#EchoError("malformed output from guru") - return - endif - - if !has_key(result, 'sameids') - if !go#config#AutoSameids() - call go#util#EchoError("no same_ids founds for the given identifier") - endif - return - endif - - let poslen = 0 - for enclosing in result['enclosing'] - if enclosing['desc'] == 'identifier' - let poslen = enclosing['end'] - enclosing['start'] - break - endif - endfor - - " return when there's no identifier to highlight. - if poslen == 0 - return - endif - - let same_ids = result['sameids'] - - " highlight the lines - let l:matches = [] - for item in same_ids - let pos = split(item, ':') - let l:matches = add(l:matches, [str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]) - endfor - - call matchaddpos('goSameId', l:matches) - - if go#config#AutoSameids() - " re-apply SameIds at the current cursor position at the time the buffer - " is redisplayed: e.g. :edit, :GoRename, etc. - augroup vim-go-sameids - autocmd! * - autocmd BufWinEnter nested call go#guru#SameIds(0) - augroup end - endif -endfunction - -" ClearSameIds returns 0 when it removes goSameId groups and non-zero if no -" goSameId groups are found. -function! go#guru#ClearSameIds() abort - let l:cleared = go#util#ClearGroupFromMatches('goSameId') - - if !l:cleared - return 1 - endif - - " remove the autocmds we defined - augroup vim-go-sameids - autocmd! * - augroup end - - return 0 -endfunction - -function! go#guru#ToggleSameIds() abort - if go#guru#ClearSameIds() != 0 - call go#guru#SameIds(1) - endif -endfunction - -function! go#guru#AutoToggleSameIds() abort - if go#config#AutoSameids() - call go#util#EchoProgress("sameids auto highlighting disabled") - call go#guru#ClearSameIds() - call go#config#SetAutoSameids(0) - else - call go#util#EchoSuccess("sameids auto highlighting enabled") - call go#config#SetAutoSameids(1) - endif - call go#auto#update_autocmd() -endfunction - - -"""""""""""""""""""""""""""""""""""""""" -"" HELPER FUNCTIONS -"""""""""""""""""""""""""""""""""""""""" - -" This uses Vim's errorformat to parse the output from Guru's 'plain output -" and put it into location list. I believe using errorformat is much more -" easier to use. If we need more power we can always switch back to parse it -" via regex. Match two possible styles of errorformats: -" -" 'file:line.col-line2.col2: message' -" 'file:line:col: message' -" -" We discard line2 and col2 for the first errorformat, because it's not -" useful and location only has the ability to show one line and column -" number -function! s:parse_guru_output(exit_val, output, title) abort - if a:exit_val - call go#util#EchoError(a:output) - return - endif - - let errformat = "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m" - let l:listtype = go#list#Type("_guru") - call go#list#ParseFormat(l:listtype, errformat, a:output, a:title) - - let errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(errors)) -endfun - -function! go#guru#Scope(...) abort - if a:0 - let scope = a:000 - if a:0 == 1 && a:1 == '""' - let scope = [] - endif - - call go#config#SetGuruScope(scope) - if empty(scope) - call go#util#EchoSuccess("guru scope is cleared") - else - call go#util#EchoSuccess("guru scope changed to: ". join(a:000, ",")) - endif - - return - endif - - let scope = go#config#GuruScope() - if empty(scope) - call go#util#EchoError("guru scope is not set") - else - call go#util#EchoSuccess("current guru scope: ". join(scope, ",")) - endif -endfunction - -function! go#guru#DescribeBalloon() abort - " don't even try if async isn't available. - if !go#util#has_job() - return - endif - - " check if the version of Vim being tested supports json_decode() - if !exists("*json_decode") - call go#util#EchoError("GoDescribeBalloon requires 'json_decode'. Update your Vim/Neovim version.") - return - endif - - " change the active window to the window where the cursor is. - let l:winid = win_getid(winnr()) - call win_gotoid(v:beval_winid) - - let l:args = { - \ 'mode': 'describe', - \ 'format': 'json', - \ 'selected': -1, - \ 'needs_scope': 0, - \ 'custom_parse': function('s:describe_balloon'), - \ 'disable_progress': 1, - \ 'postype': 'balloon', - \ } - - call s:async_guru(args) - - " make the starting window active again - call win_gotoid(l:winid) - - return '' -endfunction - -function! s:describe_balloon(exit_val, output, mode) - if a:exit_val != 0 - return - endif - - if a:output[0] !=# '{' - return - endif - - if empty(a:output) || type(a:output) != type("") - return - endif - - let l:result = json_decode(a:output) - if type(l:result) != type({}) - call go#util#EchoError(printf('malformed output from guru: %s', a:output)) - return - endif - - let l:info = [] - if has_key(l:result, 'desc') - if l:result['desc'] != 'identifier' - let l:info = add(l:info, l:result['desc']) - endif - endif - - if has_key(l:result, 'detail') - let l:detail = l:result['detail'] - - " guru gives different information based on the detail mode. Let try to - " extract the most useful information - - if l:detail == 'value' - if !has_key(l:result, 'value') - call go#util#EchoError('value key is missing. Please open a bug report on vim-go repo.') - return - endif - - let l:val = l:result['value'] - if !has_key(l:val, 'type') - call go#util#EchoError('type key is missing (value.type). Please open a bug report on vim-go repo.') - return - endif - - let l:info = add(l:info, printf('type: %s', l:val['type'])) - if has_key(l:val, 'value') - let l:info = add(l:info, printf('value: %s', l:val['value'])) - endif - elseif l:detail == 'type' - if !has_key(l:result, 'type') - call go#util#EchoError('type key is missing. Please open a bug report on vim-go repo.') - return - endif - - let l:type = l:result['type'] - if !has_key(l:type, 'type') - call go#util#EchoError('type key is missing (type.type). Please open a bug report on vim-go repo.') - return - endif - - let l:info = add(l:info, printf('type: %s', l:type['type'])) - - if has_key(l:type, 'methods') - let l:info = add(l:info, 'methods:') - for l:m in l:type.methods - let l:info = add(l:info, printf("\t%s", l:m['name'])) - endfor - endif - elseif l:detail == 'package' - if !has_key(l:result, 'package') - call go#util#EchoError('package key is missing. Please open a bug report on vim-go repo.') - return - endif - - let l:package = result['package'] - if !has_key(l:package, 'path') - call go#util#EchoError('path key is missing (package.path). Please open a bug report on vim-go repo.') - return - endif - - let l:info = add(l:info, printf('package: %s', l:package["path"])) - elseif l:detail == 'unknown' - " the description is already included in l:info, and there's no other - " information on unknowns. - else - call go#util#EchoError(printf('unknown detail mode (%s) found. Please open a bug report on vim-go repo', l:detail)) - return - endif - endif - - if has('balloon_eval') - call balloon_show(join(l:info, "\n")) - return - endif - - call balloon_show(l:info) -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/guru_test.vim b/sources_non_forked/vim-go/autoload/go/guru_test.vim deleted file mode 100644 index 47e6bf64..00000000 --- a/sources_non_forked/vim-go/autoload/go/guru_test.vim +++ /dev/null @@ -1,23 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function Test_GuruScope_Set() abort - silent call go#guru#Scope("example.com/foo/bar") - let actual = go#config#GuruScope() - call assert_equal(["example.com/foo/bar"], actual) - - silent call go#guru#Scope('""') - silent let actual = go#config#GuruScope() - call assert_equal([], actual, "setting scope to empty string should clear") - - if exists('g:go_guru_scope') - unlet g:go_guru_scope - 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/highlight_test.vim b/sources_non_forked/vim-go/autoload/go/highlight_test.vim deleted file mode 100644 index 81f60988..00000000 --- a/sources_non_forked/vim-go/autoload/go/highlight_test.vim +++ /dev/null @@ -1,145 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! Test_gomodVersion_highlight() abort - try - syntax on - - let l:dir = gotest#write_file('gomodtest/go.mod', [ - \ 'module github.com/fatih/vim-go', - \ '', - \ '\x1frequire (', - \ '\tversion/simple v1.0.0', - \ '\tversion/simple-pre-release v1.0.0-rc', - \ '\tversion/simple-pre-release v1.0.0+meta', - \ '\tversion/simple-pre-release v1.0.0-rc+meta', - \ '\tversion/pseudo/premajor v1.0.0-20060102150405-0123456789abcdef', - \ '\tversion/pseudo/prerelease v1.0.0-prerelease.0.20060102150405-0123456789abcdef', - \ '\tversion/pseudo/prepatch v1.0.1-0.20060102150405-0123456789abcdef', - \ '\tversion/simple/incompatible v2.0.0+incompatible', - \ '\tversion/pseudo/premajor/incompatible v2.0.0-20060102150405-0123456789abcdef+incompatible', - \ '\tversion/pseudo/prerelease/incompatible v2.0.0-prerelease.0.20060102150405-0123456789abcdef+incompatible', - \ '\tversion/pseudo/prepatch/incompatible v2.0.1-0.20060102150405-0123456789abcdef+incompatible', - \ ')']) - - let l:lineno = 4 - let l:lineclose = line('$') - while l:lineno < l:lineclose - let l:line = getline(l:lineno) - let l:col = col([l:lineno, '$']) - 1 - let l:idx = len(l:line) - 1 - let l:from = stridx(l:line, ' ') + 1 - - while l:idx >= l:from - call cursor(l:lineno, l:col) - let l:synname = synIDattr(synID(l:lineno, l:col, 1), 'name') - let l:errlen = len(v:errors) - - call assert_equal('gomodVersion', l:synname, 'version on line ' . l:lineno) - - " continue at the next line if there was an error at this column; - " there's no need to test each column once an error is detected. - if l:errlen < len(v:errors) - break - endif - - let l:col -= 1 - let l:idx -= 1 - endwhile - let l:lineno += 1 - endwhile - finally - call delete(l:dir, 'rf') - endtry -endfunc - -function! Test_gomodVersion_incompatible_highlight() abort - try - syntax on - - let l:dir = gotest#write_file('gomodtest/go.mod', [ - \ 'module github.com/fatih/vim-go', - \ '', - \ '\x1frequire (', - \ '\tversion/invalid/premajor/incompatible v1.0.0-20060102150405-0123456789abcdef+incompatible', - \ '\tversion/invalid/prerelease/incompatible v1.0.0-prerelease.0.20060102150405-0123456789abcdef+incompatible', - \ '\tversion/invalid/prepatch/incompatible v1.0.1-0.20060102150405-0123456789abcdef+incompatible', - \ ')']) - - let l:lineno = 4 - let l:lineclose = line('$') - while l:lineno < l:lineclose - let l:line = getline(l:lineno) - let l:col = col([l:lineno, '$']) - 1 - let l:idx = len(l:line) - 1 - let l:from = stridx(l:line, '+') - - while l:idx >= l:from - call cursor(l:lineno, l:col) - let l:synname = synIDattr(synID(l:lineno, l:col, 1), 'name') - let l:errlen = len(v:errors) - - call assert_notequal('gomodVersion', l:synname, 'version on line ' . l:lineno) - - " continue at the next line if there was an error at this column; - " there's no need to test each column once an error is detected. - if l:errlen < len(v:errors) - break - endif - - let l:col -= 1 - let l:idx -= 1 - endwhile - let l:lineno += 1 - endwhile - finally - call delete(l:dir, 'rf') - endtry -endfunc - -function! Test_numeric_literal_highlight() abort - syntax on - - let tests = { - \ 'lone zero': {'group': 'goDecimalInt', 'value': '0'}, - \ 'integer': {'group': 'goDecimalInt', 'value': '1234567890'}, - \ 'hexadecimal': {'group': 'goHexadecimalInt', 'value': '0x0123456789abdef'}, - \ 'hexadecimalErrorLeading': {'group': 'goHexadecimalError', 'value': '0xg0123456789abdef'}, - \ 'hexadecimalErrorTrailing': {'group': 'goHexadecimalError', 'value': '0x0123456789abdefg'}, - \ 'heXadecimal': {'group': 'goHexadecimalInt', 'value': '0X0123456789abdef'}, - \ 'heXadecimalErrorLeading': {'group': 'goHexadecimalError', 'value': '0Xg0123456789abdef'}, - \ 'heXadecimalErrorTrailing': {'group': 'goHexadecimalError', 'value': '0X0123456789abdefg'}, - \ 'octal': {'group': 'goOctalInt', 'value': '01234567'}, - \ 'octalErrorLeading': {'group': 'goOctalError', 'value': '081234567'}, - \ 'octalErrorTrailing': {'group': 'goOctalError', 'value': '012345678'}, - \ 'binaryInt': {'group': 'goBinaryInt', 'value': '0b0101'}, - \ 'binaryErrorLeading': {'group': 'goBinaryError', 'value': '0b20101'}, - \ 'binaryErrorTrailing': {'group': 'goBinaryError', 'value': '0b01012'}, - \ 'BinaryInt': {'group': 'goBinaryInt', 'value': '0B0101'}, - \ 'BinaryErrorLeading': {'group': 'goBinaryError', 'value': '0B20101'}, - \ 'BinaryErrorTrailing': {'group': 'goBinaryError', 'value': '0B01012'}, - \ } - - for kv in items(tests) - let l:dir = gotest#write_file(printf('numeric/%s.go', kv[0]), [ - \ 'package numeric', - \ '', - \ printf("var v = %s\x1f", kv[1].value), - \ ]) - - try - let l:pos = getcurpos() - let l:actual = synIDattr(synID(l:pos[1], l:pos[2], 1), 'name') - call assert_equal(kv[1].group, l:actual, kv[0]) - finally - " call delete(l:dir, 'rf') - endtry - endfor -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/iferr.vim b/sources_non_forked/vim-go/autoload/go/iferr.vim deleted file mode 100644 index cc777b34..00000000 --- a/sources_non_forked/vim-go/autoload/go/iferr.vim +++ /dev/null @@ -1,26 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#iferr#Generate() - let [l:out, l:err] = go#util#Exec(['iferr', - \ '-pos=' . go#util#OffsetCursor()], go#util#GetLines()) - if len(l:out) == 1 - return - endif - if getline('.') =~ '^\s*$' - silent delete _ - silent normal! k - endif - let l:pos = getcurpos() - call append(l:pos[1], split(l:out, "\n")) - silent normal! j=2j - call setpos('.', l:pos) - silent normal! 4j -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/impl.vim b/sources_non_forked/vim-go/autoload/go/impl.vim deleted file mode 100644 index 1a04d0cc..00000000 --- a/sources_non_forked/vim-go/autoload/go/impl.vim +++ /dev/null @@ -1,175 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#impl#Impl(...) abort - let recv = "" - let iface = "" - let interactive = 0 - - let pos = getpos('.') - - if a:0 is 0 - " Interactive mode if user didn't pass any arguments. - let recv = s:getReceiver() - let iface = input("vim-go: generating method stubs for interface: ") - redraw! - if empty(iface) - call go#util#EchoError('usage: interface type is not provided') - return - endif - elseif a:0 is 1 - " we assume the user only passed the interface type, - " i.e: ':GoImpl io.Writer' - let recv = s:getReceiver() - let iface = a:1 - elseif a:0 > 2 - " user passed receiver and interface type both, - " i.e: 'GoImpl f *Foo io.Writer' - let recv = join(a:000[:-2], ' ') - let iface = a:000[-1] - else - call go#util#EchoError('usage: GoImpl {receiver} {interface}') - return - endif - - " Make sure we put the generated code *after* the struct. - if getline(".") =~ "struct " - normal! $% - endif - - try - let dirname = fnameescape(expand('%:p:h')) - let [result, err] = go#util#Exec(['impl', '-dir', dirname, recv, iface]) - let result = substitute(result, "\n*$", "", "") - if err - call go#util#EchoError(result) - return - endif - - if result is# '' - return - end - - put ='' - silent put =result - finally - call setpos('.', pos) - endtry -endfunction - -function! s:getReceiver() - let receiveType = expand("") - if receiveType == "type" - normal! w - let receiveType = expand("") - elseif receiveType == "struct" - normal! ge - let receiveType = expand("") - endif - return printf("%s *%s", tolower(receiveType)[0], receiveType) -endfunction - -if exists('*uniq') - function! s:uniq(list) - return uniq(a:list) - endfunction -else - " Note: Believe that the list is sorted - function! s:uniq(list) - let i = len(a:list) - 1 - while 0 < i - if a:list[i-1] ==# a:list[i] - call remove(a:list, i) - let i -= 2 - else - let i -= 1 - endif - endwhile - return a:list - endfunction -endif - -function! s:root_dirs() abort - let dirs = [] - let root = go#util#env("goroot") - if root !=# '' && isdirectory(root) - call add(dirs, root) - endif - - let paths = map(split(go#util#env("gopath"), go#util#PathListSep()), "substitute(v:val, '\\\\', '/', 'g')") - if !empty(filter(paths, 'isdirectory(v:val)')) - call extend(dirs, paths) - endif - - return dirs -endfunction - -function! s:go_packages(dirs, arglead) abort - let pkgs = [] - for dir in a:dirs - " this may expand to multiple lines - let scr_root = expand(dir . '/src/') - for pkg in split(globpath(scr_root, a:arglead.'*'), "\n") - if isdirectory(pkg) - let pkg .= '/' - elseif pkg !~ '\.a$' - continue - endif - - " without this the result can have duplicates in form of - " 'encoding/json' and '/encoding/json/' - let pkg = go#util#StripPathSep(pkg) - - " remove the scr root and keep the package in tact - let pkg = substitute(pkg, scr_root, "", "") - call add(pkgs, pkg) - endfor - endfor - - return pkgs -endfunction - -function! s:interface_list(pkg) abort - let [contents, err] = go#util#Exec(['go', 'doc', a:pkg]) - if err - return [] - endif - - let contents = split(contents, "\n") - call filter(contents, 'v:val =~# ''^type\s\+\h\w*\s\+interface''') - return map(contents, 'a:pkg . "." . matchstr(v:val, ''^type\s\+\zs\h\w*\ze\s\+interface'')') -endfunction - -" Complete package and interface for {interface} -function! go#impl#Complete(arglead, cmdline, cursorpos) abort - let words = split(a:cmdline, '\s\+', 1) - - if words[-1] ==# '' - " if no words are given, just start completing the first package we found - return s:uniq(sort(s:go_packages(s:root_dirs(), a:arglead))) - elseif words[-1] =~# '^\(\h\w.*\.\%(\h\w*\)\=$\)\@!\S*$' - " start matching go packages. It's negate match of the below match - return s:uniq(sort(s:go_packages(s:root_dirs(), a:arglead))) - elseif words[-1] =~# '^\h\w.*\.\%(\h\w*\)\=$' - " match the following, anything that could indicate an interface candidate - " - " io. - " io.Wr - " github.com/fatih/color. - " github.com/fatih/color.U - " github.com/fatih/color.Un - let splitted = split(words[-1], '\.', 1) - let pkg = join(splitted[:-2], '.') - let interface = splitted[-1] - return s:uniq(sort(filter(s:interface_list(pkg), 'v:val =~? words[-1]'))) - else - return [] - 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/impl_test.vim b/sources_non_forked/vim-go/autoload/go/impl_test.vim deleted file mode 100644 index 0809836a..00000000 --- a/sources_non_forked/vim-go/autoload/go/impl_test.vim +++ /dev/null @@ -1,47 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_impl() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ '', - \ '']) - - call go#impl#Impl('r', 'reader', 'io.Reader') - call gotest#assert_buffer(1, [ - \ 'func (r reader) Read(p []byte) (n int, err error) {', - \ ' panic("not implemented")', - \ '}']) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_impl_get() abort - try - let l:tmp = gotest#write_file('a/a.go', [ - \ 'package a', - \ '', - \ 'type reader struct {}']) - - call go#impl#Impl('io.Reader') - call gotest#assert_buffer(0, [ - \ 'package a', - \ '', - \ 'type reader struct {}', - \ '', - \ 'func (r *reader) Read(p []byte) (n int, err error) {', - \ ' panic("not implemented")', - \ '}']) - 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/import.vim b/sources_non_forked/vim-go/autoload/go/import.vim deleted file mode 100644 index 4e848968..00000000 --- a/sources_non_forked/vim-go/autoload/go/import.vim +++ /dev/null @@ -1,232 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" Check out the docs for more information at /doc/vim-go.txt -" - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#import#SwitchImport(enabled, localname, path, bang) abort - let view = winsaveview() - let path = substitute(a:path, '^\s*\(.\{-}\)\s*$', '\1', '') - - " Quotes are not necessary, so remove them if provided. - if path[0] == '"' - let path = strpart(path, 1) - endif - if path[len(path)-1] == '"' - let path = strpart(path, 0, len(path) - 1) - endif - - " if given a trailing slash, eg. `github.com/user/pkg/`, remove it - if path[len(path)-1] == '/' - let path = strpart(path, 0, len(path) - 1) - endif - - if path == '' - call s:Error('Import path not provided') - return - endif - - if a:bang == "!" - let [l:out, l:err] = go#util#Exec(['go', 'get', '-u', '-v', path]) - if err != 0 - call s:Error("Can't find import: " . path . ":" . out) - endif - endif - let exists = go#tool#Exists(path) - if exists == -1 - call s:Error("Can't find import: " . path) - return - endif - - " Extract any site prefix (e.g. github.com/). - " If other imports with the same prefix are grouped separately, - " we will add this new import with them. - " Only up to and including the first slash is used. - let siteprefix = matchstr(path, "^[^/]*/") - - let qpath = '"' . path . '"' - if a:localname != '' - let qlocalpath = a:localname . ' ' . qpath - else - let qlocalpath = qpath - endif - let indentstr = 0 - let packageline = -1 " Position of package name statement - let appendline = -1 " Position to introduce new import - let deleteline = -1 " Position of line with existing import - let linesdelta = 0 " Lines added/removed - - " Find proper place to add/remove import. - let line = 0 - while line <= line('$') - let linestr = getline(line) - - if linestr =~# '^package\s' - let packageline = line - let appendline = line - - elseif linestr =~# '^import\s\+(\+)' - let appendline = line - let appendstr = qlocalpath - elseif linestr =~# '^import\s\+(' - let appendstr = qlocalpath - let indentstr = 1 - let appendline = line - let firstblank = -1 - let lastprefix = "" - while line <= line("$") - let line = line + 1 - let linestr = getline(line) - let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)') - if empty(m) - if siteprefix == "" && a:enabled - " must be in the first group - break - endif - " record this position, but keep looking - if firstblank < 0 - let firstblank = line - endif - continue - endif - if m[1] == ')' - " if there's no match, add it to the first group - if appendline < 0 && firstblank >= 0 - let appendline = firstblank - endif - break - endif - let lastprefix = matchstr(m[4], "^[^/]*/") - if a:localname != '' && m[3] != '' - let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath) - endif - let appendstr = m[2] . qlocalpath - let indentstr = 0 - if m[4] == path - let appendline = -1 - let deleteline = line - break - elseif m[4] < path - " don't set candidate position if we have a site prefix, - " we've passed a blank line, and this doesn't share the same - " site prefix. - if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0 - let appendline = line - endif - elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0 - " first entry of site group - let appendline = line - 1 - break - endif - endwhile - break - - elseif linestr =~# '^import ' - if appendline == packageline - let appendstr = 'import ' . qlocalpath - let appendline = line - 1 - endif - let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"') - if !empty(m) - if m[3] == path - let appendline = -1 - let deleteline = line - break - endif - if m[3] < path - let appendline = line - endif - if a:localname != '' && m[2] != '' - let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath) - endif - let appendstr = 'import' . m[1] . qlocalpath - endif - - elseif linestr =~# '^\(var\|const\|type\|func\)\>' - break - - endif - let line = line + 1 - endwhile - - " Append or remove the package import, as requested. - if a:enabled - if deleteline != -1 - call s:Error(qpath . ' already being imported') - elseif appendline == -1 - call s:Error('No package line found') - else - if appendline == packageline - call append(appendline + 0, '') - call append(appendline + 1, 'import (') - call append(appendline + 2, ')') - let appendline += 2 - let linesdelta += 3 - let appendstr = qlocalpath - let indentstr = 1 - call append(appendline, appendstr) - elseif getline(appendline) =~# '^import\s\+(\+)' - call setline(appendline, 'import (') - call append(appendline + 0, appendstr) - call append(appendline + 1, ')') - let linesdelta -= 1 - let indentstr = 1 - else - call append(appendline, appendstr) - endif - execute appendline + 1 - if indentstr - execute 'normal! >>' - endif - let linesdelta += 1 - endif - else - if deleteline == -1 - call s:Error(qpath . ' not being imported') - else - execute deleteline . 'd' - let linesdelta -= 1 - - if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)' - " Delete empty import block - let deleteline -= 1 - execute deleteline . "d" - execute deleteline . "d" - let linesdelta -= 2 - endif - - if getline(deleteline) == '' && getline(deleteline - 1) == '' - " Delete spacing for removed line too. - execute deleteline . "d" - let linesdelta -= 1 - endif - endif - endif - - " Adjust view for any changes. - let view.lnum += linesdelta - let view.topline += linesdelta - if view.topline < 0 - let view.topline = 0 - endif - - " Put buffer back where it was. - call winrestview(view) - -endfunction - - -function! s:Error(s) abort - echohl Error | echo a:s | echohl None -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/indent_test.vim b/sources_non_forked/vim-go/autoload/go/indent_test.vim deleted file mode 100644 index c969fde7..00000000 --- a/sources_non_forked/vim-go/autoload/go/indent_test.vim +++ /dev/null @@ -1,72 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_indent_raw_string() abort - " The goRawString discovery requires that syntax be enabled. - syntax on - - try - let l:dir= gotest#write_file('indent/indent.go', [ - \ 'package main', - \ '', - \ 'import "fmt"', - \ '', - \ 'func main() {', - \ "\t\x1fconst msg = `", - \ '`', - \ '\tfmt.Println(msg)', - \ '}']) - - silent execute "normal o" . "not indented\" - let l:indent = indent(line('.')) - call assert_equal(0, l:indent) - finally - call delete(l:dir, 'rf') - endtry - - try - let l:dir= gotest#write_file('indent/indent.go', [ - \ 'package main', - \ '', - \ 'import "fmt"', - \ '', - \ 'func main() {', - \ "\t\x1fmsg := `", - \ '`', - \ '\tfmt.Println(msg)', - \ '}']) - - silent execute "normal o" . "not indented\" - let l:indent = indent(line('.')) - call assert_equal(0, l:indent) - finally - call delete(l:dir, 'rf') - endtry - - try - let l:dir= gotest#write_file('indent/indent.go', [ - \ 'package main', - \ '', - \ 'import "fmt"', - \ '', - \ 'func main() {', - \ "\tconst msg = `", - \ "\t\x1findented", - \ '`', - \ '\tfmt.Println(msg)', - \ '}']) - - silent execute "normal o" . "indented\" - let l:indent = indent(line('.')) - call assert_equal(shiftwidth(), l:indent) - finally - call delete(l:dir, 'rf') - endtry -endfunc - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/issue.vim b/sources_non_forked/vim-go/autoload/go/issue.vim deleted file mode 100644 index c76df7f4..00000000 --- a/sources_non_forked/vim-go/autoload/go/issue.vim +++ /dev/null @@ -1,52 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:templatepath = go#util#Join(expand(':p:h:h:h'), '.github', 'ISSUE_TEMPLATE.md') - -function! go#issue#New() abort - let body = go#uri#Encode(s:issuebody()) - let url = "https://github.com/fatih/vim-go/issues/new?body=" . l:body - call go#util#OpenBrowser(l:url) -endfunction - -function! s:issuebody() abort - let lines = readfile(s:templatepath) - - let rtrimpat = '[[:space:]]\+$' - let body = [] - for l in lines - let body = add(body, l) - - if l =~ '^' - let [out, err] = go#util#Exec(['go', 'version']) - let body = add(body, substitute(l:out, rtrimpat, '', '')) - elseif l =~ '^' - let [out, err] = go#util#Exec(['go', 'env']) - let body = add(body, substitute(l:out, rtrimpat, '', '')) - endif - endfor - - let body = add(body, "#### vim-go configuration:\n
vim-go configuration
")
-
-  for k in keys(g:)
-    if k =~ '^go_'
-      let body = add(body, 'g:' . k . ' = ' . string(get(g:, k)))
-    endif
-  endfor
-
-  let body = add(body, '
') - - return join(body, "\n") -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/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim deleted file mode 100644 index 93638dab..00000000 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ /dev/null @@ -1,528 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Spawn starts an asynchronous job. See the description of go#job#Options to -" understand the args parameter. -" -" Spawn returns a job. -function! go#job#Spawn(cmd, args) - let l:options = go#job#Options(a:args) - return go#job#Start(a:cmd, l:options) -endfunction - -" Options returns callbacks to be used with job_start. It is abstracted to be -" used with various go commands, such as build, test, install, etc.. This -" allows us to avoid writing the same callback over and over for some -" commands. It's fully customizable so each command can change it to its own -" logic. -" -" args is a dictionary with the these keys: -" 'bang': -" Set to 0 to jump to the first error in the error list. -" Defaults to 0. -" 'statustype': -" The status type to use when updating the status. -" See statusline.vim. -" 'for': -" The g:go_list_type_command key to use to get the error list type to use. -" Errors will not be handled when the value is '_'. -" Defaults to '_job' -" 'errorformat': -" The errorformat string to use when parsing errors. Defaults to -" &errorformat. -" See :help 'errorformat'. -" 'complete': -" A function to call after the job exits and the channel is closed. The -" function will be passed three arguments: the job, its exit code, and the -" list of messages received from the channel. The default is a no-op. A -" custom value can modify the messages before they are processed by the -" returned exit_cb and close_cb callbacks. When the function is called, -" the current window will be the window that was hosting the buffer when -" the job was started. After it returns, the current window will be -" restored to what it was before the function was called. - -" The return value is a dictionary with these keys: -" 'callback': -" A function suitable to be passed as a job callback handler. See -" job-callback. -" 'exit_cb': -" A function suitable to be passed as a job exit_cb handler. See -" job-exit_cb. -" 'close_cb': -" A function suitable to be passed as a job close_cb handler. See -" job-close_cb. -" 'cwd': -" The path to the directory which contains the current buffer. The -" callbacks are configured to expect this directory is the working -" directory for the job; it should not be modified by callers. -function! go#job#Options(args) - let cbs = {} - let state = { - \ 'winid': win_getid(winnr()), - \ 'dir': getcwd(), - \ 'jobdir': expand("%:p:h"), - \ 'messages': [], - \ 'bang': 0, - \ 'for': "_job", - \ 'exited': 0, - \ 'exit_status': 0, - \ 'closed': 0, - \ 'errorformat': &errorformat, - \ 'statustype' : '' - \ } - - let cbs.cwd = state.jobdir - - if has_key(a:args, 'bang') - let state.bang = a:args.bang - endif - - if has_key(a:args, 'for') - let state.for = a:args.for - endif - - if has_key(a:args, 'statustype') - let state.statustype = a:args.statustype - endif - - if has_key(a:args, 'errorformat') - let state.errorformat = a:args.errorformat - endif - - function state.complete(job, exit_status, data) - if has_key(self, 'custom_complete') - let l:winid = win_getid(winnr()) - " Always set the active window to the window that was active when the job - " was started. Among other things, this makes sure that the correct - " window's location list will be populated when the list type is - " 'location' and the user has moved windows since starting the job. - call win_gotoid(self.winid) - call self.custom_complete(a:job, a:exit_status, a:data) - call win_gotoid(l:winid) - endif - - call self.show_errors(a:job, a:exit_status, a:data) - endfunction - - function state.show_status(job, exit_status) dict - if self.statustype == '' - return - endif - - if go#config#EchoCommandInfo() - let prefix = '[' . self.statustype . '] ' - if a:exit_status == 0 - call go#util#EchoSuccess(prefix . "SUCCESS") - else - call go#util#EchoError(prefix . "FAIL") - endif - endif - - let status = { - \ 'desc': 'last status', - \ 'type': self.statustype, - \ 'state': "success", - \ } - - if a:exit_status - let status.state = "failed" - endif - - if has_key(self, 'started_at') - let elapsed_time = reltimestr(reltime(self.started_at)) - " strip whitespace - let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') - let status.state .= printf(" (%ss)", elapsed_time) - endif - - call go#statusline#Update(self.jobdir, status) - endfunction - - if has_key(a:args, 'complete') - let state.custom_complete = a:args.complete - endif - - " explicitly bind _start to state so that within it, self will - " always refer to state. See :help Partial for more information. - " - " _start is intended only for internal use and should not be referenced - " outside of this file. - let cbs._start = function('s:start', [''], state) - - " explicitly bind callback to state so that within it, self will - " always refer to state. See :help Partial for more information. - let cbs.callback = function('s:callback', [], state) - - " explicitly bind exit_cb to state so that within it, self will always refer - " to state. See :help Partial for more information. - let cbs.exit_cb = function('s:exit_cb', [], state) - - " explicitly bind close_cb to state so that within it, self will - " always refer to state. See :help Partial for more information. - let cbs.close_cb = function('s:close_cb', [], state) - - function state.show_errors(job, exit_status, data) - if self.for == '_' - return - endif - - let l:winid = win_getid(winnr()) - " Always set the active window to the window that was active when the job - " was started. Among other things, this makes sure that the correct - " window's location list will be populated when the list type is - " 'location' and the user has moved windows since starting the job. - call win_gotoid(self.winid) - - let l:listtype = go#list#Type(self.for) - if a:exit_status == 0 - call go#list#Clean(l:listtype) - call win_gotoid(l:winid) - return - endif - - let l:listtype = go#list#Type(self.for) - if len(a:data) == 0 - call go#list#Clean(l:listtype) - call win_gotoid(l:winid) - return - endif - - let out = join(self.messages, "\n") - - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - try - " parse the errors relative to self.jobdir - execute l:cd fnameescape(self.jobdir) - call go#list#ParseFormat(l:listtype, self.errorformat, out, self.for) - let errors = go#list#Get(l:listtype) - finally - execute l:cd fnameescape(self.dir) - endtry - - - if empty(errors) - " failed to parse errors, output the original content - call go#util#EchoError([self.dir] + self.messages) - call win_gotoid(l:winid) - return - endif - - " only open the error window if user was still in the window from which - " the job was started. - if self.winid == l:winid - call go#list#Window(l:listtype, len(errors)) - if self.bang - call win_gotoid(l:winid) - else - call go#list#JumpToFirst(l:listtype) - endif - endif - endfunction - - return cbs -endfunction - -function! s:start(args) dict - if go#config#EchoCommandInfo() && self.statustype != "" - let prefix = '[' . self.statustype . '] ' - call go#util#EchoSuccess(prefix . "dispatched") - endif - - if self.statustype != '' - let status = { - \ 'desc': 'current status', - \ 'type': self.statustype, - \ 'state': "started", - \ } - - call go#statusline#Update(self.jobdir, status) - endif - let self.started_at = reltime() -endfunction - -function! s:callback(chan, msg) dict - call add(self.messages, a:msg) -endfunction - -function! s:exit_cb(job, exitval) dict - let self.exit_status = a:exitval - let self.exited = 1 - - call self.show_status(a:job, a:exitval) - - if self.closed || has('nvim') - call self.complete(a:job, self.exit_status, self.messages) - endif -endfunction - -function! s:close_cb(ch) dict - let self.closed = 1 - - if self.exited - let job = ch_getjob(a:ch) - call self.complete(job, self.exit_status, self.messages) - endif -endfunction - -" go#job#Start runs a job. The options are expected to be the options -" suitable for Vim8 jobs. When called from Neovim, Vim8 options will be -" transformed to their Neovim equivalents. -function! go#job#Start(cmd, options) - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - let l:options = copy(a:options) - - if has('nvim') - let l:options = s:neooptions(l:options) - endif - - " Verify that the working directory for the job actually exists. Return - " early if the directory does not exist. This helps avoid errors when - " working with plugins that use virtual files that don't actually exist on - " the file system. - let l:filedir = expand("%:p:h") - if has_key(l:options, 'cwd') && !isdirectory(l:options.cwd) - return - elseif !isdirectory(l:filedir) - return - endif - - let l:manualcd = 0 - if !has_key(l:options, 'cwd') - " pre start - let l:manualcd = 1 - let dir = getcwd() - execute l:cd fnameescape(filedir) - endif - - if has_key(l:options, '_start') - call l:options._start() - " remove _start to play nicely with vim (when vim encounters an unexpected - " job option it reports an "E475: invalid argument" error). - unlet l:options._start - endif - - " noblock was added in 8.1.350; remove it if it's not supported. - if has_key(l:options, 'noblock') && (has('nvim') || !has("patch-8.1.350")) - call remove(l:options, 'noblock') - endif - - if go#util#HasDebug('shell-commands') - call go#util#EchoInfo('job command: ' . string(a:cmd)) - endif - - if has('nvim') - let l:input = [] - if has_key(a:options, 'in_io') && a:options.in_io ==# 'file' && !empty(a:options.in_name) - let l:input = readfile(a:options.in_name, "b") - endif - - let job = jobstart(a:cmd, l:options) - - if len(l:input) > 0 - call chansend(job, l:input) - " close stdin to signal that no more bytes will be sent. - call chanclose(job, 'stdin') - endif - else - let l:cmd = a:cmd - if go#util#IsWin() - let l:cmd = join(map(copy(a:cmd), function('s:winjobarg')), " ") - endif - - let job = job_start(l:cmd, l:options) - endif - - if l:manualcd - " post start - execute l:cd fnameescape(l:dir) - endif - - return job -endfunction - -" s:neooptions returns a dictionary of job options suitable for use by Neovim -" based on a dictionary of job options suitable for Vim8. -function! s:neooptions(options) - let l:options = {} - let l:options['stdout_buf'] = '' - let l:options['stderr_buf'] = '' - - let l:err_mode = get(a:options, 'err_mode', get(a:options, 'mode', '')) - let l:out_mode = get(a:options, 'out_mode', get(a:options, 'mode', '')) - - for key in keys(a:options) - if key == 'cwd' - let l:options['cwd'] = a:options['cwd'] - continue - endif - - if key == 'callback' - let l:options['callback'] = a:options['callback'] - - if !has_key(a:options, 'out_cb') - let l:options['on_stdout'] = function('s:callback2on_stdout', [l:out_mode], l:options) - endif - - if !has_key(a:options, 'err_cb') - let l:options['on_stderr'] = function('s:callback2on_stderr', [l:err_mode], l:options) - endif - - continue - endif - - if key == 'out_cb' - let l:options['out_cb'] = a:options['out_cb'] - let l:options['on_stdout'] = function('s:on_stdout', [l:out_mode], l:options) - - continue - endif - - if key == 'err_cb' - let l:options['err_cb'] = a:options['err_cb'] - let l:options['on_stderr'] = function('s:on_stderr', [l:err_mode], l:options) - - continue - endif - - if key == 'exit_cb' - let l:options['exit_cb'] = a:options['exit_cb'] - let l:options['on_exit'] = function('s:on_exit', [], l:options) - - continue - endif - - if key == 'close_cb' - continue - endif - - if key == 'stoponexit' - if a:options['stoponexit'] == '' - let l:options['detach'] = 1 - endif - continue - endif - endfor - return l:options -endfunction - -function! s:callback2on_stdout(mode, ch, data, event) dict - let self.stdout_buf = s:neocb(a:mode, a:ch, self.stdout_buf, a:data, self.callback) -endfunction - -function! s:callback2on_stderr(mode, ch, data, event) dict - let self.stderr_buf = s:neocb(a:mode, a:ch, self.stderr_buf, a:data, self.callback) -endfunction - -function! s:on_stdout(mode, ch, data, event) dict - let self.stdout_buf = s:neocb(a:mode, a:ch, self.stdout_buf, a:data, self.out_cb) -endfunction - -function! s:on_stderr(mode, ch, data, event) dict - let self.stderr_buf = s:neocb(a:mode, a:ch, self.stderr_buf, a:data, self.err_cb ) -endfunction - -function! s:on_exit(jobid, exitval, event) dict - call self.exit_cb(a:jobid, a:exitval) -endfunction - -function! go#job#Stop(job) abort - if has('nvim') - call jobstop(a:job) - return - endif - - call job_stop(a:job) - call go#job#Wait(a:job) - return -endfunction - -function! go#job#Wait(job) abort - if has('nvim') - call jobwait([a:job]) - return - endif - - while job_status(a:job) is# 'run' - sleep 50m - endwhile -endfunction - -function! s:winjobarg(idx, val) abort - if empty(a:val) - return '""' - endif - return a:val -endfunction - -function! s:neocb(mode, ch, buf, data, callback) - " 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:buf = '' - - " A single empty string means EOF was reached. The first item will never be - " an empty string except for when it's the only item and is signaling that - " EOF was reached. - if len(a:data) == 1 && a:data[0] == '' - " when there's nothing buffered, return early so that an - " erroneous message will not be added. - if a:buf == '' - return '' - endif - - let l:data = [a:buf] - else - let l:data = copy(a:data) - let l:data[0] = a:buf . l:data[0] - - " The last element may be a partial line; save it for next time. - if a:mode != 'raw' - let l:buf = l:data[-1] - let l:data = l:data[:-2] - endif - endif - - let l:i = 0 - let l:last = len(l:data) - 1 - while l:i <= l:last - let l:msg = l:data[l:i] - if a:mode == 'raw' && l:i < l:last - let l:msg = l:msg . "\n" - endif - call a:callback(a:ch, l:msg) - - let l:i += 1 - endwhile - - return l:buf -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/job_test.vim b/sources_non_forked/vim-go/autoload/go/job_test.vim deleted file mode 100644 index 42f90ade..00000000 --- a/sources_non_forked/vim-go/autoload/go/job_test.vim +++ /dev/null @@ -1,53 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_JobDirWithSpaces() - if !go#util#has_job() - return - endif - - try - let l:filename = 'job/dir has spaces/main.go' - let l:tmp = gotest#load_fixture(l:filename) - exe 'cd ' . fnameescape(l:tmp . '/src/job/dir has spaces') - - " 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') - - " go build discards any results when it compiles multiple packages. So we - " pass the `errors` package just as a placeholder with the current folder - " (indicated with '.'). - let l:cmd = ['go', 'build', '.', 'errors'] - - let l:complete = go#promise#New(function('s:complete'), 10000, '') - call go#job#Spawn(l:cmd, { - \ 'for': 'GoBuild', - \ 'complete': l:complete.wrapper, - \ 'statustype': 'build' - \}) - - let l:out = l:complete.await() - - let actual = getqflist() - - call gotest#assert_quickfix(actual, l:expected) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! s:complete(job, exit_code, messages) - return a:messages -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/keyify.vim b/sources_non_forked/vim-go/autoload/go/keyify.vim deleted file mode 100644 index 41a543f3..00000000 --- a/sources_non_forked/vim-go/autoload/go/keyify.vim +++ /dev/null @@ -1,64 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#keyify#Keyify() - " Needs: https://github.com/dominikh/go-tools/pull/272 - "\ '-tags', go#config#BuildTags(), - let l:cmd = ['keyify', - \ '-json', - \ printf('%s:#%s', fnamemodify(expand('%'), ':p:gs?\\?/?'), go#util#OffsetCursor())] - - let [l:out, l:err] = go#util#Exec(l:cmd) - if l:err - call go#util#EchoError("non-zero exit code: " . l:out) - return - endif - silent! let result = json_decode(l:out) - - " We want to output the error message in case the result isn't a JSON - if type(result) != type({}) - call go#util#EchoError(s:chomp(l:out)) - return - endif - - " Because keyify returns the byte before the region we want, we goto the - " byte after that - execute "goto" result.start + 1 - let start = getpos('.') - execute "goto" result.end - let end = getpos('.') - - let vis_start = getpos("'<") - let vis_end = getpos("'>") - - " Replace contents between start and end with `replacement` - call setpos("'<", start) - call setpos("'>", end) - - let select = 'gv' - - " Make sure the visual mode is 'v', to avoid some bugs - normal! gv - if mode() !=# 'v' - let select .= 'v' - endif - - silent! execute "normal!" select."\"=result.replacement\p" - - " Replacement text isn't aligned, so it needs fix - normal! '= - - call setpos("'<", vis_start) - call setpos("'>", vis_end) -endfunction - -function! s:chomp(string) - return substitute(a:string, '\n\+$', '', '') -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim deleted file mode 100644 index 56726bc2..00000000 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ /dev/null @@ -1,279 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#lint#Gometa(bang, autosave, ...) abort - if a:0 == 0 - let goargs = [expand('%:p:h')] - else - let goargs = a:000 - endif - - let l:metalinter = go#config#MetalinterCommand() - - if l:metalinter == 'golangci-lint' - let cmd = s:metalintercmd(l:metalinter) - if empty(cmd) - return - endif - - " linters - let linters = a:autosave ? go#config#MetalinterAutosaveEnabled() : go#config#MetalinterEnabled() - for linter in linters - let cmd += ["--enable=".linter] - endfor - else - " the user wants something else, let us use it. - let cmd = split(go#config#MetalinterCommand(), " ") - endif - - if a:autosave - " redraw so that any messages that were displayed while writing the file - " will be cleared - redraw - - if l:metalinter == "golangci-lint" - let goargs[0] = expand('%:p:h') - endif - endif - - " Call metalinter asynchronously. - let deadline = go#config#MetalinterDeadline() - if deadline != '' - let cmd += ["--deadline=" . deadline] - endif - - let cmd += goargs - - " Golangci-lint can output the following: - " ::: () - " This can be defined by the following errorformat: - let errformat = "%f:%l:%c:\ %m" - - if go#util#has_job() - call s:lint_job({'cmd': cmd, 'statustype': l:metalinter, 'errformat': errformat}, a:bang, a:autosave) - return - endif - - let [l:out, l:err] = go#util#Exec(cmd) - - if a:autosave - let l:listtype = go#list#Type("GoMetaLinterAutoSave") - else - let l:listtype = go#list#Type("GoMetaLinter") - endif - - if l:err == 0 - call go#list#Clean(l:listtype) - call go#util#EchoSuccess('[metalinter] PASS') - else - let l:winid = win_getid(winnr()) - " Parse and populate our location list - - let l:messages = split(out, "\n") - - if a:autosave - call s:metalinterautosavecomplete(fnamemodify(expand('%:p'), ":."), 0, 1, l:messages) - endif - call go#list#ParseFormat(l:listtype, errformat, l:messages, 'GoMetaLinter') - - let errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(errors)) - - if a:autosave || a:bang - call win_gotoid(l:winid) - return - endif - call go#list#JumpToFirst(l:listtype) - endif -endfunction - -" Golint calls 'golint' on the current directory. Any warnings are populated in -" the location list -function! go#lint#Golint(bang, ...) abort - if a:0 == 0 - let [l:out, l:err] = go#util#Exec([go#config#GolintBin(), expand('%:p:h')]) - else - let [l:out, l:err] = go#util#Exec([go#config#GolintBin()] + a:000) - endif - - if empty(l:out) - call go#util#EchoSuccess('[lint] PASS') - return - endif - - let l:winid = win_getid(winnr()) - let l:listtype = go#list#Type("GoLint") - call go#list#Parse(l:listtype, l:out, "GoLint") - let l:errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(l:errors)) - - if a:bang - call win_gotoid(l:winid) - return - endif - - call go#list#JumpToFirst(l:listtype) -endfunction - -" Vet calls 'go vet' on the current directory. Any warnings are populated in -" the location list -function! go#lint#Vet(bang, ...) abort - call go#cmd#autowrite() - - if go#config#EchoCommandInfo() - call go#util#EchoProgress('calling vet...') - endif - - if a:0 == 0 - let [l:out, l:err] = go#util#Exec(['go', 'vet', go#package#ImportPath()]) - else - let [l:out, l:err] = go#util#Exec(['go', 'vet'] + a:000 + [go#package#ImportPath()]) - endif - - let l:listtype = go#list#Type("GoVet") - if l:err != 0 - let l:winid = win_getid(winnr()) - let l:errorformat = "%-Gexit status %\\d%\\+," . &errorformat - call go#list#ParseFormat(l:listtype, l:errorformat, out, "GoVet") - let l:errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(l:errors)) - if !empty(l:errors) && !a:bang - call go#list#JumpToFirst(l:listtype) - else - call win_gotoid(l:winid) - endif - else - call go#list#Clean(l:listtype) - call go#util#EchoSuccess('[vet] PASS') - endif -endfunction - -" ErrCheck calls 'errcheck' for the given packages. Any warnings are populated in -" the location list -function! go#lint#Errcheck(bang, ...) abort - if a:0 == 0 - let l:import_path = go#package#ImportPath() - if import_path == -1 - call go#util#EchoError('package is not inside GOPATH src') - return - endif - else - let l:import_path = join(a:000, ' ') - endif - - call go#util#EchoProgress('[errcheck] analysing ...') - redraw - - let [l:out, l:err] = go#util#Exec([go#config#ErrcheckBin(), '-abspath', l:import_path]) - - let l:listtype = go#list#Type("GoErrCheck") - if l:err != 0 - let l:winid = win_getid(winnr()) - let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" - - " Parse and populate our location list - call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"), 'Errcheck') - - let l:errors = go#list#Get(l:listtype) - if empty(l:errors) - call go#util#EchoError(l:out) - return - endif - - if !empty(errors) - call go#list#Populate(l:listtype, errors, 'Errcheck') - call go#list#Window(l:listtype, len(errors)) - if !a:bang - call go#list#JumpToFirst(l:listtype) - else - call win_gotoid(l:winid) - endif - endif - else - call go#list#Clean(l:listtype) - call go#util#EchoSuccess('[errcheck] PASS') - endif -endfunction - -function! go#lint#ToggleMetaLinterAutoSave() abort - if go#config#MetalinterAutosave() - call go#config#SetMetalinterAutosave(0) - call go#util#EchoProgress("auto metalinter disabled") - return - end - - call go#config#SetMetalinterAutosave(1) - call go#util#EchoProgress("auto metalinter enabled") -endfunction - -function! s:lint_job(args, bang, autosave) - let l:opts = { - \ 'statustype': a:args.statustype, - \ 'errorformat': a:args.errformat, - \ 'for': "GoMetaLinter", - \ 'bang': a:bang, - \ } - - if a:autosave - let l:opts.for = "GoMetaLinterAutoSave" - " s:metalinterautosavecomplete is really only needed for golangci-lint - let l:opts.complete = funcref('s:metalinterautosavecomplete', [expand('%:p:t')]) - endif - - " autowrite is not enabled for jobs - call go#cmd#autowrite() - - call go#job#Spawn(a:args.cmd, l:opts) -endfunction - -function! s:metalintercmd(metalinter) - let l:cmd = [] - let bin_path = go#path#CheckBinPath(a:metalinter) - if !empty(bin_path) - if a:metalinter == "golangci-lint" - let l:cmd = s:golangcilintcmd(bin_path) - endif - endif - - return cmd -endfunction - -function! s:golangcilintcmd(bin_path) - let cmd = [a:bin_path] - let cmd += ["run"] - let cmd += ["--print-issued-lines=false"] - let cmd += ['--build-tags', go#config#BuildTags()] - let cmd += ["--disable-all"] - " do not use the default exclude patterns, because doing so causes golint - " problems about missing doc strings to be ignored and other things that - " golint identifies. - let cmd += ["--exclude-use-default=false"] - - return cmd -endfunction - -function! s:metalinterautosavecomplete(filepath, job, exit_code, messages) - if len(a:messages) == 0 - return - endif - - let l:idx = len(a:messages) - 1 - while l:idx >= 0 - " Go 1.13 changed how go vet output is formatted by prepending a leading - " 'vet :', so account for that, too. This function is really needed for - " gometalinter at all, so the check for Go 1.13's go vet output shouldn't - " be neeeded, but s:lint_job hooks this up even when the - " g:go_metalinter_command is golangci-lint. - if a:messages[l:idx] !~# '^' . a:filepath . ':' && a:messages[l:idx] !~# '^vet: \.[\\/]' . a:filepath . ':' - call remove(a:messages, l:idx) - endif - let l:idx -= 1 - endwhile -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/lint_test.vim b/sources_non_forked/vim-go/autoload/go/lint_test.vim deleted file mode 100644 index 38f66f2e..00000000 --- a/sources_non_forked/vim-go/autoload/go/lint_test.vim +++ /dev/null @@ -1,206 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_GometaGolangciLint() abort - call s:gometa('golangci-lint') -endfunc - -func! s:gometa(metalinter) abort - let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint') - silent exe 'e ' . $GOPATH . '/src/lint/lint.go' - - try - let g:go_metalinter_command = a:metalinter - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%')+1, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'pattern': '', 'text': 'exported function MissingFooDoc should have comment or be unexported (golint)'} - \ ] - if a:metalinter == 'golangci-lint' - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%')+2, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function `MissingFooDoc` should have comment or be unexported (golint)'} - \ ] - endif - - " clear the quickfix lists - call setqflist([], 'r') - - let g:go_metalinter_enabled = ['golint'] - - call go#lint#Gometa(0, 0, $GOPATH . '/src/foo') - - 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, expected) - finally - call call(RestoreGOPATH, []) - unlet g:go_metalinter_enabled - endtry -endfunc - -func! Test_GometaAutoSaveGolangciLint() abort - call s:gometaautosave('golangci-lint') -endfunc - -func! s:gometaautosave(metalinter) abort - let RestoreGOPATH = go#util#SetEnv('GOPATH', fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/lint') - silent exe 'e ' . $GOPATH . '/src/lint/lint.go' - - try - let g:go_metalinter_command = a:metalinter - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported (golint)'} - \ ] - if a:metalinter == 'golangci-lint' - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function `MissingDoc` should have comment or be unexported (golint)'} - \ ] - endif - - let winnr = winnr() - - " clear the location lists - call setloclist(l:winnr, [], 'r') - - let g:go_metalinter_autosave_enabled = ['golint'] - - call go#lint#Gometa(0, 1) - - let actual = getloclist(l:winnr) - let start = reltime() - while len(actual) == 0 && reltimefloat(reltime(start)) < 10 - sleep 100m - let actual = getloclist(l:winnr) - endwhile - - call gotest#assert_quickfix(actual, expected) - finally - call call(RestoreGOPATH, []) - unlet g:go_metalinter_autosave_enabled - endtry -endfunc - -func! Test_Vet() abort - let l:tmp = gotest#load_fixture('lint/src/vet/vet.go') - - try - - let expected = [ - \ {'lnum': 7, 'bufnr': bufnr('%'), 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', - \ 'text': 'Printf format %d has arg str of wrong type string'} - \ ] - - let winnr = winnr() - - " clear the location lists - call setqflist([], 'r') - - call go#lint#Vet(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, expected) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_Vet_compilererror() abort - let l:tmp = gotest#load_fixture('lint/src/vet/compilererror/compilererror.go') - - try - - let expected = [ - \ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': "missing ',' before newline in argument list (and 1 more errors)"} - \ ] - - let winnr = winnr() - - " clear the location lists - call setqflist([], 'r') - - call go#lint#Vet(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, expected) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_Lint_GOPATH() abort - let RestoreGOPATH = go#util#SetEnv('GOPATH', fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/lint') - - silent exe 'e ' . $GOPATH . '/src/lint/lint.go' - compiler go - - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'}, - \ {'lnum': 5, 'bufnr': 6, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'} - \ ] - - let winnr = winnr() - - " clear the location lists - call setqflist([], 'r') - - call go#lint#Golint(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, expected) - - call call(RestoreGOPATH, []) -endfunc - -func! Test_Lint_NullModule() abort - silent exe 'e ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/lint/src/lint/lint.go' - compiler go - - let expected = [ - \ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'}, - \ {'lnum': 5, 'bufnr': 6, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'} - \ ] - - let winnr = winnr() - - " clear the location lists - call setqflist([], 'r') - - call go#lint#Golint(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, expected) -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/list.vim b/sources_non_forked/vim-go/autoload/go/list.vim deleted file mode 100644 index 90314ced..00000000 --- a/sources_non_forked/vim-go/autoload/go/list.vim +++ /dev/null @@ -1,173 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Window opens the list with the given height up to 10 lines maximum. -" Otherwise g:go_loclist_height is used. -" -" If no or zero height is given it closes the window by default. -" To prevent this, set g:go_list_autoclose = 0 -function! go#list#Window(listtype, ...) abort - " we don't use lwindow to close the location list as we need also the - " ability to resize the window. So, we are going to use lopen and lclose - " for a better user experience. If the number of errors in a current - " location list increases/decreases, cwindow will not resize when a new - " updated height is passed. lopen in the other hand resizes the screen. - if !a:0 || a:1 == 0 - call go#list#Close(a:listtype) - return - endif - - let height = go#config#ListHeight() - if height == 0 - " prevent creating a large location height for a large set of numbers - if a:1 > 10 - let height = 10 - else - let height = a:1 - endif - endif - - if a:listtype == "locationlist" - exe 'lopen ' . height - else - exe 'copen ' . height - endif -endfunction - - -" Get returns the current items from the list -function! go#list#Get(listtype) abort - if a:listtype == "locationlist" - return getloclist(0) - else - return getqflist() - endif -endfunction - -" Populate populate the list with the given items -function! go#list#Populate(listtype, items, title) abort - if a:listtype == "locationlist" - call setloclist(0, a:items, 'r') - call setloclist(0, [], 'a', {'title': a:title}) - else - call setqflist(a:items, 'r') - call setqflist([], 'a', {'title': a:title}) - endif -endfunction - -" Parse parses the given items based on the specified errorformat and -" populates the list. -function! go#list#ParseFormat(listtype, errformat, items, title) abort - " backup users errorformat, will be restored once we are finished - let old_errorformat = &errorformat - - " parse and populate the location list - let &errorformat = a:errformat - try - call go#list#Parse(a:listtype, a:items, a:title) - finally - "restore back - let &errorformat = old_errorformat - endtry -endfunction - -" Parse parses the given items based on the global errorformat and -" populates the list. -function! go#list#Parse(listtype, items, title) abort - if a:listtype == "locationlist" - lgetexpr a:items - call setloclist(0, [], 'a', {'title': a:title}) - else - cgetexpr a:items - call setqflist([], 'a', {'title': a:title}) - endif -endfunction - -" JumpToFirst jumps to the first item in the location list -function! go#list#JumpToFirst(listtype) abort - if a:listtype == "locationlist" - ll 1 - else - cc 1 - endif -endfunction - -" Clean cleans and closes the location list -function! go#list#Clean(listtype) abort - if a:listtype == "locationlist" - lex [] - else - cex [] - endif - - call go#list#Close(a:listtype) -endfunction - -" Close closes the location list -function! go#list#Close(listtype) abort - let autoclose_window = go#config#ListAutoclose() - if !autoclose_window - return - endif - - if a:listtype == "locationlist" - lclose - else - cclose - endif -endfunction - -function! s:listtype(listtype) abort - let listtype = go#config#ListType() - if empty(listtype) - return a:listtype - endif - - return listtype -endfunction - -" s:default_list_type_commands is the defaults that will be used for each of -" the supported commands (see documentation for g:go_list_type_commands). When -" defining a default, quickfix should be used if the command operates on -" multiple files, while locationlist should be used if the command operates on a -" single file or buffer. Keys that begin with an underscore are not supported -" in g:go_list_type_commands. -let s:default_list_type_commands = { - \ "GoBuild": "quickfix", - \ "GoDebug": "quickfix", - \ "GoErrCheck": "quickfix", - \ "GoFmt": "locationlist", - \ "GoGenerate": "quickfix", - \ "GoInstall": "quickfix", - \ "GoLint": "quickfix", - \ "GoMetaLinter": "quickfix", - \ "GoMetaLinterAutoSave": "locationlist", - \ "GoModFmt": "locationlist", - \ "GoModifyTags": "locationlist", - \ "GoRename": "quickfix", - \ "GoRun": "quickfix", - \ "GoTest": "quickfix", - \ "GoVet": "quickfix", - \ "_guru": "locationlist", - \ "_term": "locationlist", - \ "_job": "locationlist", - \ } - -function! go#list#Type(for) abort - let l:listtype = s:listtype(get(s:default_list_type_commands, a:for)) - if l:listtype == "0" - call go#util#EchoError(printf( - \ "unknown list type command value found ('%s'). Please open a bug report in the vim-go repo.", - \ a:for)) - let l:listtype = "quickfix" - endif - - return get(go#config#ListTypeCommands(), a:for, l:listtype) -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/lsp.vim b/sources_non_forked/vim-go/autoload/go/lsp.vim deleted file mode 100644 index 36e3983d..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp.vim +++ /dev/null @@ -1,1062 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -scriptencoding utf-8 - -let s:lspfactory = {} - -function! s:lspfactory.get() dict abort - if empty(get(self, 'current', {})) || empty(get(self.current, 'job', {})) - let self.current = s:newlsp() - endif - - return self.current -endfunction - -function! s:lspfactory.reset() dict abort - if has_key(self, 'current') - call remove(self, 'current') - endif -endfunction - -function! s:newlsp() abort - if !go#util#has_job() - let l:oldshortmess=&shortmess - if has('nvim') - set shortmess-=F - endif - call go#util#EchoWarning('Features that rely on gopls will not work without either Vim 8.0.0087 or newer with +job or Neovim') - " Sleep one second to make sure people see the message. Otherwise it is - " often immediately overwritten by an async message. - sleep 1 - let &shortmess=l:oldshortmess - return {'sendMessage': funcref('s:noop')} - endif - - " job is the job used to talk to the backing instance of gopls. - " ready is 0 until the initialize response has been received. 1 afterwards. - " queue is messages to send after initialization - " last_request_id is id of the most recently sent request. - " buf is unprocessed/incomplete responses - " handlers is a mapping of request ids to dictionaries of functions. - " request id -> {start, requestComplete, handleResult, error} - " * start is a function that takes no arguments - " * requestComplete is a function that takes 1 argument. The parameter will be 1 - " if the call was succesful. - " * handleResult takes a single argument, the result message received from gopls - " * error takes a single argument, the error message received from gopls. - " The error method is optional. - let l:lsp = { - \ 'job': '', - \ 'ready': 0, - \ 'queue': [], - \ 'last_request_id': 0, - \ 'buf': '', - \ 'handlers': {}, - \ 'workspaceDirectories': [], - \ 'wd' : '', - \ } - - function! l:lsp.readMessage(data) dict abort - let l:responses = [] - let l:rest = a:data - - while 1 - " Look for the end of the HTTP headers - let l:body_start_idx = matchend(l:rest, "\r\n\r\n") - - if l:body_start_idx < 0 - " incomplete header - break - endif - - " Parse the Content-Length header. - let l:header = l:rest[:l:body_start_idx - 4] - let l:length_match = matchlist( - \ l:header, - \ '\vContent-Length: *(\d+)' - \) - - if empty(l:length_match) - " TODO(bc): shutdown gopls? - throw "invalid JSON-RPC header:\n" . l:header - endif - - " get the start of the rest - let l:next_start_idx = l:body_start_idx + str2nr(l:length_match[1]) - - if len(l:rest) < l:next_start_idx - " incomplete response body - break - endif - - call s:debug('received', l:rest[:l:next_start_idx - 1]) - - let l:body = l:rest[l:body_start_idx : l:next_start_idx - 1] - let l:rest = l:rest[l:next_start_idx :] - - try - " add the json body to the list. - call add(l:responses, json_decode(l:body)) - catch - " TODO(bc): log the message and/or show an error message. - finally - " intentionally left blank. - endtry - endwhile - - return [l:rest, l:responses] - endfunction - - function! l:lsp.handleMessage(ch, data) dict abort - let self.buf .= a:data - - let [self.buf, l:messages] = self.readMessage(self.buf) - - for l:message in l:messages - if has_key(l:message, 'method') - if has_key(l:message, 'id') - call self.handleRequest(l:message) - else - call self.handleNotification(l:message) - endif - elseif has_key(l:message, 'result') || has_key(l:message, 'error') - call self.handleResponse(l:message) - endif - endfor - endfunction - - function! l:lsp.handleRequest(req) dict abort - if a:req.method == 'workspace/workspaceFolders' - let l:resp = go#lsp#message#WorkspaceFoldersResult(self.workspaceDirectories) - elseif a:req.method == 'workspace/configuration' && has_key(a:req, 'params') && has_key(a:req.params, 'items') - let l:resp = go#lsp#message#ConfigurationResult(a:req.params.items) - elseif a:req.method == 'client/registerCapability' && has_key(a:req, 'params') && has_key(a:req.params, 'registrations') - let l:resp = v:null - else - return - endif - - if get(self, 'exited', 0) - return - endif - - let l:msg = self.newResponse(a:req.id, l:resp) - call self.write(l:msg) - endfunction - - function! l:lsp.handleNotification(req) dict abort - " TODO(bc): handle more notifications (e.g. window/showMessage). - if a:req.method == 'textDocument/publishDiagnostics' - call s:handleDiagnostics(a:req.params) - endif - endfunction - - function! l:lsp.handleResponse(resp) dict abort - if has_key(a:resp, 'id') && has_key(self.handlers, a:resp.id) - try - let l:handler = self.handlers[a:resp.id] - - let l:winid = win_getid(winnr()) - " Always set the active window to the window that was active when - " the request was sent. Among other things, this makes sure that - " the correct window's location list will be populated when the - " list type is 'location' and the user has moved windows since - " sending the request. - call win_gotoid(l:handler.winid) - - if has_key(a:resp, 'error') - call l:handler.requestComplete(0) - if has_key(l:handler, 'error') - call call(l:handler.error, [a:resp.error.message]) - else - call go#util#EchoError(a:resp.error.message) - endif - call win_gotoid(l:winid) - return - endif - call l:handler.requestComplete(1) - - let l:winidBeforeHandler = l:handler.winid - call call(l:handler.handleResult, [a:resp.result]) - - " change the window back to the window that was active when - " starting to handle the message _only_ if the handler didn't - " update the winid, so that handlers can set the winid if needed - " (e.g. :GoDef). - if l:handler.winid == l:winidBeforeHandler - call win_gotoid(l:winid) - endif - finally - call remove(self.handlers, a:resp.id) - endtry - endif - endfunction - - function! l:lsp.handleInitializeResult(result) dict abort - if go#config#EchoCommandInfo() - call go#util#EchoProgress("initialized gopls") - endif - let status = { - \ 'desc': '', - \ 'type': 'gopls', - \ 'state': 'initialized', - \ } - call go#statusline#Update(self.wd, status) - - let self.ready = 1 - let l:msg = self.newMessage(go#lsp#message#Initialized()) - call self.write(l:msg) - - " send messages queued while waiting for ready. - for l:item in self.queue - call self.sendMessage(l:item.data, l:item.handler) - endfor - - " reset the queue - let self.queue = [] - endfunction - - function! l:lsp.sendMessage(data, handler) dict abort - if !self.last_request_id - let l:wd = go#util#ModuleRoot() - if l:wd == -1 - call go#util#EchoError('could not determine appropriate working directory for gopls') - return -1 - endif - - if l:wd == '' - let l:wd = getcwd() - endif - let self.wd = l:wd - - if go#config#EchoCommandInfo() - call go#util#EchoProgress("initializing gopls") - endif - - let l:status = { - \ 'desc': '', - \ 'type': 'gopls', - \ 'state': 'initializing', - \ } - call go#statusline#Update(l:wd, l:status) - - let self.workspaceDirectories = add(self.workspaceDirectories, l:wd) - let l:msg = self.newMessage(go#lsp#message#Initialize(l:wd)) - - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('self.handleInitializeResult', [], l:self) - - let self.handlers[l:msg.id] = l:state - - call l:state.start() - call self.write(l:msg) - endif - - if !self.ready - call add(self.queue, {'data': a:data, 'handler': a:handler}) - return - endif - - let l:msg = self.newMessage(a:data) - if has_key(l:msg, 'id') - let self.handlers[l:msg.id] = a:handler - endif - - call a:handler.start() - call self.write(l:msg) - endfunction - - " newMessage returns a message constructed from data. data should be a dict - " with 2 or 3 keys: notification, method, and optionally params. - function! l:lsp.newMessage(data) dict abort - let l:msg = { - \ 'method': a:data.method, - \ 'jsonrpc': '2.0', - \ } - - if !a:data.notification - let self.last_request_id += 1 - let l:msg.id = self.last_request_id - endif - - if has_key(a:data, 'params') - let l:msg.params = a:data.params - endif - - return l:msg - endfunction - - function l:lsp.newResponse(id, result) dict abort - let l:msg = { - \ 'jsonrpc': '2.0', - \ 'id': a:id, - \ 'result': a:result, - \ } - - return l:msg - endfunction - - function! l:lsp.write(msg) dict abort - if empty(get(self, 'job', {})) - return - endif - - let l:body = json_encode(a:msg) - let l:data = 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body - - call s:debug('sent', l:data) - - if has('nvim') - call chansend(self.job, l:data) - return - endif - - call ch_sendraw(self.job, l:data) - endfunction - - function! l:lsp.exit_cb(job, exit_status) dict - let self.exited = 1 - if !get(self, 'restarting', 0) - return - endif - - let l:queue = self.queue - - let l:workspaces = self.workspaceDirectories - - call s:lspfactory.reset() - let l:lsp = s:lspfactory.get() - - " restore workspaces - call call('go#lsp#AddWorkspaceDirectory', l:workspaces) - " * send DidOpen messages for all buffers that have b:did_lsp_open set - " TODO(bc): check modifiable and filetype, too? - bufdo if get(b:, 'go_lsp_did_open', 0) | if &modified | call go#lsp#DidOpen(expand('%:p')) | else | call go#lsp#DidChange(expand('%:p')) | endif | endif - let l:lsp.queue = extend(l:lsp.queue, l:queue) - return - endfunction - - function! l:lsp.close_cb(ch) dict abort - " TODO(bc): remove the buffer variables that indicate that gopls has been - " informed that the file is open - endfunction - - function! l:lsp.err_cb(ch, msg) dict abort - if a:msg =~ '^\tPort = \d\+$' && !get(self, 'debugport', 0) - let self.debugport = substitute(a:msg, '^\tPort = \(\d\+\).*$', '\1', '') - endif - - call s:debug('stderr', a:msg) - endfunction - - " explicitly bind callbacks to l:lsp so that within it, self will always refer - " to l:lsp instead of l:opts. See :help Partial for more information. - let l:opts = { - \ 'in_mode': 'raw', - \ 'out_mode': 'raw', - \ 'err_mode': 'nl', - \ 'noblock': 1, - \ 'err_cb': funcref('l:lsp.err_cb', [], l:lsp), - \ 'out_cb': funcref('l:lsp.handleMessage', [], l:lsp), - \ 'close_cb': funcref('l:lsp.close_cb', [], l:lsp), - \ 'exit_cb': funcref('l:lsp.exit_cb', [], l:lsp), - \ 'cwd': getcwd(), - \} - - let l:bin_path = go#path#CheckBinPath("gopls") - if empty(l:bin_path) - return l:lsp - endif - - let l:cmd = [l:bin_path] - if go#util#HasDebug('lsp') - let l:cmd = extend(l:cmd, ['-debug', 'localhost:0']) - endif - - let l:lsp.job = go#job#Start(l:cmd, l:opts) - - return l:lsp -endfunction - -function! s:noop(...) abort -endfunction - -function! s:newHandlerState(statustype) abort - let l:state = { - \ 'winid': win_getid(winnr()), - \ 'statustype': a:statustype, - \ 'jobdir': getcwd(), - \ } - - " explicitly bind requestComplete to state so that within it, self will - " always refer to state. See :help Partial for more information. - let l:state.requestComplete = funcref('s:requestComplete', [], l:state) - - " explicitly bind start to state so that within it, self will - " always refer to state. See :help Partial for more information. - let l:state.start = funcref('s:start', [], l:state) - - return l:state -endfunction - -function! s:requestComplete(ok) abort dict - if self.statustype == '' - return - endif - - if go#config#EchoCommandInfo() - let prefix = '[' . self.statustype . '] ' - if a:ok - call go#util#EchoSuccess(prefix . "SUCCESS") - else - call go#util#EchoError(prefix . "FAIL") - endif - endif - - let status = { - \ 'desc': 'last status', - \ 'type': self.statustype, - \ 'state': "success", - \ } - - if !a:ok - let status.state = "failed" - endif - - if has_key(self, 'started_at') - let elapsed_time = reltimestr(reltime(self.started_at)) - " strip whitespace - let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') - let status.state .= printf(" (%ss)", elapsed_time) - endif - - call go#statusline#Update(self.jobdir, status) -endfunction - -function! s:start() abort dict - let self.started_at = reltime() - if self.statustype == '' - return - endif - let status = { - \ 'desc': 'current status', - \ 'type': self.statustype, - \ 'state': "started", - \ } - - call go#statusline#Update(self.jobdir, status) -endfunction - -" go#lsp#Definition calls gopls to get the definition of the identifier at -" line and col in fname. handler should be a dictionary function that takes a -" list of strings in the form 'file:line:col: message'. handler will be -" attached to a dictionary that manages state (statuslines, sets the winid, -" etc.) -function! go#lsp#Definition(fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:state = s:newHandlerState('definition') - let l:state.handleResult = funcref('s:definitionHandler', [function(a:handler, [], l:state)], l:state) - let l:msg = go#lsp#message#Definition(fnamemodify(a:fname, ':p'), a:line, a:col) - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:definitionHandler(next, msg) abort dict - " gopls returns a []Location; just take the first one. - let l:msg = a:msg[0] - let l:args = [[printf('%s:%d:%d: %s', go#path#FromURI(l:msg.uri), l:msg.range.start.line+1, go#lsp#lsp#PositionOf(getline(l:msg.range.start.line+1), l:msg.range.start.character), 'lsp does not supply a description')]] - call call(a:next, l:args) -endfunction - -" go#lsp#Type calls gopls to get the type definition of the identifier at -" line and col in fname. handler should be a dictionary function that takes a -" list of strings in the form 'file:line:col: message'. handler will be -" attached to a dictionary that manages state (statuslines, sets the winid, -" etc.) -function! go#lsp#TypeDef(fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:state = s:newHandlerState('type definition') - let l:msg = go#lsp#message#TypeDefinition(fnamemodify(a:fname, ':p'), a:line, a:col) - let l:state.handleResult = funcref('s:typeDefinitionHandler', [function(a:handler, [], l:state)], l:state) - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:typeDefinitionHandler(next, msg) abort dict - " gopls returns a []Location; just take the first one. - let l:msg = a:msg[0] - let l:args = [[printf('%s:%d:%d: %s', go#path#FromURI(l:msg.uri), l:msg.range.start.line+1, go#lsp#lsp#PositionOf(getline(l:msg.range.start.line+1), l:msg.range.start.character), 'lsp does not supply a description')]] - call call(a:next, l:args) -endfunction - -function! go#lsp#DidOpen(fname) abort - if get(b:, 'go_lsp_did_open', 0) - return - endif - - if !filereadable(a:fname) - return - endif - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#DidOpen(fnamemodify(a:fname, ':p'), join(go#util#GetLines(), "\n") . "\n") - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - - " TODO(bc): setting a buffer level variable here assumes that a:fname is the - " current buffer. Change to a:fname first before setting it and then change - " back to active buffer. - let b:go_lsp_did_open = 1 - - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! go#lsp#DidChange(fname) abort - " DidChange is called even when fname isn't open in a buffer (e.g. via - " go#lsp#Info); don't report the file as open or as having changed when it's - " not actually a buffer. - if bufnr(a:fname) == -1 - return - endif - - if !filereadable(a:fname) - return - endif - - call go#lsp#DidOpen(a:fname) - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#DidChange(fnamemodify(a:fname, ':p'), join(go#util#GetLines(), "\n") . "\n") - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! go#lsp#DidClose(fname) abort - if !filereadable(a:fname) - return - endif - - if !get(b:, 'go_lsp_did_open', 0) - return - endif - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#DidClose(fnamemodify(a:fname, ':p')) - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - " TODO(bc): setting a buffer level variable here assumes that a:fname is the - " current buffer. Change to a:fname first before setting it and then change - " back to active buffer. - let b:go_lsp_did_open = 0 - - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! go#lsp#Completion(fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#Completion(a:fname, a:line, a:col) - let l:state = s:newHandlerState('completion') - let l:state.handleResult = funcref('s:completionHandler', [function(a:handler, [], l:state)], l:state) - let l:state.error = funcref('s:completionErrorHandler', [function(a:handler, [], l:state)], l:state) - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:completionHandler(next, msg) abort dict - " gopls returns a CompletionList. - let l:matches = [] - let l:start = -1 - - for l:item in a:msg.items - let l:start = l:item.textEdit.range.start.character - - let l:match = {'abbr': l:item.label, 'word': l:item.textEdit.newText, 'info': '', 'kind': go#lsp#completionitemkind#Vim(l:item.kind)} - if has_key(l:item, 'detail') - let l:match.menu = l:item.detail - if go#lsp#completionitemkind#IsFunction(l:item.kind) || go#lsp#completionitemkind#IsMethod(l:item.kind) - let l:match.info = printf('%s %s', l:item.label, l:item.detail) - - " The detail provided by gopls hasn't always provided the the full - " signature including the return value. The label used to be the - " function signature and the detail was the return value. Handle - " that case for backward compatibility. This can be removed in the - " future once it's likely that the majority of users are on a recent - " version of gopls. - if l:item.detail !~ '^func' - let l:match.info = printf('func %s %s', l:item.label, l:item.detail) - endif - endif - endif - - if has_key(l:item, 'documentation') - let l:match.info .= "\n\n" . l:item.documentation - endif - - let l:matches = add(l:matches, l:match) - endfor - let l:args = [l:start, l:matches] - call call(a:next, l:args) -endfunction - -function! s:completionErrorHandler(next, error) abort dict - call call(a:next, [-1, []]) -endfunction - -" go#lsp#SameIDs calls gopls to get the references to the identifier at line -" and col in fname. handler should be a dictionary function that takes a list -" of strings in the form 'file:line:col: message'. handler will be attached to -" a dictionary that manages state (statuslines, sets the winid, etc.). handler -" should take three arguments: an exit_code, a JSON object encoded to a string -" that mimics guru's ouput for `what`, and third mode parameter that only -" exists for compatibility with the guru implementation of SameIDs. -" TODO(bc): refactor to not need the guru adapter. -function! go#lsp#SameIDs(showstatus, fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#References(a:fname, a:line, a:col) - - if a:showstatus - let l:state = s:newHandlerState('same ids') - else - let l:state = s:newHandlerState('') - endif - - let l:state.handleResult = funcref('s:sameIDsHandler', [function(a:handler, [], l:state)], l:state) - let l:state.error = funcref('s:noop') - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:sameIDsHandler(next, msg) abort dict - let l:furi = go#path#ToURI(expand('%:p')) - - let l:result = { - \ 'sameids': [], - \ 'enclosing': [], - \ } - - for l:loc in a:msg - if l:loc.uri !=# l:furi - continue - endif - - if len(l:result.enclosing) == 0 - let l:result.enclosing = [{ - \ 'desc': 'identifier', - \ 'start': l:loc.range.start.character+1, - \ 'end': l:loc.range.end.character+1, - \ }] - endif - - let l:result.sameids = add(l:result.sameids, printf('%s:%s:%s', go#path#FromURI(l:loc.uri), l:loc.range.start.line+1, l:loc.range.start.character+1)) - endfor - - call call(a:next, [0, json_encode(l:result), '']) -endfunction - -" go#lsp#Referrers calls gopls to get the references to the identifier at line -" and col in fname. handler should be a dictionary function that takes a list -" of strings in the form 'file:line:col: message'. handler will be attached to -" a dictionary that manages state (statuslines, sets the winid, etc.). handler -" should take three arguments: an exit_code, a JSON object encoded to a string -" that mimics guru's ouput for `what`, and third mode parameter that only -" exists for compatibility with the guru implementation of SameIDs. -" TODO(bc): refactor to not need the guru adapter. -function! go#lsp#Referrers(fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#References(a:fname, a:line, a:col) - - let l:state = s:newHandlerState('referrers') - - let l:state.handleResult = funcref('s:referencesHandler', [function(a:handler, [], l:state)], l:state) - let l:state.error = funcref('s:noop') - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:referencesHandler(next, msg) abort dict - let l:result = [] - - call sort(a:msg, funcref('s:compareLocations')) - - for l:loc in a:msg - let l:fname = go#path#FromURI(l:loc.uri) - let l:line = l:loc.range.start.line+1 - let l:bufnr = bufnr(l:fname) - let l:bufinfo = getbufinfo(l:fname) - - try - if l:bufnr == -1 || len(l:bufinfo) == 0 || l:bufinfo[0].loaded == 0 - let l:filecontents = readfile(l:fname, '', l:line) - else - let l:filecontents = getbufline(l:fname, l:line) - endif - - if len(l:filecontents) == 0 - continue - endif - - let l:content = l:filecontents[-1] - catch - call go#util#EchoError(printf('%s (line %s): %s at %s', l:fname, l:line, v:exception, v:throwpoint)) - endtry - - let l:item = printf('%s:%s:%s: %s', go#path#FromURI(l:loc.uri), l:line, go#lsp#lsp#PositionOf(l:content, l:loc.range.start.character), l:content) - - let l:result = add(l:result, l:item) - endfor - - call call(a:next, [0, l:result, '']) -endfunction - -function! go#lsp#Hover(fname, line, col, handler) abort - call go#lsp#DidChange(a:fname) - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#Hover(a:fname, a:line, a:col) - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:hoverHandler', [function(a:handler, [], l:state)], l:state) - let l:state.error = funcref('s:noop') - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:hoverHandler(next, msg) abort dict - try - let l:content = split(a:msg.contents.value, '; ') - if len(l:content) > 1 - let l:curly = stridx(l:content[0], '{') - let l:content = extend([l:content[0][0:l:curly]], map(extend([l:content[0][l:curly+1:]], l:content[1:]), '"\t" . v:val')) - let l:content[len(l:content)-1] = '}' - endif - - let l:args = [l:content] - call call(a:next, l:args) - catch - " TODO(bc): log the message and/or show an error message. - endtry -endfunction - -function! go#lsp#Info(showstatus) - let l:fname = expand('%:p') - let [l:line, l:col] = go#lsp#lsp#Position() - - call go#lsp#DidChange(l:fname) - - let l:lsp = s:lspfactory.get() - - if a:showstatus - let l:state = s:newHandlerState('info') - else - let l:state = s:newHandlerState('') - endif - - let l:state.handleResult = funcref('s:infoDefinitionHandler', [function('s:info', [1], l:state), a:showstatus], l:state) - let l:state.error = funcref('s:noop') - let l:msg = go#lsp#message#Definition(l:fname, l:line, l:col) - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! go#lsp#GetInfo() - let l:fname = expand('%:p') - let [l:line, l:col] = go#lsp#lsp#Position() - - call go#lsp#DidChange(l:fname) - - let l:lsp = s:lspfactory.get() - - let l:state = s:newHandlerState('') - - let l:info = go#promise#New(function('s:info', [0], l:state), 10000, '') - - let l:state.handleResult = funcref('s:infoDefinitionHandler', [l:info.wrapper, 0], l:state) - let l:state.error = funcref('s:noop') - let l:msg = go#lsp#message#Definition(l:fname, l:line, l:col) - call l:lsp.sendMessage(l:msg, l:state) - return l:info.await() -endfunction - -function! s:infoDefinitionHandler(next, showstatus, msg) abort dict - " gopls returns a []Location; just take the first one. - let l:msg = a:msg[0] - - let l:fname = go#path#FromURI(l:msg.uri) - let l:line = l:msg.range.start.line - let l:col = l:msg.range.start.character - - let l:lsp = s:lspfactory.get() - let l:msg = go#lsp#message#Hover(l:fname, l:line, l:col) - - if a:showstatus - let l:state = s:newHandlerState('info') - else - let l:state = s:newHandlerState('') - endif - - let l:state.handleResult = funcref('s:hoverHandler', [a:next], l:state) - let l:state.error = funcref('s:noop') - return l:lsp.sendMessage(l:msg, l:state) -endfunction - -function! s:info(show, content) abort dict - let l:content = s:infoFromHoverContent(a:content) - - if a:show - call go#util#ShowInfo(l:content) - endif - - return l:content -endfunction - -function! s:infoFromHoverContent(content) abort - if len(a:content) < 1 - return '' - endif - - let l:content = a:content[0] - - " strip off the method set and fields of structs and interfaces. - if l:content =~# '^\(type \)\?[^ ]\+ \(struct\|interface\)' - let l:content = substitute(l:content, '{.*', '', '') - endif - - return l:content -endfunction - -function! go#lsp#AddWorkspaceDirectory(...) abort - if a:0 == 0 - return - endif - - call go#lsp#CleanWorkspaces() - - let l:workspaces = [] - for l:dir in a:000 - let l:dir = fnamemodify(l:dir, ':p') - if !isdirectory(l:dir) - continue - endif - - let l:workspaces = add(l:workspaces, l:dir) - endfor - - let l:lsp = s:lspfactory.get() - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - let l:lsp.workspaceDirectories = extend(l:lsp.workspaceDirectories, l:workspaces) - let l:msg = go#lsp#message#ChangeWorkspaceFolders(l:workspaces, []) - call l:lsp.sendMessage(l:msg, l:state) - - return 0 -endfunction - -function! go#lsp#CleanWorkspaces() abort - let l:workspaces = [] - - let l:lsp = s:lspfactory.get() - - let l:i = 0 - let l:missing = [] - for l:dir in l:lsp.workspaceDirectories - if !isdirectory(l:dir) - let l:missing = add(l:missing, l:dir) - call remove(l:lsp.workspaceDirectories, l:i) - continue - endif - let l:i += 1 - endfor - - if len(l:missing) == 0 - return 0 - endif - - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - let l:msg = go#lsp#message#ChangeWorkspaceFolders([], l:missing) - call l:lsp.sendMessage(l:msg, l:state) - - return 0 -endfunction - -" go#lsp#ResetWorkspaceDiretories removes and then re-adds all workspace -" folders to cause gopls to send configuration requests for all of them again. -" This is useful, for instance, when build tags have been added and gopls -" needs to use them. -function! go#lsp#ResetWorkspaceDirectories() abort - call go#lsp#CleanWorkspaces() - - let l:lsp = s:lspfactory.get() - - let l:state = s:newHandlerState('') - let l:state.handleResult = funcref('s:noop') - let l:msg = go#lsp#message#ChangeWorkspaceFolders(l:lsp.workspaceDirectories, l:lsp.workspaceDirectories) - call l:lsp.sendMessage(l:msg, l:state) - - return 0 -endfunction - -function! go#lsp#DebugBrowser() abort - let l:lsp = s:lspfactory.get() - let l:port = get(l:lsp, 'debugport', 0) - if !l:port - call go#util#EchoError("gopls was not started with debugging enabled. See :help g:go_debug.") - return - endif - - call go#util#OpenBrowser(printf('http://localhost:%d', l:port)) -endfunction - -function! go#lsp#Exit() abort - call s:exit(0) -endfunction - -function! go#lsp#Restart() abort - call s:exit(1) -endfunction - -function! s:exit(restart) abort - if !go#util#has_job() || len(s:lspfactory) == 0 || !has_key(s:lspfactory, 'current') - return - endif - - let l:lsp = s:lspfactory.get() - - " reset the factory so that future requests don't use the same instance of - " gopls. - call s:lspfactory.reset() - - let l:lsp.restarting = a:restart - - let l:state = s:newHandlerState('exit') - - let l:msg = go#lsp#message#Shutdown() - let l:state.handleResult = funcref('s:noop') - let l:retval = l:lsp.sendMessage(l:msg, l:state) - - let l:msg = go#lsp#message#Exit() - let l:retval = l:lsp.sendMessage(l:msg, l:state) - - return l:retval -endfunction - -function! s:debugasync(event, data, timer) abort - if !go#util#HasDebug('lsp') - return - endif - - let l:winid = win_getid() - - let l:name = '__GOLSP_LOG__' - let l:log_winid = bufwinid(l:name) - if l:log_winid == -1 - silent keepalt botright 10new - silent file `='__GOLSP_LOG__'` - setlocal buftype=nofile bufhidden=wipe nomodified nobuflisted noswapfile nowrap nonumber nocursorline - setlocal filetype=golsplog - else - call win_gotoid(l:log_winid) - endif - - try - setlocal modifiable - if getline(1) == '' - call setline('$', printf('%s: %s', a:event, a:data)) - else - call append('$', printf('%s: %s', a:event, a:data)) - endif - normal! G - setlocal nomodifiable - finally - call win_gotoid(l:winid) - endtry -endfunction - -function! s:debug(event, data, ...) abort - call timer_start(10, function('s:debugasync', [a:event, a:data])) -endfunction - -function! s:compareLocations(left, right) abort - if a:left.uri < a:right.uri - return -1 - endif - - if a:left.uri == a:right.uri && a:left.range.start.line < a:right.range.start.line - return -1 - endif - - if a:left.uri == a:right.uri && a:left.range.start.line == a:right.range.start.line && a:left.range.start.character < a:right.range.start.character - return -1 - endif - - if a:left.uri == a:right.uri && a:left.range.start.line == a:right.range.start.line && a:left.range.start.character == a:right.range.start.character - return 0 - endif - - return 1 -endfunction - -function! s:handleDiagnostics(data) abort - if !exists("*matchaddpos") - return 0 - endif - - try - let l:fname = go#path#FromURI(a:data.uri) - if bufnr(l:fname) == bufnr('') - let l:errorMatches = [] - let l:warningMatches = [] - for l:diag in a:data.diagnostics - if !(l:diag.severity == 1 || l:diag.severity == 2) - continue - endif - let l:range = l:diag.range - if l:range.start.line != l:range.end.line - continue - endif - - let l:line = l:range.start.line + 1 - let l:col = go#lsp#lsp#PositionOf(getline(l:line), l:range.start.character) - let l:lastcol = go#lsp#lsp#PositionOf(getline(l:line), l:range.end.character) - - let l:pos = [l:line, l:col, l:lastcol - l:col + 1] - if l:diag.severity == 1 - let l:errorMatches = add(l:errorMatches, l:pos) - elseif l:diag.severity == 2 - let l:warningMatches = add(l:warningMatches, l:pos) - endif - endfor - - if hlexists('goDiagnosticError') - " clear the old matches just before adding the new ones to keep flicker - " to a minimum. - call go#util#ClearGroupFromMatches('goDiagnosticError') - if go#config#HighlightDiagnosticErrors() - call matchaddpos('goDiagnosticError', l:errorMatches) - endif - endif - - if hlexists('goDiagnosticError') - " clear the old matches just before adding the new ones to keep flicker - " to a minimum. - call go#util#ClearGroupFromMatches('goDiagnosticWarning') - if go#config#HighlightDiagnosticWarnings() - call matchaddpos('goDiagnosticWarning', l:warningMatches) - endif - endif - endif - catch - call go#util#EchoError(v:exception) - 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/lsp/completionitemkind.vim b/sources_non_forked/vim-go/autoload/go/lsp/completionitemkind.vim deleted file mode 100644 index 0202bd26..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp/completionitemkind.vim +++ /dev/null @@ -1,63 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:Text = 1 -let s:Method = 2 -let s:Function = 3 -let s:Constructor = 4 -let s:Field = 5 -let s:Variable = 6 -let s:Class = 7 -let s:Interface = 8 -let s:Module = 9 -let s:Property = 10 -let s:Unit = 11 -let s:Value = 12 -let s:Enum = 13 -let s:Keyword = 14 -let s:Snippet = 15 -let s:Color = 16 -let s:File = 17 -let s:Reference = 18 -let s:Folder = 19 -let s:EnumMember = 20 -let s:Constant = 21 -let s:Struct = 22 -let s:Event = 23 -let s:Operator = 24 -let s:TypeParameter = 25 - -function! go#lsp#completionitemkind#Vim(kind) abort - if a:kind == s:Method || a:kind == s:Function || a:kind == s:Constructor - return 'f' - elseif a:kind == s:Variable || a:kind == s:Constant - return 'v' - elseif a:kind == s:Field || a:kind == s:Property - return 'm' - elseif a:kind == s:Class || a:kind == s:Interface || a:kind == s:Struct - return 't' - endif -endfunction - -function! go#lsp#completionitemkind#IsFunction(kind) abort - if a:kind == s:Function - return 1 - endif - - return 0 -endfunction - -function! go#lsp#completionitemkind#IsMethod(kind) abort - if a:kind == s:Method - return 1 - endif - - return 0 -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/lsp/lsp.vim b/sources_non_forked/vim-go/autoload/go/lsp/lsp.vim deleted file mode 100644 index 56a2da4c..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp/lsp.vim +++ /dev/null @@ -1,58 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" go#lsp#lsp#Position returns the LSP text position. If no arguments are -" provided, the cursor position is assumed. Otherwise, there should be two -" arguments: the line and the column. -function! go#lsp#lsp#Position(...) - if a:0 < 2 - let [l:line, l:col] = getpos('.')[1:2] - else - let l:line = a:1 - let l:col = a:2 - endif - let l:content = getline(l:line) - - " LSP uses 0-based lines. - return [l:line - 1, s:character(l:line, l:col-1)] -endfunction - -function! s:strlen(str) abort - let l:runes = split(a:str, '\zs') - return len(l:runes) + len(filter(l:runes, 'char2nr(v:val)>=0x10000')) -endfunction - -function! s:character(line, col) abort - return s:strlen(getline(a:line)[:col([a:line, a:col - 1])]) -endfunction - -" go#lsp#PositionOf returns len(content[0:units]) where units is utf-16 code -" units. This is mostly useful for converting LSP text position to vim -" position. -function! go#lsp#lsp#PositionOf(content, units) abort - if a:units == 0 - return 1 - endif - - let l:remaining = a:units - let l:str = "" - for l:rune in split(a:content, '\zs') - if l:remaining < 0 - break - endif - let l:remaining -= 1 - if char2nr(l:rune) >= 0x10000 - let l:remaining -= 1 - endif - let l:str = l:str . l:rune - endfor - - return len(l:str) -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/lsp/lsp_test.vim b/sources_non_forked/vim-go/autoload/go/lsp/lsp_test.vim deleted file mode 100644 index 24a2a747..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp/lsp_test.vim +++ /dev/null @@ -1,32 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -scriptencoding utf-8 - -function! Test_PositionOf_Simple() - let l:actual = go#lsp#lsp#PositionOf("just ascii", 3) - call assert_equal(4, l:actual) -endfunc - - -function! Test_PositionOf_MultiByte() - " ⌘ is U+2318, which encodes to three bytes in utf-8 and 1 code unit in - " utf-16. - let l:actual = go#lsp#lsp#PositionOf("⌘⌘ foo", 3) - call assert_equal(8, l:actual) -endfunc - -function! Test_PositionOf_MultipleCodeUnit() - " 𐐀 is U+10400, which encodes to 4 bytes in utf-8 and 2 code units in - " utf-16. - let l:actual = go#lsp#lsp#PositionOf("𐐀 bar", 3) - call assert_equal(6, l:actual) -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/lsp/message.vim b/sources_non_forked/vim-go/autoload/go/lsp/message.vim deleted file mode 100644 index 9d90c3fe..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp/message.vim +++ /dev/null @@ -1,221 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#lsp#message#Initialize(wd) abort - return { - \ 'notification': 0, - \ 'method': 'initialize', - \ 'params': { - \ 'processId': getpid(), - \ 'rootUri': go#path#ToURI(a:wd), - \ 'capabilities': { - \ 'workspace': { - \ 'workspaceFolders': v:true, - \ 'didChangeConfiguration': { - \ 'dynamicRegistration': v:true, - \ }, - \ 'configuration': v:true, - \ }, - \ 'textDocument': { - \ 'hover': { - \ 'contentFormat': ['plaintext'], - \ }, - \ } - \ }, - \ 'workspaceFolders': [s:workspaceFolder(0, a:wd)], - \ } - \ } -endfunction - -function! go#lsp#message#Initialized() abort - return { - \ 'notification': 1, - \ 'method': 'initialized', - \ 'params': {}, - \ } -endfunction - -function! go#lsp#message#Shutdown() abort - return { - \ 'notification': 0, - \ 'method': 'shutdown', - \ } -endfunction - -function! go#lsp#message#Exit() abort - return { - \ 'notification': 1, - \ 'method': 'exit', - \ } -endfunction - -function! go#lsp#message#WorkspaceFoldersResult(dirs) abort - return map(copy(a:dirs), function('s:workspaceFolder', [])) -endfunction - -function! go#lsp#message#Definition(file, line, col) abort - return { - \ 'notification': 0, - \ 'method': 'textDocument/definition', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file) - \ }, - \ 'position': s:position(a:line, a:col) - \ } - \ } -endfunction - -function! go#lsp#message#TypeDefinition(file, line, col) abort - return { - \ 'notification': 0, - \ 'method': 'textDocument/typeDefinition', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file) - \ }, - \ 'position': s:position(a:line, a:col) - \ } - \ } -endfunction - -function! go#lsp#message#DidOpen(file, content) abort - return { - \ 'notification': 1, - \ 'method': 'textDocument/didOpen', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file), - \ 'languageId': 'go', - \ 'text': a:content, - \ } - \ } - \ } -endfunction - -function! go#lsp#message#DidChange(file, content) abort - return { - \ 'notification': 1, - \ 'method': 'textDocument/didChange', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file), - \ }, - \ 'contentChanges': [ - \ { - \ 'text': a:content, - \ } - \ ] - \ } - \ } -endfunction - -function! go#lsp#message#DidClose(file) abort - return { - \ 'notification': 1, - \ 'method': 'textDocument/didClose', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file), - \ } - \ } - \ } -endfunction - -function! go#lsp#message#Completion(file, line, col) abort - return { - \ 'notification': 0, - \ 'method': 'textDocument/completion', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file) - \ }, - \ 'position': s:position(a:line, a:col), - \ } - \ } -endfunction - -function! go#lsp#message#References(file, line, col) abort - return { - \ 'notification': 0, - \ 'method': 'textDocument/references', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file) - \ }, - \ 'position': s:position(a:line, a:col), - \ 'context': { - \ 'includeDeclaration': v:true, - \ }, - \ } - \ } -endfunction - -function! go#lsp#message#Hover(file, line, col) abort - return { - \ 'notification': 0, - \ 'method': 'textDocument/hover', - \ 'params': { - \ 'textDocument': { - \ 'uri': go#path#ToURI(a:file) - \ }, - \ 'position': s:position(a:line, a:col), - \ } - \ } -endfunction - -function! go#lsp#message#ChangeWorkspaceFolders(add, remove) abort - let l:addDirs = map(copy(a:add), function('s:workspaceFolder', [])) - let l:removeDirs = map(copy(a:add), function('s:workspaceFolder', [])) - - return { - \ 'notification': 1, - \ 'method': 'workspace/didChangeWorkspaceFolders', - \ 'params': { - \ 'event': { - \ 'removed': l:removeDirs, - \ 'added': l:addDirs, - \ }, - \ } - \ } - -endfunction - -function! go#lsp#message#ConfigurationResult(items) abort - let l:result = [] - - " results must be in the same order as the items - for l:item in a:items - let l:config = { - \ 'buildFlags': [], - \ 'hoverKind': 'NoDocumentation', - \ 'deepCompletion': go#config#GoplsDeepCompletion() ? v:true : v:false, - \ 'fuzzyMatching': go#config#GoplsFuzzyMatching() ? v:true : v:false, - \ 'completeUnimported': go#config#GoplsCompleteUnimported() ? v:true : v:false, - \ 'usePlaceholders': go#config#GoplsUsePlaceholders() ? v:true : v:false, - \ } - let l:buildtags = go#config#BuildTags() - if buildtags isnot '' - let l:config.buildFlags = extend(l:config.buildFlags, ['-tags', go#config#BuildTags()]) - endif - - let l:result = add(l:result, l:config) - endfor - - return l:result -endfunction - -function s:workspaceFolder(key, val) abort - return {'uri': go#path#ToURI(a:val), 'name': a:val} -endfunction - -function! s:position(line, col) abort - return {'line': a:line, 'character': a:col} -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/lsp_test.vim b/sources_non_forked/vim-go/autoload/go/lsp_test.vim deleted file mode 100644 index eb45f539..00000000 --- a/sources_non_forked/vim-go/autoload/go/lsp_test.vim +++ /dev/null @@ -1,49 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -scriptencoding utf-8 - -function! Test_GetSimpleTextPosition() - call s:getinfo('lsp text position should align with cursor position after ascii only', 'ascii') -endfunction - -function! Test_GetMultiByteTextPosition() - call s:getinfo('lsp text position should align with cursor position after two place of interest symbols ⌘⌘', 'multi-byte') -endfunction - -function! Test_GetMultipleCodeUnitTextPosition() - call s:getinfo('lsp text position should align with cursor position after Deseret Capital Letter Long I 𐐀', 'multi-code-units') -endfunction - -function! s:getinfo(str, name) - if !go#util#has_job() - return - endif - - try - let g:go_info_mode = 'gopls' - - let l:tmp = gotest#write_file(a:name . '/position/position.go', [ - \ 'package position', - \ '', - \ 'func Example() {', - \ "\tid := " . '"foo"', - \ "\tprintln(" .'"' . a:str . '", id)', - \ '}', - \ ] ) - - let l:expected = 'var id string' - let l:actual = go#lsp#GetInfo() - call assert_equal(l:expected, l:actual) - finally - call delete(l:tmp, 'rf') - unlet g:go_info_mode - 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/mod.vim b/sources_non_forked/vim-go/autoload/go/mod.vim deleted file mode 100644 index a38aabe1..00000000 --- a/sources_non_forked/vim-go/autoload/go/mod.vim +++ /dev/null @@ -1,147 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:go_major_version = "" - -function! go#mod#Format() abort - " go mod only exists in `v1.11` - if empty(s:go_major_version) - let tokens = matchlist(go#util#Exec(['go', 'version']), '\d\+.\(\d\+\)\(\.\d\+\)\? ') - if len(tokens) > 0 - let s:go_major_version = str2nr(tokens[1]) - else - let s:go_major_version = "" - endif - endif - - if !empty(s:go_major_version) && s:go_major_version < "11" - call go#util#EchoError("Go v1.11 is required to format go.mod file") - return - endif - - let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - - " Save cursor position and many other things. - let l:curw = winsaveview() - - " Write current unsaved buffer to a temp file - let l:tmpname = tempname() . '.mod' - call writefile(go#util#GetLines(), l:tmpname) - if go#util#IsWin() - let l:tmpname = tr(l:tmpname, '\', '/') - endif - - let current_col = col('.') - let l:args = ['go', 'mod', 'edit', '--fmt', l:tmpname] - let [l:out, l:err] = go#util#Exec(l:args) - let diff_offset = len(readfile(l:tmpname)) - line('$') - - if l:err == 0 - call go#mod#update_file(l:tmpname, fname) - else - let errors = s:parse_errors(fname, l:out) - call s:show_errors(errors) - endif - - " We didn't use the temp file, so clean up - call delete(l:tmpname) - - " Restore our cursor/windows positions. - call winrestview(l:curw) - - " be smart and jump to the line the new statement was added/removed - call cursor(line('.') + diff_offset, current_col) - - " Syntax highlighting breaks less often. - syntax sync fromstart -endfunction - -" update_file updates the target file with the given formatted source -function! go#mod#update_file(source, target) - " remove undo point caused via BufWritePre - try | silent undojoin | catch | endtry - - let old_fileformat = &fileformat - if exists("*getfperm") - " save file permissions - let original_fperm = getfperm(a:target) - endif - - call rename(a:source, a:target) - - " restore file permissions - if exists("*setfperm") && original_fperm != '' - call setfperm(a:target , original_fperm) - endif - - " reload buffer to reflect latest changes - silent edit! - - let &fileformat = old_fileformat - let &syntax = &syntax - - let l:listtype = go#list#Type("GoModFmt") - - " clean up previous list - if l:listtype == "quickfix" - let l:list_title = getqflist({'title': 1}) - else - let l:list_title = getloclist(0, {'title': 1}) - endif - - if has_key(l:list_title, "title") && l:list_title['title'] == "Format" - call go#list#Clean(l:listtype) - endif -endfunction - -" parse_errors parses the given errors and returns a list of parsed errors -function! s:parse_errors(filename, content) abort - let splitted = split(a:content, '\n') - - " list of errors to be put into location list - let errors = [] - for line in splitted - let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\s*\(.*\)') - if !empty(tokens) - call add(errors,{ - \"filename": a:filename, - \"lnum": tokens[2], - \"text": tokens[3], - \ }) - endif - endfor - - return errors -endfunction - -" show_errors opens a location list and shows the given errors. If the given -" errors is empty, it closes the the location list -function! s:show_errors(errors) abort - let l:listtype = go#list#Type("GoModFmt") - if !empty(a:errors) - call go#list#Populate(l:listtype, a:errors, 'Format') - call go#util#EchoError("GoModFmt returned error") - endif - - " this closes the window if there are no errors or it opens - " it if there is any - call go#list#Window(l:listtype, len(a:errors)) -endfunction - -function! go#mod#ToggleModFmtAutoSave() abort - if go#config#ModFmtAutosave() - call go#config#SetModFmtAutosave(0) - call go#util#EchoProgress("auto mod fmt disabled") - return - end - - call go#config#SetModFmtAutosave(1) - call go#util#EchoProgress("auto mod fmt enabled") -endfunction - -" 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/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim deleted file mode 100644 index b700170d..00000000 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ /dev/null @@ -1,309 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" This file provides a utility function that performs auto-completion of -" package names, for use by other commands. - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:goos = $GOOS -let s:goarch = $GOARCH - -if len(s:goos) == 0 - if exists('g:golang_goos') - let s:goos = g:golang_goos - elseif has('win32') || has('win64') - let s:goos = 'windows' - elseif has('macunix') - let s:goos = 'darwin' - else - let s:goos = '*' - endif -endif - -if len(s:goarch) == 0 - if exists('g:golang_goarch') - let s:goarch = g:golang_goarch - else - let s:goarch = '*' - endif -endif - -function! s:paths() abort - let dirs = [] - - if !exists("s:goroot") - if executable('go') - let s:goroot = go#util#env("goroot") - if go#util#ShellError() != 0 - call go#util#EchoError('`go env GOROOT` failed') - endif - else - let s:goroot = $GOROOT - endif - endif - - if len(s:goroot) != 0 && isdirectory(s:goroot) - let dirs += [s:goroot] - endif - - let workspaces = split(go#path#Default(), go#util#PathListSep()) - if workspaces != [] - let dirs += workspaces - endif - - return dirs -endfunction - -function! s:module() abort - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Dir}}']) - if l:err != 0 - return {} - endif - let l:dir = split(l:out, '\n')[0] - - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Path}}']) - if l:err != 0 - return {} - endif - let l:path = split(l:out, '\n')[0] - - return {'dir': l:dir, 'path': l:path} -endfunction - -function! s:vendordirs() abort - let l:vendorsuffix = go#util#PathSep() . 'vendor' - let l:module = s:module() - if empty(l:module) - let [l:root, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Root}}']) - if l:err != 0 - return [] - endif - if empty(l:root) - return [] - endif - - let l:root = split(l:root, '\n')[0] . go#util#PathSep() . 'src' - - let [l:dir, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Dir}}']) - if l:err != 0 - return [] - endif - let l:dir = split(l:dir, '\n')[0] - - let l:vendordirs = [] - while l:dir != l:root - let l:vendordir = l:dir . l:vendorsuffix - if isdirectory(l:vendordir) - let l:vendordirs = add(l:vendordirs, l:vendordir) - endif - - let l:dir = fnamemodify(l:dir, ':h') - endwhile - - return l:vendordirs - endif - - let l:vendordir = l:module.dir . l:vendorsuffix - if !isdirectory(l:vendordir) - return [] - endif - return [l:vendordir] -endfunction - -let s:import_paths = {} -" ImportPath returns the import path of the package for current buffer. It -" returns -1 if the import path cannot be determined. -function! go#package#ImportPath() abort - let l:dir = expand("%:p:h") - if has_key(s:import_paths, dir) - return s:import_paths[l:dir] - endif - - let l:importpath = go#package#FromPath(l:dir) - if type(l:importpath) == type(0) - return -1 - endif - - let s:import_paths[l:dir] = l:importpath - - return l:importpath -endfunction - -" go#package#FromPath returns the import path of arg. -1 is returned when arg -" does not specify a package. -2 is returned when arg is a relative path -" outside of GOPATH, not in a module, and not below the current working -" directory. A relative path is returned when in a null module at or below the -" current working directory.. -function! go#package#FromPath(arg) abort - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - let l:dir = getcwd() - - let l:path = fnamemodify(a:arg, ':p') - if !isdirectory(l:path) - let l:path = fnamemodify(l:path, ':h') - endif - - execute l:cd fnameescape(l:path) - try - if glob("*.go") == "" - " There's no Go code in this directory. We might be in a module directory - " which doesn't have any code at this level. To avoid `go list` making a - " bunch of HTTP requests to fetch dependencies, short-circuit `go list` - " and return -1 immediately. - if !empty(s:module()) - return -1 - endif - endif - let [l:out, l:err] = go#util#Exec(['go', 'list']) - if l:err != 0 - return -1 - endif - - let l:importpath = split(l:out, '\n')[0] - finally - execute l:cd fnameescape(l:dir) - endtry - - " go list returns '_CURRENTDIRECTORY' if the directory is in a null module - " (i.e. neither in GOPATH nor in a module). Return a relative import path - " if possible or an error if that is the case. - if l:importpath[0] ==# '_' - let l:relativeimportpath = fnamemodify(l:importpath[1:], ':.') - if go#util#IsWin() - let l:relativeimportpath = substitute(l:relativeimportpath, '\\', '/', 'g') - endif - - if l:relativeimportpath == l:importpath[1:] - return '.' - endif - - if l:relativeimportpath[0] == '/' - return -2 - endif - - let l:importpath= printf('./%s', l:relativeimportpath) - endif - - return l:importpath -endfunction - -function! go#package#CompleteMembers(package, member) abort - let [l:content, l:err] = go#util#Exec(['go', 'doc', a:package]) - if l:err || !len(content) - return [] - endif - - let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'") - try - let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*' - let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*' - let candidates = map(filter(copy(lines), 'v:val =~ mx1'), - \ 'substitute(v:val, mx1, "\\1", "")') - \ + map(filter(copy(lines), 'v:val =~ mx2'), - \ 'substitute(v:val, mx2, "\\1", "")') - return filter(candidates, '!stridx(v:val, a:member)') - catch - return [] - endtry -endfunction - -function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort - let words = split(a:CmdLine, '\s\+', 1) - - " do not complete package members for these commands - let neglect_commands = ["GoImportAs", "GoGuruScope"] - - if len(words) > 2 && index(neglect_commands, words[0]) == -1 - " Complete package members - return go#package#CompleteMembers(words[1], words[2]) - endif - - let dirs = s:paths() - let module = s:module() - - if len(dirs) == 0 && empty(module) - " should not happen - return [] - endif - - let vendordirs = s:vendordirs() - - let ret = {} - for dir in dirs - " this may expand to multiple lines - let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") - let root = add(root, expand(dir . '/src'), ) - let root = extend(root, vendordirs) - let root = add(root, module) - for item in root - " item may be a dictionary when operating in a module. - if type(item) == type({}) - if empty(item) - continue - endif - let dir = item.dir - let path = item.path - else - let dir = item - let path = item - endif - - if !empty(module) && dir ==# module.dir - if stridx(a:ArgLead, module.path) == 0 - if len(a:ArgLead) != len(module.path) - let glob = globpath(module.dir, substitute(a:ArgLead, module.path . '/\?', '', '').'*') - else - let glob = module.dir - endif - elseif stridx(module.path, a:ArgLead) == 0 && stridx(module.path, '/', len(a:ArgLead)) < 0 - " use the module directory when a:ArgLead is contained in - " module.path and module.path does not have any path segments after - " a:ArgLead. - let glob = module.dir - else - continue - endif - else - let glob = globpath(dir, a:ArgLead.'*') - endif - for candidate in split(glob) - if isdirectory(candidate) - " TODO(bc): use wildignore instead of filtering out vendor - " directories manually? - if fnamemodify(candidate, ':t') == 'vendor' - continue - endif - let candidate .= '/' - elseif candidate !~ '\.a$' - continue - endif - - if dir !=# path - let candidate = substitute(candidate, '^' . dir, path, 'g') - else - let candidate = candidate[len(dir)+1:] - endif - " replace a backslash with a forward slash and drop .a suffixes - let candidate = substitute(substitute(candidate, '[\\]', '/', 'g'), - \ '\.a$', '', 'g') - - " without this the result can have duplicates in form of - " 'encoding/json' and '/encoding/json/' - let candidate = go#util#StripPathSep(candidate) - - let ret[candidate] = candidate - endfor - endfor - endfor - return sort(keys(ret)) -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/package_test.vim b/sources_non_forked/vim-go/autoload/go/package_test.vim deleted file mode 100644 index 4938d480..00000000 --- a/sources_non_forked/vim-go/autoload/go/package_test.vim +++ /dev/null @@ -1,58 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_Complete_GOPATH_simple() abort - let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' - silent exe 'edit ' . $GOPATH . '/src/package/package.go' - call s:complete('package', ['package']) -endfunc - -func! Test_Complete_Module_simple() abort - silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' - call s:complete('package', ['package']) -endfunc - -func! Test_Complete_GOPATH_subdirs() abort - let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' - silent exe 'edit ' . $GOPATH . '/src/package/package.go' - call s:complete('package/', ['package/bar', 'package/baz']) -endfunc - -func! Test_Complete_Module_subdirs() abort - silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' - call s:complete('package/', ['package/bar', 'package/baz']) -endfunc - -func! Test_Complete_GOPATH_baronly() abort - let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' - silent exe 'edit ' . $GOPATH . '/src/package/package.go' - call s:complete('package/bar', ['package/bar']) -endfunc - -func! Test_Complete_Module_baronly() abort - silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' - call s:complete('package/bar', ['package/bar']) -endfunc - -func! Test_Complete_GOPATH_vendor() abort - let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' - silent exe 'edit ' . $GOPATH . '/src/package/package.go' - call s:complete('foo', ['foo']) -endfunc - -func! Test_Complete_Module_vendor() abort - silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' - call s:complete('foo', ['foo']) -endfunc - -func! s:complete(arglead, expected) abort - let l:candidates = go#package#Complete(a:arglead, '', 1) - call assert_equal(a:expected, l:candidates) -endfunc - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim deleted file mode 100644 index 0d81d453..00000000 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ /dev/null @@ -1,248 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" initial_go_path is used to store the initial GOPATH that was set when Vim -" was started. It's used with :GoPathClear to restore the GOPATH when the user -" changed it explicitly via :GoPath. Initially it's empty. It's being set when -" :GoPath is used -let s:initial_go_path = "" - -" GoPath sets or echos the current GOPATH. If no arguments are passed it -" echoes the current GOPATH, if an argument is passed it replaces the current -" GOPATH with it. If two double quotes are passed (the empty string in go), -" it'll clear the GOPATH and will restore to the initial GOPATH. -function! go#path#GoPath(...) abort - " no argument, show GOPATH - if len(a:000) == 0 - echo go#path#Default() - return - endif - - " we have an argument, replace GOPATH - " clears the current manually set GOPATH and restores it to the - " initial GOPATH, which was set when Vim was started. - if len(a:000) == 1 && a:1 == '""' - if !empty(s:initial_go_path) - let $GOPATH = s:initial_go_path - let s:initial_go_path = "" - endif - - call go#util#EchoInfo("GOPATH restored to ". $GOPATH) - return - endif - - call go#util#EchoInfo("GOPATH changed to ". a:1) - let s:initial_go_path = $GOPATH - let $GOPATH = a:1 -endfunction - -" Default returns the default GOPATH. If GOPATH is not set, it uses the -" default GOPATH set starting with Go 1.8. This GOPATH can be retrieved via -" 'go env GOPATH' -function! go#path#Default() abort - if $GOPATH == "" - " use default GOPATH via go env - return go#util#env("gopath") - endif - - return $GOPATH -endfunction - -" s:HasPath checks whether the given path exists in GOPATH environment variable -" or not -function! s:HasPath(path) abort - let go_paths = split(go#path#Default(), go#util#PathListSep()) - let last_char = strlen(a:path) - 1 - - " check cases of '/foo/bar/' and '/foo/bar' - if a:path[last_char] == go#util#PathSep() - let withSep = a:path - let noSep = strpart(a:path, 0, last_char) - else - let withSep = a:path . go#util#PathSep() - let noSep = a:path - endif - - let hasA = index(go_paths, withSep) != -1 - let hasB = index(go_paths, noSep) != -1 - return hasA || hasB -endfunction - -" Detect returns the current GOPATH. If a package manager is used, such as -" Godeps, GB, it will modify the GOPATH so those directories take precedence -" over the current GOPATH. It also detects diretories whose are outside -" GOPATH. -function! go#path#Detect() abort - let gopath = go#path#Default() - - let current_dir = fnameescape(expand('%:p:h')) - - " TODO(arslan): this should be changed so folders or files should be - " fetched from a customizable list. The user should define any new package - " management tool by it's own. - - " src folders outside $GOPATH - let src_roots = finddir("src", current_dir .";", -1) - - " for cases like GOPATH/src/foo/src/bar, pick up GOPATH/src instead of - " GOPATH/src/foo/src - let src_root = "" - if len(src_roots) > 0 - let src_root = src_roots[-1] - endif - - if !empty(src_root) - let src_path = fnamemodify(src_root, ':p:h:h') . go#util#PathSep() - - " gb vendor plugin - " (https://github.com/constabulary/gb/tree/master/cmd/gb-vendor) - let gb_vendor_root = src_path . "vendor" . go#util#PathSep() - if isdirectory(gb_vendor_root) && !s:HasPath(gb_vendor_root) - let gopath = gb_vendor_root . go#util#PathListSep() . gopath - endif - - if !s:HasPath(src_path) - let gopath = src_path . go#util#PathListSep() . gopath - endif - endif - - " Godeps - let godeps_root = finddir("Godeps", current_dir .";") - if !empty(godeps_root) - let godeps_path = join([fnamemodify(godeps_root, ':p:h:h'), "Godeps", "_workspace" ], go#util#PathSep()) - - if !s:HasPath(godeps_path) - let gopath = godeps_path . go#util#PathListSep() . gopath - endif - endif - - " Fix up the case where initial $GOPATH is empty, - " and we end up with a trailing : - let gopath = substitute(gopath, ":$", "", "") - return gopath -endfunction - -" BinPath returns the binary path of installed go tools. -function! go#path#BinPath() abort - let bin_path = go#config#BinPath() - if bin_path != "" - return bin_path - endif - - " check if our global custom path is set, if not check if $GOBIN is set so - " we can use it, otherwise use default GOPATH - if $GOBIN != "" - let bin_path = $GOBIN - else - let go_paths = split(go#path#Default(), go#util#PathListSep()) - if len(go_paths) == 0 - return "" "nothing found - endif - let bin_path = expand(go_paths[0] . "/bin/") - endif - - return bin_path -endfunction - -" CheckBinPath checks whether the given binary exists or not and returns the -" path of the binary, respecting the go_bin_path and go_search_bin_path_first -" settings. It returns an empty string if the binary doesn't exist. -function! go#path#CheckBinPath(binpath) abort - " remove whitespaces if user applied something like 'goimports ' - let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '') - - " save original path - let old_path = $PATH - - " check if we have an appropriate bin_path - let go_bin_path = go#path#BinPath() - if !empty(go_bin_path) - " append our GOBIN and GOPATH paths and be sure they can be found there... - " let us search in our GOBIN and GOPATH paths - " respect the ordering specified by go_search_bin_path_first - if go#config#SearchBinPathFirst() - let $PATH = go_bin_path . go#util#PathListSep() . $PATH - else - let $PATH = $PATH . go#util#PathListSep() . go_bin_path - endif - endif - - " if it's in PATH just return it - if executable(binpath) - if exists('*exepath') - let binpath = exepath(binpath) - endif - let $PATH = old_path - - if go#util#IsUsingCygwinShell() == 1 - return s:CygwinPath(binpath) - endif - - return binpath - endif - - " just get the basename - let basename = fnamemodify(binpath, ":t") - if !executable(basename) - call go#util#EchoError(printf("could not find '%s'. Run :GoInstallBinaries to fix it", basename)) - - " restore back! - let $PATH = old_path - return "" - endif - - let $PATH = old_path - - if go#util#IsUsingCygwinShell() == 1 - return s:CygwinPath(a:binpath) - endif - - return go_bin_path . go#util#PathSep() . basename -endfunction - -function! s:CygwinPath(path) - return substitute(a:path, '\\', '/', "g") -endfunction - -" go#path#ToURI converts path to a file URI. path should be an absolute path. -" Relative paths cannot be properly converted to a URI; when path is a -" relative path, the file scheme will not be prepended. -function! go#path#ToURI(path) - let l:absolute = !go#util#IsWin() && a:path[0] is# '/' - let l:prefix = '' - let l:path = a:path - - if go#util#IsWin() && l:path[1:2] is# ':\' - let l:absolute = 1 - let l:prefix = '/' . l:path[0:1] - let l:path = l:path[2:] - endif - - return substitute( - \ (l:absolute ? 'file://' : '') . l:prefix . go#uri#EncodePath(l:path), - \ '\\', - \ '/', - \ 'g', - \) -endfunction - -function! go#path#FromURI(uri) abort - let l:i = len('file://') - let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri - - let l:path = go#uri#Decode(l:encoded_path) - - " If the path is like /C:/foo/bar, it should be C:\foo\bar instead. - if go#util#IsWin() && l:path =~# '^/[a-zA-Z]:' - let l:path = substitute(l:path[1:], '/', '\\', 'g') - endif - - return l:path -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/play.vim b/sources_non_forked/vim-go/autoload/go/play.vim deleted file mode 100644 index 980421ef..00000000 --- a/sources_non_forked/vim-go/autoload/go/play.vim +++ /dev/null @@ -1,76 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#play#Share(count, line1, line2) abort - if !executable('curl') - call go#util#EchoError('cannot share: curl cannot be found') - return - endif - - let content = join(getline(a:line1, a:line2), "\n") - let share_file = tempname() - call writefile(split(content, "\n"), share_file, "b") - - let l:cmd = ['curl', '-s', '-X', 'POST', 'https://play.golang.org/share', - \ '--data-binary', '@' . l:share_file] - let [l:snippet_id, l:err] = go#util#Exec(l:cmd) - - " we can remove the temp file because it's now posted. - call delete(share_file) - - if l:err != 0 - call go#util#EchoError(['A error has occurred. Run this command to see what the problem is:', go#util#Shelljoin(l:cmd)]) - return - endif - - let url = "http://play.golang.org/p/".snippet_id - - " copy to clipboard - if has('unix') && !has('xterm_clipboard') && !has('clipboard') - let @" = url - else - let @+ = url - endif - - if go#config#PlayOpenBrowser() - call go#util#OpenBrowser(url) - endif - - call go#util#EchoInfo('snippet uploaded: ' . url) -endfunction - - -function! s:get_visual_content() abort - let save_regcont = @" - let save_regtype = getregtype('"') - silent! normal! gvy - let content = @" - call setreg('"', save_regcont, save_regtype) - return content -endfunction - -" modified version of -" http://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript -" another function that returns the content of visual selection, it's not used -" but might be useful in the future -function! s:get_visual_selection() abort - let [lnum1, col1] = getpos("'<")[1:2] - let [lnum2, col2] = getpos("'>")[1:2] - - " check if the the visual mode is used before - if lnum1 == 0 || lnum2 == 0 || col1 == 0 || col2 == 0 - return - endif - - let lines = getline(lnum1, lnum2) - let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] - let lines[0] = lines[0][col1 - 1:] - return join(lines, "\n") -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/promise.vim b/sources_non_forked/vim-go/autoload/go/promise.vim deleted file mode 100644 index 76c2f7c3..00000000 --- a/sources_non_forked/vim-go/autoload/go/promise.vim +++ /dev/null @@ -1,50 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -scriptencoding utf-8 - -" New returns a promise. A promise's primary purpose is to make async jobs -" synchronous by awaiting fn. -" -" A promise is a dictionary with two keys: -" 'wrapper': -" A function that wraps fn. It can be used in place of fn. -" 'await': -" A function that waits for wrapper to be called and returns the value -" returned by fn. Returns default if timeout expires. -function! go#promise#New(fn, timeout, default) abort - let l:state = {} - - " explicitly bind to state so that within l:promise's methods, self will - " always refer to state. See :help Partial for more information. - return { - \ 'wrapper': function('s:wrapper', [a:fn], l:state), - \ 'await': function('s:await', [a:timeout, a:default], l:state), - \ } -endfunction - -function! s:wrapper(fn, ...) dict - let self.retval = call(a:fn, a:000) - return self.retval -endfunction - -function! s:await(timeout, default) dict - let l:timer = timer_start(a:timeout, function('s:setretval', [a:default], self)) - while !has_key(self, 'retval') - sleep 50m - endwhile - call timer_stop(l:timer) - - return self.retval -endfunction - -function! s:setretval(val, timer) dict - let self.retval = a:val -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/promise_test.vim b/sources_non_forked/vim-go/autoload/go/promise_test.vim deleted file mode 100644 index f4473fe6..00000000 --- a/sources_non_forked/vim-go/autoload/go/promise_test.vim +++ /dev/null @@ -1,41 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_PromiseNew() abort - let l:sut = go#promise#New(function('s:work', []), 100, -1) - call assert_true(has_key(l:sut, 'wrapper')) - call assert_true(has_key(l:sut, 'await')) -endfunc - -func! Test_PromiseAwait() abort - let l:expected = 1 - let l:default = -1 - let l:sut = go#promise#New(function('s:work', [l:expected]), 100, l:default) - - call timer_start(10, l:sut.wrapper) - - let l:actual = call(l:sut.await, []) - call assert_equal(l:expected, l:actual) -endfunc - -func! Test_PromiseAwait_Timeout() abort - let l:desired = 1 - let l:expected = -1 - let l:sut = go#promise#New(function('s:work', [l:desired]), 10, l:expected) - - call timer_start(100, l:sut.wrapper) - - let l:actual = call(l:sut.await, []) - call assert_equal(l:expected, l:actual) -endfunc - -func! s:work(val, timer) - return a:val -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/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim deleted file mode 100644 index 738086b7..00000000 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ /dev/null @@ -1,140 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#rename#Rename(bang, ...) abort - let to_identifier = "" - if a:0 == 0 - let ask = printf("vim-go: rename '%s' to: ", expand("")) - let prefill = go#config#GorenamePrefill() - if prefill != '' - let to_identifier = input(ask, eval(prefill)) - else - let to_identifier = input(ask) - endif - redraw! - if empty(to_identifier) - return - endif - else - let to_identifier = a:1 - endif - - let l:bin = go#config#GorenameCommand() - - " return with a warning if the bin doesn't exist - let bin_path = go#path#CheckBinPath(l:bin) - if empty(bin_path) - return - endif - - let fname = expand('%:p') - let pos = go#util#OffsetCursor() - let offset = printf('%s:#%d', fname, pos) - - let args = [] - if l:bin == 'gorename' - let l:args = extend(l:args, ['-tags', go#config#BuildTags(), '-offset', offset, '-to', to_identifier]) - elseif l:bin == 'gopls' - " TODO(bc): use -tags when gopls supports it - let l:args = extend(l:args, ['rename', '-w', l:offset, to_identifier]) - else - call go#util#EchoWarning('unexpected rename command') - endif - - let l:cmd = extend([l:bin], l:args) - - if go#util#has_job() - call s:rename_job({ - \ 'cmd': cmd, - \ 'bang': a:bang, - \}) - return - endif - - let [l:out, l:err] = go#util#ExecInDir(l:cmd) - call s:parse_errors(l:err, a:bang, split(l:out, '\n')) -endfunction - -function s:rename_job(args) - let l:job_opts = { - \ 'bang': a:args.bang, - \ 'for': 'GoRename', - \ 'statustype': 'gorename', - \ } - - " autowrite is not enabled for jobs - call go#cmd#autowrite() - let l:cbs = go#job#Options(l:job_opts) - - " wrap l:cbs.exit_cb in s:exit_cb. - let l:cbs.exit_cb = funcref('s:exit_cb', [l:cbs.exit_cb]) - - call go#job#Start(a:args.cmd, l:cbs) -endfunction - -function! s:reload_changed() abort - " reload all files to reflect the new changes. We explicitly call - " checktime to trigger a reload of all files. See - " http://www.mail-archive.com/vim@vim.org/msg05900.html for more info - " about the autoread bug - let current_autoread = &autoread - set autoread - silent! checktime - let &autoread = current_autoread -endfunction - -" s:exit_cb reloads any changed buffers and then calls next. -function! s:exit_cb(next, job, exitval) abort - call s:reload_changed() - call call(a:next, [a:job, a:exitval]) -endfunction - -function s:parse_errors(exit_val, bang, out) - " reload all files to reflect the new changes. We explicitly call - " checktime to trigger a reload of all files. See - " http://www.mail-archive.com/vim@vim.org/msg05900.html for more info - " about the autoread bug - let current_autoread = &autoread - set autoread - silent! checktime - let &autoread = current_autoread - - let l:listtype = go#list#Type("GoRename") - if a:exit_val != 0 - let errors = go#util#ParseErrors(a:out) - call go#list#Populate(l:listtype, errors, 'Rename') - call go#list#Window(l:listtype, len(errors)) - if !empty(errors) && !a:bang - call go#list#JumpToFirst(l:listtype) - elseif empty(errors) - " failed to parse errors, output the original content - call go#util#EchoError(a:out) - endif - - return - endif - - " strip out newline on the end that gorename puts. If we don't remove, it - " will trigger the 'Hit ENTER to continue' prompt - call go#list#Clean(l:listtype) - call go#util#EchoSuccess(a:out[0]) - - " refresh the buffer so we can see the new content - silent execute ":e" -endfunction - -" Commandline completion: original, unexported camelCase, and exported -" CamelCase. -function! go#rename#Complete(lead, cmdline, cursor) - let l:word = expand('') - return filter(uniq(sort( - \ [l:word, go#util#camelcase(l:word), go#util#pascalcase(l:word)])), - \ 'strpart(v:val, 0, len(a:lead)) == a:lead') -endfunction - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/statusline.vim b/sources_non_forked/vim-go/autoload/go/statusline.vim deleted file mode 100644 index 9779d763..00000000 --- a/sources_non_forked/vim-go/autoload/go/statusline.vim +++ /dev/null @@ -1,124 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Statusline -"""""""""""""""""""""""""""""""" - -" s:statuses is a global reference to all statuses. It stores the statuses per -" import paths (map[string]status), where each status is unique per its -" type. Current status dict is in form: -" { -" 'desc' : 'Job description', -" 'state' : 'Job state, such as success, failure, etc..', -" 'type' : 'Job type, such as build, test, etc..' -" 'created_at' : 'Time it was created as seconds since 1st Jan 1970' -" } -let s:statuses = {} - -" timer_id for cleaner -let s:timer_id = 0 - -" last_status stores the last generated text per status -let s:last_status = "" - -" Show returns the current status of the job for 20 seconds (configurable). It -" displays it in form of 'desc: [type|state]' if there is any state available, -" if not it returns an empty string. This function should be plugged directly -" into the statusline. -function! go#statusline#Show() abort - " lazy initialization of the cleaner - if !s:timer_id - let interval = go#config#StatuslineDuration() - let s:timer_id = timer_start(interval, function('go#statusline#Clear'), {'repeat': -1}) - endif - - " nothing to show - if empty(s:statuses) - return '' - endif - - let status_dir = expand('%:p:h') - - if !has_key(s:statuses, status_dir) - return '' - endif - - let status = s:statuses[status_dir] - if !has_key(status, 'desc') || !has_key(status, 'state') || !has_key(status, 'type') - return '' - endif - - let status_text = printf("[%s|%s]", status.type, status.state) - if empty(status_text) - return '' - endif - - " only update highlight if status has changed. - if status_text != s:last_status - if status.state =~ "success" || status.state =~ "finished" || status.state =~ "pass" || status.state =~ 'initialized' - hi goStatusLineColor cterm=bold ctermbg=76 ctermfg=22 guibg=#5fd700 guifg=#005f00 - elseif status.state =~ "started" || status.state =~ "analysing" || status.state =~ "compiling" || status.state =~ 'initializing' - hi goStatusLineColor cterm=bold ctermbg=208 ctermfg=88 guibg=#ff8700 guifg=#870000 - elseif status.state =~ "failed" - hi goStatusLineColor cterm=bold ctermbg=196 ctermfg=52 guibg=#ff0000 guifg=#5f0000 - endif - endif - - let s:last_status = status_text - return status_text -endfunction - -" Update updates (adds) the statusline for the given status_dir with the -" given status dict. It overrides any previously set status. -function! go#statusline#Update(status_dir, status) abort - let a:status.created_at = reltime() - let s:statuses[a:status_dir] = a:status - - " force to update the statusline, otherwise the user needs to move the - " cursor - exe 'let &ro = &ro' - - " before we stop the timer, check if we have any previous jobs to be cleaned - " up. Otherwise every job will reset the timer when this function is called - " and thus old jobs will never be cleaned - call s:clear() - - " also reset the timer, so the user has time to see it in the statusline. - " Setting the timer_id to 0 will cause a new timer to be created the next - " time the go#statusline#Show() is called. - call timer_stop(s:timer_id) - let s:timer_id = 0 -endfunction - -" Clear clears all currently stored statusline data. The timer_id argument is -" just a placeholder so we can pass it to a timer_start() function if needed. -function! go#statusline#Clear(timer_id) abort - call s:clear() -endfunction - -function! s:clear() - for [status_dir, status] in items(s:statuses) - let elapsed_time = reltimestr(reltime(status.created_at)) - " strip whitespace - let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '') - - if str2nr(elapsed_time) > 10 - call remove(s:statuses, status_dir) - endif - endfor - - if len(s:statuses) == 0 - let s:statuses = {} - endif - - " force to update the statusline, otherwise the user needs to move the - " cursor - exe 'let &ro = &ro' -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/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim deleted file mode 100644 index c1239b02..00000000 --- a/sources_non_forked/vim-go/autoload/go/tags.vim +++ /dev/null @@ -1,219 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" mapped to :GoAddTags -function! go#tags#Add(start, end, count, ...) abort - let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - let offset = 0 - if a:count == -1 - let offset = go#util#OffsetCursor() - endif - - let test_mode = 0 - call call("go#tags#run", [a:start, a:end, offset, "add", fname, test_mode] + a:000) -endfunction - -" mapped to :GoRemoveTags -function! go#tags#Remove(start, end, count, ...) abort - let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') - let offset = 0 - if a:count == -1 - let offset = go#util#OffsetCursor() - endif - - let test_mode = 0 - call call("go#tags#run", [a:start, a:end, offset, "remove", fname, test_mode] + a:000) -endfunction - -" run runs gomodifytag. This is an internal test so we can test it -function! go#tags#run(start, end, offset, mode, fname, test_mode, ...) abort - " do not split this into multiple lines, somehow tests fail in that case - let args = {'mode': a:mode,'start': a:start,'end': a:end,'offset': a:offset,'fname': a:fname,'cmd_args': a:000} - - if &modified - let args["modified"] = 1 - endif - - let l:result = s:create_cmd(args) - if has_key(result, 'err') - call go#util#EchoError(result.err) - return -1 - endif - - if &modified - let filename = expand("%:p:gs!\\!/!") - let content = join(go#util#GetLines(), "\n") - let in = filename . "\n" . strlen(content) . "\n" . content - let [l:out, l:err] = go#util#Exec(l:result.cmd, in) - else - let [l:out, l:err] = go#util#Exec(l:result.cmd) - endif - - if l:err != 0 - call go#util#EchoError(out) - return - endif - - if a:test_mode - exe 'edit ' . a:fname - endif - - call s:write_out(out) - - if a:test_mode - exe 'write! ' . a:fname - endif -endfunc - - -" write_out writes back the given output to the current buffer -func s:write_out(out) abort - " not a json output - if a:out[0] !=# '{' - return - endif - - " nothing to do - if empty(a:out) || type(a:out) != type("") - return - endif - - let result = json_decode(a:out) - if type(result) != type({}) - call go#util#EchoError(printf("malformed output from gomodifytags: %s", a:out)) - return - endif - - let lines = result['lines'] - let start_line = result['start'] - let end_line = result['end'] - - let index = 0 - for line in range(start_line, end_line) - call setline(line, lines[index]) - let index += 1 - endfor - - if has_key(result, 'errors') - let l:winnr = winnr() - let l:listtype = go#list#Type("GoModifyTags") - call go#list#ParseFormat(l:listtype, "%f:%l:%c:%m", result['errors'], "gomodifytags") - call go#list#Window(l:listtype, len(result['errors'])) - - "prevent jumping to quickfix list - exe l:winnr . "wincmd w" - endif -endfunc - - -" create_cmd returns a dict that contains the command to execute gomodifytags -func s:create_cmd(args) abort - if !exists("*json_decode") - return {'err': "requires 'json_decode'. Update your Vim/Neovim version."} - endif - - let bin_path = go#path#CheckBinPath('gomodifytags') - if empty(bin_path) - return {'err': "gomodifytags does not exist"} - endif - - let l:start = a:args.start - let l:end = a:args.end - let l:offset = a:args.offset - let l:mode = a:args.mode - let l:cmd_args = a:args.cmd_args - let l:modifytags_transform = go#config#AddtagsTransform() - - " start constructing the command - let cmd = [bin_path] - call extend(cmd, ["-format", "json"]) - call extend(cmd, ["-file", a:args.fname]) - call extend(cmd, ["-transform", l:modifytags_transform]) - - if has_key(a:args, "modified") - call add(cmd, "-modified") - endif - - if l:offset != 0 - call extend(cmd, ["-offset", l:offset]) - else - let range = printf("%d,%d", l:start, l:end) - call extend(cmd, ["-line", range]) - endif - - if l:mode == "add" - let l:tags = [] - let l:options = [] - - if !empty(l:cmd_args) - for item in l:cmd_args - let splitted = split(item, ",") - - " tag only - if len(splitted) == 1 - call add(l:tags, splitted[0]) - endif - - " options only - if len(splitted) == 2 - call add(l:tags, splitted[0]) - call add(l:options, printf("%s=%s", splitted[0], splitted[1])) - endif - endfor - endif - - " default value - if empty(l:tags) - let l:tags = ["json"] - endif - - " construct tags - call extend(cmd, ["-add-tags", join(l:tags, ",")]) - - " construct options - if !empty(l:options) - call extend(cmd, ["-add-options", join(l:options, ",")]) - endif - elseif l:mode == "remove" - if empty(l:cmd_args) - call add(cmd, "-clear-tags") - else - let l:tags = [] - let l:options = [] - for item in l:cmd_args - let splitted = split(item, ",") - - " tag only - if len(splitted) == 1 - call add(l:tags, splitted[0]) - endif - - " options only - if len(splitted) == 2 - call add(l:options, printf("%s=%s", splitted[0], splitted[1])) - endif - endfor - - " construct tags - if !empty(l:tags) - call extend(cmd, ["-remove-tags", join(l:tags, ",")]) - endif - - " construct options - if !empty(l:options) - call extend(cmd, ["-remove-options", join(l:options, ",")]) - endif - endif - else - return {'err': printf("unknown mode: %s", l:mode)} - endif - - return {'cmd': cmd} -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/tags_test.vim b/sources_non_forked/vim-go/autoload/go/tags_test.vim deleted file mode 100644 index 17aec410..00000000 --- a/sources_non_forked/vim-go/autoload/go/tags_test.vim +++ /dev/null @@ -1,52 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! TestAddTags() abort - try - let l:tmp = gotest#load_fixture('tags/add_all_input.go') - silent call go#tags#run(0, 0, 40, "add", bufname(''), 1) - call gotest#assert_fixture('tags/add_all_golden.go') - finally - call delete(l:tmp, 'rf') - endtry -endfunc - - -func! TestAddTags_WithOptions() abort - try - let l:tmp = gotest#load_fixture('tags/add_all_input.go') - silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') - call gotest#assert_fixture('tags/add_all_golden_options.go') - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! TestAddTags_AddOptions() abort - try - let l:tmp = gotest#load_fixture('tags/add_all_input.go') - silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json') - call gotest#assert_fixture('tags/add_all_golden.go') - silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') - call gotest#assert_fixture('tags/add_all_golden_options.go') - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_remove_tags() abort - try - let l:tmp = gotest#load_fixture('tags/remove_all_input.go') - silent call go#tags#run(0, 0, 40, "remove", bufname(''), 1) - call gotest#assert_fixture('tags/remove_all_golden.go') - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/autoload/go/template.vim b/sources_non_forked/vim-go/autoload/go/template.vim deleted file mode 100644 index 404047ae..00000000 --- a/sources_non_forked/vim-go/autoload/go/template.vim +++ /dev/null @@ -1,61 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:current_file = expand("") - -function! go#template#create() abort - let l:go_template_use_pkg = go#config#TemplateUsePkg() - let l:root_dir = fnamemodify(s:current_file, ':h:h:h') - - let l:package_name = go#tool#PackageName() - - " if we can't figure out any package name (i.e. no Go files in the directory) - " from the directory create the template or use the directory as the name. - if l:package_name == -1 - if l:go_template_use_pkg == 1 - let l:path = fnamemodify(expand('%:p:h'), ':t') - let l:content = printf("package %s", l:path) - call append(0, l:content) - else - let l:filename = expand('%:t') - if l:filename =~ "_test.go$" - let l:template_file = go#config#TemplateTestFile() - else - let l:template_file = go#config#TemplateFile() - endif - " If template_file is an absolute path, use it as-is. This is to support - " overrides pointing to templates outside of the vim-go plugin dir - if fnamemodify(l:template_file, ':p') != l:template_file - let l:template_file = go#util#Join(l:root_dir, "templates", l:template_file) - endif - - silent exe 'keepalt 0r ' . fnameescape(l:template_file) - endif - else - let l:content = printf("package %s", l:package_name) - call append(0, l:content) - endif - " checking that the last line is empty shouldn't be necessary, but for some - " reason the last line isn't the expected empty line when run via tests. - if getline('$') is '' - $delete _ - endif -endfunction - -function! go#template#ToggleAutoCreate() abort - if go#config#TemplateAutocreate() - call go#config#SetTemplateAutocreate(0) - call go#util#EchoProgress("auto template create disabled") - return - end - - call go#config#SetTemplateAutocreate(1) - call go#util#EchoProgress("auto template create enabled") -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/template_test.vim b/sources_non_forked/vim-go/autoload/go/template_test.vim deleted file mode 100644 index 2e02580d..00000000 --- a/sources_non_forked/vim-go/autoload/go/template_test.vim +++ /dev/null @@ -1,62 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_TemplateCreate() abort - try - let l:tmp = gotest#write_file('foo/empty.txt', ['']) - - edit foo/bar.go - - call gotest#assert_buffer(1, [ - \ 'func main() {', - \ '\tfmt.Println("vim-go")', - \ '}']) - finally - call delete(l:tmp, 'rf') - endtry - - try - let l:tmp = gotest#write_file('foo/empty.txt', ['']) - edit foo/bar_test.go - - call gotest#assert_buffer(1, [ - \ 'func TestHelloWorld(t *testing.T) {', - \ '\t// t.Fatal("not implemented")', - \ '}']) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_TemplateCreate_UsePkg() abort - try - let l:tmp = gotest#write_file('foo/empty.txt', ['']) - - let g:go_template_use_pkg = 1 - edit foo/bar.go - - call gotest#assert_buffer(0, ['package foo']) - finally - unlet g:go_template_use_pkg - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_TemplateCreate_PackageExists() abort - try - let l:tmp = gotest#write_file('quux/quux.go', ['package foo']) - - edit quux/bar.go - - call gotest#assert_buffer(0, ['package foo']) - 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/term.vim b/sources_non_forked/vim-go/autoload/go/term.vim deleted file mode 100644 index 5e3efd0d..00000000 --- a/sources_non_forked/vim-go/autoload/go/term.vim +++ /dev/null @@ -1,177 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" new creates a new terminal with the given command. Mode is set based on the -" global variable g:go_term_mode, which is by default set to :vsplit -function! go#term#new(bang, cmd, errorformat) abort - return go#term#newmode(a:bang, a:cmd, a:errorformat, go#config#TermMode()) -endfunction - -" go#term#newmode creates a new terminal with the given command and window mode. -function! go#term#newmode(bang, cmd, errorformat, mode) abort - let l:mode = a:mode - if empty(l:mode) - let l:mode = go#config#TermMode() - endif - - let l:state = { - \ 'cmd': a:cmd, - \ 'bang' : a:bang, - \ 'winid': win_getid(winnr()), - \ 'stdout': [], - \ 'stdout_buf': '', - \ 'errorformat': a:errorformat, - \ } - - " execute go build in the files directory - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let l:dir = getcwd() - - execute l:cd . fnameescape(expand("%:p:h")) - - execute l:mode . ' __go_term__' - - setlocal filetype=goterm - setlocal bufhidden=delete - setlocal winfixheight - setlocal noswapfile - setlocal nobuflisted - - " explicitly bind callbacks to state so that within them, self will always - " refer to state. See :help Partial for more information. - " - " Don't set an on_stderr, because it will be passed the same data as - " on_stdout. See https://github.com/neovim/neovim/issues/2836 - let l:job = { - \ 'on_stdout': function('s:on_stdout', [], state), - \ 'on_exit' : function('s:on_exit', [], state), - \ } - - let l:state.id = termopen(a:cmd, l:job) - let l:state.termwinid = win_getid(winnr()) - - execute l:cd . fnameescape(l:dir) - - " resize new term if needed. - let l:height = go#config#TermHeight() - let l:width = go#config#TermWidth() - - " Adjust the window width or height depending on whether it's a vertical or - " horizontal split. - if l:mode =~ "vertical" || l:mode =~ "vsplit" || l:mode =~ "vnew" - exe 'vertical resize ' . l:width - elseif mode =~ "split" || mode =~ "new" - exe 'resize ' . l:height - endif - - " we also need to resize the pty, so there you go... - call jobresize(l:state.id, l:width, l:height) - - call win_gotoid(l:state.winid) - - return l:state.id -endfunction - -function! s:on_stdout(job_id, data, event) dict abort - " A single empty string means EOF was reached. The first item will never be - " the empty string except for when it's the only item and is signaling that - " EOF was reached. - if len(a:data) == 1 && a:data[0] == '' - " when there's nothing buffered, return early so that an - " erroneous message will not be added. - if self.stdout_buf == '' - return - endif - - let self.stdout = add(self.stdout, self.stdout_buf) - else - let l:data = copy(a:data) - let l:data[0] = self.stdout_buf . l:data[0] - - " The last element may be a partial line; save it for next time. - let self.stdout_buf = l:data[-1] - let self.stdout = extend(self.stdout, l:data[:-2]) - endif -endfunction - -function! s:on_exit(job_id, exit_status, event) dict abort - let l:winid = win_getid(winnr()) - call win_gotoid(self.winid) - - " change to directory where test were run. if we do not do this - " the quickfix items will have the incorrect paths. - " see: https://github.com/fatih/vim-go/issues/2400 - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let l:dir = getcwd() - execute l:cd . fnameescape(expand("%:p:h")) - - let l:listtype = go#list#Type("_term") - - if a:exit_status == 0 - call go#list#Clean(l:listtype) - execute l:cd l:dir - call win_gotoid(l:winid) - return - endif - - call win_gotoid(self.winid) - - let l:title = self.cmd - if type(l:title) == v:t_list - let l:title = join(self.cmd) - endif - - let l:i = 0 - while l:i < len(self.stdout) - let self.stdout[l:i] = substitute(self.stdout[l:i], "\r$", '', 'g') - let l:i += 1 - endwhile - - call go#list#ParseFormat(l:listtype, self.errorformat, self.stdout, l:title) - let l:errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(l:errors)) - - if empty(l:errors) - call go#util#EchoError( '[' . l:title . '] ' . "FAIL") - execute l:cd l:dir - call win_gotoid(l:winid) - return - endif - - " close terminal; we don't need it anymore - if go#config#TermCloseOnExit() - call win_gotoid(self.termwinid) - close! - endif - - if self.bang - execute l:cd l:dir - call win_gotoid(l:winid) - return - endif - - call win_gotoid(self.winid) - call go#list#JumpToFirst(l:listtype) - - " change back to original working directory - execute l:cd l:dir -endfunction - -function! go#term#ToggleCloseOnExit() abort - if go#config#TermCloseOnExit() - call go#config#SetTermCloseOnExit(0) - call go#util#EchoProgress("term close on exit disabled") - return - endif - - call go#config#SetTermCloseOnExit(1) - call go#util#EchoProgress("term close on exit enabled") - return -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/term_test.vim b/sources_non_forked/vim-go/autoload/go/term_test.vim deleted file mode 100644 index 0d5d1d94..00000000 --- a/sources_non_forked/vim-go/autoload/go/term_test.vim +++ /dev/null @@ -1,60 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_GoTermNewMode() - if !has('nvim') - return - endif - - try - let l:filename = 'term/term.go' - let l:tmp = gotest#load_fixture(l:filename) - exe 'cd ' . l:tmp . '/src/term' - - let expected = expand('%:p') - - let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) - - set nosplitright - call go#term#new(0, cmd, &errorformat) - let actual = expand('%:p') - call assert_equal(actual, l:expected) - - finally - sleep 50m - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_GoTermNewMode_SplitRight() - if !has('nvim') - return - endif - - try - let l:filename = 'term/term.go' - let l:tmp = gotest#load_fixture(l:filename) - exe 'cd ' . l:tmp . '/src/term' - - let expected = expand('%:p') - - let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) - - set splitright - call go#term#new(0, cmd, &errorformat) - let actual = expand('%:p') - call assert_equal(actual, l:expected) - - finally - sleep 50m - call delete(l:tmp, 'rf') - set nosplitright - 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/test-fixtures/cmd/bad.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/cmd/bad.go deleted file mode 100644 index a1cc46ea..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/cmd/bad.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func main() { - notafunc() -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go deleted file mode 100644 index f25063fe..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/complete/complete.go +++ /dev/null @@ -1,9 +0,0 @@ -package complete - -type T struct { - V string -} - -func Example(s string) { - Example("") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/buildtags.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/buildtags.go deleted file mode 100644 index 5bf7a888..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/buildtags.go +++ /dev/null @@ -1,5 +0,0 @@ -package config - -func Example() { - foo() -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/constrainedfoo.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/constrainedfoo.go deleted file mode 100644 index 1a7b3f21..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/constrainedfoo.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build constrained - -package config - -// foo is constrained and this comment exists to make the line numbers different than foo.go -func foo() { - println("foo") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/foo.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/foo.go deleted file mode 100644 index 69266c7b..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/foo.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !constrained - -package config - -func foo() { - println("foo") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/go.mod b/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/go.mod deleted file mode 100644 index d930dc72..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/config/buildtags/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module config - -go 1.13 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/compilerror/main.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/compilerror/main.go deleted file mode 100644 index 3f3dc7c2..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/compilerror/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go" -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/debugmain/debugmain.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/debugmain/debugmain.go deleted file mode 100644 index 50e8d8d3..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/debug/debugmain/debugmain.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go deleted file mode 100644 index 50e8d8d3..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/def/jump.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go deleted file mode 100644 index 3be42f6a..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - - func main() { -fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go deleted file mode 100644 index 50e8d8d3..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/hello_golden.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports.go deleted file mode 100644 index eec47f82..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import ( - "fmt" -) - -func Foo(log *logging.TestLogger) { -log.Debug("vim-go") -} - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports_golden.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports_golden.go deleted file mode 100644 index 3719f6b3..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports_golden.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -import ( - "fmt" - - logging "gh.com/gi/foo-logging" -) - -func Foo(log *logging.TestLogger) { - log.Debug("vim-go") -} - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/vendor/gh.com/gi/foo-logging/logger.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/vendor/gh.com/gi/foo-logging/logger.go deleted file mode 100644 index 13960188..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/vendor/gh.com/gi/foo-logging/logger.go +++ /dev/null @@ -1,12 +0,0 @@ -package logging - -import "fmt" - -type TestLogger struct { - Value string -} - -func (l *TestLogger) Debug(msg string) { - fmt.Println(msg) - fmt.Println(l.Value) -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports b/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports deleted file mode 100644 index 60ee2537..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports +++ /dev/null @@ -1 +0,0 @@ -../imports/ \ No newline at end of file diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/job/dir has spaces/main.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/job/dir has spaces/main.go deleted file mode 100644 index 5d31fef0..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/job/dir has spaces/main.go +++ /dev/null @@ -1,6 +0,0 @@ -package main - -func main() { - notafunc() - println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/foo.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/foo.go deleted file mode 100644 index 594af18f..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/foo/foo.go +++ /dev/null @@ -1,7 +0,0 @@ -package foo - -import "fmt" - -func MissingFooDoc() { - fmt.Println("missing doc") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/lint.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/lint.go deleted file mode 100644 index 52446f52..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/lint.go +++ /dev/null @@ -1,7 +0,0 @@ -package lint - -import "fmt" - -func MissingDoc() { - fmt.Println("missing doc") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/quux.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/quux.go deleted file mode 100644 index 85c411d8..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/lint/quux.go +++ /dev/null @@ -1,7 +0,0 @@ -package lint - -import "fmt" - -func AlsoMissingDoc() { - fmt.Println("missing doc") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/compilererror/compilererror.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/compilererror/compilererror.go deleted file mode 100644 index 3f3dc7c2..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/compilererror/compilererror.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go" -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/vet.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/vet.go deleted file mode 100644 index d3a8e04e..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/lint/src/vet/vet.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import "fmt" - -func main() { - str := "hello world!" - fmt.Printf("%d\n", str) -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod deleted file mode 100644 index d414eac7..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module package - -go 1.12 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go deleted file mode 100644 index 50e8d8d3..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/term/term.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/term/term.go deleted file mode 100644 index 73d83e64..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/term/term.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func main() { - println("hello, world") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/.gitignore b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/.gitignore deleted file mode 100644 index fc5bd908..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/pkg diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/compilerror.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/compilerror.go deleted file mode 100644 index 3f3dc7c2..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/compilerror/compilerror.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go" -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go deleted file mode 100644 index bdcc2e10..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -import ( - "fmt" -) - -func ExampleHelloWorld() { - fmt.Println("Hello, World") - // Output: What's shakin -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/mock/controller.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/mock/controller.go deleted file mode 100644 index 893d6e90..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/mock/controller.go +++ /dev/null @@ -1,7 +0,0 @@ -package mock - -import "testing" - -func Fail(t *testing.T) { - t.Fatal("another package badness") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/play_test.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/play_test.go deleted file mode 100644 index 0270e89e..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/play/play_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package play - -import ( - "sync" - "testing" - - "play/mock" -) - -func TestTopSubHelper(t *testing.T) { - t.Run("sub", func(t *testing.T) { - t.Log("log message") - t.Error("sub badness") - }) - t.Error("badness") - helper(t) -} - -func TestMultiline(t *testing.T) { - t.Error("this is an error\nand a second line, too") - t.Error("\nthis is another error") -} - -func TestSub(t *testing.T) { - t.Run("indented", func(t *testing.T) { - t.Error("this is a sub-test error\nand a second line, too") - }) -} - -func TestOK(t *testing.T) { - t.Run("log", func(t *testing.T) { - t.Log("goodness") - }) -} - -// TestMocked tests behavior similar to what users may experience when using -// github.com/golang/mock/gomock. -func TestMocked(t *testing.T) { - mock.Fail(t) -} - -func TestPanic(t *testing.T) { - panic("worst ever") -} - -func TestConcurrentPanic(t *testing.T) { - var wg sync.WaitGroup - wg.Add(1) - go func() { - panic("concurrent fail") - wg.Done() - }() - wg.Wait() -} - -func helper(t *testing.T) { - t.Helper() - t.Fatal("helper badness") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/showname_test.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/showname_test.go deleted file mode 100644 index b1290cea..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/showname/showname_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import "testing" - -func TestHelloWorld(t *testing.T) { - t.Error("so long") - - t.Run("sub", func(t *testing.T) { - t.Error("thanks for all the fish") - }) -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/testcompilerror_test.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/testcompilerror_test.go deleted file mode 100644 index 75fdade0..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/testcompilerror/testcompilerror_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import ( - "io/ioutil" - "testing" -) - -func TestSomething(t *testing.T) { - r := struct{}{} - ioutil.ReadAll(r) -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/timeout_test.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/timeout_test.go deleted file mode 100644 index 502c39e8..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/timeout/timeout_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Run a few parallel tests, all in parallel, using multiple techniques for -// causing the test to take a while so that the stacktraces resulting from a -// test timeout will contain several goroutines to avoid giving a false sense -// of confidence or creating error formats that don't account for the more -// complex scenarios that can occur with timeouts. - -package main - -import ( - "testing" - "time" -) - -func TestSleep(t *testing.T) { - t.Parallel() - time.Sleep(15 * time.Second) - t.Log("expected panic if run with timeout < 15s") -} - -func TestRunning(t *testing.T) { - t.Parallel() - c := time.After(15 * time.Second) -Loop: - for { - select { - case <-c: - break Loop - default: - } - } - - t.Log("expected panic if run with timeout < 15s") -} - -func TestRunningAlso(t *testing.T) { - t.Parallel() - c := time.After(15 * time.Second) -Loop: - for { - select { - case <-c: - break Loop - default: - } - } - t.Log("expected panic if run with timeout < 15s") -} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/veterror.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/veterror.go deleted file mode 100644 index 8c585f22..00000000 --- a/sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/veterror/veterror.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Errorf("%v") -} diff --git a/sources_non_forked/vim-go/autoload/go/test.vim b/sources_non_forked/vim-go/autoload/go/test.vim deleted file mode 100644 index ff15c8da..00000000 --- a/sources_non_forked/vim-go/autoload/go/test.vim +++ /dev/null @@ -1,329 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Test runs `go test` in the current directory. If compile is true, it'll -" compile the tests instead of running them (useful to catch errors in the -" test files). Any other argument is appended to the final `go test` command. -function! go#test#Test(bang, compile, ...) abort - let args = ["test", '-tags', go#config#BuildTags()] - - " don't run the test, only compile it. Useful to capture and fix errors. - if a:compile - let testfile = tempname() . ".vim-go.test" - call extend(args, ["-c", "-o", testfile]) - endif - - if a:0 - let goargs = a:000 - - " do not expand for coverage mode as we're passing the arg ourself - if a:1 != '-coverprofile' - " expand all wildcards(i.e: '%' to the current file name) - let goargs = map(copy(a:000), "expand(v:val)") - endif - - call extend(args, goargs, 1) - else - " only add this if no custom flags are passed - let timeout = go#config#TestTimeout() - call add(args, printf("-timeout=%s", timeout)) - endif - - if go#config#TermEnabled() - call go#term#new(a:bang, ["go"] + args, s:errorformat()) - return - endif - - if go#util#has_job() - " use vim's job functionality to call it asynchronously - let job_options = { - \ 'bang': a:bang, - \ 'for': 'GoTest', - \ 'statustype': 'test', - \ 'errorformat': s:errorformat(), - \ } - - if a:compile - let job_options.statustype = 'compile ' . job_options.statustype - endif - - call s:test_job(['go'] + args, job_options) - return - endif - - if go#config#EchoCommandInfo() - if a:compile - call go#util#EchoProgress("compiling tests ...") - else - call go#util#EchoProgress("testing...") - endif - endif - - call go#cmd#autowrite() - redraw - - let l:cmd = ['go'] + l:args - - let [l:out, l:err] = go#util#ExecInDir(l:cmd) - " TODO(bc): When the output is JSON, the JSON should be run through a - " filter to produce lines that are more easily described by errorformat. - - let l:listtype = go#list#Type("GoTest") - - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - execute cd fnameescape(expand("%:p:h")) - - if l:err != 0 - let l:winid = win_getid(winnr()) - call go#list#ParseFormat(l:listtype, s:errorformat(), split(out, '\n'), l:cmd) - let errors = go#list#Get(l:listtype) - call go#list#Window(l:listtype, len(errors)) - if empty(errors) - " failed to parse errors, output the original content - call go#util#EchoError(out) - elseif a:bang - call win_gotoid(l:winid) - else - call go#list#JumpToFirst(l:listtype) - endif - else - call go#list#Clean(l:listtype) - - if a:compile - call go#util#EchoSuccess("[test] SUCCESS") - else - call go#util#EchoSuccess("[test] PASS") - endif - endif - execute cd . fnameescape(dir) -endfunction - -" Testfunc runs a single test that surrounds the current cursor position. -" Arguments are passed to the `go test` command. -function! go#test#Func(bang, ...) abort - " search flags legend (used only) - " 'b' search backward instead of forward - " 'c' accept a match at the cursor position - " 'n' do Not move the cursor - " 'W' don't wrap around the end of the file - " - " for the full list - " :help search - let test = search('func \(Test\|Example\)', "bcnW") - - if test == 0 - echo "vim-go: [test] no test found immediate to cursor" - return - end - - let line = getline(test) - let name = split(split(line, " ")[1], "(")[0] - let args = [a:bang, 0, "-run", name . "$"] - - if a:0 - call extend(args, a:000) - else - " only add this if no custom flags are passed - let timeout = go#config#TestTimeout() - call add(args, printf("-timeout=%s", timeout)) - endif - - call call('go#test#Test', args) -endfunction - -function! s:test_job(cmd, args) abort - " autowrite is not enabled for jobs - call go#cmd#autowrite() - - call go#job#Spawn(a:cmd, a:args) -endfunction - -let s:efm = "" -let s:go_test_show_name = 0 - -function! s:errorformat() abort - " NOTE(arslan): once we get JSON output everything will be easier :). - " TODO(bc): When the output is JSON, the JSON should be run through a - " filter to produce lines that are more easily described by errorformat. - " https://github.com/golang/go/issues/2981. - let goroot = go#util#goroot() - - let show_name = go#config#TestShowName() - if s:efm != "" && s:go_test_show_name == show_name - return s:efm - endif - let s:go_test_show_name = show_name - - " each level of test indents the test output 4 spaces. Capturing groups - " (e.g. \(\)) cannot be used in an errorformat, but non-capturing groups can - " (e.g. \%(\)). - let indent = '%\\%( %\\)' - - " ignore `go test -v` output for starting tests - let format = "%-G=== RUN %.%#" - " ignore `go test -v` output for passing tests - let format .= ",%-G" . indent . "%#--- PASS: %.%#" - - " Match failure lines. - - " Example failures start with '--- FAIL: ', followed by the example name - " followed by a space , followed by the duration of the example in - " parantheses. They aren't nested, though, so don't check for indentation. - " The errors from them also aren't indented and don't report file location - " or line numbers, so those won't show up. This will at least let the user - " know which example failed, though. - let format .= ',%G--- FAIL: %\\%(Example%\\)%\\@=%m (%.%#)' - - " Test failures start with '--- FAIL: ', followed by the test name followed - " by a space, followed by the duration of the test in parentheses. - " - " e.g.: - " '--- FAIL: TestSomething (0.00s)' - if show_name - let format .= ",%G" . indent . "%#--- FAIL: %m (%.%#)" - else - let format .= ",%-G" . indent . "%#--- FAIL: %.%#" - endif - - " Go 1.10 test output {{{1 - " Matches test output lines. - " - " All test output lines start with the test indentation and a tab, followed - " by the filename, a colon, the line number, another colon, a space, and the - " message. e.g.: - " '\ttime_test.go:30: Likely problem: the time zone files have not been installed.' - let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: %m" - " also match lines that don't have a message (i.e. the message begins with a - " newline or is the empty string): - " e.g.: - " t.Errorf("\ngot %v; want %v", actual, expected) - " t.Error("") - let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: " - - " Match the 2nd and later lines of multi-line output. These lines are - " indented the number of spaces for the level of nesting of the test, - " followed by two tabs, followed by the message. - " - " Treat these lines as if they are stand-alone lines of output by using %G. - " It would also be valid to treat these lines as if they were the - " continuation of a multi-line error by using %C instead of %G, but that - " would also require that all test errors using a %A or %E modifier to - " indicate that they're multiple lines of output, but in that case the lines - " get concatenated in the quickfix list, which is not what users typically - " want when writing a newline into their test output. - let format .= ",%G" . indent . "%#%\\t%\\{2}%m" - " }}}1 - - " Go 1.11 test output {{{1 - " Match test output lines similarly to Go 1.10 test output lines, but they - " use an indent level where the Go 1.10 test output uses tabs, so they'll - " always have at least one level indentation... - let format .= ",%A" . indent . "%\\+%f:%l: %m" - let format .= ",%A" . indent . "%\\+%f:%l: " - let format .= ",%G" . indent . "%\\{2\\,}%m" - " }}}1 - - " set the format for panics. - - " handle panics from test timeouts - let format .= ",%+Gpanic: test timed out after %.%\\+" - - " handle non-timeout panics - " In addition to 'panic', check for 'fatal error' to support older versions - " of Go that used 'fatal error'. - " - " Panics come in two flavors. When the goroutine running the tests panics, - " `go test` recovers and tries to exit more cleanly. In that case, the panic - " message is suffixed with ' [recovered]'. If the panic occurs in a - " different goroutine, it will not be suffixed with ' [recovered]'. - let format .= ",%+Afatal error: %.%# [recovered]" - let format .= ",%+Apanic: %.%# [recovered]" - let format .= ",%+Afatal error: %.%#" - let format .= ",%+Apanic: %.%#" - - " Match address lines in stacktraces produced by panic. - " - " Address lines in the stack trace have leading tabs, followed by the path - " to the file. The file path is followed by a colon and then the line number - " within the file where the panic occurred. After that there's a space and - " hexadecimal number. - " - " e.g.: - " '\t/usr/local/go/src/time.go:1313 +0x5d' - - " panicaddress and readyaddress are identical except for - " panicaddress sets the filename and line number. - let panicaddress = "%\\t%f:%l +0x%[0-9A-Fa-f]%\\+" - let readyaddress = "%\\t%\\f%\\+:%\\d%\\+ +0x%[0-9A-Fa-f]%\\+" - " stdlib address is identical to readyaddress, except it matches files - " inside GOROOT. - let stdlibaddress = "%\\t" . goroot . "%\\f%\\+:%\\d%\\+ +0x%[0-9A-Fa-f]%\\+" - - " Match and ignore the running goroutine line. - let format .= ",%-Cgoroutine %\\d%\\+ [running]:" - " Match address lines that refer to stdlib, but consider them informational - " only. This is to catch the lines after the first address line in the - " running goroutine of a panic stack trace. Ideally, this wouldn't be - " necessary, but when a panic happens in the goroutine running a test, it's - " recovered and another panic is created, so the stack trace actually has - " the line that caused the original panic a couple of addresses down the - " stack. - let format .= ",%-C" . stdlibaddress - " Match address lines in the first matching goroutine. This means the panic - " message will only be shown as the error message in the first address of - " the running goroutine's stack. - let format .= ",%Z" . panicaddress - - " Match and ignore errors from runtime.goparkunlock(). These started - " appearing in stack traces from Go 1.12 test timeouts. - let format .= ",%-Gruntime.goparkunlock(%.%#" - let format .= ",%-G%\\t" . goroot . "%\\f%\\+:%\\d%\\+" - - " Match and ignore panic address without being part of a multi-line message. - " This is to catch those lines that come after the top most non-standard - " library line in stack traces. - let format .= ",%-G" . readyaddress - - " Match and ignore exit status lines (produced when go test panics) whether - " part of a multi-line message or not, because these lines sometimes come - " before and sometimes after panic stacktraces. - let format .= ",%-Cexit status %[0-9]%\\+" - "let format .= ",exit status %[0-9]%\\+" - - " Match and ignore failure lines whether part of a multi-line message - " or not, because these lines sometimes come before and sometimes after - " panic stacktraces. - let format .= ",%-CFAIL%\\t%.%#" - "let format .= ",FAIL%\\t%.%#" - - " match compiler errors. - " These are very smilar to errors from <=go1.10 test output, but lack - " leading tabs for the first line of an error, and subsequent lines only - " have one tab instead of two. - let format .= ",%A%f:%l:%c: %m" - let format .= ",%A%f:%l: %m" - " It would be nice if this weren't necessary, but panic lines from tests are - " prefixed with a single leading tab, making them very similar to 2nd and - " later lines of a multi-line compiler error. Swallow it so that it doesn't - " cause a quickfix entry since the next %G entry can add a quickfix entry - " for 2nd and later lines of a multi-line compiler error. - let format .= ",%-C%\\tpanic: %.%#" - let format .= ",%G%\\t%m" - - " Match and ignore everything else in multi-line messages. - let format .= ",%-C%.%#" - " Match and ignore everything else not in a multi-line message: - let format .= ",%-G%.%#" - - let s:efm = format - - return s:efm -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/test_test.vim b/sources_non_forked/vim-go/autoload/go/test_test.vim deleted file mode 100644 index 322abed6..00000000 --- a/sources_non_forked/vim-go/autoload/go/test_test.vim +++ /dev/null @@ -1,143 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_GoTest() abort - let expected = [ - \ {'lnum': 12, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'log message'}, - \ {'lnum': 13, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'sub badness'}, - \ {'lnum': 15, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'badness'}, - \ {'lnum': 16, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'helper badness'}, - \ {'lnum': 20, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is an error'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'and a second line, too'}, - \ {'lnum': 21, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is another error'}, - \ {'lnum': 26, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is a sub-test error'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'and a second line, too'}, - \ {'lnum': 6, 'bufnr': 3, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'another package badness'}, - \ {'lnum': 43, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'panic: worst ever [recovered]'} - \ ] - call s:test('play/play_test.go', expected) -endfunc - -func! Test_GoTestConcurrentPanic() - let expected = [ - \ {'lnum': 50, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'panic: concurrent fail'} - \ ] - call s:test('play/play_test.go', expected, "-run", "TestConcurrentPanic") -endfunc - -func! Test_GoTestVerbose() abort - let expected = [ - \ {'lnum': 12, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'log message'}, - \ {'lnum': 13, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'sub badness'}, - \ {'lnum': 15, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'badness'}, - \ {'lnum': 16, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'helper badness'}, - \ {'lnum': 20, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is an error'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'and a second line, too'}, - \ {'lnum': 21, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is another error'}, - \ {'lnum': 26, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'this is a sub-test error'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'and a second line, too'}, - \ {'lnum': 32, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'goodness'}, - \ {'lnum': 6, 'bufnr': 3, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'another package badness'}, - \ {'lnum': 43, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'panic: worst ever [recovered]'} - \ ] - call s:test('play/play_test.go', expected, "-v") -endfunc - -func! Test_GoTestCompilerError() abort - let expected = [ - \ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'} - \ ] - call s:test('compilerror/compilerror_test.go', expected) -endfunc - -func! Test_GoTestTimeout() abort - let expected = [ - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'panic: test timed out after 500ms'} - \ ] - - let g:go_test_timeout="500ms" - call s:test('timeout/timeout_test.go', expected) - unlet g:go_test_timeout -endfunc - -func! Test_GoTestShowName() abort - let expected = [ - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld'}, - \ {'lnum': 6, 'bufnr': 8, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld/sub'}, - \ {'lnum': 9, 'bufnr': 8, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'}, - \ ] - - let g:go_test_show_name=1 - call s:test('showname/showname_test.go', expected) - unlet g:go_test_show_name -endfunc - -func! Test_GoTestVet() abort - let expected = [ - \ {'lnum': 6, 'bufnr': 11, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'}, - \ ] - call s:test('veterror/veterror.go', expected) -endfunc - -func! Test_GoTestTestCompilerError() abort - let expected = [ - \ {'lnum': 10, 'bufnr': 9, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'}, - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'struct {} does not implement io.Reader (missing Read method)'} - \ ] - - call s:test('testcompilerror/testcompilerror_test.go', expected) -endfunc - -func! Test_GoTestExample() abort - let expected = [ - \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'ExampleHelloWorld'} - \ ] - call s:test('example/example_test.go', expected) -endfunc - -func! s:test(file, expected, ...) abort - let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/test' - silent exe 'e ' . $GOPATH . '/src/' . a:file - - " clear the quickfix lists - call setqflist([], 'r') - - let args = [1,0] - if a:0 - let args += a:000 - endif - - " run the tests - silent call call(function('go#test#Test'), args) - - let actual = getqflist() - let start = reltime() - while len(actual) == 0 && reltimefloat(reltime(start)) < 10 - sleep 100m - let actual = getqflist() - endwhile - - for item in actual - let item.text = s:normalize_durations(item.text) - endfor - - for item in a:expected - let item.text = s:normalize_durations(item.text) - endfor - - call gotest#assert_quickfix(actual, a:expected) -endfunc - -func! s:normalize_durations(str) abort - return substitute(a:str, '[0-9]\+\(\.[0-9]\+\)\?s', '0.000s', 'g') -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/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim deleted file mode 100644 index 9a38c95b..00000000 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ /dev/null @@ -1,284 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" ( ) motions -" { } motions -" s for sentence -" p for paragraph -" < > -" t for tag - -function! go#textobj#Comment(mode) abort - let l:fname = expand('%:p') - - try - if &modified - let l:tmpname = tempname() - call writefile(go#util#GetLines(), l:tmpname) - let l:fname = l:tmpname - endif - - let l:cmd = ['motion', - \ '-format', 'json', - \ '-file', l:fname, - \ '-offset', go#util#OffsetCursor(), - \ '-mode', 'comment', - \ ] - - let [l:out, l:err] = go#util#Exec(l:cmd) - if l:err - call go#util#EchoError(l:out) - return - endif - finally - if exists("l:tmpname") - call delete(l:tmpname) - endif - endtry - - let l:result = json_decode(l:out) - if type(l:result) != 4 || !has_key(l:result, 'comment') - return - endif - - let l:info = l:result.comment - call cursor(l:info.startLine, l:info.startCol) - - " Adjust cursor to exclude start comment markers. Try to be a little bit - " clever when using multi-line '/*' markers. - if a:mode is# 'i' - " trim whitespace so matching below works correctly - let l:line = substitute(getline('.'), '^\s*\(.\{-}\)\s*$', '\1', '') - - " //text - if l:line[:2] is# '// ' - call cursor(l:info.startLine, l:info.startCol+3) - " // text - elseif l:line[:1] is# '//' - call cursor(l:info.startLine, l:info.startCol+2) - " /* - " text - elseif l:line =~# '^/\* *$' - call cursor(l:info.startLine+1, 0) - " /* - " * text - if getline('.')[:2] is# ' * ' - call cursor(l:info.startLine+1, 4) - " /* - " *text - elseif getline('.')[:1] is# ' *' - call cursor(l:info.startLine+1, 3) - endif - " /* text - elseif l:line[:2] is# '/* ' - call cursor(l:info.startLine, l:info.startCol+3) - " /*text - elseif l:line[:1] is# '/*' - call cursor(l:info.startLine, l:info.startCol+2) - endif - endif - - normal! v - - " Exclude trailing newline. - if a:mode is# 'i' - let l:info.endCol -= 1 - endif - - call cursor(l:info.endLine, l:info.endCol) - - " Exclude trailing '*/'. - if a:mode is# 'i' - let l:line = getline('.') - " text - " */ - if l:line =~# '^ *\*/$' - call cursor(l:info.endLine - 1, len(getline(l:info.endLine - 1))) - " text */ - elseif l:line[-3:] is# ' */' - call cursor(l:info.endLine, l:info.endCol - 3) - " text*/ - elseif l:line[-2:] is# '*/' - call cursor(l:info.endLine, l:info.endCol - 2) - endif - endif -endfunction - -" Select a function in visual mode. -function! go#textobj#Function(mode) abort - let l:fname = expand("%:p") - if &modified - let l:tmpname = tempname() - call writefile(go#util#GetLines(), l:tmpname) - let l:fname = l:tmpname - endif - - let l:cmd = ['motion', - \ '-format', 'vim', - \ '-file', l:fname, - \ '-offset', go#util#OffsetCursor(), - \ '-mode', 'enclosing', - \ ] - - if go#config#TextobjIncludeFunctionDoc() - let l:cmd += ['-parse-comments'] - endif - - let [l:out, l:err] = go#util#Exec(l:cmd) - if l:err - call go#util#EchoError(out) - return - endif - - " if exists, delete it as we don't need it anymore - if exists("l:tmpname") - call delete(l:tmpname) - endif - - " convert our string dict representation into native Vim dictionary type - let result = eval(out) - if type(result) != 4 || !has_key(result, 'fn') - return - endif - - let info = result.fn - - if a:mode == 'a' - " anonymous functions doesn't have associated doc. Also check if the user - " want's to include doc comments for function declarations - if has_key(info, 'doc') && go#config#TextobjIncludeFunctionDoc() - call cursor(info.doc.line, info.doc.col) - elseif info['sig']['name'] == '' && go#config#TextobjIncludeVariable() - " one liner anonymous functions - if info.lbrace.line == info.rbrace.line - " jump to first nonblack char, to get the correct column - call cursor(info.lbrace.line, 0 ) - normal! ^ - call cursor(info.func.line, col(".")) - else - call cursor(info.func.line, info.rbrace.col) - endif - else - call cursor(info.func.line, info.func.col) - endif - - normal! v - call cursor(info.rbrace.line, info.rbrace.col) - return - endif - - " rest is inner mode, a:mode == 'i' - - " if the function is a one liner we need to select only that portion - if info.lbrace.line == info.rbrace.line - call cursor(info.lbrace.line, info.lbrace.col+1) - normal! v - call cursor(info.rbrace.line, info.rbrace.col-1) - return - endif - - call cursor(info.lbrace.line+1, 1) - normal! V - call cursor(info.rbrace.line-1, 1) -endfunction - -" Get the location of the previous or next function. -function! go#textobj#FunctionLocation(direction, cnt) abort - let l:fname = expand("%:p") - if &modified - " Write current unsaved buffer to a temp file and use the modified content - let l:tmpname = tempname() - call writefile(go#util#GetLines(), l:tmpname) - let l:fname = l:tmpname - endif - - let l:cmd = ['motion', - \ '-format', 'vim', - \ '-file', l:fname, - \ '-offset', go#util#OffsetCursor(), - \ '-shift', a:cnt, - \ '-mode', a:direction, - \ ] - - if go#config#TextobjIncludeFunctionDoc() - let l:cmd += ['-parse-comments'] - endif - - let [l:out, l:err] = go#util#Exec(l:cmd) - if l:err - call go#util#EchoError(out) - return - endif - - " if exists, delete it as we don't need it anymore - if exists("l:tmpname") - call delete(l:tmpname) - endif - - let l:result = json_decode(out) - if type(l:result) != 4 || !has_key(l:result, 'fn') - return 0 - endif - - return l:result -endfunction - -function! go#textobj#FunctionJump(mode, direction) abort - " get count of the motion. This should be done before all the normal - " expressions below as those reset this value(because they have zero - " count!). We abstract -1 because the index starts from 0 in motion. - let l:cnt = v:count1 - 1 - - " set context mark so we can jump back with '' or `` - normal! m' - - " select already previously selected visual content and continue from there. - " If it's the first time starts with the visual mode. This is needed so - " after selecting something in visual mode, every consecutive motion - " continues. - if a:mode == 'v' - normal! gv - endif - - let l:result = go#textobj#FunctionLocation(a:direction, l:cnt) - if l:result is 0 - return - endif - - " we reached the end and there are no functions. The usual [[ or ]] jumps to - " the top or bottom, we'll do the same. - if type(result) == 4 && has_key(result, 'err') && result.err == "no functions found" - if a:direction == 'next' - keepjumps normal! G - else " 'prev' - keepjumps normal! gg - endif - return - endif - - let info = result.fn - - " if we select something ,select all function - if a:mode == 'v' && a:direction == 'next' - keepjumps call cursor(info.rbrace.line, 1) - return - endif - - if a:mode == 'v' && a:direction == 'prev' - if has_key(info, 'doc') && go#config#TextobjIncludeFunctionDoc() - keepjumps call cursor(info.doc.line, 1) - else - keepjumps call cursor(info.func.line, 1) - endif - return - endif - - keepjumps call cursor(info.func.line, 1) -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/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim deleted file mode 100644 index 41380abd..00000000 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ /dev/null @@ -1,147 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" From "go list -h". -function! go#tool#ValidFiles(...) - let l:list = ["GoFiles", "CgoFiles", "IgnoredGoFiles", "CFiles", "CXXFiles", - \ "MFiles", "HFiles", "FFiles", "SFiles", "SwigFiles", "SwigCXXFiles", - \ "SysoFiles", "TestGoFiles", "XTestGoFiles"] - - " Used as completion - if len(a:000) > 0 - let l:list = filter(l:list, 'strpart(v:val, 0, len(a:1)) == a:1') - endif - - return l:list -endfunction - -function! go#tool#Files(...) abort - if len(a:000) > 0 - let source_files = a:000 - else - let source_files = ['GoFiles'] - endif - - let combined = '' - for sf in source_files - " Strip dot in case people used ":GoFiles .GoFiles". - let sf = substitute(sf, '^\.', '', '') - - " Make sure the passed options are valid. - if index(go#tool#ValidFiles(), sf) == -1 - echoerr "unknown source file variable: " . sf - endif - - if go#util#IsWin() - let combined .= '{{range $f := .' . sf . '}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}\{{$f}}{{printf \"\n\"}}{{end}}' - else - let combined .= "{{range $f := ." . sf . "}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}{{range $f := .CgoFiles}}{{$.Dir}}/{{$f}}{{printf \"\\n\"}}{{end}}" - endif - endfor - - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-tags', go#config#BuildTags(), '-f', l:combined]) - return split(l:out, '\n') -endfunction - -function! go#tool#Deps() abort - if go#util#IsWin() - let format = '{{range $f := .Deps}}{{$f}}{{printf \"\n\"}}{{end}}' - else - let format = "{{range $f := .Deps}}{{$f}}\n{{end}}" - endif - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-tags', go#config#BuildTags(), '-f', l:format]) - return split(l:out, '\n') -endfunction - -function! go#tool#Imports() abort - let imports = {} - if go#util#IsWin() - let format = '{{range $f := .Imports}}{{$f}}{{printf \"\n\"}}{{end}}' - else - let format = "{{range $f := .Imports}}{{$f}}{{printf \"\\n\"}}{{end}}" - endif - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-tags', go#config#BuildTags(), '-f', l:format]) - if l:err != 0 - echo out - return imports - endif - - for package_path in split(out, '\n') - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-tags', go#config#BuildTags(), '-f', '{{.Name}}', l:package_path]) - if l:err != 0 - echo out - return imports - endif - let package_name = substitute(l:out, '\n$', '', '') - let imports[package_name] = package_path - endfor - - return imports -endfunction - -function! go#tool#Info(showstatus) abort - let l:mode = go#config#InfoMode() - if l:mode == 'gocode' - call go#complete#Info(a:showstatus) - elseif l:mode == 'guru' - call go#guru#DescribeInfo(a:showstatus) - elseif l:mode == 'gopls' - call go#lsp#Info(a:showstatus) - else - call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru, gopls]') - endif -endfunction - -function! go#tool#PackageName() abort - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-tags', go#config#BuildTags(), '-f', '{{.Name}}']) - if l:err != 0 - return -1 - endif - - return split(out, '\n')[0] -endfunction - -" Exists checks whether the given importpath exists or not. It returns 0 if -" the importpath exists under GOPATH. -function! go#tool#Exists(importpath) abort - let [l:out, l:err] = go#util#ExecInDir(['go', 'list', a:importpath]) - if l:err != 0 - return -1 - endif - - return 0 -endfunction - -function! go#tool#DescribeBalloon() - let l:fname = fnamemodify(bufname(v:beval_bufnr), ':p') - - let l:winid = win_getid() - - call win_gotoid(bufwinid(v:beval_bufnr)) - - let [l:line, l:col] = go#lsp#lsp#Position(v:beval_lnum, v:beval_col) - call go#lsp#Hover(l:fname, l:line, l:col, funcref('s:balloon', [])) - - call win_gotoid(l:winid) - return '' -endfunction - -function! s:balloon(msg) - let l:msg = a:msg - if has('balloon_eval') - if has('balloon_multiline') - let l:msg = join(a:msg, "\n") - else - let l:msg = substitute(join(map(deepcopy(a:msg), 'substitute(v:val, "\t", "", "")'), '; '), '{;', '{', '') - endif - endif - - call balloon_show(l:msg) -endfunction - -" restore Vi compatibility settings -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/tool_test.vim b/sources_non_forked/vim-go/autoload/go/tool_test.vim deleted file mode 100644 index 42b86304..00000000 --- a/sources_non_forked/vim-go/autoload/go/tool_test.vim +++ /dev/null @@ -1,31 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -func! Test_ExecuteInDir() abort - let l:tmp = gotest#write_file('a/a.go', ['package a']) - try - let l:out = go#util#ExecInDir(['pwd']) - call assert_equal([l:tmp . "/src/a\n", 0], l:out) - finally - call delete(l:tmp, 'rf') - endtry -endfunc - -func! Test_ExecuteInDir_nodir() abort - let l:tmp = go#util#tempdir("executeindir") - exe ':e ' . l:tmp . '/new-dir/a' - - try - let l:out = go#util#ExecInDir(['pwd']) - call assert_equal(['', 1], l:out) - 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/ui.vim b/sources_non_forked/vim-go/autoload/go/ui.vim deleted file mode 100644 index 9d5b249e..00000000 --- a/sources_non_forked/vim-go/autoload/go/ui.vim +++ /dev/null @@ -1,122 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let s:buf_nr = -1 - -"OpenWindow opens a new scratch window and put's the content into the window -function! go#ui#OpenWindow(title, content, filetype) abort - " Ensure there's only one return window in this session/tabpage - call go#util#Windo("unlet! w:vim_go_return_window") - " Mark the window we're leaving as such - let w:vim_go_return_window = 1 - - " reuse existing buffer window if it exists otherwise create a new one - if !bufexists(s:buf_nr) - execute 'botright new' - file `="[" . a:title . "]"` - let s:buf_nr = bufnr('%') - elseif bufwinnr(s:buf_nr) == -1 - execute 'botright new' - execute s:buf_nr . 'buffer' - elseif bufwinnr(s:buf_nr) != bufwinnr('%') - execute bufwinnr(s:buf_nr) . 'wincmd w' - endif - - " Resize window to content length - exe 'resize' . len(a:content) - - execute "setlocal filetype=".a:filetype - - " some sane default values for a readonly buffer - setlocal bufhidden=delete - setlocal buftype=nofile - setlocal noswapfile - setlocal nobuflisted - setlocal winfixheight - setlocal cursorline " make it easy to distinguish - setlocal nonumber - setlocal norelativenumber - setlocal showbreak="" - - " we need this to purge the buffer content - setlocal modifiable - - "delete everything first from the buffer - %delete _ - - " add the content - call append(0, a:content) - - " delete last line that comes from the append call - $delete _ - - " set it back to non modifiable - setlocal nomodifiable - - " Remove the '... [New File]' message line from the command line - echon -endfunction - -function! go#ui#GetReturnWindow() abort - for l:wn in range(1, winnr("$")) - if !empty(getwinvar(l:wn, "vim_go_return_window")) - return l:wn - endif - endfor -endfunction - -" CloseWindow closes the current window -function! go#ui#CloseWindow() abort - " Close any window associated with the ui buffer, if it's there - if bufexists(s:buf_nr) - let ui_window_number = bufwinnr(s:buf_nr) - if ui_window_number != -1 - execute ui_window_number . 'close' - endif - endif - - "return to original window, if it's there - let l:rw = go#ui#GetReturnWindow() - if !empty(l:rw) - execute l:rw . 'wincmd w' - unlet! w:vim_go_return_window - endif -endfunction - -" OpenDefinition parses the current line and jumps to it by openening a new -" tab -function! go#ui#OpenDefinition(filter) abort - let curline = getline('.') - - " don't touch our first line or any blank line - if curline =~ a:filter || curline =~ "^$" - " suppress information about calling this function - echo "" - return - endif - - " format: 'interface file:lnum:coln' - let mx = '^\(^\S*\)\s*\(.\{-}\):\(\d\+\):\(\d\+\)' - - " parse it now into the list - let tokens = matchlist(curline, mx) - - " convert to: 'file:lnum:coln' - let expr = tokens[2] . ":" . tokens[3] . ":" . tokens[4] - - " jump to it in a new tab, we use explicit lgetexpr so we can later change - " the behaviour via settings (like opening in vsplit instead of tab) - lgetexpr expr - tab split - ll 1 - - " center the word - norm! zz -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/uri.vim b/sources_non_forked/vim-go/autoload/go/uri.vim deleted file mode 100644 index e8f38ab8..00000000 --- a/sources_non_forked/vim-go/autoload/go/uri.vim +++ /dev/null @@ -1,38 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! go#uri#Encode(value) abort - return s:encode(a:value, '[^A-Za-z0-9_.~-]') -endfunction - -function! go#uri#EncodePath(value) abort - let l:separator = '/' - if go#util#IsWin() - let l:separator = '\\' - endif - return s:encode(a:value, '[^' . l:separator . 'A-Za-z0-9_.~-]') -endfunction - -function! s:encode(value, unreserved) - return substitute( - \ a:value, - \ a:unreserved, - \ '\="%".printf(''%02X'', char2nr(submatch(0)))', - \ 'g' - \) -endfunction - -function! go#uri#Decode(value) abort - return substitute( - \ a:value, - \ '%\(\x\x\)', - \ '\=nr2char(''0X'' . submatch(1))', - \ 'g' - \) -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/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim deleted file mode 100644 index 8fb17737..00000000 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ /dev/null @@ -1,596 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" PathSep returns the appropriate OS specific path separator. -function! go#util#PathSep() abort - if go#util#IsWin() - return '\' - endif - return '/' -endfunction - -" PathListSep returns the appropriate OS specific path list separator. -function! go#util#PathListSep() abort - if go#util#IsWin() - return ";" - endif - return ":" -endfunction - -" LineEnding returns the correct line ending, based on the current fileformat -function! go#util#LineEnding() abort - if &fileformat == 'dos' - return "\r\n" - elseif &fileformat == 'mac' - return "\r" - endif - - return "\n" -endfunction - -" Join joins any number of path elements into a single path, adding a -" Separator if necessary and returns the result -function! go#util#Join(...) abort - return join(a:000, go#util#PathSep()) -endfunction - -" IsWin returns 1 if current OS is Windows or 0 otherwise -" Note that has('win32') is always 1 when has('win64') is 1, so has('win32') is enough. -function! go#util#IsWin() abort - return has('win32') -endfunction - -" IsMac returns 1 if current OS is macOS or 0 otherwise. -function! go#util#IsMac() abort - return has('mac') || - \ has('macunix') || - \ has('gui_macvim') || - \ go#util#Exec(['uname'])[0] =~? '^darwin' -endfunction - - " Checks if using: - " 1) Windows system, - " 2) And has cygpath executable, - " 3) And uses *sh* as 'shell' -function! go#util#IsUsingCygwinShell() - return go#util#IsWin() && executable('cygpath') && &shell =~ '.*sh.*' -endfunction - -" Check if Vim jobs API is supported. -" -" The (optional) first parameter can be added to indicate the 'cwd' or 'env' -" parameters will be used, which wasn't added until a later version. -function! go#util#has_job(...) abort - return has('job') || has('nvim') -endfunction - -let s:env_cache = {} - -" env returns the go environment variable for the given key. Where key can be -" GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached -" version. -function! go#util#env(key) abort - let l:key = tolower(a:key) - if has_key(s:env_cache, l:key) - return s:env_cache[l:key] - endif - - if executable('go') - let l:var = call('go#util#'.l:key, []) - if go#util#ShellError() != 0 - call go#util#EchoError(printf("'go env %s' failed", toupper(l:key))) - return '' - endif - else - let l:var = eval("$".toupper(a:key)) - endif - - let s:env_cache[l:key] = l:var - return l:var -endfunction - -" goarch returns 'go env GOARCH'. This is an internal function and shouldn't -" be used. Instead use 'go#util#env("goarch")' -function! go#util#goarch() abort - return substitute(s:exec(['go', 'env', 'GOARCH'])[0], '\n', '', 'g') -endfunction - -" goos returns 'go env GOOS'. This is an internal function and shouldn't -" be used. Instead use 'go#util#env("goos")' -function! go#util#goos() abort - return substitute(s:exec(['go', 'env', 'GOOS'])[0], '\n', '', 'g') -endfunction - -" goroot returns 'go env GOROOT'. This is an internal function and shouldn't -" be used. Instead use 'go#util#env("goroot")' -function! go#util#goroot() abort - return substitute(s:exec(['go', 'env', 'GOROOT'])[0], '\n', '', 'g') -endfunction - -" gopath returns 'go env GOPATH'. This is an internal function and shouldn't -" be used. Instead use 'go#util#env("gopath")' -function! go#util#gopath() abort - return substitute(s:exec(['go', 'env', 'GOPATH'])[0], '\n', '', 'g') -endfunction - -" gomod returns 'go env GOMOD'. gomod changes depending on the folder. Don't -" use go#util#env as it caches the value. -function! go#util#gomod() abort - return substitute(s:exec(['go', 'env', 'GOMOD'])[0], '\n', '', 'g') -endfunction - -function! go#util#osarch() abort - return go#util#env("goos") . '_' . go#util#env("goarch") -endfunction - -" go#util#ModuleRoot returns the root directory of the module of the current -" buffer. -function! go#util#ModuleRoot() abort - let [l:out, l:err] = go#util#ExecInDir(['go', 'env', 'GOMOD']) - if l:err != 0 - return -1 - endif - - let l:module = split(l:out, '\n', 1)[0] - - " When run with `GO111MODULE=on and not in a module directory, the module will be reported as /dev/null. - let l:fakeModule = '/dev/null' - if go#util#IsWin() - let l:fakeModule = 'NUL' - endif - - if l:fakeModule == l:module - return expand('%:p:h') - endif - - return fnamemodify(l:module, ':p:h') -endfunction - -" Run a shell command. -" -" It will temporary set the shell to /bin/sh for Unix-like systems if possible, -" so that we always use a standard POSIX-compatible Bourne shell (and not e.g. -" csh, fish, etc.) See #988 and #1276. -function! s:system(cmd, ...) abort - " Preserve original shell, shellredir and shellcmdflag values - let l:shell = &shell - let l:shellredir = &shellredir - let l:shellcmdflag = &shellcmdflag - - if !go#util#IsWin() && executable('/bin/sh') - set shell=/bin/sh shellredir=>%s\ 2>&1 shellcmdflag=-c - endif - - try - return call('system', [a:cmd] + a:000) - finally - " Restore original values - let &shell = l:shell - let &shellredir = l:shellredir - let &shellcmdflag = l:shellcmdflag - endtry -endfunction - -" System runs a shell command "str". Every arguments after "str" is passed to -" stdin. -function! go#util#System(str, ...) abort - return call('s:system', [a:str] + a:000) -endfunction - -" Exec runs a shell command "cmd", which must be a list, one argument per item. -" Every list entry will be automatically shell-escaped -" Every other argument is passed to stdin. -function! go#util#Exec(cmd, ...) abort - if len(a:cmd) == 0 - call go#util#EchoError("go#util#Exec() called with empty a:cmd") - return ['', 1] - endif - - let l:bin = a:cmd[0] - - " Lookup the full path, respecting settings such as 'go_bin_path'. On errors, - " CheckBinPath will show a warning for us. - let l:bin = go#path#CheckBinPath(l:bin) - if empty(l:bin) - return ['', 1] - endif - - " Finally execute the command using the full, resolved path. Do not pass the - " unmodified command as the correct program might not exist in $PATH. - return call('s:exec', [[l:bin] + a:cmd[1:]] + a:000) -endfunction - -function! go#util#ExecInDir(cmd, ...) abort - if !isdirectory(expand("%:p:h")) - return ['', 1] - endif - - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() - try - execute cd . fnameescape(expand("%:p:h")) - let [l:out, l:err] = call('go#util#Exec', [a:cmd] + a:000) - finally - execute cd . fnameescape(l:dir) - endtry - return [l:out, l:err] -endfunction - -function! s:exec(cmd, ...) abort - let l:bin = a:cmd[0] - let l:cmd = go#util#Shelljoin([l:bin] + a:cmd[1:]) - if go#util#HasDebug('shell-commands') - call go#util#EchoInfo('shell command: ' . l:cmd) - endif - - let l:out = call('s:system', [l:cmd] + a:000) - return [l:out, go#util#ShellError()] -endfunction - -function! go#util#ShellError() abort - return v:shell_error -endfunction - -" StripPath strips the path's last character if it's a path separator. -" example: '/foo/bar/' -> '/foo/bar' -function! go#util#StripPathSep(path) abort - let last_char = strlen(a:path) - 1 - if a:path[last_char] == go#util#PathSep() - return strpart(a:path, 0, last_char) - endif - - return a:path -endfunction - -" StripTrailingSlash strips the trailing slash from the given path list. -" example: ['/foo/bar/'] -> ['/foo/bar'] -function! go#util#StripTrailingSlash(paths) abort - return map(copy(a:paths), 'go#util#StripPathSep(v:val)') -endfunction - -" Shelljoin returns a shell-safe string representation of arglist. The -" {special} argument of shellescape() may optionally be passed. -function! go#util#Shelljoin(arglist, ...) abort - try - let ssl_save = &shellslash - set noshellslash - if a:0 - return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ') - endif - - return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ') - finally - let &shellslash = ssl_save - endtry -endfunction - -fu! go#util#Shellescape(arg) - try - let ssl_save = &shellslash - set noshellslash - return shellescape(a:arg) - finally - let &shellslash = ssl_save - endtry -endf - -" Shelllist returns a shell-safe representation of the items in the given -" arglist. The {special} argument of shellescape() may optionally be passed. -function! go#util#Shelllist(arglist, ...) abort - try - let ssl_save = &shellslash - set noshellslash - if a:0 - return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')') - endif - return map(copy(a:arglist), 'shellescape(v:val)') - finally - let &shellslash = ssl_save - endtry -endfunction - -" Returns the byte offset for line and column -function! go#util#Offset(line, col) abort - if &encoding != 'utf-8' - let sep = go#util#LineEnding() - let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep) - let buf .= a:col == 1 ? '' : getline('.')[:a:col-2] - return len(iconv(buf, &encoding, 'utf-8')) - endif - return line2byte(a:line) + (a:col-2) -endfunction -" -" Returns the byte offset for the cursor -function! go#util#OffsetCursor() abort - return go#util#Offset(line('.'), col('.')) -endfunction - -" Windo is like the built-in :windo, only it returns to the window the command -" was issued from -function! go#util#Windo(command) abort - let s:currentWindow = winnr() - try - execute "windo " . a:command - finally - execute s:currentWindow. "wincmd w" - unlet s:currentWindow - endtry -endfunction - -" snippetcase converts the given word to given preferred snippet setting type -" case. -function! go#util#snippetcase(word) abort - let l:snippet_case = go#config#AddtagsTransform() - if l:snippet_case == "snakecase" - return go#util#snakecase(a:word) - elseif l:snippet_case == "camelcase" - return go#util#camelcase(a:word) - else - return a:word " do nothing - endif -endfunction - -" snakecase converts a string to snake case. i.e: FooBar -> foo_bar -" Copied from tpope/vim-abolish -function! go#util#snakecase(word) abort - let word = substitute(a:word, '::', '/', 'g') - let word = substitute(word, '\(\u\+\)\(\u\l\)', '\1_\2', 'g') - let word = substitute(word, '\(\l\|\d\)\(\u\)', '\1_\2', 'g') - let word = substitute(word, '[.-]', '_', 'g') - let word = tolower(word) - return word -endfunction - -" camelcase converts a string to camel case. e.g. FooBar or foo_bar will become -" fooBar. -" Copied from tpope/vim-abolish. -function! go#util#camelcase(word) abort - let word = substitute(a:word, '-', '_', 'g') - if word !~# '_' && word =~# '\l' - return substitute(word, '^.', '\l&', '') - else - return substitute(word, '\C\(_\)\=\(.\)', '\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g') - endif -endfunction - -" pascalcase converts a string to 'PascalCase'. e.g. fooBar or foo_bar will -" become FooBar. -function! go#util#pascalcase(word) abort - let word = go#util#camelcase(a:word) - return toupper(word[0]) . word[1:] -endfunction - -" Echo a message to the screen and highlight it with the group in a:hi. -" -" The message can be a list or string; every line with be :echomsg'd separately. -function! s:echo(msg, hi) - let l:msg = [] - if type(a:msg) != type([]) - let l:msg = split(a:msg, "\n") - else - let l:msg = a:msg - endif - - " Tabs display as ^I or <09>, so manually expand them. - let l:msg = map(l:msg, 'substitute(v:val, "\t", " ", "")') - - exe 'echohl ' . a:hi - for line in l:msg - echom "vim-go: " . line - endfor - echohl None -endfunction - -function! go#util#EchoSuccess(msg) - call s:echo(a:msg, 'Function') -endfunction -function! go#util#EchoError(msg) - call s:echo(a:msg, 'ErrorMsg') -endfunction -function! go#util#EchoWarning(msg) - call s:echo(a:msg, 'WarningMsg') -endfunction -function! go#util#EchoProgress(msg) - redraw - call s:echo(a:msg, 'Identifier') -endfunction -function! go#util#EchoInfo(msg) - call s:echo(a:msg, 'Debug') -endfunction - -" Get all lines in the buffer as a a list. -function! go#util#GetLines() - let buf = getline(1, '$') - if &encoding != 'utf-8' - let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') - endif - if &l:fileformat == 'dos' - " XXX: line2byte() depend on 'fileformat' option. - " so if fileformat is 'dos', 'buf' must include '\r'. - let buf = map(buf, 'v:val."\r"') - endif - return buf -endfunction - -" Convert the current buffer to the "archive" format of -" golang.org/x/tools/go/buildutil: -" https://godoc.org/golang.org/x/tools/go/buildutil#ParseOverlayArchive -" -" > The archive consists of a series of files. Each file consists of a name, a -" > decimal file size and the file contents, separated by newlinews. No newline -" > follows after the file contents. -function! go#util#archive() - let l:buffer = join(go#util#GetLines(), "\n") - return expand("%:p:gs!\\!/!") . "\n" . strlen(l:buffer) . "\n" . l:buffer -endfunction - -" Make a named temporary directory which starts with "prefix". -" -" Unfortunately Vim's tempname() is not portable enough across various systems; -" see: https://github.com/mattn/vim-go/pull/3#discussion_r138084911 -function! go#util#tempdir(prefix) abort - " See :help tempfile - if go#util#IsWin() - let l:dirs = [$TMP, $TEMP, 'c:\tmp', 'c:\temp'] - else - let l:dirs = [$TMPDIR, '/tmp', './', $HOME] - endif - - let l:dir = '' - for l:d in dirs - if !empty(l:d) && filewritable(l:d) == 2 - let l:dir = l:d - break - endif - endfor - - if l:dir == '' - call go#util#EchoError('Unable to find directory to store temporary directory in') - return - endif - - " Not great randomness, but "good enough" for our purpose here. - let l:rnd = sha256(printf('%s%s', reltimestr(reltime()), fnamemodify(bufname(''), ":p"))) - let l:tmp = printf("%s/%s%s", l:dir, a:prefix, l:rnd) - call mkdir(l:tmp, 'p', 0700) - return l:tmp -endfunction - -" Report if the user enabled a debug flag in g:go_debug. -function! go#util#HasDebug(flag) - return index(go#config#Debug(), a:flag) >= 0 -endfunction - -function! go#util#OpenBrowser(url) abort - let l:cmd = go#config#PlayBrowserCommand() - if len(l:cmd) == 0 - redraw - echohl WarningMsg - echo "It seems that you don't have general web browser. Open URL below." - echohl None - echo a:url - return - endif - - " if setting starts with a !. - if l:cmd =~ '^!' - let l:cmd = substitute(l:cmd, '%URL%', '\=escape(shellescape(a:url), "#")', 'g') - silent! exec l:cmd - elseif cmd =~ '^:[A-Z]' - let l:cmd = substitute(l:cmd, '%URL%', '\=escape(a:url,"#")', 'g') - exec l:cmd - else - let l:cmd = substitute(l:cmd, '%URL%', '\=shellescape(a:url)', 'g') - call go#util#System(l:cmd) - endif -endfunction - -function! go#util#ParseErrors(lines) abort - let errors = [] - - for line in a:lines - let fatalerrors = matchlist(line, '^\(fatal error:.*\)$') - let tokens = matchlist(line, '^\s*\(.\{-}\):\(\d\+\):\s*\(.*\)') - - if !empty(fatalerrors) - call add(errors, {"text": fatalerrors[1]}) - elseif !empty(tokens) - " strip endlines of form ^M - let out = substitute(tokens[3], '\r$', '', '') - - call add(errors, { - \ "filename" : fnamemodify(tokens[1], ':p'), - \ "lnum" : tokens[2], - \ "text" : out, - \ }) - elseif !empty(errors) - " Preserve indented lines. - " This comes up especially with multi-line test output. - if match(line, '^\s') >= 0 - call add(errors, {"text": substitute(line, '\r$', '', '')}) - endif - endif - endfor - - return errors -endfunction - -function! go#util#ShowInfo(info) - if empty(a:info) - return - endif - - echo "vim-go: " | echohl Function | echon a:info | echohl None -endfunction - -" go#util#SetEnv takes the name of an environment variable and what its value -" should be and returns a function that will restore it to its original value. -function! go#util#SetEnv(name, value) abort - let l:state = {} - - if len(a:name) == 0 - return function('s:noop', [], l:state) - endif - - let l:remove = 0 - if exists('$' . a:name) - let l:oldvalue = eval('$' . a:name) - else - let l:remove = 1 - endif - - " wrap the value in single quotes so that it will work on windows when there - " are backslashes present in the value (e.g. $PATH). - call execute('let $' . a:name . " = '" . a:value . "'") - - if l:remove - return function('s:unset', [a:name], l:state) - endif - - return function('go#util#SetEnv', [a:name, l:oldvalue], l:state) -endfunction - -function! go#util#ClearGroupFromMatches(group) abort - if !exists("*matchaddpos") - return 0 - endif - - let l:cleared = 0 - - let m = getmatches() - for item in m - if item['group'] == a:group - call matchdelete(item['id']) - let l:cleared = 1 - endif - endfor - - return l:cleared -endfunction - -function! s:unset(name) abort - try - " unlet $VAR was introducted in Vim 8.0.1832, which is newer than the - " minimal version that vim-go supports. Set the environment variable to - " the empty string in that case. It's not perfect, but it will work fine - " for most things, and is really the best alternative that's available. - if !has('patch-8.0.1832') - call go#util#SetEnv(a:name, '') - return - endif - - call execute('unlet $' . a:name) - catch - call go#util#EchoError(printf('could not unset $%s: %s', a:name, v:exception)) - endtry -endfunction - -function! s:noop(...) abort dict -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/gotest.vim b/sources_non_forked/vim-go/autoload/gotest.vim deleted file mode 100644 index 7fae8152..00000000 --- a/sources_non_forked/vim-go/autoload/gotest.vim +++ /dev/null @@ -1,155 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Write a Go file to a temporary directory and append this directory to $GOPATH. -" -" The file will written to a:path, which is relative to the temporary directory, -" and this file will be loaded as the current buffer. -" -" The cursor will be placed on the character before any 0x1f byte. -" -" The full path to the created directory is returned, it is the caller's -" responsibility to clean that up! -fun! gotest#write_file(path, contents) abort - if go#util#has_job() - call go#lsp#CleanWorkspaces() - endif - let l:dir = go#util#tempdir("vim-go-test/testrun/") - let $GOPATH .= ':' . l:dir - let l:full_path = l:dir . '/src/' . a:path - - call mkdir(fnamemodify(l:full_path, ':h'), 'p') - call writefile(a:contents, l:full_path) - exe 'cd ' . l:dir . '/src' - - if go#util#has_job() - call go#lsp#AddWorkspaceDirectory(fnamemodify(l:full_path, ':p:h')) - endif - - silent exe 'e! ' . a:path - - " Set cursor. - let l:lnum = 1 - for l:line in a:contents - let l:m = stridx(l:line, "\x1f") - if l:m > -1 - let l:byte = line2byte(l:lnum) + l:m - exe 'goto '. l:byte - call setline('.', substitute(getline('.'), "\x1f", '', '')) - silent noautocmd w! - - break - endif - - let l:lnum += 1 - endfor - - return l:dir -endfun - -" Load a fixture file from test-fixtures. -" -" The file will be copied to a new GOPATH-compliant temporary directory and -" loaded as the current buffer. -fun! gotest#load_fixture(path) abort - if go#util#has_job() - call go#lsp#CleanWorkspaces() - endif - let l:dir = go#util#tempdir("vim-go-test/testrun/") - let $GOPATH .= ':' . l:dir - let l:full_path = l:dir . '/src/' . a:path - - call mkdir(fnamemodify(l:full_path, ':h'), 'p') - exe 'cd ' . l:dir . '/src' - silent exe 'noautocmd e ' . a:path - silent exe printf('read %s/test-fixtures/%s', g:vim_go_root, a:path) - silent noautocmd w! - if go#util#has_job() - call go#lsp#AddWorkspaceDirectory(fnamemodify(l:full_path, ':p:h')) - endif - - return l:dir -endfun - -" Diff the contents of the current buffer to a:want, which should be a list. -" If a:skipHeader is true we won't bother with the package and import -" declarations; so e.g.: -" -" let l:diff = s:diff_buffer(1, ['_ = mail.Address{}']) -" -" will pass, whereas otherwise you'd have to: -" -" let l:diff = s:diff_buffer(0, ['package main', 'import "net/mail", '_ = mail.Address{}']) -fun! gotest#assert_buffer(skipHeader, want) abort - let l:buffer = go#util#GetLines() - - if a:skipHeader - for l:lnum in range(0, len(l:buffer) - 1) - " Bit rudimentary, but works reasonably well. - if match(l:buffer[l:lnum], '^\v(func|var|const|import \(|\))') > -1 - " vint bug: https://github.com/Kuniwak/vint/issues/179 - " vint: -ProhibitUsingUndeclaredVariable - let l:buffer = l:buffer[l:lnum:len(l:buffer)] - break - endif - endfor - endif - - " Using ' is often easier so we don't have to escape ". - let l:want = map(a:want, 'substitute(v:val, "\\\\t", "\t", "")') - - let l:tmp = go#util#tempdir('assert_buffer') - try - call writefile(l:buffer, l:tmp . '/have') - call writefile(l:want, l:tmp . '/want') - call go#fmt#run('gofmt', l:tmp . '/have', l:tmp . '/have') - call go#fmt#run('gofmt', l:tmp . '/want', l:tmp . '/want') - let [l:out, l:err] = go#util#Exec(["diff", "-u", l:tmp . '/have', l:tmp . '/want']) - finally - call delete(l:tmp . '/have') - call delete(l:tmp . '/want') - call delete(l:tmp, 'd') - endtry - - if l:err || l:out != '' - let v:errors = extend(v:errors, split(l:out, "\n")) - endif -endfun - -" Diff the contents of the current buffer to the fixture file in a:path. -fun! gotest#assert_fixture(path) abort - let l:want = readfile(printf('%s/test-fixtures/%s', g:vim_go_root, a:path)) - call gotest#assert_buffer(0, l:want) -endfun - -func! gotest#assert_quickfix(got, want) abort - call assert_equal(len(a:want), len(a:got), "number of errors") - if len(a:want) != len(a:got) - call assert_equal(a:want, a:got) - return - endif - - let i = 0 - while i < len(a:want) - let want_item = a:want[i] - let got_item = a:got[i] - let i += 1 - - call assert_equal(want_item.bufnr, got_item.bufnr, "bufnr") - call assert_equal(want_item.lnum, got_item.lnum, "lnum") - call assert_equal(want_item.col, got_item.col, "col") - call assert_equal(want_item.vcol, got_item.vcol, "vcol") - call assert_equal(want_item.nr, got_item.nr, "nr") - call assert_equal(want_item.pattern, got_item.pattern, "pattern") - call assert_equal(want_item.text, got_item.text, "text") - call assert_equal(want_item.type, got_item.type, "type") - call assert_equal(want_item.valid, got_item.valid, "valid") - endwhile -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/unite/sources/decls.vim b/sources_non_forked/vim-go/autoload/unite/sources/decls.vim deleted file mode 100644 index 31138085..00000000 --- a/sources_non_forked/vim-go/autoload/unite/sources/decls.vim +++ /dev/null @@ -1,70 +0,0 @@ -let s:save_cpo = &cpoptions -set cpoptions&vim - -let s:source = { - \ 'name': 'decls', - \ 'description': 'GoDecls implementation for unite', - \ 'syntax': 'uniteSource__Decls', - \ 'action_table': {}, - \ 'hooks': {}, - \ } - -function! unite#sources#decls#define() - return s:source -endfunction - -function! s:source.gather_candidates(args, context) abort - let l:bin_path = go#path#CheckBinPath('motion') - if empty(l:bin_path) - return [] - endif - - let l:path = expand(get(a:args, 0, '%:p:h')) - if isdirectory(l:path) - let l:mode = 'dir' - elseif filereadable(l:path) - let l:mode = 'file' - else - return [] - endif - - let l:include = go#config#DeclsIncludes() - let l:command = printf('%s -format vim -mode decls -include %s -%s %s', l:bin_path, l:include, l:mode, shellescape(l:path)) - let l:candidates = [] - try - let l:result = eval(unite#util#system(l:command)) - let l:candidates = get(l:result, 'decls', []) - catch - call unite#print_source_error(['command returned invalid response.', v:exception], s:source.name) - endtry - - return map(l:candidates, "{ - \ 'word': printf('%s :%d :%s', fnamemodify(v:val.filename, ':~:.'), v:val.line, v:val.full), - \ 'kind': 'jump_list', - \ 'action__path': v:val.filename, - \ 'action__line': v:val.line, - \ 'action__col': v:val.col, - \ }") -endfunction - -function! s:source.hooks.on_syntax(args, context) abort - syntax match uniteSource__Decls_Filepath /[^:]*\ze:/ contained containedin=uniteSource__Decls - syntax match uniteSource__Decls_Line /\d\+\ze :/ contained containedin=uniteSource__Decls - syntax match uniteSource__Decls_WholeFunction /\vfunc %(\([^)]+\) )?[^(]+/ contained containedin=uniteSource__Decls - syntax match uniteSource__Decls_Function /\S\+\ze(/ contained containedin=uniteSource__Decls_WholeFunction - syntax match uniteSource__Decls_WholeType /type \S\+/ contained containedin=uniteSource__Decls - syntax match uniteSource__Decls_Type /\v( )@<=\S+/ contained containedin=uniteSource__Decls_WholeType - highlight default link uniteSource__Decls_Filepath Comment - highlight default link uniteSource__Decls_Line LineNr - highlight default link uniteSource__Decls_Function Function - highlight default link uniteSource__Decls_Type Type - - syntax match uniteSource__Decls_Separator /:/ contained containedin=uniteSource__Decls conceal - syntax match uniteSource__Decls_SeparatorFunction /func / contained containedin=uniteSource__Decls_WholeFunction conceal - syntax match uniteSource__Decls_SeparatorType /type / contained containedin=uniteSource__Decls_WholeType conceal -endfunction - -let &cpoptions = s:save_cpo -unlet s:save_cpo - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/compiler/go.vim b/sources_non_forked/vim-go/compiler/go.vim deleted file mode 100644 index 0bd6a154..00000000 --- a/sources_non_forked/vim-go/compiler/go.vim +++ /dev/null @@ -1,48 +0,0 @@ -" Copyright 2013 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" compiler/go.vim: Vim compiler file for Go. - -if exists("g:current_compiler") - finish -endif -let g:current_compiler = "go" - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -if exists(":CompilerSet") != 2 - command -nargs=* CompilerSet setlocal -endif - -let s:save_cpo = &cpo -set cpo-=C -if filereadable("makefile") || filereadable("Makefile") - CompilerSet makeprg=make -else - CompilerSet makeprg=go\ build -endif - -" Define the patterns that will be recognized by QuickFix when parsing the -" output of Go command that use this errorforamt (when called make, cexpr or -" lmake, lexpr). This is the global errorformat, however some command might -" use a different output, for those we define them directly and modify the -" errorformat ourselves. More information at: -" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#errorformat -CompilerSet errorformat =%-G#\ %.%# " Ignore lines beginning with '#' ('# command-line-arguments' line sometimes appears?) -CompilerSet errorformat+=%-G%.%#panic:\ %m " Ignore lines containing 'panic: message' -CompilerSet errorformat+=%Ecan\'t\ load\ package:\ %m " Start of multiline error string is 'can\'t load package' -CompilerSet errorformat+=%A%\\%%(%[%^:]%\\+:\ %\\)%\\?%f:%l:%c:\ %m " Start of multiline unspecified string is 'filename:linenumber:columnnumber:' -CompilerSet errorformat+=%A%\\%%(%[%^:]%\\+:\ %\\)%\\?%f:%l:\ %m " Start of multiline unspecified string is 'filename:linenumber:' -CompilerSet errorformat+=%C%*\\s%m " Continuation of multiline error message is indented -CompilerSet errorformat+=%-G%.%# " All lines not matching any of the above patterns are ignored -let &cpo = s:save_cpo -unlet s:save_cpo - -" 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/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt deleted file mode 100644 index 30dffd74..00000000 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ /dev/null @@ -1,2534 +0,0 @@ -*vim-go.txt* Go development plugin -*vim-go* - -============================================================================== -# # -# ## ## #### ## ## ###### ####### # -# ## ## ## ### ### ## ## ## ## # -# ## ## ## #### #### ## ## ## # -# ## ## ## ## ### ## ####### ## #### ## ## # -# ## ## ## ## ## ## ## ## ## # -# ## ## ## ## ## ## ## ## ## # -# ### #### ## ## ###### ####### # -# # -============================================================================== -CONTENTS *go-contents* - - 1. Intro........................................|go-intro| - 2. Install......................................|go-install| - 3. Commands.....................................|go-commands| - 4. Mappings.....................................|go-mappings| - 5. Text Objects.................................|go-text-objects| - 6. Functions....................................|go-functions| - 7. Settings.....................................|go-settings| - 8. Syntax highlighting..........................|go-syntax| - 9. Debugger.....................................|go-debug| - 10. FAQ/Troubleshooting..........................|go-troubleshooting| - 11. Development..................................|go-development| - 12. Donation.....................................|go-donation| - 13. Credits......................................|go-credits| - -============================================================================== -INTRO *go-intro* - -Go (golang) support for Vim. vim-go comes with sensible predefined settings -(e.g. automatic `gofmt` on save), has code completion, snippet support, -improved syntax highlighting, go toolchain commands, etc. It is highly -customizable, and individual features can be toggled easily. vim-go leverages -a number of tools developed by the Go community to provide a seamless Vim -experience. - - * Compile your package with |:GoBuild|, install it with |:GoInstall| or - test it with |:GoTest|. Run a single test with |:GoTestFunc|). - * Quickly execute your current file(s) with |:GoRun|. - * Improved syntax highlighting and folding. - * Debug programs with integrated `delve` support with |:GoDebugStart|. - * Code completion support via `gocode` and `gopls`. - * `gofmt` or `goimports` on save keeps the cursor position and undo history. - * Go to symbol/declaration with |:GoDef|. - * Look up documentation with |:GoDoc| or |:GoDocBrowser|. - * 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 `golangci-lint` with |:GoMetaLinter| to invoke all possible linters - (`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|. - * Automatic `GOPATH` detection which works with `gb` and `godep`. Change or - display `GOPATH` with |:GoPath|. - * Integrated and improved snippets, supporting `ultisnips`, `neosnippet`, - and `vim-minisnip`. - * Share your current code to play.golang.org with |:GoPlay|. - * On-the-fly information about the word under the cursor. Plug it into your - custom Vim function. - * Text objects such as "a function" (|go-af|) or "inner function" (|go-if|). - * Most commands are run asynchronous in Neovim and Vim 8. Fully async - building and testing. - * Integrated with the Neovim terminal, launch |:GoRun| and other Go commands - in a terminal buffer. - * Switch between `file.go` and `file_test.go` code with |:GoAlternate|. - * Supports integration with the Tagbar and ctrlp.vim plugins. - * ...and more... - -============================================================================== -INSTALL *go-install* - -vim-go requires at least Vim 8.0.1453 or Neovim 0.3.2. On macOS, if you are -still using your system version of vim, you can use homebrew to keep your -version of Vim up-to-date with the following terminal command: -> - brew install vim - -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 and should work with any of -the major plugin managers. - -For Pathogen or Vim |packages|, just clone the repo. For other plugin managers -you may also need to add the lines to your vimrc to execute the plugin -manager's install command. - -* Vim 8 |packages| > - - git clone https://github.com/fatih/vim-go.git \ - ~/.vim/pack/plugins/start/vim-go -< -* https://github.com/tpope/vim-pathogen > - - git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go -< -* https://github.com/junegunn/vim-plug > - - Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -< -* https://github.com/Shougo/neobundle.vim > - - NeoBundle 'fatih/vim-go' -< -* https://github.com/gmarik/vundle > - - Plugin 'fatih/vim-go' -< -* Manual (not recommended) > - - Copy all of the files into your `~/.vim` directory -< - -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|, to -`go get` all the required binaries. The binaries will be installed to $GOBIN -or $GOPATH/bin (default: $HOME/go/bin). It requires `git`. - -Depending on your installation method, you may have to generate the plugin's -|:helptags| manually (e.g. `:helptags ALL`). - -Code completion is enabled by default via 'omnifunc', which you can trigger -with |i_CTRL-X_CTRL-O| (``). - -Supported Go plugins~ *vim-go-plugins* - -The following plugins are supported for use with vim-go: - -* Real-time completion (Vim): - https://github.com/Shougo/neocomplete.vim - -* Real-time completion (Neovim and Vim 8): - https://github.com/Shougo/deoplete.nvim - - Add the following line to your vimrc. This instructs deoplete to use omni - completion for Go files. - - call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) - -* Display source code navigation in a sidebar: - https://github.com/majutsushi/tagbar - -* Snippets: - https://github.com/Shougo/neosnippet.vim or - https://github.com/SirVer/ultisnips or - https://github.com/joereynolds/vim-minisnip - -* Interactive |:GoDecls| and |:GoDeclsDir|: - https://github.com/ctrlpvim/ctrlp.vim or - https://github.com/junegunn/fzf.vim or - https://github.com/Shougo/unite.vim or - https://github.com/Shougo/denite.nvim - -============================================================================== -COMMANDS *go-commands* - - *:GoReportGitHubIssue* -:GoReportGitHubIssue - GoReportGitHubIssue opens the default browser and starts a new bug report - with useful system information. - - *:GoPath* -:GoPath [path] - - GoPath sets and overrides GOPATH with the given {path}. If no {path} is - given it shows the current GOPATH. If `""` is given as path, it clears - current `GOPATH` which was set with |:GoPath| and restores `GOPATH` back - to the initial value which was sourced when Vim was started. - - *:GoImport* -:GoImport[!] [path] - - Import ensures that the provided package {path} is imported in the current - Go buffer, using proper style and ordering. If {path} is already being - imported, an error will be displayed and the buffer will be untouched. - - If [!] is given it will download the package with `go get` - - *:GoImportAs* -:GoImportAs [localname] [path] - - Same as Import, but uses a custom local name for the package. - - *:GoDrop* -:GoDrop [path] - - Remove the import line for the provided package {path}, if present in the - current Go buffer. If {path} is not being imported, an error will be - displayed and the buffer will be untouched. - - *:GoLint* -:GoLint! [packages] - - Run golint for the directory under your current file, or for the given - packages. - - If [!] is not given the first error is jumped to. - - *:GoDoc* -:GoDoc [word] - - Open the relevant GoDoc in split window for either the word[s] passed to - the command or by default, the word under the cursor. - - *:GoDocBrowser* -:GoDocBrowser [word] - - Open the relevant GoDoc in browser for either the word[s] passed to the - command or by default, the word under the cursor. By default it opens the - documentation in 'https://godoc.org'. To change it see |'g:go_doc_url'|. - - *:GoFmt* -:GoFmt - - Filter the current Go buffer through gofmt. It tries to preserve cursor - position and avoids replacing the buffer with stderr output. - - *:GoImports* -:GoImports - - Filter the current Go buffer through goimports (needs to be installed). - `goimports` automatically discards/add import path based on the code. Like - |:GoFmt|, It tries to preserve cursor position and avoids replacing the - buffer with stderr output. - - *:GoPlay* -:[range]GoPlay - - Share snippet to play.golang.org. If no [range] is given it shares - the whole file, otherwise the selected lines are shared. Snippet URL - is copied to system clipboard if Vim is compiled with 'clipboard' or - 'xterm-clipboard' otherwise it's get yanked into the `""` register. - - *:GoVet* -:GoVet[!] [options] - - Run `go vet` for the directory under your current file. Vet examines Go - source code and reports suspicious constructs, such as Printf calls whose - arguments do not align with the format string. Vet uses heuristics that do - not guarantee all reports are genuine problems, but it can find errors not - caught by the compilers. - - You may optionally pass any valid go vet flags/options. - - If [!] is not given the first error is jumped to. - - *:GoDef* -:GoDef -gd -CTRL-] -g - - - Go to declaration/definition for the identifier under the cursor. By - default the CTRL-] shortcut, the mapping `gd` and , - g are enabled to invoke :GoDef for the identifier under the - cursor. See |'g:go_def_mapping_enabled'| to disable them. No explicit - arguments are supported. - - vim-go also keeps a per-window location stack, roughly analogous to how - Vim's internal |tags| functionality works. This is pushed to every time a - jump is made using the GoDef functionality. In essence, this is a LIFO - list of file locations you have visited with :GoDef that is retained to - help you navigate software. - - The per-window location stack is shared with |:GoDefType|. - - *:GoDefType* -:GoDefType - - Go to type definition for the identifier under the cursor. - - The per-window location stack is shared with |:GoDef|. - *:GoDefStack* -:GoDefStack [number] - - This command Jumps to a given location in the jumpstack, retaining all - other entries. Jumps to non-existent entries will print an informative - message, but are otherwise a noop. - - If no argument is given, it will print out an interactive list of all - items in the stack. Its output looks like this: - - 1 /path/first/file.go|1187 col 16|AddThing func(t *Thing) - > 2 /path/thing/thing.go|624 col 19|String() string - 3 /path/thing/thing.go|744 col 6|func Sprintln(a ...interface{}) string - - This list shows the identifiers that you jumped to and the file and cursor - position before that jump. The older jumps are at the top, the newer at - the bottom. - - The '>' points to the active entry. This entry and any newer entries - below it will be replaced if |:GoDef| is done from this location. The - CTRL-t and |:GoDefPop| command will jump to the position above the active - entry. - - Jumps to non-existent entries will print an informative message, but are - otherwise a noop. - - *:GoDefStackClear* -:GoDefStackClear - - Clears the current stack list and resets it. - - *:GoDefPop* -:GoDefPop [count] -CTRL-t - - Navigate to the [count] earlier entry in the jump stack, retaining the - newer entries. If no argument is given, it will jump to the next most - recent entry (`:GoDefPop 1`). If [count] is greater than the number of - prior entries, an error will be printed and no jump will be performed. - - If you have used :GoDefPop to jump to an earlier location, and you issue - another :GoDef command, the current entry will be replaced, and all newer - entries will be removed, effectively resuming the stack at that location. - - By default [count]CTRL-t is enabled to invoke :GoDefPop. Similarly, - hitting CTRL-t without a prior count is equivalent to `:GoDefPop 1`. See - |'g:go_def_mapping_enabled'| to disable this. - - *:GoRun* -:GoRun[!] [expand] - - Build and run your current main package. By default all main files for the - current file is used. If an argument is passed, [expand] is used as file - selector. For example use `:GoRun %` to select the current file only. - - You may optionally pass any valid go run flags/options. For a full list - please see `go help run`. - - If [!] is not given the first error is jumped to. - - If using neovim then `:GoRun` will run in a new terminal according to - |'g:go_term_mode'|. - - *:GoBuild* -:GoBuild[!] [expand] - - Build your package with `go build`. Errors are populated in the quickfix - window. It automatically builds only the files that depends on the current - file. `:GoBuild` doesn't produce a result file. - Use |:make| to create a result file. - - You may optionally pass any valid go build flags/options. For a full list - please see `go help build`. Options are expanded with [expand]. - - If [!] is not given the first error is jumped to. - - If using neovim then this command is fully async, it does not block the - UI. - - *:GoGenerate* -:GoGenerate[!] [expand] - - Creates or updates your auto-generated source files by running `go - generate`. - - You may optionally pass any valid go generate flags/options. For a full - list please see `go help generate`. Options are expanded with [expand]. - - If [!] is not given the first error is jumped to. - - *:GoInfo* -:GoInfo - Show type information about the identifier under the cursor. For example - putting it above a function call is going to show the full function - signature. By default it uses `gopls` to get the type informations. To - change the underlying tool from `gopls` to another tool, see - |'g:go_info_mode'|. - - - *:GoInstall* -:GoInstall[!] [options] - - Install your package with `go install`. - - You may optionally pass any valid go install flags/options. For a full - list please see `go help install`. - - If [!] is not given the first error is jumped to. - - *:GoTest* -:GoTest[!] [expand] - - Run the tests on your _test.go files via in your current directory. Errors - are populated in the quickfix window. If an argument is passed, [expand] - is used as file selector (useful for cases like `:GoTest ./...`). - - You may optionally pass any valid go test flags/options. For a full list - please see `go help test`. - - GoTest timesout automatically after 10 seconds. To customize the timeout - use |'g:go_test_timeout'|. This feature is disabled if any arguments are - passed to the `:GoTest` command. - - If [!] is not given the first error is jumped to. - - If using neovim `:GoTest` will run in a new terminal or run asynchronously - in the background according to |'g:go_term_enabled'|. You can set the mode - of the new terminal with |'g:go_term_mode'|. - - *:GoTestFunc* -:GoTestFunc[!] [expand] - - Runs :GoTest, but only on the single test function immediate to your - cursor using 'go test's '-run' flag. - - Lookup is done starting at the cursor (including that line) moving up till - a matching `func Test` pattern is found or top of file is reached. Search - will not wrap around when at the top of the file. - - If [!] is not given the first error is jumped to. - - If using neovim `:GoTestFunc` will run in a new terminal or run - asynchronously in the background according to |'g:go_term_enabled'|. You - can set the mode of the new terminal with |'g:go_term_mode'|. - - *:GoTestCompile* -:GoTestCompile[!] [expand] - - Compile your _test.go files via in your current directory. Errors are - populated in the quickfix window. If an argument is passed, [expand] is - used as file selector (useful for cases like `:GoTest ./...`). Useful to - not run the tests and capture/fix errors before running the tests or to - create test binary. - - If [!] is not given the first error is jumped to. - - If using neovim `:GoTestCompile` will run in a new terminal or run - asynchronously in the background according to |'g:go_term_enabled'|. You - can set the mode of the new terminal with |'g:go_term_mode'|. - - *:GoCoverage* -:GoCoverage[!] [options] - - Create a coverage profile and annotates the current file's source code. If - called again it rerurns the tests. - - If [!] is not given the first error is jumped to. - - *:GoCoverageToggle* -:GoCoverageToggle[!] [options] - - Create a coverage profile and annotates the current file's source code. If - called again clears the annotation (works as a toggle). - - If [!] is not given the first error is jumped to. - - *:GoCoverageClear* -:GoCoverageClear [options] - - Clears the coverage annotation. - - - *:GoCoverageBrowser* -:GoCoverageBrowser[!] [options] - - Create a coverage profile and open a browser to display the annotated - source code of the current package. - - You may optionally pass any valid go test flags/options, such as - `-covermode set,count,atomic`. For a full list please see `go help test`. - - If [!] is not given the first error is jumped to. - - *:GoErrCheck* -:GoErrCheck! [options] - - Check for unchecked errors in you current package. Errors are populated in - the quickfix window. - - You may optionally pass any valid errcheck flags/options. See - `errcheck -h` for a full list. - - If [!] is not given the first error is jumped to. - - *:GoFiles* -:GoFiles [source_files] - - Show source files for the current package. The [source_files] specifies - which file types to list. See the "// Source files" section of - `go list -h` for possible values; multiple values are accepted. - Command-line completion also works for this command. - The default is to use `GoFiles` if no arguments are given. - - *:GoDeps* -:GoDeps - - Show dependencies for the current package. - - *:GoInstallBinaries* -:GoInstallBinaries [binaries] - - Download and install all necessary Go tool binaries such as `godef`, - `goimports`, `gocode`, etc. under |'g:go_bin_path'|. If [binaries] is - supplied, then only the specified binaries will be installed. The default - is to install everything. - - Set |'g:go_get_update'| to disable updating dependencies. - - *:GoUpdateBinaries* -:GoUpdateBinaries [binaries] - - Download and update previously installed Go tool binaries such as `godef`, - `goimports`, `gocode`, etc. under |'g:go_bin_path'|. If [binaries] is - supplied, then only the specified binaries will be updated. The default is - to update everything. - - Set |'g:go_get_update'| to disable updating dependencies. - - *:GoImplements* -:GoImplements - - Show "implements" relation for a selected package. A list of interfaces - for the type that implements an interface under the cursor (or selected - package) is shown in a location list. - *:GoRename* -:GoRename[!] [to] - - Rename the identifier under the cursor to the desired new name. If no - argument is given a prompt will ask for the desired identifier. - - If [!] is not given the first error is jumped to. - - - *:GoGuruScope* -:GoGuruScope [pattern] ... - - Changes the custom |'g:go_guru_scope'| setting and overrides it with the - given package patterns. The custom scope is cleared (unset) if `""` is - given as the only path. If no arguments is given it prints the current - custom scope. Example patterns are: -> - golang.org/x/tools/cmd/guru # a single package - golang.org/x/tools/... # all packages beneath dir - ... # the entire workspace. -< - Example usage, the following sets the scope to a `github.com/fatih/color` - and to all packages under `golang.org/x/tools/`: -> - :GoGuruScope github.com/fatih/color golang.org/x/tools/... -< - The following sets it to the entire workspace: -> - :GoGuruScope ... -< - Under the hood, the patterns are all joined to a comma-separated list and - passed to `guru`'s `-scope` flag. - - Also see |go-guru-scope|. - - *:GoCallees* -:GoCallees - - Show "callees" relation for a selected package. A list of possible call - targets for the type under the cursor (or selected package) is shown in a - location list. - - *:GoCallers* -:GoCallers - - Show "callers" relation for a selected function. A list of possible - callers for the selected function under the cursor is shown in a location - list. - - *:GoDescribe* -:GoDescribe - - Shows various properties of the selected syntax: its syntactic kind, its - type (for an expression), its value (for a constant expression), its size, - alignment, method set and interfaces (for a type), its declaration (for an - identifier), etc. Almost any piece of syntax may be described, and the - guru will try to print all the useful information it can. - - *:GoCallstack* -:GoCallstack - - Shows "callstack" relation for the selected function. An arbitrary path - from the root of the callgraph to the selected function is shown in a - location list. This may be useful to understand how the function is - reached in a given program. - - *:GoFreevars* -:GoFreevars - - Enumerates the free variables of the selection. "Free variables" is a - technical term meaning the set of variables that are referenced but not - defined within the selection, or loosely speaking, its inputs. - - This information is useful when considering whether to refactor the - selection into a function of its own, as the free variables would be the - necessary parameters of that function. It's also useful when you want to - understand what the inputs are to a complex block of code even if you - don’t plan to change it. - - *:GoChannelPeers* -:GoChannelPeers - - Shows the set of possible sends/receives on the channel operand of the - selected send or receive operation; the selection must be a `<-` token. - - For example, visually select a channel operand in the form of: -> - done <- true -< - And call |:GoChannelPeers| on it. It will show where it was allocated, and - the sending and receiving endings. - - *:GoReferrers* -:GoReferrers - - The referrers query shows the set of identifiers that refer to the same - object as does the selected identifier. - - *:GoSameIds* -:GoSameIds - - Highlights all identifiers that are equivalent to the identifier under the - cursor. - - *:GoSameIdsClear* -:GoSameIdsClear - - Clears all SameIds highlights from a |:GoSameIds| call. - - *:GoSameIdsToggle* -:GoSameIdsToggle - - Toggle between |:GoSameIds| and |:GoSameIdsClear|. - - *:GoSameIdsAutoToggle* -:GoSameIdsAutoToggle - - Enables or disables automatic highlighting of |:GoSameIds| while moving - the cursor. This basically toggles the option |'g:go_auto_sameids'| - on/off. - If enabled it starts highlighting whenever your cursor is staying at the - same position for a configurable period of time (see |'g:go_updatetime'|). - If disabled it clears and stops automatic highlighting. - - *:GoMetaLinter* -:GoMetaLinter! [path] - - Calls the underlying `golangci-lint` tool and displays all warnings and - errors in the |quickfix| window. By default the following linters are - enabled: `vet`, `golint`, and `errcheck`. This can be changed with the - |'g:go_metalinter_enabled'| variable. To override the command completely - use the variable |'g:go_metalinter_command'|. To override the maximum - linters execution time use |'g:go_metalinter_deadline'| variable. - - If [!] is not given the first error is jumped to. - - *:GoBuildTags* -:GoBuildTags [tags] - - Changes the build tags for various commands. If you have any file that - uses a custom build tag, such as `// +build integration` , this command - can be used to pass it to all tools that accepts tags, such as gopls, - guru, gorename, etc. - - The build tags is cleared (unset) if `""` is given. If no arguments are - given it prints the current build tags. - - *:AsmFmt* -:AsmFmt - - Filter the current Go asm buffer through asmfmt. It tries to preserve - cursor position and avoids replacing the buffer with stderr output. - - *:GoAlternate* -:GoAlternate[!] - - Alternates between the implementation and test code. For example if in - main.go, switch to main_test.go. Uses the |'g:go_alternate_mode'| setting - as the command to open the file. - - If [!] is given then it switches to the new file even if it does not - exist. - - If you would like to override the traditional commands for alternating, - add the following to your .vimrc: -> - augroup go - autocmd! - autocmd Filetype go - \ command! -bang A call go#alternate#Switch(0, 'edit') - \| command! -bang AV call go#alternate#Switch(0, 'vsplit') - \| command! -bang AS call go#alternate#Switch(0, 'split') - augroup END -< - - *:GoPointsTo* -:GoPointsTo - - Show all variables to which the pointer under the cursor may point to. - - *:GoWhicherrs* -:GoWhicherrs - - Show the list of possible constants, global variables, and concrete types - for the error type under the cursor in a location list. - - *:GoDecls* -:GoDecls [file] - - Show all function and type declarations for the current file. If - [file] is non empty it parses the given file. - Requires `ctrlp.vim` or `fzf`; it will autodetect the plugin if installed, - but you can use |'g:go_decls_mode'| to force using one or the other. - By default `type` and `func` declarations are shown. This can be changed - via |'g:go_decls_includes'|. Also see |unite-decls|, |denite-decls|. - - *:GoDeclsDir* -:GoDeclsDir [dir] - - Show all function and type declarations for the current directory. If - [dir] is given it parses the given directory. - - *unite-decls* - *denite-decls* -:Unite decls[:path] -:Denite decls[:path] - - Only enabled if `unite.vim` or `denite.nvim` is installed. Show - declarations for all functions and types on the current file or directory - or for [path] if given. - - Note: `denite.nvim` requires NeoVim or Vim 8 with |:python3| enabled. -> - " show declarations on the parent directory of the current file - :Unite decls - :Denite decls - - " show declarations in the file. - :Unite decls:foo/bar.go - :Denite decls:foo/bar.go - - " show declarations in the directory "foo". - :Unite decls:foo - :Denite decls:foo -< - *:GoImpl* -:GoImpl [receiver] [interface] - - Generates method stubs for implementing an interface. If no arguments is - passed it takes the identifier under the cursor to be the receiver and - asks for the interface type to be generated. If used with arguments, the - receiver and the interface needs to be specified. Example usages: -> - :GoImpl f *Foo io.Writer - :GoImpl t Type io.ReadWriteCloser -< - *:GoAddTags* -:[range]GoAddTags [key],[option] [key1],[option] ... - - Adds field tags for the fields of a struct. If called inside a struct it - automatically add field tags with the `json` key and the value - automatically generated based on the field name. An error message is given - if it's called outside a struct definition or if the file is not correctly - formatted. - - If [range] is given, only the selected fields will be changed. - - The default `json` can be changed by providing one or more [key] - arguments. An example of adding `xml` and `db` would be: -> - :GoAddTags xml db -< - If [option] is passed it'll either add a new tag with an option or will - modify existing tags. An example of adding `omitempty` to all `json` - fields would be: -> - :GoAddTags json,omitempty -< - You can define a constant value instead of the default field based value. - For example the following command will add ``valid:"1"`` to all fields. -> - :GoAddTags valid=1 -< - *:GoRemoveTags* -:[range]GoRemoveTags [key],[option] [key1],[option1] ... - - Remove field tags for the fields of a struct. If called inside a struct it - automatically remove all field tags. An error message is given if it's - called outside a struct definition or if the file is not correctly - formatted - - If [range] is given, only the selected fields will be changed. - - If [key] is given, it will only remove those keys. Example: -> - :GoRemoveTags json -< - If [option] is passed with a [key], it will only remove the options. - Example, this will only remove `omitempty` options from fields containing - `json`: -> - :GoRemoveTags json,omitempty -< - *:GoAutoTypeInfoToggle* -:GoAutoTypeInfoToggle - - Toggles |'g:go_auto_type_info'|. - - *:GoFmtAutoSaveToggle* -:GoFmtAutoSaveToggle - - Toggles |'g:go_fmt_autosave'|. - - *:GoModFmtAutoSaveToggle* -:GoModFmtAutoSaveToggle - - Toggles |'g:go_mod_fmt_autosave'|. - - *:GoAsmFmtAutoSaveToggle* -:GoAsmFmtAutoSaveToggle - - Toggles |'g:go_asmfmt_autosave'|. - - *:GoMetaLinterAutoSaveToggle* -:GoMetaLinterAutoSaveToggle - - Toggles |'g:go_metalinter_autosave'|. - - By default, `golangci-lint` messages will be shown in the |location-list| - window. The list to use can be set using |'g:go_list_type_commands'|. - - *:GoTemplateAutoCreateToggle* -:GoTemplateAutoCreateToggle - - Toggles |'g:go_template_autocreate'|. - - *:GoKeyify* -:GoKeyify - - Uses `keyify` to turn unkeyed struct literals into keyed ones. - - For example: -> - Person{"John", "Smith"} -< - Becomes: -> - Person{ - Name: "John", - Surname: "Smith", - } -< - *:GoFillStruct* -:GoFillStruct - - Use `fillstruct` to fill a struct literal with default values. Existing - values (if any) are preserved. The cursor must be on the struct you wish - to fill. - - For example: -> - addr := net.Address{Name: "Ford Prefect"} -< - Becomes: -> - addr := net.Address{ - Name: "Ford Prefect", - Email: "", - } -< - - *:GoIfErr* -:GoIfErr - - Generate 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 - } - } -< - *:GoModFmt* -:GoModFmt - - Filter the current go.mod buffer through "go mod edit -fmt" command. It - tries to preserve cursor position and avoids replacing the buffer with - stderr output. - - *:GoAddWorkspace* -:GoAddWorkspace [dir] ... - - Add directories to the `gopls` workspace. - - *:GoLSPDebugBrowser* -:GoLSPDebugBrowser - - Open a browser to see gopls debugging information. - -============================================================================== -MAPPINGS *go-mappings* - -vim-go has several keys which can be used to create custom mappings -For example, to create a mapping that calls `go run` for the current package, -create a mapping for the `(go-run)`: > - - au FileType go nmap r (go-run) - -As always one is free to create more advanced mappings or functions based with -|go-commands|. For more information please check out the mappings command -documentation in the |go-commands| section. Available keys are: - - *(go-run)* - -Calls `go run` for the current main package - - *(go-run-tab)* - -Calls `go run` for the current file in a new terminal tab -This option is neovim only. - - *(go-run-split)* - -Calls `go run` for the current file in a new terminal horizontal split -This option is neovim only. - - *(go-run-vertical)* - -Calls `go run` for the current file in a new terminal vertical split -This option is neovim only. - - *(go-build)* - -Calls `go build` for the current package - - *(go-generate)* - -Calls `go generate` for the current package - - *(go-info)* - -Shows type information for the word under the cursor - - *(go-install)* - -Calls `go install` for the current package - - *(go-test)* - -Calls `go test` for the current package - - *(go-test-func)* - -Calls `go test -run '...'` for the test function immediate to cursor - - *(go-test-compile)* - -Calls `go test -c` for the current package - - *(go-coverage)* - -Calls `go test -coverprofile-temp.out` for the current package and shows the -coverage annotation. - - *(go-coverage-clear)* - -Clears the coverage annotation - - *(go-coverage-toggle)* - -Calls `go test -coverprofile-temp.out` for the current package and shows the -coverage annotation. If run again it acts as a toggle and clears the -annotation. - - *(go-imports)* - -Calls `goimports` for the current package - - *(go-lint)* - -Calls `golint` for the current package - - *(go-vet)* - -Calls `go vet` for the current package - - - *(go-files)* - -Show source files that depends for the current package - - - *(go-deps)* - -Show dependencies for the current package - - *(go-doc)* - -Show the relevant GoDoc for the word under the cursor in a split window -leftabove (default mode). - - *(go-doc-split)* - -Show the relevant GoDoc for the word under the cursor in a split window. - - - *(go-doc-vertical)* - -Show the relevant GoDoc for the word under the cursor in a vertical split -window. - - *(go-doc-tab)* - -Show the relevant GoDoc for the word under the cursor in a tab window. - - - *(go-doc-browser)* - -Show the relevant GoDoc for the word under in browser - - *(go-def)* - -Goto declaration/definition. Results are shown in the current buffer. - - *(go-def-split)* - -Goto declaration/definition. Results are shown in a split window. -Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. - - *(go-def-vertical)* - -Goto declaration/definition. Results are shown in a vertical split window. -Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. - - *(go-def-tab)* - -Goto declaration/definition. Results are shown in a tab window. -Jumps to an existing buffer if |'g:go_def_reuse_buffer'| is enabled. - - *(go-def-stack)* - -Shows the godef tag stack - - *(go-def-stack-clear)* - -Resets and clears the tag stack - - *(go-def-pop)* - -Jump to previous entry in the tag stack - - *(go-implements)* - -Show the interfaces that the type under the cursor implements. - - *(go-rename)* - -Rename the identifier under the cursor to the desired new name - - *(go-callees)* - -Show the call targets for the type under the cursor - - *(go-callers)* - -Show possible callers of selected function - - *(go-describe)* - -Describe selected syntax: definition, methods, etc - - *(go-callstack)* - -Show path from callgraph root to selected function - - *(go-freevars)* - -Show free variables of selection - - *(go-channelpeers)* - -Show send/receive corresponding to selected channel op - - *(go-referrers)* - -Show all refs to entity denoted by selected identifier - - *(go-pointsto)* - -Show all variables to which the pointer under the cursor may point to. - - *(go-metalinter)* - -Calls `go-metalinter` for the current directory - - *(go-alternate-edit)* - -Alternates between the implementation and test code in the current window - - *(go-alternate-split)* - -Alternates between the implementation and test code in a new horizontal split - - *(go-alternate-vertical)* - -Alternates between the implementation and test code in a new vertical split - - *(go-import)* - -Calls `:GoImport` for the current package - - *(go-iferr)* - -Generate if err != nil { return ... } automatically which infer the type of -return values and the numbers. - - *(go-mod-fmt)* - -Calls |:GoModFmt| for the current buffer - -============================================================================== -TEXT OBJECTS *go-text-objects* - -vim-go comes with several custom |text-objects| that can be used to operate -upon regions of text. vim-go currently defines the following text objects: - - *go-v_af* *go-af* -af "a function", select contents from a function definition to the - closing bracket. If |'g:go_textobj_include_function_doc'| is - enabled it also includes the comment doc for a function - declaration. This text-object also supports literal functions. - If |'g:go_textobj_include_variable'| is enabled it also - includes the variable of an function assignment - - *go-v_if* *go-if* -if "inside a function", select contents of a function, - excluding the function definition and the closing bracket. This - text-object also supports literal functions - - *go-v_ac* *go-ac* -ac "a comment", select contents of the current comment block. - - *go-v_ic* *go-ic* -ic "inner comment", select contents of the current comment block, - excluding the start and end comment markers. - -vim-go also defines the following text motion objects: - - *go-v_]]* *go-]]* -]] [count] forward to next function declaration. If - |'g:go_textobj_include_function_doc'| is enabled and if your - on a comment, it skips the function which the comment - belongs and forwards to the next function declaration. - - *go-v_[[* *go-[[* -[[ [count] backward to previous function declaration. - - - -============================================================================== -FUNCTIONS *go-functions* - - *go#statusline#Show()* - -Shows the status of a job running asynchronously. Can be used to plug into the -statusline. It works to show the status per package instead of per file. -Assume you have three files open, all belonging to the same package, if the -package build (`:GoBuild`) is successful, all statuslines will show `success`, -if it fails all windows' statuslines will show `failed`. - -To avoid always showing old status information, the status information is -cleaned for each package after `60` seconds. This can be changed with the -|'g:go_statusline_duration'| setting. - - *go#complete#GetInfo()* - -Returns the description of the identifer under the cursor. Can be used to plug -into the statusline. - - *go#complete#Complete()* - -Uses `gopls` for autocompletion. By default, it is hooked up to |'omnifunc'|. - - - *go#complete#GocodeComplete()* - -Uses `gocode` for autocompletion. - - *go#tool#DescribeBalloon()* - -Suitable to be used as an expression to show the evaluation balloon. See `help -balloonexpr`. - -============================================================================== -SETTINGS *go-settings* - - *'g:go_version_warning'* - -Enable warning when using an unsupported version of Vim. By default it is -enabled. -> - let g:go_version_warning = 1 -< - - *'g:go_code_completion_enabled'* - -Enable code completion with |'omnifunc'|. By default it is enabled. -> - let g:go_code_completion_enabled = 1 -< - - *'g:go_test_show_name'* - -Show the name of each failed test before the errors and logs output by the -test. By default it is disabled. -> - let g:go_test_show_name = 0 -< - - *'g:go_test_timeout'* - -Use this option to change the test timeout of |:GoTest|. By default it is -set to 10 seconds . > - - let g:go_test_timeout= '10s' -< - *'g:go_play_browser_command'* - -Browser to use for |:GoPlay|, |:GoDocBrowser|, and |:GoLSPDebugBrowser|. The -url must be added with `%URL%`, and it's advisable to include `&` to make sure -the shell returns. For example: -> - let g:go_play_browser_command = 'firefox-developer %URL% &' -< - -By default it tries to find it automatically for the current OS. > - - let g:go_play_browser_command = '' -< - *'g:go_play_open_browser'* - -Use this option to open browser after posting the snippet to play.golang.org -with |:GoPlay|. By default it's enabled. > - - let g:go_play_open_browser = 1 -< - *'g:go_auto_type_info'* - -Use this option to show the type info (|:GoInfo|) for the word under the -cursor automatically. Whenever the cursor changes the type info will be -updated. By default it's disabled. The delay can be configured with the -|'g:go_updatetime'| setting. -> - let g:go_auto_type_info = 0 -< - - *'g:go_info_mode'* - -Use this option to define the command to be used for |:GoInfo|. By default -`gopls` is used, because it is the fastest and is known to be highly accurate. -One might also use `guru` for its accuracy or `gocode` for its performance. -Valid options are `gocode`, `gopls`, and `guru`. -> - let g:go_info_mode = 'gopls' -< - *'g:go_auto_sameids'* - -Use this option to highlight all uses of the identifier under the cursor -(|:GoSameIds|) automatically. By default it's disabled. The delay can be -configured with the |'g:go_updatetime'| setting. -> - let g:go_auto_sameids = 0 -< - *'g:go_updatetime'* - -Use this option to configure the delay until it starts some jobs (see -|'g:go_auto_type_info'|, |'g:go_auto_sameids'|). If set to 0, it uses the -value from 'updatetime'. By default it's set to 800ms. -> - let g:go_updatetime = 800 -< - *'g:go_jump_to_error'* - -Use this option to enable/disable passing the bang attribute to the mappings -|(go-build)|, |(go-run)|, etc.. When enabled it will jump to the first error -automatically (means it will NOT pass the bang attribute to the appropriate -command, i.e: (go-run) -> :GoRun ). Note, that calling this doesn't have any -affect on calling the commands manually. This setting is only useful for -changing the behaviour of our custom static mappings. By default it's enabled. -> - let g:go_jump_to_error = 1 -< - *'g:go_fmt_autosave'* - -Use this option to auto |:GoFmt| on save. By default it's enabled > - - let g:go_fmt_autosave = 1 -< - *'g:go_fmt_command'* - -Use this option to define which tool is used to gofmt. By default `gofmt` is -used. -> - - let g:go_fmt_command = "gofmt" -< - *'g:go_fmt_options'* - -Use this option to add additional options to the |'g:go_fmt_command'|. It's -value type can be either a string or a dictionary. This is due backwards -compatibility. The string version will be removed in the future so please use -the dictionary version. Default is empty. -> - let g:go_fmt_options = '' - - or - - let g:go_fmt_options = {} -< -The dictionary version allows you to define options for multiple binaries: -> - let g:go_fmt_options = { - \ 'gofmt': '-s', - \ 'goimports': '-local mycompany.com', - \ } -< - *'g:go_fmt_fail_silently'* - -Use this option to disable showing a location list when |'g:go_fmt_command'| -fails. By default the location list is shown. > - - let g:go_fmt_fail_silently = 0 -< - *'g:go_fmt_experimental'* - -Use this option to enable fmt's experimental mode. This experimental mode is -superior to the current mode as it fully saves the undo history, so undo/redo -doesn't break. However, it's slow (creates/deletes a file for every save) and -it's causing problems on some Vim versions. By default it's disabled. > - - let g:go_fmt_experimental = 0 - -< - *'g:go_mod_fmt_autosave'* - -Use this option to auto |:GoModFmt| on save. By default it's enabled > - - let g:go_mod_fmt_autosave = 1 -< - - *'g:go_doc_keywordprg_enabled'* - -Use this option to run `godoc` on words under the cursor with |K|; this will -normally run the `man` program, but for Go using `godoc` is more idiomatic. It -will not override the |'keywordprg'| setting, but will run |:GoDoc|. Default -is enabled. > - - let g:go_doc_keywordprg_enabled = 1 -< - *'g:go_doc_height'* - -Maximum height for the GoDoc window created with |:GoDoc|. Default is 20. > - - let g:go_doc_max_height = 20 -< - - *'g:go_doc_url'* - -godoc server URL used when |:GoDocBrowser| is used. Change if you want to use -a private internal service. Default is 'https://godoc.org'. -> - let g:go_doc_url = 'https://godoc.org' -< - - *'g:go_doc_popup_window'* - -Use this option to use the popup-window for |K| and |:GoDoc|, rather than the -|preview-window|. Default is disabled. -> - let g:go_doc_popup_window = 0 -< - - *'g:go_def_mode'* - -Use this option to define the command to be used for |:GoDef|. By default -`gopls` is used, because it is the fastest. One might also use `guru` for its -accuracy or `godef` for its performance. Valid options are `godef`, `gopls`, -and `guru`. -> - let g:go_def_mode = 'gopls' -< - *'g:go_referrers_mode'* - -Use this option to define the command to be used for |:GoReferrers|. By -default `gopls` is used, because it is the fastest and works with Go modules. -One might also use `guru` for its ability to show references from other -packages. This option will be removed after `gopls` can show references from -other packages. Valid options are `gopls` and `guru`. -> - let g:go_referrers_mode = 'gopls' -< - *'g:go_def_mapping_enabled'* - -Use this option to enable/disable the default mapping of CTRL-], -, g and (`gd`) for GoDef and CTRL-t for :GoDefPop. -Disabling it allows you to map something else to these keys or mappings. -Default is enabled. > - - let g:go_def_mapping_enabled = 1 -< - *'g:go_def_reuse_buffer'* - -Use this option to jump to an existing buffer for the split, vsplit and tab -mappings of |:GoDef|. By default it's disabled. > - - let g:go_def_reuse_buffer = 0 -< - *'g:go_bin_path'* - -Use this option to change default path for vim-go tools when using -|:GoInstallBinaries| and |:GoUpdateBinaries|. If not set `$GOBIN` or -`$GOPATH/bin` is used. > - - let g:go_bin_path = "" -< - *'g:go_search_bin_path_first'* - -This option lets |'g:go_bin_path'| (or its default value) take precedence over -$PATH when invoking a tool command such as |:GoFmt| or |:GoImports|. - -Enabling this option ensures that the binaries installed via -|:GoInstallBinaries| and |:GoUpdateBinaries| are the same ones that are -invoked via the tool commands. - -By default it is enabled. > - - let g:go_search_bin_path_first = 1 -< - *'g:go_snippet_engine'* - -Define the snippet engine to use. The default is to auto-detect one. Valid -values are: - - automatic Automatically detect a snippet engine. - ultisnips https://github.com/SirVer/ultisnips - neosnippet https://github.com/Shougo/neosnippet.vim - minisnip https://github.com/joereynolds/vim-minisnip - Note: the original at KeyboardFire/vim-minisnip won't work. -> - let g:go_snippet_engine = "automatic" -< - *'g:go_get_update'* - -Use this option to disable updating dependencies with |:GoInstallBinaries|. By -default this is enabled. -> - let g:go_get_update = 1 -< - *'g:go_guru_scope'* - -Use this option to define the scope of the analysis to be passed for guru -related commands, such as |:GoImplements|, |:GoCallers|, etc. You can change -it on-the-fly with |:GoGuruScope|. The input should be a a list of package -pattern. An example input might be: -`["github.com/fatih/color","github.com/fatih/structs"]` - -Also see |go-guru-scope|. - -By default it's not set, so the relevant commands' defaults are being used. -> - let g:go_guru_scope = [] -< - *'g:go_build_tags'* - -Space-separated list of build tags passed to the `-tags` flag of tools that -support it. -There is also the |:GoBuildTags| convenience command to change or remove build -tags. -> - let g:go_build_tags = '' -< - *'g:go_autodetect_gopath'* - -Automatically modify GOPATH for certain directory structures, such as for -the `godep` tool which stores dependencies in the `Godeps` folder. What this -means is that all tools are now working with the newly modified GOPATH. So -|:GoDef| for example jumps to the source inside the `Godeps` (vendored) -source. Currently `godep` and `gb` are supported. By default it's disabled. -> - let g:go_autodetect_gopath = 0 -< - *'g:go_textobj_enabled'* - -Adds custom text objects. By default it's enabled. > - - let g:go_textobj_enabled = 1 -< - *'g:go_textobj_include_function_doc'* - -Consider the comment above a function to be part of the function when using -the `af` text object and `[[` motion. By default it's enabled. > - - let g:go_textobj_include_function_doc = 1 -< - *'g:go_textobj_include_variable'* - -Consider the variable of an function assignment to be part of the anonymous -function when using the `af` text object. By default it's enabled. > - - let g:go_textobj_include_variable = 1 -< - *'g:go_metalinter_autosave'* - -Use this option to auto |:GoMetaLinter| on save. Only linter messages for -the active buffer will be shown. - -By default, `golangci-lint` messages will be shown in the |location-list| -window. The list to use can be set using |'g:go_list_type_commands'|. - - By default it's disabled > - let g:go_metalinter_autosave = 0 -< - *'g:go_metalinter_autosave_enabled'* - -Specifies the enabled linters for auto |:GoMetaLinter| on save. By -default it's using `vet` and `golint`. -> - let g:go_metalinter_autosave_enabled = ['vet', 'golint'] -< - *'g:go_metalinter_enabled'* - -Specifies the linters to enable for the |:GoMetaLinter| command. By default -it's using `vet`, `golint` and `errcheck`. -> - let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] -< - *'g:go_metalinter_disabled'* - -Specifies the linters to disable for the |:GoMetaLinter| command. By default -it's empty -> - let g:go_metalinter_disabled = [] -< - *'g:go_metalinter_command'* - -Overrides the command to be executed when |:GoMetaLinter| is called. By -default it's `golangci-lint`. It can also be used as an advanced setting -for users who want to have more control over the metalinter. -> - let g:go_metalinter_command = "golangci-lint" -< - *'g:go_metalinter_deadline'* - -Overrides the maximum time the linters have to complete. By default it's 5 -seconds. -> - let g:go_metalinter_deadline = "5s" -< - *'g:go_list_height'* - -Specifies the window height for the quickfix and location list windows. The -default value (empty) automatically sets the height to the number of items -(maximum up to 10 items to prevent large heights). Setting the value -explicitly overrides this behavior. For standard Vim behavior, set it to 10. -> - let g:go_list_height = 0 -< - *'g:go_list_type'* - -Specifies the type of list to use for command outputs (such as errors from -builds, results from static analysis commands, etc...). The list type for -specific commands can be overridden with |'g:go_list_type_commands'|. The -default value (empty) will use the appropriate kind of list for the command -that was called. Supported values are "", "quickfix", and "locationlist". -> - let g:go_list_type = "" -< - - *'g:go_list_type_commands'* - -Specifies the type of list to use for command outputs (such as errors from -builds, results from static analysis commands, etc...). When an expected key -is not present in the dictionary, |'g:go_list_type'| will be used instead. -Supported keys are "GoBuild", "GoErrCheck", "GoFmt", "GoModFmt", "GoInstall", -"GoLint", "GoMetaLinter", "GoMetaLinterAutoSave", "GoModifyTags" (used for -both :GoAddTags and :GoRemoveTags), "GoRename", "GoRun", and "GoTest". -Supported values for each command are "quickfix" and "locationlist". -> - let g:go_list_type_commands = {} -< -As an example, the following settings will change all list types to -`locationlist` except for `:GoBuild` where `quickfix` is used: -> - let g:go_list_type = "locationlist" - let g:go_list_type_commands = {"GoBuild": "quickfix"} -< - - *'g:go_list_autoclose'* - -Specifies whether the quickfix/location list should be closed automatically -in the absence of errors. The default value is 1. -If you prefer to keep a long running error window open, you can disable -this by setting the value to 0. -> - let g:go_list_autoclose = 1 -< - *'g:go_asmfmt_autosave'* - -Use this option to auto |:AsmFmt| on save. By default it's disabled. > - - let g:go_asmfmt_autosave = 0 -< - *'g:go_term_mode'* - -This option is Neovim only. Use it to change the default command used to -open a new terminal for go commands such as |:GoRun|. -The default is vsplit. -> - let g:go_term_mode = "vsplit" -< - *'g:go_term_height'* - *'g:go_term_width'* - -These options are Neovim only. Use them to control the height and width of -a terminal split. By default these are not set, meaning that the height and -width are set automatically by Neovim. The height only applies to a -horizontal split and width only applies to a vertical split. - -For example here is how to set each to 30. -> - let g:go_term_height = 30 - let g:go_term_width = 30 -< - *'g:go_term_enabled'* - -This option is Neovim only. Use it to change the behavior of the test -commands. If set to 1 it opens the test commands inside a new terminal -according to |'g:go_term_mode'|, otherwise it will run them in the background -just like `:GoBuild`. By default it is disabled. -> - let g:go_term_enabled = 0 -< - *'g:go_term_close_on_exit'* - -This option is Neovim only. If set to 1 it closes the terminal after the -command run in it exits when the command fails. By default it is enabled. -> - let g:go_term_close_on_exit = 1 -< - *'g:go_alternate_mode'* - -Specifies the command that |:GoAlternate| uses to open the alternate file. -By default it is set to edit. -> - let g:go_alternate_mode = "edit" -< - *'g:go_gorename_command'* - -Use this option to define which tool is used to rename. By default `gorename` -is used. Valid options are `gorename` and `gopls`. Warning: as of `gopls` -v0.2.0, it will only rename identifiers in the current package. -> - let g:go_gorename_command = 'gorename' -< - *'g:go_gorename_prefill'* - -Expression to prefill the new identifier when using |:GoRename| without any -arguments. Use an empty string if you don't want to prefill anything. By -default it converts the identifier to camel case but preserves the -capitalisation of the first letter to ensure that the exported state stays the -same. -> - let g:go_gorename_prefill = 'expand("") =~# "^[A-Z]"' . - \ '? go#util#pascalcase(expand(""))' . - \ ': go#util#camelcase(expand(""))' -< - *'g:go_gocode_propose_builtins'* - -Specifies whether `gocode` should add built-in types, functions and constants -to code completion proposals. By default it is enabled. -> - let g:go_gocode_propose_builtins = 1 -< - *'g:go_gocode_propose_source'* - -Specifies whether `gocode` should use source files instead of binary packages -for code completion proposals. When disabled, only identifiers from the -current package and packages that have been installed will proposed. -> - let g:go_gocode_propose_source = 0 -< - *'g:go_gocode_unimported_packages'* - -Specifies whether `gocode` should include suggestions from unimported -packages. By default it is disabled. -> - let g:go_gocode_unimported_packages = 0 -< - - *'g:go_gocode_socket_type'* - -Specifies whether `gocode` should use a different socket type. By default -`unix` is enabled. Possible values: `unix`, `tcp` -> - let g:go_gocode_socket_type = 'unix' -< - - *'g:go_gopls_complete_unimported'* - -Specifies whether `gopls` should include suggestions from unimported packages. -By default it is disabled. -> - let g:go_gopls_complete_unimported = 0 -< - - *'g:go_gopls_deep_completion'* - -Specifies whether `gopls` should use deep completion. By default it is -enabled. -> - let g:go_gopls_deep_completion = 1 -< - - *'g:go_gopls_fuzzy_matching'* - -Specifies whether `gopls` should use fuzzy matching for completions. -By default it is enabled. -> - let g:go_gopls_fuzzy_matching = 1 -< - - *'g:go_gopls_use_placeholders'* - -Specifies whether `gopls` can provide placeholders for function parameters and -struct fields. By default it is disabled. -> - let g:go_gopls_use_placeholders = 0 -< - - *'g:go_template_autocreate'* - -When a new Go file is created, vim-go automatically fills the buffer content -with a Go code template. By default, the templates under the `templates` -folder are used. This can be changed with the |'g:go_template_file'| and -|'g:go_template_test_file'| settings to either use a different file in the -same `templates` folder, or to use a file stored elsewhere. - -If the new file is created in an already prepopulated package (with other Go -files), in this case a Go code template with only the Go package declaration -(which is automatically determined according to the current package) is added. - -To always use the package name instead of the template, enable the -|'g:go_template_use_pkg'| setting. - -By default it is enabled. -> - let g:go_template_autocreate = 1 -< - *'g:go_template_file'* - -Specifies either the file under the `templates` folder that is used if a new -Go file is created. Checkout |'g:go_template_autocreate'| for more info. By -default the `hello_world.go` file is used. - -This variable can be set to an absolute path, so the template files don't have -to be stored inside the vim-go directory structure. Useful when you want to -use different templates for different projects. -> - let g:go_template_file = "hello_world.go" -< - *'g:go_template_test_file'* - -Like with |'g:go_template_file'|, this specifies the file to use for test -tempaltes. The template file should be under the `templates` folder, -alternatively absolute paths can be used, too. Checkout -|'g:go_template_autocreate'| for more info. By default, the -`hello_world_test.go` file is used. -> - let g:go_template_test_file = "hello_world_test.go" -< - *'g:go_template_use_pkg'* - -Specifies that, rather than using a template, the package name is used if a -new Go file is created. Checkout |'g:go_template_autocreate'| for more info. -By default the template file specified by |'g:go_template_file'| is used. - -> - let g:go_template_use_pkg = 0 -< - *'g:go_decls_includes'* - -Only useful if `ctrlp.vim`, `unite.vim`, `denite.nvim` or `fzf` are installed. -This sets which declarations to show for |:GoDecls| (`ctrp.vim`), -|unite-decls| (`unite.vim`) and |denite-decls| (`denite.nvim`). It is a Comma -delimited list. Possible options are: {func,type}. The default is: > - - let g:go_decls_includes = 'func,type' -< - *'g:go_decls_mode'* - -Define the tool to be used for |:GoDecls|. Valid options are `ctrlp.vim`, -`fzf`, or an empty string; in which case it will try to autodetect either -`ctrlp.vim` or `fzf`. -> - let g:go_decls_mode = '' -< - *'g:go_echo_command_info'* - -Echoes information about various Go commands, such as `:GoBuild`, `:GoTest`, -`:GoCoverage`, etc... Useful to disable if you use the statusline integration, -i.e: |go#statusline#Show()|. By default it's enabled -> - let g:go_echo_command_info = 1 -< - *'g:go_echo_go_info'* - -Use this option to show the identifier information when code completion is -done. By default it's enabled. > - - let g:go_echo_go_info = 1 -< -Please note that 'noshowmode' must be set for this feature to work correctly. - - *'g:go_statusline_duration'* - -Specifies the duration of statusline information being showed per package. By -default it's 60 seconds. Must be in milliseconds. -> - let g:go_statusline_duration = 60000 -< - *'g:go_addtags_transform'* - -Sets the `transform` option for `gomodifytags` when using |:GoAddTags| or if -it's being used for snippet expansion of single fields. Possible options are: -`snakecase`, `camelcase`, `lispcase`, `pascalcase`, `keep`. For the following -case, if `snakecase` is used the field will be transformed to: -> - type T struct { - FooBarQuz string `json:"foo_bar_quz" - } -< - -If "camelcase" is used: -> - type T struct { - FooBarQuz string `json:"fooBarQuz" - } -< -By default "snakecase" is used. Current values are: ["snakecase", -"camelcase", "lispcase", "pascalcase", "keep"]. -> - let g:go_addtags_transform = 'snakecase' -< - *'g:go_debug'* - -A list of options to debug; useful for development and/or reporting bugs. - -Currently accepted values: - - shell-commands Echo all shell commands that vim-go runs. - debugger-state Expose debugger state in 'g:go_debug_diag'. - debugger-commands Echo communication between vim-go and `dlv`; requests and - responses are recorded in `g:go_debug_commands`. - lsp Echo communication between vim-go and `gopls`. All - communication is shown in a dedicated window. When - enabled before gopls is started, |:GoLSPDebugBrowser| can - be used to open a browser window to help debug gopls. -> - let g:go_debug = [] -< - -============================================================================== -SYNTAX HIGHLIGHTING *ft-go-syntax* *go-syntax* - -vim-go comes with an enhanced version of Vim's Go syntax highlighting. It -comes with a number of features, most of which are disabled by default. - -The recommended settings are the default values. If you're experiencing -slowdowns in Go files and you enabled some of these options then try disabling -them; some can be resource intensive. - - *'g:go_fold_enable'* - -Control syntax-based folding which takes effect when 'foldmethod' is set to -`syntax`. -You can enable specific fold regions by setting an array. Possible values are: - - block `{` .. `}` blocks. - import `import` block. - varconst `var` and `const` blocks. - package_comment The package comment. - comment Any comment that is not the package comment. - -By default all except "comment" are enabled: -> - let g:go_fold_enable = ['block', 'import', 'varconst', 'package_comment'] -< -Enable folding of only imports: -> - let g:go_fold_enable = ['import'] -< -Disable everything (same as not setting 'foldmethod' to `syntax`): -> - let g:go_fold_enable = [] -< - *'g:go_highlight_array_whitespace_error'* - -Highlight white space after `[]`. > - - let g:go_highlight_array_whitespace_error = 0 -< - *'g:go_highlight_chan_whitespace_error'* - -Highlight white space around the receive operator (`<-`) that doesn't follow -the standard style. > - - let g:go_highlight_chan_whitespace_error = 0 -< - *'g:go_highlight_extra_types'* - -Highlight commonly used library types (`io.Reader`, etc.). > - - let g:go_highlight_extra_types = 0 -< - *'g:go_highlight_space_tab_error'* - -Highlight instances of tabs following spaces. > - - let g:go_highlight_space_tab_error = 0 -< - *'g:go_highlight_trailing_whitespace_error'* - -Highlight trailing white space. > - - let g:go_highlight_trailing_whitespace_error = 0 -< - *'g:go_highlight_operators'* - -Highlight operators such as `:=` , `==`, `-=`, etc. -> - let g:go_highlight_operators = 0 -< - *'g:go_highlight_functions'* - -Highlight function and method declarations. -> - let g:go_highlight_functions = 0 -< - *'g:go_highlight_function_parameters'* - -Highlight the variable names in parameters (including named return parameters) -in function declarations. Setting this implies the functionality from -|'g:go_highlight_functions'|. -> - let g:go_highlight_function_parameters = 0 -< - *'g:go_highlight_function_calls'* - -Highlight function and method calls. -> - let g:go_highlight_function_calls = 0 -< - *'g:go_highlight_types'* - -Highlight struct and interface names. -> - let g:go_highlight_types = 0 -< - *'g:go_highlight_fields'* - -Highlight struct field names. -> - let g:go_highlight_fields = 0 -< - *'g:go_highlight_build_constraints'* - -Highlights build constraints. -> - let g:go_highlight_build_constraints = 0 -< - *'g:go_highlight_generate_tags'* - -Highlight go:generate directives. -> - let g:go_highlight_generate_tags = 0 -< - *'g:go_highlight_string_spellcheck'* - -Highlight spelling errors in strings when |spell| is enabled. -> - let g:go_highlight_string_spellcheck = 1 -< - *'g:go_highlight_format_strings'* - -Highlight printf-style formatting verbs inside string literals. -> - let g:go_highlight_format_strings = 1 -< - *'g:go_highlight_variable_declarations'* - -Highlight variable names in variable declarations (`x` in ` x :=`). -> - let g:go_highlight_variable_declarations = 0 -< - *'g:go_highlight_variable_assignments'* - -Highlight variable names in variable assignments (`x` in `x =`). -> - let g:go_highlight_variable_assignments = 0 -< - *'g:go_highlight_diagnostic_errors'* - -Highlight diagnostic errors. -> - let g:go_highlight_diagnostic_errors = 1 -< - *'g:go_highlight_diagnostic_warnings'* - -Highlight diagnostic warnings. -> - let g:go_highlight_diagnostic_warnings = 1 -< - -============================================================================== - *gohtmltmpl* *ft-gohtmltmpl-syntax* - *gotexttmpl* *ft-gotexttmpl-syntax* -Go template syntax~ - -The `gotexttmpl` 'filetype' provides syntax highlighting and indentation for -Go's `text/template` package. - -The `gohtmltmpl` filetype is for use with the `html/template` package and is -identical to `gotexttmpl` except that it will also load the standard `html` -filetype. - -The `gohtmltmpl` filetype is automatically set for `*.tmpl` files; the -`gotexttmpl` is never automatically set and needs to be set manually. - -============================================================================== - *gomod* *ft-gomod-syntax* -go.mod file syntax~ - -The `gomod` 'filetype' provides syntax highlighting for Go's module file -`go.mod` - - -============================================================================== -DEBUGGER *go-debug* - -Vim-go comes with a special "debugger mode". This starts a `dlv` process in -the background and provides various commands to communicate with it. - -This debugger is similar to Visual Studio or Eclipse and has the following -features: - - * Show stack trace and jumps. - * List local variables. - * List function arguments. - * Expand values of struct or array/slice. - * Show balloon on the symbol. - * Show output of stdout/stderr. - * Toggle breakpoint. - * Stack operation continue/next/step out. - -This feature requires either Vim 8.0.0087 or newer with the |+job| feature or -Neovim. This features also requires Delve 1.0.0 or newer, and it is -recommended to use Go 1.10 or newer, as its new caching will speed up -recompiles. - - *go-debug-intro* -GETTING STARTED WITH THE DEBUGGER~ - -Use |:GoDebugStart| or |:GoDebugTest| to start the debugger. The first -argument is the package name, and any arguments after that will be passed on -to the program; for example: -> - :GoDebugStart . -someflag value -< -This may take few seconds. After the code is compiled you'll see three new -windows: the stack trace on left side, the variable list on the bottom-left, -and program output at the bottom. - -You can add breakpoints with |:GoDebugBreakpoint| () and run your program -with |:GoDebugContinue| (). - -The program will halt on the breakpoint, at which point you can inspect the -program state. You can go to the next line with |:GoDebugNext| () or step -in with |:GoDebugStep| (). - -The variable window in the bottom left (`GODEBUG_VARIABLES`) will display all -local variables. Struct values are displayed as `{...}`, array/slices as -`[4]`. Use on the variable name to expand the values. - -The `GODEBUG_OUTPUT` window displays output from the program and the Delve -debugger. - -The `GODEBUG_STACKTRACE` window can be used to jump to different places in the -call stack. - -When you're done use |:GoDebugStop| to close the debugging windows and halt -the `dlv` process, or |:GoDebugRestart| to recompile the code. - - *go-debug-commands* -DEBUGGER COMMANDS~ - -Only |:GoDebugStart| and |:GoDebugBreakpoint| are available by default; the -rest of the commands and mappings become available after starting debug mode. - - *:GoDebugStart* -:GoDebugStart [pkg] [program-args] - - Start the debug mode for [pkg]; this does several things: - - * Setup the debug windows according to |'g:go_debug_windows'|. - * Make the `:GoDebug*` commands and `(go-debug-*)` mappings available. - - The directory of the current buffer is used if [pkg] is empty. Any other - arguments will be passed to the program. - - Use |:GoDebugStop| to stop `dlv` and exit debugging mode. - - *:GoDebugTest* -:GoDebugTest [pkg] [program-args] - - Behaves the same as |:GoDebugStart| but runs `dlv test` instead of - `dlv debug` so you can debug tests. - - Use `-test.flag` to pass flags to `go test` when debugging a test; for - example `-test.v` or `-test.run TestFoo` - - *:GoDebugRestart* -:GoDebugRestart - - Stop the program (if running) and restart `dlv` to recompile the package. - The current window layout and breakpoints will be left intact. - - *:GoDebugStop* - *(go-debug-stop)* -:GoDebugStop - - Stop `dlv` and remove all debug-specific commands, mappings, and windows. - - *:GoDebugBreakpoint* - *(go-debug-breakpoint)* -:GoDebugBreakpoint [linenr] - - Toggle breakpoint for the [linenr]. [linenr] defaults to the current line - if it is omitted. A line with a breakpoint will have the - {godebugbreakpoint} |:sign| placed on it. The line the program is - currently halted on will have the {godebugcurline} sign. - - *hl-GoDebugCurrent* *hl-GoDebugBreakpoint* - A line with a breakpoint will be highlighted with the {GoDebugBreakpoint} - group; the line the program is currently halted on will be highlighted - with {GoDebugCurrent}. - - Mapped to by default. - - *:GoDebugContinue* - *(go-debug-continue)* -:GoDebugContinue - - Continue execution until breakpoint or program termination. It will start - the program if it hasn't been started yet. - - Mapped to by default. - - *:GoDebugNext* - *(go-debug-next)* -:GoDebugNext - - Advance execution by one line, also called "step over" by some other - debuggers. - It will behave as |:GoDebugContinue| if the program isn't started. - - Mapped to by default. - - *:GoDebugStep* - *(go-debug-step)* -:GoDebugStep - - Advance execution by one step, stopping at the next line of code that will - be executed (regardless of location). - It will behave as |:GoDebugContinue| if the program isn't started. - - Mapped to by default. - - *:GoDebugStepOut* - *(go-debug-stepout)* - -:GoDebugStepOut - - Run all the code in the current function and halt when the function - returns ("step out of the current function"). - It will behave as |:GoDebugContinue| if the program isn't started. - - *:GoDebugSet* -:GoDebugSet {var} {value} - - Set the variable {var} to {value}. Example: -> - :GoDebugSet truth 42 -< - This only works for `float`, `int` and variants, `uint` and variants, - `bool`, and pointers (this is a `delve` limitation, not a vim-go - limitation). - - *:GoDebugPrint* - *(go-debug-print)* -:GoDebugPrint {expr} - - Print the result of a Go expression. -> - :GoDebugPrint truth == 42 - truth == 42 true -< - Mapped to by default, which will evaluate the under the - cursor. - - *go-debug-settings* -DEBUGGER SETTINGS~ - - *'g:go_debug_windows'* - -Controls the window layout for debugging mode. This is a |dict| with four -possible keys: "vars", "stack", "goroutines", and "out"; each of the new -windows will be created in that that order with the commands in the value. The -current window is made the only window before creating the debug windows. - -A window will not be created if a key is missing or empty. - -Defaults: -> - let g:go_debug_windows = { - \ 'vars': 'leftabove 30vnew', - \ 'stack': 'leftabove 20new', - \ 'goroutines': 'botright 10new', - \ 'out': 'botright 5new', - \ } -< -Show only variables on the right-hand side: > - - let g:go_debug_windows = { - \ 'vars': 'rightbelow 60vnew', - \ } -< - *'g:go_debug_address'* - -Server address `dlv` will listen on; must be in `hostname:port` format. -Defaults to `127.0.0.1:8181`: -> - let g:go_debug_address = '127.0.0.1:8181' -< - - *'g:go_debug_log_output'* - -Specifies log output options for `dlv`. Value should be a single string of -comma-separated options suitable for passing to `dlv`. An empty string (`''`) -will suppress logging entirely. Default: `'debugger,rpc'`: -> - let g:go_debug_log_output = 'debugger,rpc' -< - - *'g:go_highlight_debug'* - -Highlight the current line and breakpoints in the debugger. - -> - let g:go_highlight_debug = 1 -< - -============================================================================== -FAQ TROUBLESHOOTING *go-troubleshooting* - -How do I troubleshoot problems?~ - -One of the best ways to understand what vim-go is doing and the output from -the tools to which it delegates is to use leverage the features described in -|'g:go_debug'|. - -Completion and other functions that use `gopls` don't work~ - -Vim-go is heavily reliant on `gopls` for completion and other functionality. -Many of the features that use `gopls` (e.g. completion, jumping to -definitions, showing identifier information, et al.) can be configured to -delegate to other tools. e.g. completion via |'omnifunc'|, |'g:go_info_mode'| -and |'g:go_def_mode'| can be set to use other tools for now (though some of -the alternatives to `gopls` are effectively at their end of life and support -for them from within vim-go may be removed soon). - -I get "Unknown function: go#config#..." error when I open a Go file.~ - -This often happens to vim-polyglot users when new config options are added to -vim-go. Run vim-polyglot's `build` script or make sure that vim-go is loaded -before vim-polyglot. - -I get "not an editor command" error when I invoke :GoXXX~ - -This happens if vim-go is not installed properly. Be sure you have added this -line into your vimrc: -> - filetype plugin indent on -< - -I get a "command not found" error when I invoke :GoXXX~ - -If you try to call |:GoDef|, |:GoInfo| and get a command not found, check that -you have the binaries installed by using |:GoInstallBinaries|. - -Before opening vim, check your current $PATH: -> - echo $PATH -< -After opening vim, run `:echo $PATH`, the output must be your current `$PATH` -plus `$GOPATH/bin` (the location where |:GoInstallBinaries| installed the -binaries). - - *go-guru-scope* -What is the guru scope and how do I set it?~ - -Many vim-go commands use the `guru` commandline tool to get information. Some -`guru` commands require an expensive analysis of the source code. To still get -a reasonable amount of performance `guru` limits this analysis to a selected -list of packages. This is known as the "guru scope". - -The default is to use the package the current buffer belongs to, but this may -not always be correct. For example for the file `guthub.com/user/pkg/a/a.go` -the scope will be set to `github.com/user/pkg/a`, but you probably want -`github.com/user/pkg` - -Guessing what package(s) you do want is not easy so you may need to set this -manually, usually from an |autocommand|: -> - autocmd BufRead /home/martin/go/src/github.com/user/pkg/*.go - \ :GoGuruScope github.com/user/pkg -< - -If you have a lot of packages with the same prefix (`github.com/user`) you can -use a single autocommand: -> - autocmd BufRead /home/martin/go/src/*.go - \ let s:tmp = matchlist(expand('%:p'), - \ '/home/martin/go/src/\(github.com/user/[^/]\+\)') - \| if len(s:tmp) > 1 | exe 'silent :GoGuruScope ' . s:tmp[1] | endif - \| unlet s:tmp -< -Also see |:GoGuruScope| and |'g:go_guru_scope'|. - - -Vim becomes slow while editing Go files~ - -The most common cause for this is using an older version of Vim that doesn't -support asynchronous jobs. |'g:go_auto_sameids'| and |'g:go_auto_type_info'| -run jobs that can cause noticable delays when used with vim74. The problem is -most pronounced on vim74, but can occur on vim8 and nvim. On vim8 and nvim, -the problem should be restricted to a short period when the first buffer in a -package is first loaded. - -If you see unexpected characters rendered in the current window, the problem -is most likely due to |'g:go_auto_sameids'| or |'g:go_auto_type_info'|. First, -try using another mode for |'g:go_info_mode'|. If that doesn't work, try -disabling |'g:go_auto_sameids'| and |'g:go_auto_type_info'|. - -To a lesser extent, this can be caused by `g:go_highlight_*` options. If Vim -is just slower than normal, but doesn't render unexpected characters in the -currrent window, then the problem is most likely the `g:go_highlight_*` -options. Try disabling them if you've enabled some of them. - -I get errors when using GoInstallBinaries~ - -If you see errors like this: -> - Error installing golang.org/x/tools/cmd/goimports -< -that means your local Go setup is broken or the remote website is down. For -example sometimes code.google.com times out. To test, just execute a simple -`go get`: -> - go get golang.org/x/tools/cmd/goimports -< -You'll see a more detailed error. If this works, vim-go will work too. - - -I want to use a different binary name than "go", can I do this?~ - -There is no way to directly configure the binary name; but you can use a -wrapper script; for example if you would like to run `goapp` instead of `go`: - -1. In `~/gobin/go` (remember to make it executable): -> - #!/bin/sh - # Remove gobin from PATH and run goapp. - PATH=${PATH#$HOME/gobin} goapp "$@" -< -2. Start Vim with `~/gobin` as the first `PATH` entry so it will use the - wrapper script: -> - PATH="$HOME/gobin/:$PATH" vim -< - Alternatively you you could set `$PATH` in your vimrc with an |:autocmd|. - - -How do I use vim-go with syntastic?~ - -Sometimes when using both `vim-go` and `syntastic` Vim will start lagging -while saving and opening files. The following fixes this: -> - let g:syntastic_go_checkers = ['golint', 'govet'] - let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } -< -If you want to add errcheck you can use golangci-lint as a wrapper: -> - let g:syntastic_go_checkers = ['golint', 'govet', 'golangci-lint'] - let g:syntastic_go_gometalinter_args = ['--disable-all', '--enable=errcheck'] - let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } -< -Another issue with `vim-go` and `syntastic` is that the location list window -that contains the output of commands such as `:GoBuild` and `:GoTest` might -not appear. To resolve this: -> - let g:go_list_type = "quickfix" -< - -How do I run focused ginkgo tests?~ - -You must set this environment variable in your `.vimrc`: -> - let $GINKGO_EDITOR_INTEGRATION = "true" -< - -Using with NeoVim~ - -Note: Neovim currently is not a first class citizen for vim-go. You are free -to open bug, however I'm not using Neovim so it's hard for me to test it. -vim-go might not work as well in Neovim as it does in Vim. I'm happy to accept -pull requests or very detailed bug reports. If you're interested to improve -the state of Neovim in vim-go you're always welcome! - -Run `:GoRun` in a new tab, horizontal split or vertical split terminal -> - au FileType go nmap rt (go-run-tab) - au FileType go nmap rs (go-run-split) - au FileType go nmap rv (go-run-vertical) -< -By default new terminals are opened in a vertical split. To change it -> - let g:go_term_mode = "split" -> - -How can I customize the highlighting?~ - -All the highlight groups used by vim-go are prefixed with `go` (e.g. -`goType`) and are defined in the files in the `syntax` directory. To change -the highlighting for any group, add a `highlight` command for the group to -your vimrc. To turn off the highlighting for any group, add `highlight link -group-name NONE` (where `group-name` is the name of the group whose highlight -you'd like to turn off) to your vimrc. - -Some people may wish to highlight Go's builtins as keywords. To do so, one -should simply add `highlight link goBuiltins Keyword` to the `vimrc` file. - -============================================================================== -DEVELOPMENT *go-development* - -vim-go supports test files written in VimScript; the way they're run is -roughly similar to Go tests: - -- A `*.vim` file has a corresponding `*_test.vim`. -- All functions starting with `Test_` are run as test. -- A test is considered to be "failed" if |v:errors| has any entries. You can - use one of the |test-functions| to set this, or append to it directly. - -A simple example: -> - function Test_run_fmt() - call assert_equal(expected, actual) - ... - endfunction -< -To run tests vim-go comes with three small helper scripts: - - `scripts/install-vim` Install a pristine Vim to `/tmp/vim-go-test/`. - `scripts/run-vim` Run a Vim version from `/tmp/vim-go-test/`. - `scripts/test` Run all tests with a Vim from `/tmp/vim-go-test/`. - -All scripts accept a Vim version as the first argument, which can be -`vim-8.0` or `nvim`. You will need to install a Vim version with -`install-vim` before you can use `run-vim` or `test`. - -You can install and test all Vim versions by running `make`. - - -============================================================================== -DONATION *go-donation* - -People have asked for this for a long time, now you can be a fully supporter -by being a patreon at: https://www.patreon.com/bhcleek - -By being a patron, you are enabling vim-go to grow and mature, helping me to -invest in bug fixes, new documentation, and improving both current and future -features. It's completely optional and is just a direct way to support -vim-go's ongoing development. Thanks! - -Check it out: https://www.patreon.com/bhcleek - - -============================================================================== -CREDITS *go-credits* - -* Go Authors for official Vim plugins. -* Gocode, Godef, Golint, Guru, Goimports, Errcheck projects and authors of - those projects. -* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, - vim-godef). -* vim-go contributors: https://github.com/fatih/vim-go/graphs/contributors. - - - vim: ft=help tw=78 et ts=2 sw=2 sts=2 norl diff --git a/sources_non_forked/vim-go/ftdetect/gofiletype.vim b/sources_non_forked/vim-go/ftdetect/gofiletype.vim deleted file mode 100644 index 7051f373..00000000 --- a/sources_non_forked/vim-go/ftdetect/gofiletype.vim +++ /dev/null @@ -1,40 +0,0 @@ -" vint: -ProhibitAutocmdWithNoGroup - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -" Note: should not use augroup in ftdetect (see :help ftdetect) -au BufRead,BufNewFile *.go setfiletype go -au BufRead,BufNewFile *.s setfiletype asm -au BufRead,BufNewFile *.tmpl setfiletype gohtmltmpl - -" remove the autocommands for modsim3, and lprolog files so that their -" highlight groups, syntax, etc. will not be loaded. *.MOD is included, so -" that on case insensitive file systems the module2 autocmds will not be -" executed. -au! BufRead,BufNewFile *.mod,*.MOD -" Set the filetype if the first non-comment and non-blank line starts with -" 'module '. -au BufRead,BufNewFile go.mod call s:gomod() - -fun! s:gomod() - for l:i in range(1, line('$')) - let l:l = getline(l:i) - if l:l ==# '' || l:l[:1] ==# '//' - continue - endif - - if l:l =~# '^module .\+' - setfiletype gomod - endif - - break - endfor -endfun - -" 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/ftplugin/asm.vim b/sources_non_forked/vim-go/ftplugin/asm.vim deleted file mode 100644 index 9271d225..00000000 --- a/sources_non_forked/vim-go/ftplugin/asm.vim +++ /dev/null @@ -1,37 +0,0 @@ -" asm.vim: Vim filetype plugin for Go assembler. - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let b:undo_ftplugin = "setl fo< com< cms< - \ | exe 'au! vim-go-asm-buffer * '" - -setlocal formatoptions-=t - -setlocal comments=s1:/*,mb:*,ex:*/,:// -setlocal commentstring=//\ %s - -setlocal noexpandtab - -command! -nargs=0 AsmFmt call go#asmfmt#Format() - -" Autocommands -" ============================================================================ - -augroup vim-go-asm-buffer - autocmd! * - - autocmd BufWritePre call go#auto#asmfmt_autosave() -augroup end - -" 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/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim deleted file mode 100644 index 6f68ba4a..00000000 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ /dev/null @@ -1,128 +0,0 @@ -" Copyright 2013 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" go.vim: Vim filetype plugin for Go. - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let b:undo_ftplugin = "setl fo< com< cms< - \ | exe 'au! vim-go-buffer * '" - -setlocal formatoptions-=t - -setlocal comments=s1:/*,mb:*,ex:*/,:// -setlocal commentstring=//\ %s - -setlocal noexpandtab - -compiler go - -if go#config#CodeCompletionEnabled() - " Set autocompletion - setlocal omnifunc=go#complete#Complete - if !go#util#has_job() - setlocal omnifunc=go#complete#GocodeComplete - endif -endif - -if get(g:, "go_doc_keywordprg_enabled", 1) - " keywordprg doesn't allow to use vim commands, override it - nnoremap K :GoDoc -endif - -if get(g:, "go_def_mapping_enabled", 1) - " these are default Vim mappings, we're overriding them to make them - " useful again for Go source code - nnoremap gd :GoDef - nnoremap :GoDef - nnoremap :GoDef - nnoremap g :GoDef - nnoremap :call go#def#Jump("split", 0) - nnoremap ] :call go#def#Jump("split", 0) - nnoremap :call go#def#StackPop(v:count1) -endif - -if get(g:, "go_textobj_enabled", 1) - onoremap af :call go#textobj#Function('a') - xnoremap af :call go#textobj#Function('a') - - onoremap if :call go#textobj#Function('i') - xnoremap if :call go#textobj#Function('i') - - onoremap ac :call go#textobj#Comment('a') - xnoremap ac :call go#textobj#Comment('a') - - onoremap ic :call go#textobj#Comment('i') - xnoremap ic :call go#textobj#Comment('i') - - " Remap ]] and [[ to jump betweeen functions as they are useless in Go - nnoremap ]] :call go#textobj#FunctionJump('n', 'next') - nnoremap [[ :call go#textobj#FunctionJump('n', 'prev') - - onoremap ]] :call go#textobj#FunctionJump('o', 'next') - onoremap [[ :call go#textobj#FunctionJump('o', 'prev') - - xnoremap ]] :call go#textobj#FunctionJump('v', 'next') - xnoremap [[ :call go#textobj#FunctionJump('v', 'prev') -endif - -" Autocommands -" ============================================================================ -" -augroup vim-go-buffer - autocmd! * - - " The file is registered (textDocument/DidOpen) with gopls in plugin/go.vim - " on the FileType event. - " TODO(bc): handle all the other events that may be of interest to gopls, - " too (e.g. BufFilePost , CursorHold , CursorHoldI, FileReadPost, - " StdinReadPre, BufWritePost, TextChange, TextChangedI) - if go#util#has_job() - autocmd BufWritePost call go#lsp#DidChange(expand(':p')) - autocmd FileChangedShellPost call go#lsp#DidChange(expand(':p')) - autocmd BufDelete call go#lsp#DidClose(expand(':p')) - endif - - autocmd BufEnter,CursorHold call go#auto#update_autocmd() - - " Echo the identifier information when completion is done. Useful to see - " the signature of a function, etc... - if exists('##CompleteDone') - autocmd CompleteDone call go#auto#echo_go_info() - endif - - autocmd BufWritePre call go#auto#fmt_autosave() - autocmd BufWritePost call go#auto#metalinter_autosave() - - " clear SameIds when the buffer is unloaded so that loading another buffer - " in the same window doesn't highlight the most recently matched - " identifier's positions. - autocmd BufWinEnter call go#guru#ClearSameIds() - - autocmd BufEnter - \ if go#config#AutodetectGopath() && !exists('b:old_gopath') - \| let b:old_gopath = exists('$GOPATH') ? $GOPATH : -1 - \| let $GOPATH = go#path#Detect() - \| endif - autocmd BufLeave - \ if exists('b:old_gopath') - \| if b:old_gopath isnot -1 - \| let $GOPATH = b:old_gopath - \| endif - \| unlet b:old_gopath - \| endif -augroup end - -" 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/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim deleted file mode 100644 index 716b49da..00000000 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ /dev/null @@ -1,126 +0,0 @@ -" -- gorename -command! -nargs=? -complete=customlist,go#rename#Complete GoRename call go#rename#Rename(0, ) - -" -- guru -command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope() -command! -range=% GoImplements call go#guru#Implements() -command! -range=% GoPointsTo call go#guru#PointsTo() -command! -range=% GoWhicherrs call go#guru#Whicherrs() -command! -range=% GoCallees call go#guru#Callees() -command! -range=% GoDescribe call go#guru#Describe() -command! -range=% GoCallers call go#guru#Callers() -command! -range=% GoCallstack call go#guru#Callstack() -command! -range=% GoFreevars call go#guru#Freevars() -command! -range=% GoChannelPeers call go#guru#ChannelPeers() -command! -range=% GoReferrers call go#guru#Referrers() - -command! -range=0 GoSameIds call go#guru#SameIds(1) -command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() -command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds() -command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToggleSameIds() - -" -- tags -command! -nargs=* -range GoAddTags call go#tags#Add(, , , ) -command! -nargs=* -range GoRemoveTags call go#tags#Remove(, , , ) - -" -- mod -command! -nargs=0 -range GoModFmt call go#mod#Format() - -" -- tool -command! -nargs=* -complete=customlist,go#tool#ValidFiles GoFiles echo go#tool#Files() -command! -nargs=0 GoDeps echo go#tool#Deps() -command! -nargs=0 GoInfo call go#tool#Info(1) -command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo() - -" -- cmd -command! -nargs=* -bang GoBuild call go#cmd#Build(0,) -command! -nargs=? -bang GoBuildTags call go#cmd#BuildTags(0, ) -command! -nargs=* -bang GoGenerate call go#cmd#Generate(0,) -command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(0,) -command! -nargs=* -bang GoInstall call go#cmd#Install(0, ) - -" -- test -command! -nargs=* -bang GoTest call go#test#Test(0, 0, ) -command! -nargs=* -bang GoTestFunc call go#test#Func(0, ) -command! -nargs=* -bang GoTestCompile call go#test#Test(0, 1, ) - -" -- cover -command! -nargs=* -bang GoCoverage call go#coverage#Buffer(0, ) -command! -nargs=* -bang GoCoverageClear call go#coverage#Clear() -command! -nargs=* -bang GoCoverageToggle call go#coverage#BufferToggle(0, ) -command! -nargs=* -bang GoCoverageBrowser call go#coverage#Browser(0, ) - -" -- play -command! -nargs=0 -range=% GoPlay call go#play#Share(, , ) - -" -- def -command! -nargs=* -range GoDef :call go#def#Jump('', 0) -command! -nargs=* -range GoDefType :call go#def#Jump('', 1) -command! -nargs=? GoDefPop :call go#def#StackPop() -command! -nargs=? GoDefStack :call go#def#Stack() -command! -nargs=? GoDefStackClear :call go#def#StackClear() - -" -- doc -command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go#doc#Open('new', 'split', ) -command! -nargs=* -range -complete=customlist,go#package#Complete GoDocBrowser call go#doc#OpenBrowser() - -" -- fmt -command! -nargs=0 GoFmt call go#fmt#Format(-1) -command! -nargs=0 GoFmtAutoSaveToggle call go#fmt#ToggleFmtAutoSave() -command! -nargs=0 GoImports call go#fmt#Format(1) - -" -- asmfmt -command! -nargs=0 GoAsmFmtAutoSaveToggle call go#asmfmt#ToggleAsmFmtAutoSave() - -" -- import -command! -nargs=? -complete=customlist,go#package#Complete GoDrop call go#import#SwitchImport(0, '', , '') -command! -nargs=1 -bang -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', , '') -command! -nargs=* -bang -complete=customlist,go#package#Complete GoImportAs call go#import#SwitchImport(1, , '') - -" -- linters -command! -nargs=* -bang GoMetaLinter call go#lint#Gometa(0, 0, ) -command! -nargs=0 GoMetaLinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave() -command! -nargs=* -bang GoLint call go#lint#Golint(0, ) -command! -nargs=* -bang GoVet call go#lint#Vet(0, ) -command! -nargs=* -bang -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(0, ) - -" -- alternate -command! -bang GoAlternate call go#alternate#Switch(0, '') - -" -- decls -command! -nargs=? -complete=file GoDecls call go#decls#Decls(0, ) -command! -nargs=? -complete=dir GoDeclsDir call go#decls#Decls(1, ) - -" -- impl -command! -nargs=* -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl() - -" -- template -command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate() - -" -- keyify -command! -nargs=0 GoKeyify call go#keyify#Keyify() - -" -- fillstruct -command! -nargs=0 GoFillStruct call go#fillstruct#FillStruct() - -" -- debug -if !exists(':GoDebugStart') - command! -nargs=* -complete=customlist,go#package#Complete GoDebugStart call go#debug#Start(0, ) - command! -nargs=* -complete=customlist,go#package#Complete GoDebugTest call go#debug#Start(1, ) - command! -nargs=? GoDebugBreakpoint call go#debug#Breakpoint() -endif - -" -- issue -command! -nargs=0 GoReportGitHubIssue call go#issue#New() - -" -- iferr -command! -nargs=0 GoIfErr call go#iferr#Generate() - -" -- lsp -command! -nargs=+ -complete=dir GoAddWorkspace call go#lsp#AddWorkspaceDirectory() -command! -nargs=0 GoLSPDebugBrowser call go#lsp#DebugBrowser() - -" -- term -command! GoToggleTermCloseOnExit call go#term#ToggleCloseOnExit() - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/mappings.vim b/sources_non_forked/vim-go/ftplugin/go/mappings.vim deleted file mode 100644 index f1f069ee..00000000 --- a/sources_non_forked/vim-go/ftplugin/go/mappings.vim +++ /dev/null @@ -1,86 +0,0 @@ -" go_jump_to_error defines whether we should pass the bang attribute to the -" command or not. This is only used for mappings, because the user can't pass -" the bang attribute to the plug mappings below. So instead of hardcoding it -" as 0 (no '!' attribute) or 1 (with '!' attribute) we pass the user setting, -" which by default is enabled. For commands the user has the ability to pass -" the '!', such as :GoBuild or :GoBuild! -if !exists("g:go_jump_to_error") - let g:go_jump_to_error = 1 -endif - -" Some handy plug mappings -nnoremap (go-run) :call go#cmd#Run(!g:go_jump_to_error) - -if has("nvim") - nnoremap (go-run-vertical) :call go#cmd#RunTerm(!g:go_jump_to_error, 'vsplit', []) - nnoremap (go-run-split) :call go#cmd#RunTerm(!g:go_jump_to_error, 'split', []) - nnoremap (go-run-tab) :call go#cmd#RunTerm(!g:go_jump_to_error, 'tabe', []) -endif - -nnoremap (go-build) :call go#cmd#Build(!g:go_jump_to_error) -nnoremap (go-generate) :call go#cmd#Generate(!g:go_jump_to_error) -nnoremap (go-install) :call go#cmd#Install(!g:go_jump_to_error) -nnoremap (go-test) :call go#test#Test(!g:go_jump_to_error, 0) -nnoremap (go-test-func) :call go#test#Func(!g:go_jump_to_error) -nnoremap (go-test-compile) :call go#test#Test(!g:go_jump_to_error, 1) - -nnoremap (go-coverage) :call go#coverage#Buffer(!g:go_jump_to_error) -nnoremap (go-coverage-clear) :call go#coverage#Clear() -nnoremap (go-coverage-toggle) :call go#coverage#BufferToggle(!g:go_jump_to_error) -nnoremap (go-coverage-browser) :call go#coverage#Browser(!g:go_jump_to_error) - -nnoremap (go-files) :call go#tool#Files() -nnoremap (go-deps) :call go#tool#Deps() -nnoremap (go-info) :call go#tool#Info(1) -nnoremap (go-import) :call go#import#SwitchImport(1, '', expand(''), '') -nnoremap (go-imports) :call go#fmt#Format(1) - -nnoremap (go-implements) :call go#guru#Implements(-1) -nnoremap (go-callees) :call go#guru#Callees(-1) -nnoremap (go-callers) :call go#guru#Callers(-1) -nnoremap (go-describe) :call go#guru#Describe(-1) -nnoremap (go-callstack) :call go#guru#Callstack(-1) -xnoremap (go-freevars) :call go#guru#Freevars(0) -nnoremap (go-channelpeers) :call go#guru#ChannelPeers(-1) -nnoremap (go-referrers) :call go#guru#Referrers(-1) -nnoremap (go-sameids) :call go#guru#SameIds(1) -nnoremap (go-pointsto) :call go#guru#PointsTo(-1) -nnoremap (go-whicherrs) :call go#guru#Whicherrs(-1) -nnoremap (go-sameids-toggle) :call go#guru#ToggleSameIds() - -nnoremap (go-rename) :call go#rename#Rename(!g:go_jump_to_error) - -nnoremap (go-decls) :call go#decls#Decls(0, '') -nnoremap (go-decls-dir) :call go#decls#Decls(1, '') - -nnoremap (go-def) :call go#def#Jump('', 0) -nnoremap (go-def-vertical) :call go#def#Jump("vsplit", 0) -nnoremap (go-def-split) :call go#def#Jump("split", 0) -nnoremap (go-def-tab) :call go#def#Jump("tab", 0) - -nnoremap (go-def-type) :call go#def#Jump('', 1) -nnoremap (go-def-type-vertical) :call go#def#Jump("vsplit", 1) -nnoremap (go-def-type-split) :call go#def#Jump("split", 1) -nnoremap (go-def-type-tab) :call go#def#Jump("tab", 1) - -nnoremap (go-def-pop) :call go#def#StackPop() -nnoremap (go-def-stack) :call go#def#Stack() -nnoremap (go-def-stack-clear) :call go#def#StackClear() - -nnoremap (go-doc) :call go#doc#Open("new", "split") -nnoremap (go-doc-tab) :call go#doc#Open("tabnew", "tabe") -nnoremap (go-doc-vertical) :call go#doc#Open("vnew", "vsplit") -nnoremap (go-doc-split) :call go#doc#Open("new", "split") -nnoremap (go-doc-browser) :call go#doc#OpenBrowser() - -nnoremap (go-metalinter) :call go#lint#Gometa(!g:go_jump_to_error, 0) -nnoremap (go-lint) :call go#lint#Golint(!g:go_jump_to_error) -nnoremap (go-vet) :call go#lint#Vet(!g:go_jump_to_error) - -nnoremap (go-alternate-edit) :call go#alternate#Switch(0, "edit") -nnoremap (go-alternate-vertical) :call go#alternate#Switch(0, "vsplit") -nnoremap (go-alternate-split) :call go#alternate#Switch(0, "split") - -nnoremap (go-iferr) :call go#iferr#Generate() - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/snippets.vim b/sources_non_forked/vim-go/ftplugin/go/snippets.vim deleted file mode 100644 index 1fbc1ab8..00000000 --- a/sources_non_forked/vim-go/ftplugin/go/snippets.vim +++ /dev/null @@ -1,75 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -if exists("g:go_loaded_gosnippets") - finish -endif -let g:go_loaded_gosnippets = 1 - -function! s:GoUltiSnips() abort - if get(g:, 'did_plugin_ultisnips') isnot 1 - return - endif - - if !exists("g:UltiSnipsSnippetDirectories") - let g:UltiSnipsSnippetDirectories = ["gosnippets/UltiSnips"] - else - let g:UltiSnipsSnippetDirectories += ["gosnippets/UltiSnips"] - endif -endfunction - -function! s:GoNeosnippet() abort - if get(g:, 'loaded_neosnippet') isnot 1 - return - endif - - let g:neosnippet#enable_snipmate_compatibility = 1 - - let l:gosnippets_dir = globpath(&rtp, 'gosnippets/snippets') - if type(g:neosnippet#snippets_directory) == type([]) - let g:neosnippet#snippets_directory += [l:gosnippets_dir] - elseif type(g:neosnippet#snippets_directory) == type("") - if strlen(g:neosnippet#snippets_directory) > 0 - let g:neosnippet#snippets_directory = g:neosnippet#snippets_directory . "," . l:gosnippets_dir - else - let g:neosnippet#snippets_directory = l:gosnippets_dir - endif - endif -endfunction - -function! s:GoMinisnip() abort - if get(g:, 'loaded_minisnip') isnot 1 - return - endif - - if exists('g:minisnip_dir') - let g:minisnip_dir .= go#util#PathListSep() . globpath(&rtp, 'gosnippets/minisnip') - else - let g:minisnip_dir = globpath(&rtp, 'gosnippets/minisnip') - endif -endfunction - - -let s:engine = go#config#SnippetEngine() -if s:engine is? "automatic" - if get(g:, 'did_plugin_ultisnips') is 1 - call s:GoUltiSnips() - elseif get(g:, 'loaded_neosnippet') is 1 - call s:GoNeosnippet() - elseif get(g:, 'loaded_minisnip') is 1 - call s:GoMinisnip() - endif -elseif s:engine is? "ultisnips" - call s:GoUltiSnips() -elseif s:engine is? "neosnippet" - call s:GoNeosnippet() -elseif s:engine is? "minisnip" - call s:GoMinisnip() -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/ftplugin/go/tagbar.vim b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim deleted file mode 100644 index 3ca244ba..00000000 --- a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim +++ /dev/null @@ -1,65 +0,0 @@ -" Check if tagbar is installed under plugins or is directly under rtp -" this covers pathogen + Vundle/Bundle -" -" Also make sure the ctags command exists -" -if !executable('ctags') - finish -elseif globpath(&rtp, 'plugin/tagbar.vim') == "" - finish -endif - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -if !exists("g:go_gotags_bin") - let g:go_gotags_bin = "gotags" -endif - - -function! s:SetTagbar() - let bin_path = go#path#CheckBinPath(g:go_gotags_bin) - if empty(bin_path) - return - endif - - if !exists("g:tagbar_type_go") - let g:tagbar_type_go = { - \ 'ctagstype' : 'go', - \ 'kinds' : [ - \ 'p:package', - \ 'i:imports', - \ 'c:constants', - \ 'v:variables', - \ 't:types', - \ 'n:interfaces', - \ 'w:fields', - \ 'e:embedded', - \ 'm:methods', - \ 'r:constructor', - \ 'f:functions' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 't' : 'ctype', - \ 'n' : 'ntype' - \ }, - \ 'scope2kind' : { - \ 'ctype' : 't', - \ 'ntype' : 'n' - \ }, - \ 'ctagsbin' : bin_path, - \ 'ctagsargs' : '-sort -silent' - \ } - endif -endfunction - - -call s:SetTagbar() - -" 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/ftplugin/gohtmltmpl.vim b/sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim deleted file mode 100644 index ea0aacff..00000000 --- a/sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim +++ /dev/null @@ -1,7 +0,0 @@ -if exists("b:did_ftplugin") - finish -endif - -runtime! ftplugin/html.vim - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/gomod.vim b/sources_non_forked/vim-go/ftplugin/gomod.vim deleted file mode 100644 index b7871705..00000000 --- a/sources_non_forked/vim-go/ftplugin/gomod.vim +++ /dev/null @@ -1,33 +0,0 @@ -" gomod.vim: Vim filetype plugin for Go assembler. - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -let b:undo_ftplugin = "setl fo< com< cms< - \ | exe 'au! vim-go-gomod-buffer * '" - -setlocal formatoptions-=t - -setlocal comments=s1:/*,mb:*,ex:*/,:// -setlocal commentstring=//\ %s - -" Autocommands -" ============================================================================ - -augroup vim-go-gomod-buffer - autocmd! * - - autocmd BufWritePre call go#auto#modfmt_autosave() -augroup end - -" 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/ftplugin/gomod/commands.vim b/sources_non_forked/vim-go/ftplugin/gomod/commands.vim deleted file mode 100644 index d6a7285f..00000000 --- a/sources_non_forked/vim-go/ftplugin/gomod/commands.vim +++ /dev/null @@ -1,3 +0,0 @@ -command! -nargs=0 -range GoModFmt call go#mod#Format() - -command! -nargs=0 GoModFmtAutoSaveToggle call go#mod#ToggleModFmtAutoSave() diff --git a/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim b/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim deleted file mode 100644 index c8664f64..00000000 --- a/sources_non_forked/vim-go/ftplugin/gomod/mappings.vim +++ /dev/null @@ -1 +0,0 @@ -nnoremap (go-mod-fmt) :call go#mod#Format() diff --git a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets b/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets deleted file mode 100644 index 3acf9cf3..00000000 --- a/sources_non_forked/vim-go/gosnippets/UltiSnips/go.snippets +++ /dev/null @@ -1,485 +0,0 @@ -# Snippets for Go - -priority -10 - -# shorthand variable declaration -snippet : "v := value" -${1} := ${0} -endsnippet - -# anonymous function -snippet anon "fn := func() { ... }" -${1:fn} := func() { - ${2:${VISUAL}} -} -${0} -endsnippet - -# append -snippet ap "append(slice, value)" -append(${1:slice}, ${0:value}) -endsnippet - -# append assignment -snippet ap= "a = append(a, value)" -${1:slice} = append($1, ${0:value}) -endsnippet - -# break -snippet br "break" -break -endsnippet - -# channel -snippet ch "chan Type" -chan ${0:int} -endsnippet - -# case -snippet case "case ...:" -case ${1:value}: - ${0:${VISUAL}} -endsnippet - -# constant -snippet con "const XXX Type = ..." -const ${1:NAME} ${2:Type} = ${0:0} -endsnippet - -# constants -snippet cons "const ( ... )" -const ( - ${1:NAME} ${2:Type} = ${3:value} - ${0} -) -endsnippet - -# constants with iota -snippet iota "const ( ... = iota )" -const ( - ${1:NAME} ${2:Type} = iota - ${0} -) -endsnippet - -# continue -snippet cn "continue" -continue -endsnippet - -# default case -snippet default "default: ..." -default: - ${0:${VISUAL}} -endsnippet - -# defer -snippet df "defer someFunction()" -defer ${1:func}(${2}) -${0} -endsnippet - -snippet def "defer func() { ... }" -defer func() { - ${0:${VISUAL}} -}() -endsnippet - -# defer recover -snippet defr -defer func() { - if err := recover(); err != nil { - ${0:${VISUAL}} - } -}() -endsnippet - -# gpl -snippet gpl -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, see . -* -* Copyright (C) ${1:Author}, `!v strftime("%Y")` -*/ -${0} -endsnippet - -# import -snippet import "import ( ... )" -import ( - "${1:package}" -) -endsnippet - -# full interface snippet -snippet interface "interface I { ... }" -type ${1:Interface} interface { - ${2:/* TODO: add methods */} -} -endsnippet - -# if condition -snippet if "if ... { ... }" -if ${1:condition} { - ${0:${VISUAL}} -} -endsnippet - -# else snippet -snippet else -else { - ${0:${VISUAL}} -} -endsnippet - -# if inline error -snippet ife "If with inline erro" -if err := ${1:condition}; err != nil { - ${0:${VISUAL}} -} -endsnippet - -# error snippet -snippet errn "Error return" !b -if err != nil { - return err -} -${0} -endsnippet - -# error log snippet -snippet errl "Error with log.Fatal(err)" !b -if err != nil { - log.Fatal(err) -} -${0} -endsnippet - -# error multiple return -snippet errn, "Error return with two return values" !b -if err != nil { - return ${1:nil}, ${2:err} -} -${0} -endsnippet - -# error panic -snippet errp "Error panic" !b -if err != nil { - panic(${1}) -} -${0} -endsnippet - -# error test -snippet errt "Error test fatal " !b -if err != nil { - t.Fatal(err) -} -${0} -endsnippet - -# error handle -snippet errh "Error handle and return" !b -if err != nil { - ${1} - return -} -${0} -endsnippet - -# json field tag -snippet json "\`json:key\`" -\`json:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\` -endsnippet - -# yaml field tag -snippet yaml "\`yaml:key\`" -\`yaml:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\` -endsnippet - -# fallthrough -snippet ft "fallthrough" -fallthrough -endsnippet - -# for loop -snippet for "for ... { ... }" -for ${1} { - ${0:${VISUAL}} -} -endsnippet - -# for integer loop -snippet fori "for 0..N-1 { ... }" -for ${1:i} := 0; $1 < ${2:N}; $1++ { - ${0:${VISUAL}} -} -endsnippet - -# for range loop -snippet forr "for k, v := range items { ... }" -for ${2:k}, ${3:v} := range ${1} { - ${0:${VISUAL}} -} -endsnippet - -# function -snippet func "func Function(...) [error] { ... }" -func ${1:name}(${2:params})${3/(.+)/ /}`!p opening_par(snip, 3)`$3`!p closing_par(snip, 3)` { - ${0:${VISUAL}} -} -endsnippet - -# Fmt Printf debug -snippet ff "fmt.Printf(...)" -fmt.Printf("${1:${VISUAL}} = %+v\n", $1) -endsnippet - -# Fmt Println debug -snippet fn "fmt.Println(...)" -fmt.Println("${1:${VISUAL}}") -endsnippet - -# Fmt Errorf debug -snippet fe "fmt.Errorf(...)" -fmt.Errorf("${1:${VISUAL}}") -endsnippet - -# log printf -snippet lf "log.Printf(...)" -log.Printf("${1:${VISUAL}} = %+v\n", $1) -endsnippet - -# log println -snippet ln "log.Println(...)" -log.Println("${1:${VISUAL}}") -endsnippet - -# make -snippet make "make(Type, size)" -make(${1:[]string}, ${2:0})${0} -endsnippet - -# map -snippet map "map[Type]Type" -map[${1:string}]${0:int} -endsnippet - -# main() -snippet main "func main() { ... }" -func main() { - ${0:${VISUAL}} -} -endsnippet - -# method -snippet meth "func (self Type) Method(...) [error] { ... }" -func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}`!p opening_par(snip, 5)`$5`!p closing_par(snip, 5)` { - ${0:${VISUAL}} -} -endsnippet - -# ok -snippet ok "if !ok { ... }" -if !ok { - ${0:${VISUAL}} -} -endsnippet - -# package -snippet package "package ..." -// Package $1 provides ${2:...} -package ${1:main} -${0} -endsnippet - -# panic -snippet pn "panic()" -panic("${0:msg}") -endsnippet - -# return -snippet rt "return" -return ${0:${VISUAL}} -endsnippet - -# select -snippet select "select { case a := <-chan: ... }" -select { -case ${1:v1} := <-${2:chan1} - ${0} -} -endsnippet - -# struct -snippet st "type T struct { ... }" -type ${1:Type} struct { - ${0} -} -endsnippet - -# switch -snippet switch "switch x { ... }" -switch ${1:var} { -case ${2:value1}: - ${0} -} -endsnippet - -# sprintf -snippet sp "fmt.Sprintf(...)" -fmt.Sprintf("%${1:s}", ${2:var}) -endsnippet - -# goroutine named function -snippet go "go someFunc(...)" -go ${1:funcName}(${0}) -endsnippet - -# goroutine anonymous function -snippet gof "go func() { ... }()" -go func() { - ${1:${VISUAL}} -}() -${0} -endsnippet - -# test function -snippet test "func TestXYZ(t *testing.T) { ... }" -func Test${1:Function}(t *testing.T) { - ${0:${VISUAL}} -} -endsnippet - -# test table snippet -snippet tt -var tests = []struct { - name string - expected string - given string -}{ - {"${1}", "${2}", "${3}",}, -} -for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T){ - actual := ${0:${VISUAL}}(tt.given) - if actual != tt.expected { - t.Errorf("$0(%s): expected %s, actual %s", tt.given, tt.expected, actual) - } - - }) -} -endsnippet - - -snippet hf "http.HandlerFunc" !b -func ${1:handler}(w http.ResponseWriter, r *http.Request) { - ${0:fmt.Fprintf(w, "hello world")} -} -endsnippet - -snippet hhf "mux.HandleFunc" !b -${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) { - ${0:fmt.Fprintf(w, "hello world")} -}) -endsnippet - -# quick test server -snippet tsrv "httptest.NewServer" -ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, ${1:`response`}) -})) -defer ts.Close() - -${0:someUrl} = ts.URL -endsnippet - -# test error handling -snippet ter "if err != nil { t.Errorf(...) }" -if err != nil { - t.Errorf("${0:message}") -} -endsnippet - -# test fatal error -snippet terf "if err != nil { t.Fatalf(...) }" -if err != nil { - t.Fatalf("${0:message}") -} -endsnippet - -snippet example "func ExampleXYZ() { ... }" -func Example${1:Method}() { - ${0:${VISUAL}} - // Output: -} -endsnippet - -snippet benchmark "func BenchmarkXYZ(b *testing.B) { ... }" -func Benchmark${1:Method}(b *testing.B) { - for i := 0; i < b.N; i++ { - ${0:${VISUAL}} - } -} -endsnippet - -# variable declaration -snippet var "var x Type [= ...]" -var ${1:x} ${2:Type}${3: = ${0:value}} -endsnippet - -# variables declaration -snippet vars "var ( ... )" -var ( - ${1:x} ${2:Type}${3: = ${0:value}} -) -endsnippet - -# equals fails the test if exp is not equal to act. -snippet eq "equals: test two identifiers with DeepEqual" -if !reflect.DeepEqual(${1:expected}, ${2:actual}) { - _, file, line, _ := runtime.Caller(0) - fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2) - t.FailNow() -} -endsnippet - -global !p - -import re - -# Automatically wrap return types with parentheses - -def return_values(s): - # remove everything wrapped in parentheses - s = re.sub("\(.*?\)|\([^)]*$", "", s) - return len(s.split(",")) - -def opening_par(snip, pos): - if return_values(t[pos]) > 1 and not t[pos].startswith("("): - snip.rv = "(" - else: - snip.rv = "" - -def closing_par(snip, pos): - if return_values(t[pos]) > 1: - snip.rv = ")" - else: - snip.rv = "" - -endglobal - -# vim:ft=snippets: diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_eq b/sources_non_forked/vim-go/gosnippets/minisnip/_go_eq deleted file mode 100644 index 9e8fad09..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_eq +++ /dev/null @@ -1,3 +0,0 @@ -if !reflect.DeepEqual({{+got+}}, {{+want+}}) { - t.Errorf("\ngot: %#v\nwant: %#v\n", {{+~\~2+}}, {{+~\~2+}}) -} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_err b/sources_non_forked/vim-go/gosnippets/minisnip/_go_err deleted file mode 100644 index 3a5a4930..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_err +++ /dev/null @@ -1,3 +0,0 @@ -if err != nil { - return {{+err+}} -} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_errt b/sources_non_forked/vim-go/gosnippets/minisnip/_go_errt deleted file mode 100644 index c5cb6fc3..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_errt +++ /dev/null @@ -1,4 +0,0 @@ -if err != nil { - t.Fatal(err) -} -{{++}} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_errw b/sources_non_forked/vim-go/gosnippets/minisnip/_go_errw deleted file mode 100644 index d1958d5b..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_errw +++ /dev/null @@ -1,3 +0,0 @@ -if err != nil { - return errors.Wrap(err, "{{++}}") -} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_f b/sources_non_forked/vim-go/gosnippets/minisnip/_go_f deleted file mode 100644 index 6e35d249..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_f +++ /dev/null @@ -1,3 +0,0 @@ -// {{++}} -func {{+~\~1+}}() { -} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_ff b/sources_non_forked/vim-go/gosnippets/minisnip/_go_ff deleted file mode 100644 index ed942c22..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_ff +++ /dev/null @@ -1 +0,0 @@ -fmt.Printf("%#v\n", {{++}}) diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_fori b/sources_non_forked/vim-go/gosnippets/minisnip/_go_fori deleted file mode 100644 index 8a52ec91..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_fori +++ /dev/null @@ -1,3 +0,0 @@ -for i := 0; i < {{++}}; i++ { - {{++}} -} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg b/sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg deleted file mode 100644 index 2491d9a9..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_pkg +++ /dev/null @@ -1,2 +0,0 @@ -// Package {{+~expand('%:p:h:t')+}} {{++}} -package {{+~\~2+}} diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_sp b/sources_non_forked/vim-go/gosnippets/minisnip/_go_sp deleted file mode 100644 index b392681f..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_sp +++ /dev/null @@ -1,2 +0,0 @@ -fmt.Sprintf("{{++}}", {{++}}) - diff --git a/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt b/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt deleted file mode 100644 index 602e017d..00000000 --- a/sources_non_forked/vim-go/gosnippets/minisnip/_go_tt +++ /dev/null @@ -1,17 +0,0 @@ -var tests = []struct { - name string - expected string - given string -}{ - {"", "", "",}, -} -for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T){ - actual := {{++}}(tt.given) - if actual != tt.expected { - t.Errorf("{{+~\~1+}}(%s): expected %s, actual %s", tt.given, tt.expected, actual) - } - - }) -} diff --git a/sources_non_forked/vim-go/gosnippets/snippets/go.snip b/sources_non_forked/vim-go/gosnippets/snippets/go.snip deleted file mode 100644 index 3235fb46..00000000 --- a/sources_non_forked/vim-go/gosnippets/snippets/go.snip +++ /dev/null @@ -1,401 +0,0 @@ -# shorthand variable declaration -snippet : -abbr v := value - ${1} := ${0} -# anonymous function -snippet anon -abbr fn := func() { ... } - ${1:fn} := func() { - ${0} - } -# append -snippet ap -abbr append(slice, value) - append(${1:slice}, ${0:value}) -# append assign -snippet ap= -abbr slice = append(slice, value) - ${1:slice} = append($1, ${0:value}) -# break -snippet br -abbr break - break -# channel -snippet ch -abbr chan Type - chan ${0:int} -# case -snippet case -abbr case ...: - case ${1:value}: - ${0} -# constant -snippet con -abbr const XXX Type = ... - const ${1:NAME} ${2:Type} = ${0:0} -# constants -snippet cons -abbr const ( ... ) - const ( - ${1:NAME} ${2:Type} = ${3:value} - ${0} - ) -# constants with iota -snippet iota -abbr const ( ... = iota ) - const ( - ${1:NAME} ${2:Type} = iota - ${0} - ) -# continue -snippet cn -abbr continue - continue -# default case -snippet default -abbr default: ... - default: - ${0} - -# defer -snippet df -abbr defer someFunction() - defer ${1:func}(${2}) - ${0} -snippet def -abbr defer func() { ... } - defer func() { - ${0} - }() -# defer recover -snippet defr - defer func() { - if err := recover(); err != nil { - ${0} - } - }() -# gpl -snippet gpl - /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - * - * Copyright (C) ${1:Author}, `strftime("%Y")` - */ - - ${0} -# import -snippet import -abbr import ( ... ) - import ( - "${1:package}" - ) -# full interface snippet -snippet interface -abbr interface I { ... } - type ${1:Interface} interface { - ${2:/* TODO: add methods */} - } -# if condition -snippet if -abbr if ... { ... } - if ${1:condition} { - ${0} - } -# else snippet -abbr else { ... } -snippet else - else { - ${0} - } - -# if inline error -snippet ife -abbr if err := ...; err != nil { ... } - if err := ${1:condition}; err != nil { - ${0} - } - -# error snippet -snippet errn -abbr if err != nil { return err } - if err != nil { - return err - } - ${0} -# error snippet in TestFunc -snippet errt -abbr if err != nil { t.Fatal(err) } - if err != nil { - t.Fatal(err) - } - -# error snippet in log.Fatal -snippet errl -abbr if err != nil { log.Fatal(err) } - if err != nil { - log.Fatal(err) - } - -# error snippet with two return values -snippet errn, -abbr if err != nil { return [...], err } - if err != nil { - return ${1:nil}, err - } - ${0} - -# error snippet handle and return -snippet errh -abbr if err != nil { ... return } - if err != nil { - ${1} - return - } - ${0} - -# error snippet with panic -snippet errp -abbr if err != nil { panic(...) } - if err != nil { - panic(${1}) - } - ${0} - -# json snippet -snippet json -abbr \`json:key\` - \`json:"${1:keyName}"\` - -# yaml snippet -snippet yaml -abbr \`yaml:key\` - \`yaml:"${1:keyName}"\` - -# fallthrough -snippet ft -abbr fallthrough - fallthrough -# for loop -snippet for -abbr for ... { ... } - for ${1} { - ${0} - } -# for integer loop -snippet fori -abbr for 0..N-1 { ... } - for ${1:i} := 0; $1 < ${2:N}; $1++ { - ${0} - } -# for range loop -snippet forr -abbr for k, v := range items { ... } - for ${2:k}, ${3:v} := range ${1} { - ${0} - } -# function -snippet func -abbr func function(...) [error] { ... } - func ${1:function}(${2}) ${3:error }{ - ${0} - } -# Fmt Printf debug -snippet ff -abbr fmt.Printf(...) - fmt.Printf("${1} = %+v\n", $1) - ${0} -# Fmt Println debug -snippet fn -abbr fmt.Println(...) - fmt.Println("${1}") -# Fmt Errorf -snippet fe -abbr fmt.Errorf(...) - fmt.Errorf("${1}") -# log printf -snippet lf -abbr log.Printf(...) - log.Printf("${1} = %+v\n", $1) -# log println -snippet ln -abbr log.Println(...) - log.Println("${1}") -# make -snippet make -abbr make(Type, size) - make(${1:[]string}, ${2:0})${0} -# map -snippet map -abbr map[Type]Type - map[${1:string}]${0:int} -# main() -snippet main -abbr func main() { ... } -options head - func main() { - ${0} - } -# method -snippet meth -abbr func (self Type) Method(...) [error] { ... } -regexp /^meth/ - func (${1:self} ${2:Type}) ${3:Do}(${4}) ${5:error }{ - ${0} - } -# ok -snippet ok -abbr if !ok { ... } - if !ok { - ${0} - } -# package -snippet package -abbr package ... - // Package $1 provides ${2:...} - package ${1:main} - ${0} -# panic -snippet panic -alias pn -abbr panic("...") - panic("${0}") -# return -snippet return -alias rt -abbr return ... - return ${0} -# select -snippet select -abbr select { case a := <-chan: ... } - select { - case ${1:v1} := <-${2:chan1} - ${0} - } -# struct -snippet st -abbr type T struct { ... } - type ${1:Type} struct { - ${0} - } -# switch -snippet switch -abbr switch x { ... } - switch ${1:var} { - case ${2:value1}: - ${0} - } -# sprintf -snippet sp -abbr fmt.Sprintf(...) - fmt.Sprintf("%${1:s}", ${2:var}) -# goroutine named function -snippet go -abbr go someFunc(...) - go ${1:funcName}(${0}) -# goroutine anonymous function -snippet gof -abbr go func(...) { ... }(...) - go func(${1}) { - ${3:/* TODO */} - }(${2}) -# test function -snippet test -abbr func TestXYZ(t *testing.T) { ... } - func Test${1:Function}(t *testing.T) { - ${0} - } -# test table snippet -snippet tt -abbr var test = {...}{...} for {t.Run(){...}} - var tests = []struct { - name string - expected string - given string - }{ - {"${2}", "${3}", "${4}",}, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T){ - actual := ${1:Function}(tt.given) - if actual != tt.expected { - t.Errorf("given(%s): expected %s, actual %s", tt.given, tt.expected, actual) - } - }) - } -# test server -snippet tsrv -abbr ts := httptest.NewServer(...) - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, ${1:`response`}) - })) - defer ts.Close() - - //Use testing server url (type string) somewhere - ${0:someUrl} = ts.URL -# test error -snippet ter -abbr if err != nil { t.Errorf(...) } - if err != nil { - t.Errorf("${1}") - } -# test fatal error -snippet terf -abbr if err != nil { t.Fatalf(...) } - if err != nil { - t.Fatalf("${1}") - } -# test example -snippet example - func Example${1:Method}() { - ${0} - // Output: - } -# test benchmark -snippet benchmark - func Benchmark${1:Method}(b *testing.B) { - for i := 0; i < b.N; i++ { - ${0} - } - } -# variable declaration -snippet var -abbr var x Type [= ...] - var ${1:x} ${2:Type}${3: = ${0:value\}} -# variables declaration -snippet vars -abbr var ( ... ) - var ( - ${1:x} ${2:Type}${3: = ${0:value\}} - ) -# equals fails the test if exp is not equal to act. -snippet eq -abbr equals: test two identifiers with DeepEqual - if !reflect.DeepEqual(${1:expected}, ${2:actual}) { - _, file, line, _ := runtime.Caller(0) - fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2) - t.FailNow() - } - -snippet hf -abbr http.HandlerFunc - func ${1:handler}(w http.ResponseWriter, r *http.Request) { - ${0:fmt.Fprintf(w, "hello world")} - } - -snippet hhf -abbr mux.HandleFunc(...) - ${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) { - ${0:fmt.Fprintf(w, "hello world")} - }) diff --git a/sources_non_forked/vim-go/indent/go.vim b/sources_non_forked/vim-go/indent/go.vim deleted file mode 100644 index 4c3ea042..00000000 --- a/sources_non_forked/vim-go/indent/go.vim +++ /dev/null @@ -1,86 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" indent/go.vim: Vim indent file for Go. -" -" TODO: -" - function invocations split across lines -" - general line splits (line ends in an operator) - -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -" C indentation is too far off useful, mainly due to Go's := operator. -" Let's just define our own. -setlocal nolisp -setlocal autoindent -setlocal indentexpr=GoIndent(v:lnum) -setlocal indentkeys+=<:>,0=},0=) - -if exists("*GoIndent") - finish -endif - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! GoIndent(lnum) abort - let prevlnum = prevnonblank(a:lnum-1) - if prevlnum == 0 - " top of file - return 0 - endif - - " grab the previous and current line, stripping comments. - let prevl = substitute(getline(prevlnum), '//.*$', '', '') - let thisl = substitute(getline(a:lnum), '//.*$', '', '') - let previ = indent(prevlnum) - - let ind = previ - - for synid in synstack(a:lnum, 1) - if synIDattr(synid, 'name') == 'goRawString' - if prevl =~ '\%(\%(:\?=\)\|(\|,\)\s*`[^`]*$' - " previous line started a multi-line raw string - return 0 - endif - " return -1 to keep the current indent. - return -1 - endif - endfor - - if prevl =~ '[({]\s*$' - " previous line opened a block - let ind += shiftwidth() - endif - if prevl =~# '^\s*\(case .*\|default\):$' - " previous line is part of a switch statement - let ind += shiftwidth() - endif - " TODO: handle if the previous line is a label. - - if thisl =~ '^\s*[)}]' - " this line closed a block - let ind -= shiftwidth() - endif - - " Colons are tricky. - " We want to outdent if it's part of a switch ("case foo:" or "default:"). - " We ignore trying to deal with jump labels because (a) they're rare, and - " (b) they're hard to disambiguate from a composite literal key. - if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= shiftwidth() - endif - - return ind -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/indent/gohtmltmpl.vim b/sources_non_forked/vim-go/indent/gohtmltmpl.vim deleted file mode 100644 index 8cc544a2..00000000 --- a/sources_non_forked/vim-go/indent/gohtmltmpl.vim +++ /dev/null @@ -1,54 +0,0 @@ -if exists("b:did_indent") - finish -endif - -runtime! indent/html.vim - -" Indent Golang HTML templates -setlocal indentexpr=GetGoHTMLTmplIndent(v:lnum) -setlocal indentkeys+==else,=end - -" Only define the function once. -if exists("*GetGoHTMLTmplIndent") - finish -endif - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! GetGoHTMLTmplIndent(lnum) - " Get HTML indent - if exists('*HtmlIndent') - let ind = HtmlIndent() - else - let ind = HtmlIndentGet(a:lnum) - endif - - " The value of a single shift-width - if exists('*shiftwidth') - let sw = shiftwidth() - else - let sw = &sw - endif - - " If need to indent based on last line - let last_line = getline(a:lnum-1) - if last_line =~ '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}' - let ind += sw - endif - - " End of FuncMap block - let current_line = getline(a:lnum) - if current_line =~ '^\s*{{-\=\s*\%(else\|end\).*}}' - let ind -= sw - endif - - return ind -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/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim deleted file mode 100644 index 129f6f8b..00000000 --- a/sources_non_forked/vim-go/plugin/go.vim +++ /dev/null @@ -1,313 +0,0 @@ -" install necessary Go tools -if exists("g:go_loaded_install") - finish -endif -let g:go_loaded_install = 1 - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -function! s:checkVersion() abort - let l:unsupported = 0 - if go#config#VersionWarning() != 0 - if has('nvim') - let l:unsupported = !has('nvim-0.3.2') - else - let l:unsupported = !has('patch-8.0.1453') - endif - - if l:unsupported == 1 - echohl Error - echom "vim-go requires at least Vim 8.0.1453 or Neovim 0.3.2, but you're using an older version." - echom "Please update your Vim for the best vim-go experience." - echom "If you really want to continue you can set this to make the error go away:" - echom " let g:go_version_warning = 0" - echom "Note that some features may error out or behave incorrectly." - echom "Please do not report bugs unless you're using at least Vim 8.0.1453 or Neovim 0.3.2." - echohl None - - " Make sure people see this. - sleep 2 - endif - endif -endfunction - -call s:checkVersion() - -" these packages are used by vim-go and can be automatically installed if -" needed by the user with GoInstallBinaries. - -" NOTE(bc): varying the binary name and the tail of the import path (e.g. -" gocode-gomod) does not yet work in module aware mode. -let s:packages = { - \ 'asmfmt': ['github.com/klauspost/asmfmt/cmd/asmfmt@master'], - \ 'dlv': ['github.com/go-delve/delve/cmd/dlv@master'], - \ 'errcheck': ['github.com/kisielk/errcheck@master'], - \ 'fillstruct': ['github.com/davidrjenni/reftools/cmd/fillstruct@master'], - \ 'gocode': ['github.com/mdempsky/gocode@master', {'windows': ['-ldflags', '-H=windowsgui']}], - \ 'gocode-gomod': ['github.com/stamblerre/gocode'], - \ 'godef': ['github.com/rogpeppe/godef@master'], - \ 'gogetdoc': ['github.com/zmb3/gogetdoc@master'], - \ 'goimports': ['golang.org/x/tools/cmd/goimports@master'], - \ 'golint': ['golang.org/x/lint/golint@master'], - \ 'gopls': ['golang.org/x/tools/gopls@latest', {}, {'after': function('go#lsp#Restart', [])}], - \ 'golangci-lint': ['github.com/golangci/golangci-lint/cmd/golangci-lint@master'], - \ 'gomodifytags': ['github.com/fatih/gomodifytags@master'], - \ 'gorename': ['golang.org/x/tools/cmd/gorename@master'], - \ 'gotags': ['github.com/jstemmer/gotags@master'], - \ 'guru': ['golang.org/x/tools/cmd/guru@master'], - \ 'impl': ['github.com/josharian/impl@master'], - \ 'keyify': ['honnef.co/go/tools/cmd/keyify@master'], - \ 'motion': ['github.com/fatih/motion@master'], - \ 'iferr': ['github.com/koron/iferr@master'], -\ } - -" These commands are available on any filetypes -command! -nargs=* -complete=customlist,s:complete GoInstallBinaries call s:GoInstallBinaries(-1, ) -command! -nargs=* -complete=customlist,s:complete GoUpdateBinaries call s:GoInstallBinaries(1, ) -command! -nargs=? -complete=dir GoPath call go#path#GoPath() - -fun! s:complete(lead, cmdline, cursor) - return filter(keys(s:packages), 'strpart(v:val, 0, len(a:lead)) == a:lead') -endfun - -" GoInstallBinaries downloads and installs binaries defined in s:packages to -" $GOBIN or $GOPATH/bin. GoInstallBinaries will update already installed -" binaries only if updateBinaries = 1. By default, all packages in s:packages -" will be installed, but the set can be limited by passing the desired -" packages in the unnamed arguments. -function! s:GoInstallBinaries(updateBinaries, ...) - let err = s:CheckBinaries() - if err != 0 - return - endif - - if go#path#Default() == "" - call go#util#EchoError('$GOPATH is not set and `go env GOPATH` returns empty') - return - endif - - let go_bin_path = go#path#BinPath() - - " change $GOBIN so go get can automatically install to it - let Restore_gobin = go#util#SetEnv('GOBIN', go_bin_path) - - " vim's executable path is looking in PATH so add our go_bin path to it - let Restore_path = go#util#SetEnv('PATH', go_bin_path . go#util#PathListSep() . $PATH) - - " when shellslash is set on MS-* systems, shellescape puts single quotes - " around the output string. cmd on Windows does not handle single quotes - " correctly. Unsetting shellslash forces shellescape to use double quotes - " instead. - let resetshellslash = 0 - if has('win32') && &shellslash - let resetshellslash = 1 - set noshellslash - endif - - let l:get_base_cmd = ['go', 'get', '-v'] - - " Filter packages from arguments (if any). - let l:packages = {} - if a:0 > 0 - for l:bin in a:000 - let l:pkg = get(s:packages, l:bin, []) - if len(l:pkg) == 0 - call go#util#EchoError('unknown binary: ' . l:bin) - return - endif - let l:packages[l:bin] = l:pkg - endfor - else - let l:packages = s:packages - endif - - let l:platform = '' - if go#util#IsWin() - let l:platform = 'windows' - endif - - let l:oldmore = &more - let &more = 0 - - for [l:binary, l:pkg] in items(l:packages) - let l:importPath = l:pkg[0] - - " TODO(bc): how to support this with modules? Do we have to clone and then - " install manually? Probably not. I suspect that we can just use GOPATH - " mode and then do the legacy method. - let bin_setting_name = "go_" . l:binary . "_bin" - - if exists("g:{bin_setting_name}") - let bin = g:{bin_setting_name} - else - if go#util#IsWin() - let bin = l:binary . '.exe' - else - let bin = l:binary - endif - endif - - if !executable(bin) || a:updateBinaries == 1 - if a:updateBinaries == 1 - echo "vim-go: Updating " . l:binary . ". Reinstalling ". importPath . " to folder " . go_bin_path - else - echo "vim-go: ". l:binary ." not found. Installing ". importPath . " to folder " . go_bin_path - endif - - if l:importPath =~ "@" - let Restore_modules = go#util#SetEnv('GO111MODULE', 'on') - let l:tmpdir = go#util#tempdir('vim-go') - let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let l:dir = getcwd() - try - execute l:cd . fnameescape(l:tmpdir) - let l:get_cmd = copy(l:get_base_cmd) - - if len(l:pkg) > 1 && get(l:pkg[1], l:platform, []) isnot [] - let l:get_cmd += get(l:pkg[1], l:platform, []) - endif - - " TODO(bc): how to install the bin to a different name than the - " binary path? go get does not support -o - " let l:get_cmd += ['-o', printf('%s%s%s', go_bin_path, go#util#PathSep(), bin)] - - let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath]) - if l:err - call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out)) - endif - - call call(Restore_modules, []) - finally - execute l:cd . fnameescape(l:dir) - endtry - call call(Restore_modules, []) - else - let l:get_cmd = copy(l:get_base_cmd) - let l:get_cmd += ['-d'] - if get(g:, "go_get_update", 1) != 0 - let l:get_cmd += ['-u'] - endif - - let Restore_modules = go#util#SetEnv('GO111MODULE', 'off') - - " first download the binary - let [l:out, l:err] = go#util#Exec(l:get_cmd + [l:importPath]) - if l:err - call go#util#EchoError(printf('Error downloading %s: %s', l:importPath, l:out)) - endif - - " and then build and install it - let l:build_cmd = ['go', 'build'] - if len(l:pkg) > 1 && get(l:pkg[1], l:platform, []) isnot [] - let l:build_cmd += get(l:pkg[1], l:platform, []) - endif - let l:build_cmd += ['-o', printf('%s%s%s', go_bin_path, go#util#PathSep(), bin), l:importPath] - - let [l:out, l:err] = go#util#Exec(l:build_cmd) - if l:err - call go#util#EchoError(printf('Error installing %s: %s', l:importPath, l:out)) - endif - - call call(Restore_modules, []) - endif - - if len(l:pkg) > 2 - call call(get(l:pkg[2], 'after', function('s:noop', [])), []) - endif - endif - endfor - - " restore back! - call call(Restore_path, []) - call call(Restore_gobin, []) - - if resetshellslash - set shellslash - endif - - if a:updateBinaries == 1 - call go#util#EchoInfo('updating finished!') - else - call go#util#EchoInfo('installing finished!') - endif - - let &more = l:oldmore -endfunction - -" CheckBinaries checks if the necessary binaries to install the Go tool -" commands are available. -function! s:CheckBinaries() - if !executable('go') - call go#util#EchoError('go executable not found.') - return -1 - endif - - if !executable('git') - call go#util#EchoError('git executable not found.') - return -1 - endif -endfunction - -" Autocommands -" ============================================================================ -" - -" We take care to preserve the user's fileencodings and fileformats, -" because those settings are global (not buffer local), yet we want -" to override them for loading Go files, which are defined to be UTF-8. -let s:current_fileformats = '' -let s:current_fileencodings = '' - -" define fileencodings to open as utf-8 encoding even if it's ascii. -function! s:gofiletype_pre() - let s:current_fileformats = &g:fileformats - let s:current_fileencodings = &g:fileencodings - set fileencodings=utf-8 fileformats=unix -endfunction - -" restore fileencodings as others -function! s:gofiletype_post() - let &g:fileformats = s:current_fileformats - let &g:fileencodings = s:current_fileencodings -endfunction - -function! s:register() - if !(&modifiable && expand('') ==# 'go') - return - endif - - let l:RestoreGopath = function('s:noop') - if go#config#AutodetectGopath() - let l:RestoreGopath = go#util#SetEnv('GOPATH', go#path#Detect()) - endif - call go#lsp#DidOpen(expand(':p')) - call call(l:RestoreGopath, []) -endfunction - -function! s:noop(...) abort -endfunction - -augroup vim-go - autocmd! - - autocmd BufNewFile *.go if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif - autocmd BufNewFile *.go call go#auto#template_autocreate() - autocmd BufRead *.go call s:gofiletype_pre() - autocmd BufReadPost *.go call s:gofiletype_post() - - autocmd BufNewFile *.s if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif - autocmd BufRead *.s call s:gofiletype_pre() - autocmd BufReadPost *.s call s:gofiletype_post() - - if go#util#has_job() - autocmd FileType * call s:register() - endif -augroup end - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py b/sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py deleted file mode 100644 index 68651a87..00000000 --- a/sources_non_forked/vim-go/rplugin/python3/denite/source/decls.py +++ /dev/null @@ -1,93 +0,0 @@ -# ============================================================================ -# FILE: decls.py -# AUTHOR: delphinus -# License: MIT license -# ============================================================================ - -import os -import subprocess -import json -import denite.util -from .base import Base - -DECLS_SYNTAX_HIGHLIGHT = [ - {'name': 'FilePath', 're': r'[^:]*\ze:', 'link': 'Comment'}, - {'name': 'Line', 're': r'\d\+\ze :', 'link': 'LineNr'}, - {'name': 'WholeFunction', 're': r'\vfunc %(\([^)]+\) )?[^(]+'}, - {'name': 'Function', 'parent': 'WholeFunction', - 're': r'\S\+\ze(', 'link': 'Function'}, - {'name': 'WholeType', 're': r'type \S\+'}, - {'name': 'Type', 'parent': 'WholeType', - 're': r'\v( )@<=\S+', 'link': 'Type'}, - {'name': 'Separator', 're': r':', 'conceal': True}, - {'name': 'SeparatorFunction', 'parent': 'WholeFunction', - 're': r'func ', 'conceal': True}, - {'name': 'SeparatorType', 'parent': 'WholeType', - 're': r'type ', 'conceal': True}, - ] - -class Source(Base): - - def __init__(self, vim): - super().__init__(vim) - - self.name = 'decls' - self.kind = 'file' - - def gather_candidates(self, context): - bin_path = self.vim.call('go#path#CheckBinPath', 'motion') - if bin_path == '': - return [] - - expand = context['args'][0] if context['args'] else '%:p:h' - target = self.vim.funcs.expand(expand) - - if os.path.isdir(target): - mode = 'dir' - elif os.path.isfile(target): - mode = 'file' - else: - return [] - - if self.vim.funcs.exists('g:go_decls_includes'): - include = self.vim.eval('g:go_decls_includes') - else: - include = 'func,type' - - command = [bin_path, '-mode', 'decls', '-include', include, - '-' + mode, target] - - try: - cmd = subprocess.run(command, stdout=subprocess.PIPE, check=True) - except subprocess.CalledProcessError as err: - denite.util.error(self.vim, - 'command returned invalid response: ' + str(err)) - return [] - - txt = cmd.stdout.decode('utf-8') - output = json.loads(txt, encoding='utf-8') - - def make_candidates(row): - name = self.vim.funcs.fnamemodify(row['filename'], ':~:.') - return { - 'word': '{0} :{1} :{2}'.format(name, row['line'], row['full']), - 'action__path': row['filename'], - 'action__line': row['line'], - 'action__col': row['col'], - } - return list(map(make_candidates, output['decls'])) - - def highlight(self): - for syn in DECLS_SYNTAX_HIGHLIGHT: - containedin = self.syntax_name - containedin += '_' + syn['parent'] if 'parent' in syn else '' - conceal = ' conceal' if 'conceal' in syn else '' - - self.vim.command( - 'syntax match {0}_{1} /{2}/ contained containedin={3}{4}' - .format(self.syntax_name, syn['name'], syn['re'], - containedin, conceal)) - - if 'link' in syn: - self.vim.command('highlight default link {0}_{1} {2}'.format( - self.syntax_name, syn['name'], syn['link'])) diff --git a/sources_non_forked/vim-go/scripts/bench-syntax b/sources_non_forked/vim-go/scripts/bench-syntax deleted file mode 100644 index b4496af5..00000000 --- a/sources_non_forked/vim-go/scripts/bench-syntax +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# -# Benchmark the syntax/go.vim file. -# -# The first argument is the Vim version to test (as in run-vim), the rest of the -# agument are g:go_highlight_* settings (without that prefix). You can use "ALL" -# to set all the options. -# - -set -euC -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -if [ -z "${1:-}" ]; then - echo "unknown version: '${1:-}'" - echo "First argument must be 'vim-8.0' or 'nvim'." - exit 1 -fi - -if [ -z "${2:-}" ]; then - echo "file not set" - echo "Second argument must be a Go file to benchmark, as 'filename:linenr'" - exit 1 -fi - -vim=$1 -file="$(echo "$2" | cut -d : -f 1)" -line="$(echo "$2" | cut -d : -f 2)" -if [ -z "$line" -o "$line" = "$file" ]; then - echo "Second argument must be a Go file to benchmark, as 'filename:linenr'" - exit 1 -fi - -shift; shift -export RUNBENCH_SETTINGS=$@ -export RUNBENCH_OUT="$(mktemp -p "${TMPDIR:-/tmp}" vimgo-bench.XXXXX)" - -"$vimgodir/scripts/run-vim" $vim \ - +"silent e $file" \ - +"normal! ${line}G" \ - -S ./scripts/runbench.vim - -echo "Report written to:" -echo "$RUNBENCH_OUT" diff --git a/sources_non_forked/vim-go/scripts/docker-test b/sources_non_forked/vim-go/scripts/docker-test deleted file mode 100644 index e984f610..00000000 --- a/sources_non_forked/vim-go/scripts/docker-test +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Run all tests inside a Docker container -# - -set -euC -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -docker build --tag vim-go-test . -# seccomp=confined is required for dlv to run in a container, hence it's -# required for vim-go's debug tests. -docker run --rm --security-opt="seccomp=unconfined" vim-go-test - -# vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/scripts/install-vim b/sources_non_forked/vim-go/scripts/install-vim deleted file mode 100644 index 7aca0d54..00000000 --- a/sources_non_forked/vim-go/scripts/install-vim +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -# -# Install and setup a Vim or Neovim for running tests. -# This should work on both Travis and people's desktop computers, and be 100% -# independent from any system installed Vim. -# -# It will echo the full path to a Vim binary, e.g.: -# /some/path/src/vim - -set -euC - -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -vim=${1:-} - -case "$vim" in - "vim-8.0") - # This follows the version in Ubuntu LTS. Vim's master branch isn't always - # stable, and we don't want to have the build fail because Vim introduced a - # bug. - tag="v8.0.1453" - giturl="https://github.com/vim/vim" - ;; - - "nvim") - # Use latest stable version. - tag="v0.3.2" - giturl="https://github.com/neovim/neovim" - ;; - - *) - echo "unknown version: '${1:-}'" - echo "First argument must be 'vim-8.0' or 'nvim'." - exit 1 - ;; -esac - -srcdir="/tmp/vim-go-test/$1-src" -installdir="/tmp/vim-go-test/$1-install" - -# Use cached installdir. -if [ -d "$installdir" ]; then - echo "$installdir exists; skipping build." - - # The ./scripts/test script relies on this. - echo "installed to: $installdir" - exit 0 -fi - -mkdir -p "$srcdir" -cd "$srcdir" - -# Neovim build requires more deps than Vim and is annoying, so we use the -# binary. -# 0.2.0 doesn't have a binary build for Linux, so we use 0.2.1-dev for now. -if [ "$1" = "nvim" ]; then - - # TODO: Use macOS binaries on macOS - curl -Ls https://github.com/neovim/neovim/releases/download/$tag/nvim-linux64.tar.gz | - tar xzf - -C /tmp/vim-go-test/ - mv /tmp/vim-go-test/nvim-linux64 /tmp/vim-go-test/nvim-install - mkdir -p "$installdir/share/nvim/runtime/pack/vim-go/start" - ln -s "$vimgodir" "$installdir/share/nvim/runtime/pack/vim-go/start/vim-go" - - # Consistent paths makes calling things easier. - mv "$installdir/bin/nvim" "$installdir/bin/vim" - mkdir -p "$installdir/share/vim/vimgo/pack" - ln -s "$installdir/share/nvim/runtime/pack/vim-go" "$installdir/share/vim/vimgo/pack/vim-go" - -# Build Vim from source. -else - if [ -d "$srcdir/.git" ]; then - echo "Skipping clone as $srcdir/.git exists" - else - echo "Cloning $tag from $giturl" - git clone --branch "$tag" --depth 1 "$giturl" "$srcdir" - fi - - ./configure --prefix="$installdir" --with-features=huge --disable-gui - make install - mkdir -p "$installdir/share/vim/vimgo/pack/vim-go/start" - ln -s "$vimgodir" "$installdir/share/vim/vimgo/pack/vim-go/start/vim-go" -fi - -# Make sure all Go tools and other dependencies are installed. -echo "Installing Go binaries" -export GOPATH=$installdir -export GO111MODULE=off -export PATH=${GOPATH}/bin:$PATH -"$vimgodir/scripts/run-vim" $vim +':silent :GoUpdateBinaries' +':qa' - -echo "Installing lint tools" -( - mkdir -p "$installdir/share/vim/vimgo/pack/vim-go/start/" - cd "$installdir/share/vim/vimgo/pack/vim-go/start/" - [ -d "vim-vimhelplint" ] || git clone --depth 1 --quiet https://github.com/machakann/vim-vimhelplint - [ -d "vim-vimlparser" ] || git clone --depth 1 --quiet https://github.com/ynkdir/vim-vimlparser - [ -d "vim-vimlint" ] || git clone --depth 1 --quiet https://github.com/syngan/vim-vimlint -) - -# Don't really need source after successful install. -rm -rf "$srcdir" - -echo "installed to: $installdir" - -# vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/scripts/lint b/sources_non_forked/vim-go/scripts/lint deleted file mode 100644 index fd067252..00000000 --- a/sources_non_forked/vim-go/scripts/lint +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -# -# Run all linting tools. -# - -set -euC -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -### Setup Vim and other dependencies. -##################################### -if [ -z "${1:-}" ]; then - echo "unknown version: '${1:-}'" - echo "First argument must be 'vim-8.0' or 'nvim'." - exit 1 -fi - -vim=$1 -vimdir="/tmp/vim-go-test/$vim-install" -export GOPATH=$vimdir -export PATH=${GOPATH}/bin:$PATH - -if [ ! -f "$vimdir/bin/vim" ]; then - echo "$vimdir/bin/vim doesn't exist; did you install it with the install-vim script?" - exit 1 -fi - -### Run vint -############ -failed=0 -printf "Running vint ... " -if [ -x "$(command -v vint)" ]; then - lint=$(vint "$vimgodir" 2>&1 ||:) - if [ -n "$lint" ]; then - echo "FAILED" - echo "$lint" - echo - failed=6 - else - echo "PASSED" - fi -else - echo "SKIPPED" - echo "'vint' binary not found; use 'pip install vim-vint' to install it." -fi - -### Run vim-vimlint -################### -printf "Running vim-vimlint ... " -lint=$(sh "$vimdir/share/vim/vimgo/pack/vim-go/start/vim-vimlint/bin/vimlint.sh" \ - -p "$vimdir/share/vim/vimgo/pack/vim-go/start/vim-vimlparser" \ - -l "$vimdir/share/vim/vimgo/pack/vim-go/start/vim-vimlint" \ - -u \ - -c func_abort=1 \ - -e EVL110=1 -e EVL103=1 -e EVL104=1 -e EVL102=1 \ - "$vimgodir" \ - 2>&1 ||:) -if [ -n "$lint" ]; then - echo "FAILED" - echo "$lint" - echo - failed=6 -else - echo "PASSED" -fi - -### Run vimhelplint. -#################### -printf "Running vimhelplint ... " - -# set modeline explicitly so that the modeline will be respected when run as root. -lint=$($vimdir/bin/vim -esNR \ - --cmd "set rtp+=$vimdir/share/vim/vimgo/pack/vim-go/start/vim-vimhelplint/" \ - --cmd 'set modeline' \ - +'filetype plugin on' \ - +"e $vimgodir/doc/vim-go.txt" \ - +'verbose VimhelpLintEcho' \ - +q \ - 2>&1 ||:) -if [ "$lint" ]; then - echo "FAILED" - echo "$lint" - failed=6 -else - echo "PASSED" -fi - -exit "$failed" diff --git a/sources_non_forked/vim-go/scripts/run-vim b/sources_non_forked/vim-go/scripts/run-vim deleted file mode 100644 index fbfdf6a0..00000000 --- a/sources_non_forked/vim-go/scripts/run-vim +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# Run a "bare" Vim with just vim-go and ignoring ~/.vim -# - -set -euC -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -coverage=0 -while getopts "c" option; do - case "$option" in - c) coverage=1; ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - echo "unknown version: '${1:-}'" - echo "First argument must be 'vim-8.0' or 'nvim'." - exit 1 -fi - -dir="/tmp/vim-go-test/$1-install" -export GOPATH=$dir -export GO111MODULE=auto -export PATH=${GOPATH}/bin:$PATH -shift - -if [ ! -f "$dir/bin/vim" ]; then - echo "$dir/bin/vim doesn't exist; did you install it with the install-vim script?" - exit 1 -fi - -if [ $coverage -eq 1 ]; then - covimerage -q run --report-file /tmp/vim-go-test/cov-profile.txt --append \ - $dir/bin/vim --noplugin -u NONE -N \ - +"set shm+=WAFI rtp^=$vimgodir packpath=$dir/share/vim/vimgo" \ - +'filetype plugin indent on' \ - +'packloadall!' \ - "$@" -else - $dir/bin/vim --noplugin -u NONE -N \ - +"set shm+=WAFI rtp^=$vimgodir packpath=$dir/share/vim/vimgo" \ - +'filetype plugin indent on' \ - +'packloadall!' \ - "$@" -fi - - -# vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/scripts/runbench.vim b/sources_non_forked/vim-go/scripts/runbench.vim deleted file mode 100644 index e1c6c88a..00000000 --- a/sources_non_forked/vim-go/scripts/runbench.vim +++ /dev/null @@ -1,37 +0,0 @@ -" vint: -ProhibitSetNoCompatible - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -set nocompatible nomore shellslash encoding=utf-8 shortmess+=WIF -lang mess C - -if $RUNBENCH_SETTINGS is? 'all' - let $RUNBENCH_SETTINGS = join(['array_whitespace_error', 'build_constraints', - \ 'chan_whitespace_error', 'extra_types', 'fields', 'format_strings', - \ 'function_arguments', 'function_calls', 'functions', 'generate_tags', - \ 'operators', 'space_tab_error', 'string_spellcheck', - \ 'trailing_whitespace_error', 'types', 'variable_assignments', - \ 'variable_declarations'], ' ') -endif - -for s:s in split($RUNBENCH_SETTINGS, ' ') - call execute('let g:go_highlight_' . s:s . ' = 1') -endfor - -filetype plugin indent on -syntax on - -syntime on -redraw! -let s:report = execute('syntime report') -execute ':e ' . fnameescape($RUNBENCH_OUT) -call setline('.', split(s:report, '\n')) -wq - -" 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/scripts/runtest.vim b/sources_non_forked/vim-go/scripts/runtest.vim deleted file mode 100644 index 9802405c..00000000 --- a/sources_non_forked/vim-go/scripts/runtest.vim +++ /dev/null @@ -1,133 +0,0 @@ -" Make sure some options are set to sane defaults and output all messages in -" English. - -" vint: -ProhibitSetNoCompatible - -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -set nocompatible nomore shellslash encoding=utf-8 shortmess+=WIF -lang mess C - -" Initialize variables. -let s:total_started = reltime() -let s:fail = 0 -let s:done = 0 -let s:logs = [] -let s:gopath = $GOPATH -if !exists('g:test_verbose') - let g:test_verbose = 0 -endif -let g:go_echo_command_info = 0 - -function! s:logmessages() abort - " Add all messages (usually errors). - redir => s:mess - silent messages - redir END - let s:logs = s:logs + filter(split(s:mess, "\n"), 'v:val !~ "^Messages maintainer"') - silent messages clear -endfunction - -" Source the passed test file. -source % - -" cd into the folder of the test file. -let s:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' -let s:testfile = expand('%:t') -let s:dir = expand('%:p:h') -execute s:cd . s:dir - -" Export root path to vim-go dir. -let g:vim_go_root = fnamemodify(getcwd(), ':p') - -" Get a list of all Test_ functions for the given file. -redir @q - silent function /^Test_ -redir END -let s:tests = split(substitute(@q, 'function \(\k\+()\)', '\1', 'g')) - -" log any messages already accumulated. -call s:logmessages() -" Iterate over all tests and execute them. -for s:test in sort(s:tests) - " Since we extract the tests from a regexp the "abort" keyword is also in - " the list, which is not a test name :-) - if s:test == 'abort' - continue - endif - - let s:started = reltime() - if g:test_verbose is 1 - call add(s:logs, printf("=== RUN %s", s:test[:-3])) - endif - try - exe 'call ' . s:test - " sleep to give events a chance to be processed. This is especially - " important for the LSP code to have a chance to run before Vim exits, in - " order to avoid errors trying to write to the gopls channels since Vim - " would otherwise stop gopls before the event handlers were run and result - " in 'stream closed' errors when the events were run _after_ gopls exited. - sleep 50m - catch - let v:errors += [v:exception] - endtry - - let s:elapsed_time = substitute(reltimestr(reltime(s:started)), '^\s*\(.\{-}\)\s*$', '\1', '') - - " Restore GOPATH after each test. - let $GOPATH = s:gopath - " Restore the working directory after each test. - execute s:cd . s:dir - - " exit gopls after each test - call go#lsp#Exit() - - let s:done += 1 - - if len(v:errors) > 0 - let s:fail += 1 - call add(s:logs, printf("--- FAIL %s (%ss)", s:test[:-3], s:elapsed_time)) - call s:logmessages() - call extend(s:logs, map(v:errors, '" ". v:val')) - - " Reset so we can capture failures of the next test. - let v:errors = [] - else - if g:test_verbose is 1 - call s:logmessages() - call add(s:logs, printf("--- PASS %s (%ss)", s:test[:-3], s:elapsed_time)) - endif - endif -endfor - -" Create an empty fail to indicate that at least one test failed. -if s:fail > 0 - split /tmp/vim-go-test/FAILED - silent write -endif - -let s:total_elapsed_time = substitute(reltimestr(reltime(s:total_started)), '^\s*\(.\{-}\)\s*$', '\1', '') - -" Also store all internal messages from s:logs as well. -silent! split /tmp/vim-go-test/test.tmp -call append(line('$'), s:logs) -call append(line('$'), printf("%s %s %s %ss / %s tests", - \ (s:fail > 0 ? 'FAIL' : 'ok '), - \ s:testfile, - \ repeat(' ', 25 - len(s:testfile)), - \ s:total_elapsed_time, s:done)) -if g:test_verbose is 0 - silent :g/^$/d -endif -silent! write - -" Our work here is done. -qall! - -" restore Vi compatibility settings -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/scripts/test b/sources_non_forked/vim-go/scripts/test deleted file mode 100644 index e6bf96dc..00000000 --- a/sources_non_forked/vim-go/scripts/test +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -# -# Run all tests. -# - -set -euC -vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) -cd "$vimgodir" - -_usage() { - echo "Usage: ${0##*/} [-hvc] [-r file] vim_version" - echo - echo "Options:" - echo " -h Show this help" - echo " -v Enable verbose output" - echo " -r Run only the tests from this file" - echo " -c Generate and submit code coverage reports" - echo -} - -verbose=0 -run="" -coverage="" -while getopts "hvcr:" option; do - case "$option" in - h) _usage; exit 0 ;; - v) verbose=1; ;; - r) run=$OPTARG ;; - c) coverage="-c" ;; - *) - echo "error: unknown option '$option'" - _usage - exit 1 - ;; - esac -done -shift $((OPTIND - 1)) - -### Setup Vim and other dependencies. -##################################### -if [ -z "${1:-}" ]; then - echo "unknown version: '${1:-}'" - echo "First argument must be 'vim-8.0' or 'nvim'." - exit 1 -fi - -vim=$1 -vimdir="/tmp/vim-go-test/$vim-install" -export GOPATH=$vimdir -export PATH=${GOPATH}/bin:$PATH - -if [ ! -f "$vimdir/bin/vim" ]; then - echo "$vimdir/bin/vim doesn't exist; did you install it with the install-vim script?" - exit 1 -fi - -### Run tests. -############## -# Clean stale log file. -[ -f '/tmp/vim-go-test/test.log' ] && rm '/tmp/vim-go-test/test.log' -[ -f '/tmp/vim-go-test/FAILED' ] && rm '/tmp/vim-go-test/FAILED' -[ -f '/tmp/vim-go-test/cov-profile.txt' ] && rm '/tmp/vim-go-test/cov-profile.txt' -[ -f '/tmp/vim-go-test/cov-report.txt' ] && rm '/tmp/vim-go-test/cov-report.txt' - -# Run the actual tests. -find "$vimgodir" -name '*_test.vim' | while read test_file; do - [ -n "$run" -a "$(basename "$test_file")" != "$run" ] && continue - - "$vimgodir/scripts/run-vim" $coverage $vim -e \ - +"silent e $test_file" \ - +"let g:test_verbose=$verbose" \ - -S ./scripts/runtest.vim < /dev/null || ( - # If Vim exits with non-0 it's almost certainly a bug in the test runner; - # should very rarely happen in normal usage. - echo 'test runner failure' - cat '/tmp/vim-go-test/test.tmp' - rm '/tmp/vim-go-test/test.tmp' - exit 5 - ) - - # Append logs - cat '/tmp/vim-go-test/test.tmp' | tee '/tmp/vim-go-test/test.log' - rm '/tmp/vim-go-test/test.tmp' -done - -echo -if [ -f "/tmp/vim-go-test/FAILED" ]; then - echo 2>&1 "Some ($vim) tests FAILED" - exit 1 -fi -echo 2>&1 "All ($vim) tests PASSED" - -# Submit coverage reports -if [ -n "$coverage" ]; then - coverage xml --omit '*_test.vim' - codecov -X search gcov pycov -f coverage.xml --required \ - --flags "$(echo "$vim" | sed -s 's/[-.]//g')" - rm coverage.xml -fi - -# vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/syntax/go.vim b/sources_non_forked/vim-go/syntax/go.vim deleted file mode 100644 index c39e044a..00000000 --- a/sources_non_forked/vim-go/syntax/go.vim +++ /dev/null @@ -1,425 +0,0 @@ -" Copyright 2009 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" go.vim: Vim syntax file for Go. - -" Quit when a (custom) syntax file was already loaded -if exists("b:current_syntax") - finish -endif - -syn case match - -syn keyword goPackage package -syn keyword goImport import contained -syn keyword goVar var contained -syn keyword goConst const contained - -hi def link goPackage Statement -hi def link goImport Statement -hi def link goVar Keyword -hi def link goConst Keyword -hi def link goDeclaration Keyword - -" Keywords within functions -syn keyword goStatement defer go goto return break continue fallthrough -syn keyword goConditional if else switch select -syn keyword goLabel case default -syn keyword goRepeat for range - -hi def link goStatement Statement -hi def link goConditional Conditional -hi def link goLabel Label -hi def link goRepeat Repeat - -" Predefined types -syn keyword goType chan map bool string error -syn keyword goSignedInts int int8 int16 int32 int64 rune -syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr -syn keyword goFloats float32 float64 -syn keyword goComplexes complex64 complex128 - -hi def link goType Type -hi def link goSignedInts Type -hi def link goUnsignedInts Type -hi def link goFloats Type -hi def link goComplexes Type - -" Predefined functions and values -syn keyword goBuiltins append cap close complex copy delete imag len -syn keyword goBuiltins make new panic print println real recover -syn keyword goBoolean true false -syn keyword goPredefinedIdentifiers nil iota - -hi def link goBuiltins Identifier -hi def link goBoolean Boolean -hi def link goPredefinedIdentifiers goBoolean - -" Comments; their contents -syn keyword goTodo contained TODO FIXME XXX BUG -syn cluster goCommentGroup contains=goTodo - -syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell -if go#config#FoldEnable('comment') - syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold - syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold -else - syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell -endif - -hi def link goComment Comment -hi def link goTodo Todo - -if go#config#HighlightGenerateTags() - syn match goGenerateVariables contained /\%(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/ - syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables - hi def link goGenerate PreProc - hi def link goGenerateVariables Special -endif - -" Go escapes -syn match goEscapeOctal display contained "\\[0-7]\{3}" -syn match goEscapeC display contained +\\[abfnrtv\\'"]+ -syn match goEscapeX display contained "\\x\x\{2}" -syn match goEscapeU display contained "\\u\x\{4}" -syn match goEscapeBigU display contained "\\U\x\{8}" -syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ - -hi def link goEscapeOctal goSpecialString -hi def link goEscapeC goSpecialString -hi def link goEscapeX goSpecialString -hi def link goEscapeU goSpecialString -hi def link goEscapeBigU goSpecialString -hi def link goSpecialString Special -hi def link goEscapeError Error - -" Strings and their contents -syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError -if go#config#HighlightStringSpellcheck() - syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup,@Spell - syn region goRawString start=+`+ end=+`+ contains=@Spell -else - syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup - syn region goRawString start=+`+ end=+`+ -endif - -if go#config#HighlightFormatStrings() - " [n] notation is valid for specifying explicit argument indexes - " 1. Match a literal % not preceded by a %. - " 2. Match any number of -, #, 0, space, or + - " 3. Match * or [n]* or any number or nothing before a . - " 4. Match * or [n]* or any number or nothing after a . - " 5. Match [n] or nothing before a verb - " 6. Match a formatting verb - syn match goFormatSpecifier /\ - \%([^%]\%(%%\)*\)\ - \@<=%[-#0 +]*\ - \%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\ - \%(\.\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\)\=\ - \%(\[\d\+\]\)\=[vTtbcdoqxXUeEfFgGspw]/ contained containedin=goString,goRawString - hi def link goFormatSpecifier goSpecialString -endif - -hi def link goString String -hi def link goRawString String - -" Characters; their contents -syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU -syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup - -hi def link goCharacter Character - -" Regions -syn region goParen start='(' end=')' transparent -if go#config#FoldEnable('block') - syn region goBlock start="{" end="}" transparent fold -else - syn region goBlock start="{" end="}" transparent -endif - -" import -if go#config#FoldEnable('import') - syn region goImport start='import (' end=')' transparent fold contains=goImport,goString,goComment -else - syn region goImport start='import (' end=')' transparent contains=goImport,goString,goComment -endif - -" var, const -if go#config#FoldEnable('varconst') - syn region goVar start='var (' end='^\s*)$' transparent fold - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator - syn region goConst start='const (' end='^\s*)$' transparent fold - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator -else - syn region goVar start='var (' end='^\s*)$' transparent - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator - syn region goConst start='const (' end='^\s*)$' transparent - \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator -endif - -" Single-line var, const, and import. -syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst - -" Integers -syn match goDecimalInt "\<-\=\(0\|[1-9]\d*\)\%([Ee][-+]\=\d\+\)\=\>" -syn match goHexadecimalInt "\<-\=0[xX]\x\+\>" -syn match goHexadecimalError "\<-\=0[xX]\x*[^ \t0-9A-Fa-f]\S*\>" -syn match goOctalInt "\<-\=0\o\+\>" -syn match goOctalError "\<-\=0[XxBb\]]\@!\o*[^ \t0-7]\S*\>" -syn match goBinaryInt "\<-\=0[bB][01]\+\>" -syn match goBinaryError "\<-\=0[bB][01]*[^ \t01]\S*\>" - -hi def link goDecimalInt Integer -hi def link goHexadecimalInt Integer -hi def link goHexadecimalError Error -hi def link goOctalInt Integer -hi def link goOctalError Error -hi def link goBinaryInt Integer -hi def link goBinaryError Error -hi def link Integer Number - -" Floating point -syn match goFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=\>" -syn match goFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=\>" - -hi def link goFloat Float - -" Imaginary literals -syn match goImaginary "\<-\=\d\+i\>" -syn match goImaginary "\<-\=\d\+[Ee][-+]\=\d\+i\>" -syn match goImaginaryFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=i\>" -syn match goImaginaryFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=i\>" - -hi def link goImaginary Number -hi def link goImaginaryFloat Float - -" Spaces after "[]" -if go#config#HighlightArrayWhitespaceError() - syn match goSpaceError display "\%(\[\]\)\@<=\s\+" -endif - -" Spacing errors around the 'chan' keyword -if go#config#HighlightChanWhitespaceError() - " receive-only annotation on chan type - " - " \(\\)\@\)\@\)\@=" - - " send-only annotation on chan type - " - " \(<-\)\@ (only pick chan when it doesn't come after an arrow) - " this prevents picking up '<-chan <-chan' but not 'chan <-' - syn match goSpaceError display "\%(\%(<-\)\@\)\@<=\s\+\%(<-\)\@=" - - " value-ignoring receives in a few contexts - syn match goSpaceError display "\%(\%(^\|[={(,;]\)\s*<-\)\@<=\s\+" -endif - -" Extra types commonly seen -if go#config#HighlightExtraTypes() - syn match goExtraType /\/ - syn match goExtraType /\/ - syn match goExtraType /\/ - syn match goExtraType /\/ - syn match goExtraType /\/ -endif - -" Space-tab error -if go#config#HighlightSpaceTabError() - syn match goSpaceError display " \+\t"me=e-1 -endif - -" Trailing white space error -if go#config#HighlightTrailingWhitespaceError() - syn match goSpaceError display excludenl "\s\+$" -endif - -hi def link goExtraType Type -hi def link goSpaceError Error - - - -" included from: https://github.com/athom/more-colorful.vim/blob/master/after/syntax/go.vim -" -" Comments; their contents -syn keyword goTodo contained NOTE -hi def link goTodo Todo - -syn match goVarArgs /\.\.\./ - -" Operators; -if go#config#HighlightOperators() - " match single-char operators: - + % < > ! & | ^ * = - " and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= == - syn match goOperator /[-+%<>!&|^*=]=\?/ - " match / and /= - syn match goOperator /\/\%(=\|\ze[^/*]\)/ - " match two-char operators: << >> &^ - " and corresponding three-char operators: <<= >>= &^= - syn match goOperator /\%(<<\|>>\|&^\)=\?/ - " match remaining two-char operators: := && || <- ++ -- - syn match goOperator /:=\|||\|<-\|++\|--/ - " match ... - - hi def link goPointerOperator goOperator - hi def link goVarArgs goOperator -endif -hi def link goOperator Operator - -" Functions; -if go#config#HighlightFunctions() || go#config#HighlightFunctionParameters() - syn match goDeclaration /\/ nextgroup=goReceiver,goFunction,goSimpleParams skipwhite skipnl - syn match goReceiverVar /\w\+\ze\s\+\%(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained - syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl - syn match goFunction /\w\+/ nextgroup=goSimpleParams contained skipwhite skipnl - syn match goReceiverType /\w\+/ contained - if go#config#HighlightFunctionParameters() - syn match goSimpleParams /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType nextgroup=goFunctionReturn skipwhite skipnl - syn match goFunctionReturn /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType skipwhite skipnl - syn match goParamName /\w\+\%(\s*,\s*\w\+\)*\ze\s\+\%(\w\|\.\|\*\|\[\)/ contained nextgroup=goParamType skipwhite skipnl - syn match goParamType /\%([^,)]\|\_s\)\+,\?/ contained nextgroup=goParamName skipwhite skipnl - \ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock - hi def link goReceiverVar goParamName - hi def link goParamName Identifier - endif - syn match goReceiver /(\s*\w\+\%(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl -else - syn keyword goDeclaration func -endif -hi def link goFunction Function - -" Function calls; -if go#config#HighlightFunctionCalls() - syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration -endif -hi def link goFunctionCall Type - -" Fields; -if go#config#HighlightFields() - " 1. Match a sequence of word characters coming after a '.' - " 2. Require the following but dont match it: ( \@= see :h E59) - " - The symbols: / - + * % OR - " - The symbols: [] {} <> ) OR - " - The symbols: \n \r space OR - " - The symbols: , : . - " 3. Have the start of highlight (hs) be the start of matched - " pattern (s) offsetted one to the right (+1) (see :h E401) - syn match goField /\.\w\+\ - \%(\%([\/\-\+*%]\)\|\ - \%([\[\]{}<\>\)]\)\|\ - \%([\!=\^|&]\)\|\ - \%([\n\r\ ]\)\|\ - \%([,\:.]\)\)\@=/hs=s+1 -endif -hi def link goField Identifier - -" Structs & Interfaces; -if go#config#HighlightTypes() - syn match goTypeConstructor /\<\w\+{\@=/ - syn match goTypeDecl /\/ nextgroup=goTypeName skipwhite skipnl - syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl - syn match goDeclType /\<\%(interface\|struct\)\>/ skipwhite skipnl - hi def link goReceiverType Type -else - syn keyword goDeclType struct interface - syn keyword goDeclaration type -endif -hi def link goTypeConstructor Type -hi def link goTypeName Type -hi def link goTypeDecl Keyword -hi def link goDeclType Keyword - -" Variable Assignments -if go#config#HighlightVariableAssignments() - syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&]|\*|\<\<|\>\>|\&\^)?\=[^=])/ - hi def link goVarAssign Special -endif - -" Variable Declarations -if go#config#HighlightVariableDeclarations() - syn match goVarDefs /\v\w+(,\s*\w+)*\ze(\s*:\=)/ - hi def link goVarDefs Special -endif - -" Build Constraints -if go#config#HighlightBuildConstraints() - syn match goBuildKeyword display contained "+build" - " Highlight the known values of GOOS, GOARCH, and other +build options. - syn keyword goBuildDirectives contained - \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 - \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 - \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc - \ s390 s390x sparc sparc64 cgo ignore race - - " Other words in the build directive are build tags not listed above, so - " avoid highlighting them as comments by using a matchgroup just for the - " start of the comment. - " The rs=s+2 option lets the \s*+build portion be part of the inner region - " instead of the matchgroup so it will be highlighted as a goBuildKeyword. - syn region goBuildComment matchgroup=goBuildCommentStart - \ start="//\s*+build\s"rs=s+2 end="$" - \ contains=goBuildKeyword,goBuildDirectives - hi def link goBuildCommentStart Comment - hi def link goBuildDirectives Type - hi def link goBuildKeyword PreProc -endif - -if go#config#HighlightBuildConstraints() || go#config#FoldEnable('package_comment') - " One or more line comments that are followed immediately by a "package" - " declaration are treated like package documentation, so these must be - " matched as comments to avoid looking like working build constraints. - " The he, me, and re options let the "package" itself be highlighted by - " the usual rules. - exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/' - \ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7' - \ . ' contains=@goCommentGroup,@Spell' - \ . (go#config#FoldEnable('package_comment') ? ' fold' : '') - exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage/' - \ . ' end=/\v\*\/\n\s*package/he=e-7,me=e-7,re=e-7' - \ . ' contains=@goCommentGroup,@Spell' - \ . (go#config#FoldEnable('package_comment') ? ' fold' : '') - hi def link goPackageComment Comment -endif - -" :GoCoverage commands -hi def link goCoverageNormalText Comment - -function! s:hi() - hi def link goSameId Search - hi def link goDiagnosticError SpellBad - hi def link goDiagnosticWarning SpellRare - - hi def link goDeclsFzfKeyword Keyword - hi def link goDeclsFzfFunction Function - hi def link goDeclsFzfSpecialComment SpecialComment - hi def link goDeclsFzfComment Comment - - " :GoCoverage commands - hi def goCoverageCovered ctermfg=green guifg=#A6E22E - hi def goCoverageUncover ctermfg=red guifg=#F92672 - - " :GoDebug commands - if go#config#HighlightDebug() - hi GoDebugBreakpoint term=standout ctermbg=117 ctermfg=0 guibg=#BAD4F5 guifg=Black - hi GoDebugCurrent term=reverse ctermbg=12 ctermfg=7 guibg=DarkBlue guifg=White - endif -endfunction - -augroup vim-go-hi - autocmd! - autocmd ColorScheme * call s:hi() -augroup end -call s:hi() - -" Search backwards for a global declaration to start processing the syntax. -"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ - -" There's a bug in the implementation of grouphere. For now, use the -" following as a more expensive/less precise workaround. -syn sync minlines=500 - -let b:current_syntax = "go" - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/godebugoutput.vim b/sources_non_forked/vim-go/syntax/godebugoutput.vim deleted file mode 100644 index b8e6f5ff..00000000 --- a/sources_non_forked/vim-go/syntax/godebugoutput.vim +++ /dev/null @@ -1,13 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -syn match godebugOutputErr '^ERR:.*' -syn match godebugOutputOut '^OUT:.*' - -let b:current_syntax = "godebugoutput" - -hi def link godebugOutputErr Comment -hi def link godebugOutputOut Normal - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/godebugstacktrace.vim b/sources_non_forked/vim-go/syntax/godebugstacktrace.vim deleted file mode 100644 index b0c53725..00000000 --- a/sources_non_forked/vim-go/syntax/godebugstacktrace.vim +++ /dev/null @@ -1,11 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -syn match godebugStacktrace '^\S\+' - -let b:current_syntax = "godebugoutput" - -hi def link godebugStacktrace SpecialKey - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/godebugvariables.vim b/sources_non_forked/vim-go/syntax/godebugvariables.vim deleted file mode 100644 index 791705ba..00000000 --- a/sources_non_forked/vim-go/syntax/godebugvariables.vim +++ /dev/null @@ -1,23 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -syn match godebugTitle '^#.*' -syn match godebugVariables '^\s*\S\+\ze:' - -syn keyword goType chan map bool string error -syn keyword goSignedInts int int8 int16 int32 int64 rune -syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr -syn keyword goFloats float32 float64 -syn keyword goComplexes complex64 complex128 - -syn keyword goBoolean true false - -let b:current_syntax = "godebugvariables" - -hi def link godebugTitle Underlined -hi def link godebugVariables Statement -hi def link goType Type -hi def link goBoolean Boolean - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/godefstack.vim b/sources_non_forked/vim-go/syntax/godefstack.vim deleted file mode 100644 index e4eefff4..00000000 --- a/sources_non_forked/vim-go/syntax/godefstack.vim +++ /dev/null @@ -1,20 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -syn match godefStackComment '^".*' -syn match godefLinePrefix '^[>\s]\s' nextgroup=godefStackEntryNumber contains=godefStackCurrentPosition -syn match godefStackEntryNumber '\d\+' nextgroup=godefStackFilename skipwhite -syn match godefStackCurrentPosition '>' contained -syn match godefStackFilename '[^|]\+' contained nextgroup=godefStackEntryLocation -syn region godefStackEntryLocation oneline start='|' end='|' contained contains=godefStackEntryLocationNumber -syn match godefStackEntryLocationNumber '\d\+' contained display - -let b:current_syntax = "godefstack" - -hi def link godefStackComment Comment -hi def link godefStackCurrentPosition Special -hi def link godefStackFilename Directory -hi def link godefStackEntryLocationNumber LineNr - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/gohtmltmpl.vim b/sources_non_forked/vim-go/syntax/gohtmltmpl.vim deleted file mode 100644 index ea3dbf08..00000000 --- a/sources_non_forked/vim-go/syntax/gohtmltmpl.vim +++ /dev/null @@ -1,17 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -if !exists("g:main_syntax") - let g:main_syntax = 'html' -endif - -runtime! syntax/gotexttmpl.vim -runtime! syntax/html.vim -unlet b:current_syntax - -syn cluster htmlPreproc add=gotplAction,goTplComment - -let b:current_syntax = "gohtmltmpl" - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/gomod.vim b/sources_non_forked/vim-go/syntax/gomod.vim deleted file mode 100644 index 7dcef1a8..00000000 --- a/sources_non_forked/vim-go/syntax/gomod.vim +++ /dev/null @@ -1,92 +0,0 @@ -" gomod.vim: Vim syntax file for go.mod file -" -" Quit when a (custom) syntax file was already loaded -if exists("b:current_syntax") - finish -endif - -syntax case match - -" match keywords -syntax keyword gomodModule module -syntax keyword gomodGo go contained -syntax keyword gomodRequire require -syntax keyword gomodExclude exclude -syntax keyword gomodReplace replace - -" require, exclude, replace, and go can be also grouped into block -syntax region gomodRequire start='require (' end=')' transparent contains=gomodRequire,gomodVersion -syntax region gomodExclude start='exclude (' end=')' transparent contains=gomodExclude,gomodVersion -syntax region gomodReplace start='replace (' end=')' transparent contains=gomodReplace,gomodVersion -syntax match gomodGo '^go .*$' transparent contains=gomodGo,gomodGoVersion - -" set highlights -highlight default link gomodModule Keyword -highlight default link gomodGo Keyword -highlight default link gomodRequire Keyword -highlight default link gomodExclude Keyword -highlight default link gomodReplace Keyword - -" comments are always in form of // ... -syntax region gomodComment start="//" end="$" contains=@Spell -highlight default link gomodComment Comment - -" make sure quoted import paths are higlighted -syntax region gomodString start=+"+ skip=+\\\\\|\\"+ end=+"+ -highlight default link gomodString String - -" replace operator is in the form of '=>' -syntax match gomodReplaceOperator "\v\=\>" -highlight default link gomodReplaceOperator Operator - -" match go versions -syntax match gomodGoVersion "1\.\d\+" contained -highlight default link gomodGoVersion Identifier - - -" highlight versions: -" * vX.Y.Z-pre -" * vX.Y.Z -" * vX.0.0-yyyyymmddhhmmss-abcdefabcdef -" * vX.Y.Z-pre.0.yyyymmddhhmmss-abcdefabcdef -" * vX.Y.(Z+1)-0.yyyymmddhhss-abcdefabcdef -" see https://godoc.org/golang.org/x/tools/internal/semver for more -" information about how semantic versions are parsed and -" https://golang.org/cmd/go/ for how pseudo-versions and +incompatible -" are applied. - - -" match vX.Y.Z and their prereleases -syntax match gomodVersion "v\d\+\.\d\+\.\d\+\%(-\%([0-9A-Za-z-]\+\)\%(\.[0-9A-Za-z-]\+\)*\)\?\%(+\%([0-9A-Za-z-]\+\)\(\.[0-9A-Za-z-]\+\)*\)\?" -" ^--- version ---^^------------ pre-release ---------------------^^--------------- metadata ---------------------^ -" ^--------------------------------------- semantic version -------------------------------------------------------^ - -" match pseudo versions -" without a major version before the commit (e.g. vX.0.0-yyyymmddhhmmss-abcdefabcdef) -syntax match gomodVersion "v\d\+\.0\.0-\d\{14\}-\x\+" -" when most recent version before target is a pre-release -syntax match gomodVersion "v\d\+\.\d\+\.\d\+-\%([0-9A-Za-z-]\+\)\%(\.[0-9A-Za-z-]\+\)*\%(+\%([0-9A-Za-z-]\+\)\(\.[0-9A-Za-z-]\+\)*\)\?\.0\.\d\{14}-\x\+" -" ^--- version ---^^--- ------ pre-release -----------------^^--------------- metadata ---------------------^ -" ^------------------------------------- semantic version --------------------------------------------------^ -" most recent version before the target is X.Y.Z -syntax match gomodVersion "v\d\+\.\d\+\.\d\+\%(+\%([0-9A-Za-z-]\+\)\(\.[0-9A-Za-z-]\+\)*\)\?-0\.\d\{14}-\x\+" -" ^--- version ---^^--------------- metadata ---------------------^ - -" match incompatible vX.Y.Z and their prereleases -syntax match gomodVersion "v[2-9]\{1}\d*\.\d\+\.\d\+\%(-\%([0-9A-Za-z-]\+\)\%(\.[0-9A-Za-z-]\+\)*\)\?\%(+\%([0-9A-Za-z-]\+\)\(\.[0-9A-Za-z-]\+\)*\)\?+incompatible" -" ^------- version -------^^------------- pre-release ---------------------^^--------------- metadata ---------------------^ -" ^------------------------------------------- semantic version -----------------------------------------------------------^ - -" match incompatible pseudo versions -" incompatible without a major version before the commit (e.g. vX.0.0-yyyymmddhhmmss-abcdefabcdef) -syntax match gomodVersion "v[2-9]\{1}\d*\.0\.0-\d\{14\}-\x\++incompatible" -" when most recent version before target is a pre-release -syntax match gomodVersion "v[2-9]\{1}\d*\.\d\+\.\d\+-\%([0-9A-Za-z-]\+\)\%(\.[0-9A-Za-z-]\+\)*\%(+\%([0-9A-Za-z-]\+\)\(\.[0-9A-Za-z-]\+\)*\)\?\.0\.\d\{14}-\x\++incompatible" -" ^------- version -------^^---------- pre-release -----------------^^--------------- metadata ---------------------^ -" ^---------------------------------------- semantic version ------------------------------------------------------^ -" most recent version before the target is X.Y.Z -syntax match gomodVersion "v[2-9]\{1}\d*\.\d\+\.\d\+\%(+\%([0-9A-Za-z-]\+\)\%(\.[0-9A-Za-z-]\+\)*\)\?-0\.\d\{14}-\x\++incompatible" -" ^------- version -------^^---------------- metadata ---------------------^ -highlight default link gomodVersion Identifier - -let b:current_syntax = "gomod" diff --git a/sources_non_forked/vim-go/syntax/gotexttmpl.vim b/sources_non_forked/vim-go/syntax/gotexttmpl.vim deleted file mode 100644 index ab8b1b6d..00000000 --- a/sources_non_forked/vim-go/syntax/gotexttmpl.vim +++ /dev/null @@ -1,85 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" gotexttmpl.vim: Vim syntax file for Go templates. - -" Quit when a (custom) syntax file was already loaded -if exists("b:current_syntax") - finish -endif - -syn case match - -" Go escapes -syn match goEscapeOctal display contained "\\[0-7]\{3}" -syn match goEscapeC display contained +\\[abfnrtv\\'"]+ -syn match goEscapeX display contained "\\x\x\{2}" -syn match goEscapeU display contained "\\u\x\{4}" -syn match goEscapeBigU display contained "\\U\x\{8}" -syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ - -hi def link goEscapeOctal goSpecialString -hi def link goEscapeC goSpecialString -hi def link goEscapeX goSpecialString -hi def link goEscapeU goSpecialString -hi def link goEscapeBigU goSpecialString -hi def link goSpecialString Special -hi def link goEscapeError Error - -" Strings and their contents -syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError -syn region goString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup -syn region goRawString contained start=+`+ end=+`+ - -hi def link goString String -hi def link goRawString String - -" Characters; their contents -syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU -syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup - -hi def link goCharacter Character - -" Integers -syn match goDecimalInt contained "\<\d\+\([Ee]\d\+\)\?\>" -syn match goHexadecimalInt contained "\<0x\x\+\>" -syn match goOctalInt contained "\<0\o\+\>" -syn match goOctalError contained "\<0\o*[89]\d*\>" -syn cluster goInt contains=goDecimalInt,goHexadecimalInt,goOctalInt -" Floating point -syn match goFloat contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" -syn match goFloat contained "\<\.\d\+\([Ee][-+]\d\+\)\?\>" -syn match goFloat contained "\<\d\+[Ee][-+]\d\+\>" -" Imaginary literals -syn match goImaginary contained "\<\d\+i\>" -syn match goImaginary contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" -syn match goImaginary contained "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" -syn match goImaginary contained "\<\d\+[Ee][-+]\d\+i\>" - -hi def link goInt Number -hi def link goFloat Number -hi def link goImaginary Number - -" Token groups -syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary -syn keyword gotplControl contained if else end range with template -syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge -syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/ -syn match goTplIdentifier contained /\.[^\s}]+\>/ - -hi def link gotplControl Keyword -hi def link gotplFunctions Function -hi def link goTplVariable Special - -syn region gotplAction start="{{" end="}}" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable,goTplIdentifier display -syn region gotplAction start="\[\[" end="\]\]" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable display -syn region goTplComment start="{{\(- \)\?/\*" end="\*/\( -\)\?}}" display -syn region goTplComment start="\[\[\(- \)\?/\*" end="\*/\( -\)\?\]\]" display - -hi def link gotplAction PreProc -hi def link goTplComment Comment - -let b:current_syntax = "gotexttmpl" - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/syntax/vimgo.vim b/sources_non_forked/vim-go/syntax/vimgo.vim deleted file mode 100644 index 3a2204c4..00000000 --- a/sources_non_forked/vim-go/syntax/vimgo.vim +++ /dev/null @@ -1,13 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -let b:current_syntax = "vimgo" - -syn match goInterface /^\S*/ -syn region goTitle start="\%1l" end=":" - -hi def link goInterface Type -hi def link goTitle Label - -" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/templates/hello_world.go b/sources_non_forked/vim-go/templates/hello_world.go deleted file mode 100644 index 50e8d8d3..00000000 --- a/sources_non_forked/vim-go/templates/hello_world.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("vim-go") -} diff --git a/sources_non_forked/vim-go/templates/hello_world_test.go b/sources_non_forked/vim-go/templates/hello_world_test.go deleted file mode 100644 index 3ef4f524..00000000 --- a/sources_non_forked/vim-go/templates/hello_world_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "testing" - -func TestHelloWorld(t *testing.T) { - // t.Fatal("not implemented") -} diff --git a/sources_non_forked/vim-go/test/gopath_test.vim b/sources_non_forked/vim-go/test/gopath_test.vim deleted file mode 100644 index 5036a598..00000000 --- a/sources_non_forked/vim-go/test/gopath_test.vim +++ /dev/null @@ -1,65 +0,0 @@ -" don't spam the user when Vim is started in Vi compatibility mode -let s:cpo_save = &cpo -set cpo&vim - -fun! Test_Detect_Gopath() abort - let l:gopath = $GOPATH - try - let g:go_autodetect_gopath = 1 - let l:tmp = go#util#tempdir("pathdetect") - let l:tmp2 = go#util#tempdir("pathdetect-nogodep") - - call mkdir(l:tmp . '/subdir', 'p') - call mkdir(l:tmp . '/Godeps/_workspace', 'p') - - exe ':e ' . l:tmp . '/a.go' - call assert_equal(l:tmp . '/Godeps/_workspace:' . l:gopath, $GOPATH) - - exe ':e ' . l:tmp . '/not-a-go-file' - call assert_equal(l:gopath, $GOPATH) - - exe ':e ' . l:tmp . '/subdir/a.go' - call assert_equal(l:tmp . '/Godeps/_workspace:' . l:gopath, $GOPATH) - - exec ':e ' . l:tmp2 . '/a.go' - call assert_equal(l:gopath, $GOPATH) - finally - let g:go_autodetect_gopath = 0 - call delete(l:tmp, 'rf') - call delete(l:tmp2, 'rf') - endtry -endfun - -fun! Test_Detect_Gopath_disabled() abort - let l:gopath = $GOPATH - try - let g:go_autodetect_gopath = 0 - let l:tmp = go#util#tempdir("pathdetect") - let l:tmp2 = go#util#tempdir("pathdetect-nogodep") - - call mkdir(l:tmp . '/subdir', 'p') - call mkdir(l:tmp . '/Godeps/_workspace', 'p') - - exe ':e ' . l:tmp . '/a.go' - call assert_equal(l:gopath, $GOPATH) - - exe ':e ' . l:tmp . '/not-a-go-file' - call assert_equal(l:gopath, $GOPATH) - - exe ':e ' . l:tmp . '/subdir/a.go' - call assert_equal(l:gopath, $GOPATH) - - exec ':e ' . l:tmp2 . '/a.go' - call assert_equal(l:gopath, $GOPATH) - finally - let g:go_autodetect_gopath = 0 - call delete(l:tmp, 'rf') - call delete(l:tmp2, 'rf') - endtry -endfun - -" 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/test/parse.go b/sources_non_forked/vim-go/test/parse.go deleted file mode 100644 index 7e296a79..00000000 --- a/sources_non_forked/vim-go/test/parse.go +++ /dev/null @@ -1,2096 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// golang.org/x/net/html/parse.go - -package html - -import ( - "errors" - "fmt" - "io" - "strings" - - a "golang.org/x/net/html/atom" -) - -// A parser implements the HTML5 parsing algorithm: -// https://html.spec.whatwg.org/multipage/syntax.html#tree-construction -type parser struct { - // tokenizer provides the tokens for the parser. - tokenizer *Tokenizer - // tok is the most recently read token. - tok Token - // Self-closing tags like
are treated as start tags, except that - // hasSelfClosingToken is set while they are being processed. - hasSelfClosingToken bool - // doc is the document root element. - doc *Node - // The stack of open elements (section 12.2.3.2) and active formatting - // elements (section 12.2.3.3). - oe, afe nodeStack - // Element pointers (section 12.2.3.4). - head, form *Node - // Other parsing state flags (section 12.2.3.5). - scripting, framesetOK bool - // im is the current insertion mode. - im insertionMode - // originalIM is the insertion mode to go back to after completing a text - // or inTableText insertion mode. - originalIM insertionMode - // fosterParenting is whether new elements should be inserted according to - // the foster parenting rules (section 12.2.5.3). - fosterParenting bool - // quirks is whether the parser is operating in "quirks mode." - quirks bool - // fragment is whether the parser is parsing an HTML fragment. - fragment bool - // context is the context element when parsing an HTML fragment - // (section 12.4). - context *Node -} - -func (p *parser) top() *Node { - if n := p.oe.top(); n != nil { - return n - } - return p.doc -} - -// Stop tags for use in popUntil. These come from section 12.2.3.2. -var ( - defaultScopeStopTags = map[string][]a.Atom{ - "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, - "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext}, - "svg": {a.Desc, a.ForeignObject, a.Title}, - } -) - -type scope int - -const ( - defaultScope scope = iota - listItemScope - buttonScope - tableScope - tableRowScope - tableBodyScope - selectScope -) - -// popUntil pops the stack of open elements at the highest element whose tag -// is in matchTags, provided there is no higher element in the scope's stop -// tags (as defined in section 12.2.3.2). It returns whether or not there was -// such an element. If there was not, popUntil leaves the stack unchanged. -// -// For example, the set of stop tags for table scope is: "html", "table". If -// the stack was: -// ["html", "body", "font", "table", "b", "i", "u"] -// then popUntil(tableScope, "font") would return false, but -// popUntil(tableScope, "i") would return true and the stack would become: -// ["html", "body", "font", "table", "b"] -// -// If an element's tag is in both the stop tags and matchTags, then the stack -// will be popped and the function returns true (provided, of course, there was -// no higher element in the stack that was also in the stop tags). For example, -// popUntil(tableScope, "table") returns true and leaves: -// ["html", "body", "font"] -func (p *parser) popUntil(s scope, matchTags ...a.Atom) bool { - if i := p.indexOfElementInScope(s, matchTags...); i != -1 { - p.oe = p.oe[:i] - return true - } - return false -} - -// indexOfElementInScope returns the index in p.oe of the highest element whose -// tag is in matchTags that is in scope. If no matching element is in scope, it -// returns -1. -func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { - for i := len(p.oe) - 1; i >= 0; i-- { - tagAtom := p.oe[i].DataAtom - if p.oe[i].Namespace == "" { - for _, t := range matchTags { - if t == tagAtom { - return i - } - } - switch s { - case defaultScope: - // No-op. - case listItemScope: - if tagAtom == a.Ol || tagAtom == a.Ul { - return -1 - } - case buttonScope: - if tagAtom == a.Button { - return -1 - } - case tableScope: - if tagAtom == a.Html || tagAtom == a.Table { - return -1 - } - case selectScope: - if tagAtom != a.Optgroup && tagAtom != a.Option { - return -1 - } - default: - panic("unreachable") - } - } - switch s { - case defaultScope, listItemScope, buttonScope: - for _, t := range defaultScopeStopTags[p.oe[i].Namespace] { - if t == tagAtom { - return -1 - } - } - } - } - return -1 -} - -// elementInScope is like popUntil, except that it doesn't modify the stack of -// open elements. -func (p *parser) elementInScope(s scope, matchTags ...a.Atom) bool { - return p.indexOfElementInScope(s, matchTags...) != -1 -} - -// clearStackToContext pops elements off the stack of open elements until a -// scope-defined element is found. -func (p *parser) clearStackToContext(s scope) { - for i := len(p.oe) - 1; i >= 0; i-- { - tagAtom := p.oe[i].DataAtom - switch s { - case tableScope: - if tagAtom == a.Html || tagAtom == a.Table { - p.oe = p.oe[:i+1] - return - } - case tableRowScope: - if tagAtom == a.Html || tagAtom == a.Tr { - p.oe = p.oe[:i+1] - return - } - case tableBodyScope: - if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead { - p.oe = p.oe[:i+1] - return - } - default: - panic("unreachable") - } - } -} - -// generateImpliedEndTags pops nodes off the stack of open elements as long as -// the top node has a tag name of dd, dt, li, option, optgroup, p, rp, or rt. -// If exceptions are specified, nodes with that name will not be popped off. -func (p *parser) generateImpliedEndTags(exceptions ...string) { - var i int -loop: - for i = len(p.oe) - 1; i >= 0; i-- { - n := p.oe[i] - if n.Type == ElementNode { - switch n.DataAtom { - case a.Dd, a.Dt, a.Li, a.Option, a.Optgroup, a.P, a.Rp, a.Rt: - for _, except := range exceptions { - if n.Data == except { - break loop - } - } - continue - } - } - break - } - - p.oe = p.oe[:i+1] -} - -// addChild adds a child node n to the top element, and pushes n onto the stack -// of open elements if it is an element node. -func (p *parser) addChild(n *Node) { - if p.shouldFosterParent() { - p.fosterParent(n) - } else { - p.top().AppendChild(n) - } - - if n.Type == ElementNode { - p.oe = append(p.oe, n) - } -} - -// shouldFosterParent returns whether the next node to be added should be -// foster parented. -func (p *parser) shouldFosterParent() bool { - if p.fosterParenting { - switch p.top().DataAtom { - case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: - return true - } - } - return false -} - -// fosterParent adds a child node according to the foster parenting rules. -// Section 12.2.5.3, "foster parenting". -func (p *parser) fosterParent(n *Node) { - var table, parent, prev *Node - var i int - for i = len(p.oe) - 1; i >= 0; i-- { - if p.oe[i].DataAtom == a.Table { - table = p.oe[i] - break - } - } - - if table == nil { - // The foster parent is the html element. - parent = p.oe[0] - } else { - parent = table.Parent - } - if parent == nil { - parent = p.oe[i-1] - } - - if table != nil { - prev = table.PrevSibling - } else { - prev = parent.LastChild - } - if prev != nil && prev.Type == TextNode && n.Type == TextNode { - prev.Data += n.Data - return - } - - parent.InsertBefore(n, table) -} - -// addText adds text to the preceding node if it is a text node, or else it -// calls addChild with a new text node. -func (p *parser) addText(text string) { - if text == "" { - return - } - - if p.shouldFosterParent() { - p.fosterParent(&Node{ - Type: TextNode, - Data: text, - }) - return - } - - t := p.top() - if n := t.LastChild; n != nil && n.Type == TextNode { - n.Data += text - return - } - p.addChild(&Node{ - Type: TextNode, - Data: text, - }) -} - -// addElement adds a child element based on the current token. -func (p *parser) addElement() { - p.addChild(&Node{ - Type: ElementNode, - DataAtom: p.tok.DataAtom, - Data: p.tok.Data, - Attr: p.tok.Attr, - }) -} - -// Section 12.2.3.3. -func (p *parser) addFormattingElement() { - tagAtom, attr := p.tok.DataAtom, p.tok.Attr - p.addElement() - - // Implement the Noah's Ark clause, but with three per family instead of two. - identicalElements := 0 -findIdenticalElements: - for i := len(p.afe) - 1; i >= 0; i-- { - n := p.afe[i] - if n.Type == scopeMarkerNode { - break - } - if n.Type != ElementNode { - continue - } - if n.Namespace != "" { - continue - } - if n.DataAtom != tagAtom { - continue - } - if len(n.Attr) != len(attr) { - continue - } - compareAttributes: - for _, t0 := range n.Attr { - for _, t1 := range attr { - if t0.Key == t1.Key && t0.Namespace == t1.Namespace && t0.Val == t1.Val { - // Found a match for this attribute, continue with the next attribute. - continue compareAttributes - } - } - // If we get here, there is no attribute that matches a. - // Therefore the element is not identical to the new one. - continue findIdenticalElements - } - - identicalElements++ - if identicalElements >= 3 { - p.afe.remove(n) - } - } - - p.afe = append(p.afe, p.top()) -} - -// Section 12.2.3.3. -func (p *parser) clearActiveFormattingElements() { - for { - n := p.afe.pop() - if len(p.afe) == 0 || n.Type == scopeMarkerNode { - return - } - } -} - -// Section 12.2.3.3. -func (p *parser) reconstructActiveFormattingElements() { - n := p.afe.top() - if n == nil { - return - } - if n.Type == scopeMarkerNode || p.oe.index(n) != -1 { - return - } - i := len(p.afe) - 1 - for n.Type != scopeMarkerNode && p.oe.index(n) == -1 { - if i == 0 { - i = -1 - break - } - i-- - n = p.afe[i] - } - for { - i++ - clone := p.afe[i].clone() - p.addChild(clone) - p.afe[i] = clone - if i == len(p.afe)-1 { - break - } - } -} - -// Section 12.2.4. -func (p *parser) acknowledgeSelfClosingTag() { - p.hasSelfClosingToken = false -} - -// An insertion mode (section 12.2.3.1) is the state transition function from -// a particular state in the HTML5 parser's state machine. It updates the -// parser's fields depending on parser.tok (where ErrorToken means EOF). -// It returns whether the token was consumed. -type insertionMode func(*parser) bool - -// setOriginalIM sets the insertion mode to return to after completing a text or -// inTableText insertion mode. -// Section 12.2.3.1, "using the rules for". -func (p *parser) setOriginalIM() { - if p.originalIM != nil { - panic("html: bad parser state: originalIM was set twice") - } - p.originalIM = p.im -} - -// Section 12.2.3.1, "reset the insertion mode". -func (p *parser) resetInsertionMode() { - for i := len(p.oe) - 1; i >= 0; i-- { - n := p.oe[i] - if i == 0 && p.context != nil { - n = p.context - } - - switch n.DataAtom { - case a.Select: - p.im = inSelectIM - case a.Td, a.Th: - p.im = inCellIM - case a.Tr: - p.im = inRowIM - case a.Tbody, a.Thead, a.Tfoot: - p.im = inTableBodyIM - case a.Caption: - p.im = inCaptionIM - case a.Colgroup: - p.im = inColumnGroupIM - case a.Table: - p.im = inTableIM - case a.Head: - p.im = inBodyIM - case a.Body: - p.im = inBodyIM - case a.Frameset: - p.im = inFramesetIM - case a.Html: - p.im = beforeHeadIM - default: - continue - } - return - } - p.im = inBodyIM -} - -const whitespace = " \t\r\n\f" - -// Section 12.2.5.4.1. -func initialIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) - if len(p.tok.Data) == 0 { - // It was all whitespace, so ignore it. - return true - } - case CommentToken: - p.doc.AppendChild(&Node{ - Type: CommentNode, - Data: p.tok.Data, - }) - return true - case DoctypeToken: - n, quirks := parseDoctype(p.tok.Data) - p.doc.AppendChild(n) - p.quirks = quirks - p.im = beforeHTMLIM - return true - } - p.quirks = true - p.im = beforeHTMLIM - return false -} - -// Section 12.2.5.4.2. -func beforeHTMLIM(p *parser) bool { - switch p.tok.Type { - case DoctypeToken: - // Ignore the token. - return true - case TextToken: - p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) - if len(p.tok.Data) == 0 { - // It was all whitespace, so ignore it. - return true - } - case StartTagToken: - if p.tok.DataAtom == a.Html { - p.addElement() - p.im = beforeHeadIM - return true - } - case EndTagToken: - switch p.tok.DataAtom { - case a.Head, a.Body, a.Html, a.Br: - p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) - return false - default: - // Ignore the token. - return true - } - case CommentToken: - p.doc.AppendChild(&Node{ - Type: CommentNode, - Data: p.tok.Data, - }) - return true - } - p.parseImpliedToken(StartTagToken, a.Html, a.Html.String()) - return false -} - -// Section 12.2.5.4.3. -func beforeHeadIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace) - if len(p.tok.Data) == 0 { - // It was all whitespace, so ignore it. - return true - } - case StartTagToken: - switch p.tok.DataAtom { - case a.Head: - p.addElement() - p.head = p.top() - p.im = inHeadIM - return true - case a.Html: - return inBodyIM(p) - } - case EndTagToken: - switch p.tok.DataAtom { - case a.Head, a.Body, a.Html, a.Br: - p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) - return false - default: - // Ignore the token. - return true - } - case CommentToken: - p.addChild(&Node{ - Type: CommentNode, - Data: p.tok.Data, - }) - return true - case DoctypeToken: - // Ignore the token. - return true - } - - p.parseImpliedToken(StartTagToken, a.Head, a.Head.String()) - return false -} - -// Section 12.2.5.4.4. -func inHeadIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - s := strings.TrimLeft(p.tok.Data, whitespace) - if len(s) < len(p.tok.Data) { - // Add the initial whitespace to the current node. - p.addText(p.tok.Data[:len(p.tok.Data)-len(s)]) - if s == "" { - return true - } - p.tok.Data = s - } - case StartTagToken: - switch p.tok.DataAtom { - case a.Html: - return inBodyIM(p) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta: - p.addElement() - p.oe.pop() - p.acknowledgeSelfClosingTag() - return true - case a.Script, a.Title, a.Noscript, a.Noframes, a.Style: - p.addElement() - p.setOriginalIM() - p.im = textIM - return true - case a.Head: - // Ignore the token. - return true - } - case EndTagToken: - switch p.tok.DataAtom { - case a.Head: - n := p.oe.pop() - if n.DataAtom != a.Head { - panic("html: bad parser state: element not found, in the in-head insertion mode") - } - p.im = afterHeadIM - return true - case a.Body, a.Html, a.Br: - p.parseImpliedToken(EndTagToken, a.Head, a.Head.String()) - return false - default: - // Ignore the token. - return true - } - case CommentToken: - p.addChild(&Node{ - Type: CommentNode, - Data: p.tok.Data, - }) - return true - case DoctypeToken: - // Ignore the token. - return true - } - - p.parseImpliedToken(EndTagToken, a.Head, a.Head.String()) - return false -} - -// Section 12.2.5.4.6. -func afterHeadIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - s := strings.TrimLeft(p.tok.Data, whitespace) - if len(s) < len(p.tok.Data) { - // Add the initial whitespace to the current node. - p.addText(p.tok.Data[:len(p.tok.Data)-len(s)]) - if s == "" { - return true - } - p.tok.Data = s - } - case StartTagToken: - switch p.tok.DataAtom { - case a.Html: - return inBodyIM(p) - case a.Body: - p.addElement() - p.framesetOK = false - p.im = inBodyIM - return true - case a.Frameset: - p.addElement() - p.im = inFramesetIM - return true - case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title: - p.oe = append(p.oe, p.head) - defer p.oe.remove(p.head) - return inHeadIM(p) - case a.Head: - // Ignore the token. - return true - } - case EndTagToken: - switch p.tok.DataAtom { - case a.Body, a.Html, a.Br: - // Drop down to creating an implied tag. - default: - // Ignore the token. - return true - } - case CommentToken: - p.addChild(&Node{ - Type: CommentNode, - Data: p.tok.Data, - }) - return true - case DoctypeToken: - // Ignore the token. - return true - } - - p.parseImpliedToken(StartTagToken, a.Body, a.Body.String()) - p.framesetOK = true - return false -} - -// copyAttributes copies attributes of src not found on dst to dst. -func copyAttributes(dst *Node, src Token) { - if len(src.Attr) == 0 { - return - } - attr := map[string]string{} - for _, t := range dst.Attr { - attr[t.Key] = t.Val - } - for _, t := range src.Attr { - if _, ok := attr[t.Key]; !ok { - dst.Attr = append(dst.Attr, t) - attr[t.Key] = t.Val - } - } -} - -// Section 12.2.5.4.7. -func inBodyIM(p *parser) bool { - switch p.tok.Type { - case TextToken: - d := p.tok.Data - switch n := p.oe.top(); n.DataAtom { - case a.Pre, a.Listing: - if n.FirstChild == nil { - // Ignore a newline at the start of a
 block.
-				if d != "" && d[0] == '\r' {
-					d = d[1:]
-				}
-				if d != "" && d[0] == '\n' {
-					d = d[1:]
-				}
-			}
-		}
-		d = strings.Replace(d, "\x00", "", -1)
-		if d == "" {
-			return true
-		}
-		p.reconstructActiveFormattingElements()
-		p.addText(d)
-		if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
-			// There were non-whitespace characters inserted.
-			p.framesetOK = false
-		}
-	case StartTagToken:
-		switch p.tok.DataAtom {
-		case a.Html:
-			copyAttributes(p.oe[0], p.tok)
-		case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
-			return inHeadIM(p)
-		case a.Body:
-			if len(p.oe) >= 2 {
-				body := p.oe[1]
-				if body.Type == ElementNode && body.DataAtom == a.Body {
-					p.framesetOK = false
-					copyAttributes(body, p.tok)
-				}
-			}
-		case a.Frameset:
-			if !p.framesetOK || len(p.oe) < 2 || p.oe[1].DataAtom != a.Body {
-				// Ignore the token.
-				return true
-			}
-			body := p.oe[1]
-			if body.Parent != nil {
-				body.Parent.RemoveChild(body)
-			}
-			p.oe = p.oe[:1]
-			p.addElement()
-			p.im = inFramesetIM
-			return true
-		case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
-			p.popUntil(buttonScope, a.P)
-			switch n := p.top(); n.DataAtom {
-			case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
-				p.oe.pop()
-			}
-			p.addElement()
-		case a.Pre, a.Listing:
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-			// The newline, if any, will be dealt with by the TextToken case.
-			p.framesetOK = false
-		case a.Form:
-			if p.form == nil {
-				p.popUntil(buttonScope, a.P)
-				p.addElement()
-				p.form = p.top()
-			}
-		case a.Li:
-			p.framesetOK = false
-			for i := len(p.oe) - 1; i >= 0; i-- {
-				node := p.oe[i]
-				switch node.DataAtom {
-				case a.Li:
-					p.oe = p.oe[:i]
-				case a.Address, a.Div, a.P:
-					continue
-				default:
-					if !isSpecialElement(node) {
-						continue
-					}
-				}
-				break
-			}
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-		case a.Dd, a.Dt:
-			p.framesetOK = false
-			for i := len(p.oe) - 1; i >= 0; i-- {
-				node := p.oe[i]
-				switch node.DataAtom {
-				case a.Dd, a.Dt:
-					p.oe = p.oe[:i]
-				case a.Address, a.Div, a.P:
-					continue
-				default:
-					if !isSpecialElement(node) {
-						continue
-					}
-				}
-				break
-			}
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-		case a.Plaintext:
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-		case a.Button:
-			p.popUntil(defaultScope, a.Button)
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-			p.framesetOK = false
-		case a.A:
-			for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- {
-				if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A {
-					p.inBodyEndTagFormatting(a.A)
-					p.oe.remove(n)
-					p.afe.remove(n)
-					break
-				}
-			}
-			p.reconstructActiveFormattingElements()
-			p.addFormattingElement()
-		case a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
-			p.reconstructActiveFormattingElements()
-			p.addFormattingElement()
-		case a.Nobr:
-			p.reconstructActiveFormattingElements()
-			if p.elementInScope(defaultScope, a.Nobr) {
-				p.inBodyEndTagFormatting(a.Nobr)
-				p.reconstructActiveFormattingElements()
-			}
-			p.addFormattingElement()
-		case a.Applet, a.Marquee, a.Object:
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-			p.afe = append(p.afe, &scopeMarker)
-			p.framesetOK = false
-		case a.Table:
-			if !p.quirks {
-				p.popUntil(buttonScope, a.P)
-			}
-			p.addElement()
-			p.framesetOK = false
-			p.im = inTableIM
-			return true
-		case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr:
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-			p.oe.pop()
-			p.acknowledgeSelfClosingTag()
-			if p.tok.DataAtom == a.Input {
-				for _, t := range p.tok.Attr {
-					if t.Key == "type" {
-						if strings.ToLower(t.Val) == "hidden" {
-							// Skip setting framesetOK = false
-							return true
-						}
-					}
-				}
-			}
-			p.framesetOK = false
-		case a.Param, a.Source, a.Track:
-			p.addElement()
-			p.oe.pop()
-			p.acknowledgeSelfClosingTag()
-		case a.Hr:
-			p.popUntil(buttonScope, a.P)
-			p.addElement()
-			p.oe.pop()
-			p.acknowledgeSelfClosingTag()
-			p.framesetOK = false
-		case a.Image:
-			p.tok.DataAtom = a.Img
-			p.tok.Data = a.Img.String()
-			return false
-		case a.Isindex:
-			if p.form != nil {
-				// Ignore the token.
-				return true
-			}
-			action := ""
-			prompt := "This is a searchable index. Enter search keywords: "
-			attr := []Attribute{{Key: "name", Val: "isindex"}}
-			for _, t := range p.tok.Attr {
-				switch t.Key {
-				case "action":
-					action = t.Val
-				case "name":
-					// Ignore the attribute.
-				case "prompt":
-					prompt = t.Val
-				default:
-					attr = append(attr, t)
-				}
-			}
-			p.acknowledgeSelfClosingTag()
-			p.popUntil(buttonScope, a.P)
-			p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
-			if action != "" {
-				p.form.Attr = []Attribute{{Key: "action", Val: action}}
-			}
-			p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
-			p.parseImpliedToken(StartTagToken, a.Label, a.Label.String())
-			p.addText(prompt)
-			p.addChild(&Node{
-				Type:     ElementNode,
-				DataAtom: a.Input,
-				Data:     a.Input.String(),
-				Attr:     attr,
-			})
-			p.oe.pop()
-			p.parseImpliedToken(EndTagToken, a.Label, a.Label.String())
-			p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
-			p.parseImpliedToken(EndTagToken, a.Form, a.Form.String())
-		case a.Textarea:
-			p.addElement()
-			p.setOriginalIM()
-			p.framesetOK = false
-			p.im = textIM
-		case a.Xmp:
-			p.popUntil(buttonScope, a.P)
-			p.reconstructActiveFormattingElements()
-			p.framesetOK = false
-			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
-		case a.Iframe:
-			p.framesetOK = false
-			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
-		case a.Noembed, a.Noscript:
-			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
-		case a.Select:
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-			p.framesetOK = false
-			p.im = inSelectIM
-			return true
-		case a.Optgroup, a.Option:
-			if p.top().DataAtom == a.Option {
-				p.oe.pop()
-			}
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-		case a.Rp, a.Rt:
-			if p.elementInScope(defaultScope, a.Ruby) {
-				p.generateImpliedEndTags()
-			}
-			p.addElement()
-		case a.Math, a.Svg:
-			p.reconstructActiveFormattingElements()
-			if p.tok.DataAtom == a.Math {
-				adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments)
-			} else {
-				adjustAttributeNames(p.tok.Attr, svgAttributeAdjustments)
-			}
-			adjustForeignAttributes(p.tok.Attr)
-			p.addElement()
-			p.top().Namespace = p.tok.Data
-			if p.hasSelfClosingToken {
-				p.oe.pop()
-				p.acknowledgeSelfClosingTag()
-			}
-			return true
-		case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
-			// Ignore the token.
-		default:
-			p.reconstructActiveFormattingElements()
-			p.addElement()
-		}
-	case EndTagToken:
-		switch p.tok.DataAtom {
-		case a.Body:
-			if p.elementInScope(defaultScope, a.Body) {
-				p.im = afterBodyIM
-			}
-		case a.Html:
-			if p.elementInScope(defaultScope, a.Body) {
-				p.parseImpliedToken(EndTagToken, a.Body, a.Body.String())
-				return false
-			}
-			return true
-		case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
-			p.popUntil(defaultScope, p.tok.DataAtom)
-		case a.Form:
-			node := p.form
-			p.form = nil
-			i := p.indexOfElementInScope(defaultScope, a.Form)
-			if node == nil || i == -1 || p.oe[i] != node {
-				// Ignore the token.
-				return true
-			}
-			p.generateImpliedEndTags()
-			p.oe.remove(node)
-		case a.P:
-			if !p.elementInScope(buttonScope, a.P) {
-				p.parseImpliedToken(StartTagToken, a.P, a.P.String())
-			}
-			p.popUntil(buttonScope, a.P)
-		case a.Li:
-			p.popUntil(listItemScope, a.Li)
-		case a.Dd, a.Dt:
-			p.popUntil(defaultScope, p.tok.DataAtom)
-		case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
-			p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6)
-		case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
-			p.inBodyEndTagFormatting(p.tok.DataAtom)
-		case a.Applet, a.Marquee, a.Object:
-			if p.popUntil(defaultScope, p.tok.DataAtom) {
-				p.clearActiveFormattingElements()
-			}
-		case a.Br:
-			p.tok.Type = StartTagToken
-			return false
-		default:
-			p.inBodyEndTagOther(p.tok.DataAtom)
-		}
-	case CommentToken:
-		p.addChild(&Node{
-			Type: CommentNode,
-			Data: p.tok.Data,
-		})
-	}
-
-	return true
-}
-
-func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
-	// This is the "adoption agency" algorithm, described at
-	// https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency
-
-	// TODO: this is a fairly literal line-by-line translation of that algorithm.
-	// Once the code successfully parses the comprehensive test suite, we should
-	// refactor this code to be more idiomatic.
-
-	// Steps 1-4. The outer loop.
-	for i := 0; i < 8; i++ {
-		// Step 5. Find the formatting element.
-		var formattingElement *Node
-		for j := len(p.afe) - 1; j >= 0; j-- {
-			if p.afe[j].Type == scopeMarkerNode {
-				break
-			}
-			if p.afe[j].DataAtom == tagAtom {
-				formattingElement = p.afe[j]
-				break
-			}
-		}
-		if formattingElement == nil {
-			p.inBodyEndTagOther(tagAtom)
-			return
-		}
-		feIndex := p.oe.index(formattingElement)
-		if feIndex == -1 {
-			p.afe.remove(formattingElement)
-			return
-		}
-		if !p.elementInScope(defaultScope, tagAtom) {
-			// Ignore the tag.
-			return
-		}
-
-		// Steps 9-10. Find the furthest block.
-		var furthestBlock *Node
-		for _, e := range p.oe[feIndex:] {
-			if isSpecialElement(e) {
-				furthestBlock = e
-				break
-			}
-		}
-		if furthestBlock == nil {
-			e := p.oe.pop()
-			for e != formattingElement {
-				e = p.oe.pop()
-			}
-			p.afe.remove(e)
-			return
-		}
-
-		// Steps 11-12. Find the common ancestor and bookmark node.
-		commonAncestor := p.oe[feIndex-1]
-		bookmark := p.afe.index(formattingElement)
-
-		// Step 13. The inner loop. Find the lastNode to reparent.
-		lastNode := furthestBlock
-		node := furthestBlock
-		x := p.oe.index(node)
-		// Steps 13.1-13.2
-		for j := 0; j < 3; j++ {
-			// Step 13.3.
-			x--
-			node = p.oe[x]
-			// Step 13.4 - 13.5.
-			if p.afe.index(node) == -1 {
-				p.oe.remove(node)
-				continue
-			}
-			// Step 13.6.
-			if node == formattingElement {
-				break
-			}
-			// Step 13.7.
-			clone := node.clone()
-			p.afe[p.afe.index(node)] = clone
-			p.oe[p.oe.index(node)] = clone
-			node = clone
-			// Step 13.8.
-			if lastNode == furthestBlock {
-				bookmark = p.afe.index(node) + 1
-			}
-			// Step 13.9.
-			if lastNode.Parent != nil {
-				lastNode.Parent.RemoveChild(lastNode)
-			}
-			node.AppendChild(lastNode)
-			// Step 13.10.
-			lastNode = node
-		}
-
-		// Step 14. Reparent lastNode to the common ancestor,
-		// or for misnested table nodes, to the foster parent.
-		if lastNode.Parent != nil {
-			lastNode.Parent.RemoveChild(lastNode)
-		}
-		switch commonAncestor.DataAtom {
-		case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
-			p.fosterParent(lastNode)
-		default:
-			commonAncestor.AppendChild(lastNode)
-		}
-
-		// Steps 15-17. Reparent nodes from the furthest block's children
-		// to a clone of the formatting element.
-		clone := formattingElement.clone()
-		reparentChildren(clone, furthestBlock)
-		furthestBlock.AppendChild(clone)
-
-		// Step 18. Fix up the list of active formatting elements.
-		if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark {
-			// Move the bookmark with the rest of the list.
-			bookmark--
-		}
-		p.afe.remove(formattingElement)
-		p.afe.insert(bookmark, clone)
-
-		// Step 19. Fix up the stack of open elements.
-		p.oe.remove(formattingElement)
-		p.oe.insert(p.oe.index(furthestBlock)+1, clone)
-	}
-}
-
-// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
-// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content
-// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
-func (p *parser) inBodyEndTagOther(tagAtom a.Atom) {
-	for i := len(p.oe) - 1; i >= 0; i-- {
-		if p.oe[i].DataAtom == tagAtom {
-			p.oe = p.oe[:i]
-			break
-		}
-		if isSpecialElement(p.oe[i]) {
-			break
-		}
-	}
-}
-
-// Section 12.2.5.4.8.
-func textIM(p *parser) bool {
-	switch p.tok.Type {
-	case ErrorToken:
-		p.oe.pop()
-	case TextToken:
-		d := p.tok.Data
-		if n := p.oe.top(); n.DataAtom == a.Textarea && n.FirstChild == nil {
-			// Ignore a newline at the start of a