fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16.01k stars 1.45k forks source link

vim-go prints out the current completion item's doc on <ESC> #2904

Closed urandom closed 4 years ago

urandom commented 4 years ago

What did you do? (required: The issue will be closed when not provided)

Pressing after selecting a completion item from the omni menu

What did you expect to happen?

I expected vim-go to not take any part in that workflow.

What happened instead?

The following message will be printed in the command line, expanding it to at least 4 lines, even if only one line is being occupied.

vim-go: First godoc line of the completion item.

This steals the focus and exits insert mode.

Configuration (MUST fill this out):

    Plug 'fatih/vim-go'

vim-go version:

9d76bb0

vimrc you used to reproduce:

vimrc
set ignorecase
set nomodeline
set smartcase
set ruler
set showcmd
set cursorline
set number
set showbreak==>\
set hidden
set undofile
set shiftwidth=4
set tabstop=4
set clipboard=unnamed
set shortmess+=c
set updatetime=300
set signcolumn=yes
set expandtab
set wildmode=longest:full
set pumblend=20

set go-=T,e,r,L,m
set go+=c
set completeopt=longest,noinsert,menuone,noselect
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
set wildignore+=*.o,*.obj,*.jpg,*.gif,*.png,*.jar,*.zip,*.jpeg,*.tif*,*.exe,*.jpe,*.pdf,*.doc,*.mo,*.svg,*.cache,*.mp4,*.class,*.a
set termguicolors
set inccommand=nosplit
set mouse=a
set guifont=Fira\ Code:h12
set virtualedit=onemore

scriptencoding utf-8
syn on

call plug#begin('~/.config/nvim/plugged')

try
    " color schemes
    Plug 'daddye/soda.vim'
    Plug 'mhartington/oceanic-next'

    " languages
    Plug 'jiangmiao/auto-pairs'
    Plug 'fatih/vim-go'
    Plug 'buoto/gotests-vim'

    " completion
    Plug 'neovim/nvim-lsp'
    Plug 'hrsh7th/vim-vsnip'
    Plug 'hrsh7th/vim-vsnip-integ'
    Plug 'haorenW1025/completion-nvim'
    Plug 'microsoft/vscode-go'

    " misc
    " Plug 'dense-analysis/ale'
    Plug 'simnalamburt/vim-mundo'
    Plug 'tpope/vim-fugitive'
    Plug 'itchyny/lightline.vim'
    Plug 'ervandew/supertab'
    Plug 'AndrewRadev/linediff.vim'
    Plug 'wbthomason/lsp-status.nvim' " lsp-based status functions

    " files
    " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
    " Plug 'junegunn/fzf.vim'
    Plug 'liuchengxu/vim-clap', { 'do': ':Clap install-binary' }
    Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
    Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
    Plug 'ryanoasis/vim-devicons'
catch
endt

call plug#end()

try
    if has("gui_running")
        colo OceanicNext
    else
        if match(&term, 'xterm') == 0 || &term =~ 'screen' || &term == 'nvim'
            colo OceanicNext
            set t_Co=256
        else
            colo desert
        endif
    endif
catch /^Vim\%((\a\+)\)\=:E185/
    colo desert
endtry

" %/ expands the current path
cmap %/ =expand("%:p:h") . '/'

if has('autocmd')
    au! BufReadPost *.po setlocal kmp=bulgarian-phonetic
    au! BufReadPost bg.all.json setlocal kmp=bulgarian-phonetic
    au! FileType clap_input inoremap    :call clap#handler#exit()
    augroup highlight_yank
        au! TextYankPost * silent! lua require'vim.highlight'.on_yank("IncSearch", 1000)
    augroup END 
endif

inoremap  :MundoToggle
nnoremap  :MundoToggle
nnoremap  :NERDTreeToggle
nnoremap  :nohl
nnoremap  :syntax sync fromstart
inoremap  :syntax sync fromstart
nnoremap  :Clap buffers
nnoremap  :Clap history
nnoremap  :Clap files
nnoremap gb :bn
nnoremap gB :bp
tnoremap  
nnoremap gc :Clap quickfix
nnoremap gl :Clap loclist
nnoremap gG :Clap grep ++query=

lua <lua vim.lsp.buf.declaration()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.definition()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'i', '', 'lua vim.lsp.buf.signature_help()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()botright copen', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'e', 'lua vim.lsp.util.show_line_diagnostics()', opts)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gs', 'lua vim.lsp.buf.document_symbol()', opts)

    compl.on_attach(v, bufnr)
  end

  -- vimls, 
  local servers = {'rust_analyzer', 'pyls_ms', 'tsserver',  'jsonls', 'ccls', 'bashls', 'texlab', 'sumneko_lua'}
  for _, lsp in ipairs(servers) do
    nvim_lsp[lsp].setup {
      on_attach = on_attach,
    }
  end
  nvim_lsp['gopls'].setup {
    cmd = {"gopls", "-logfile=/tmp/gopls.log", "-rpc.trace"}, -- , "--remote=auto"},
    init_options = {usePlaceholders = true, completeUnimported = true},
    on_attach = on_attach,
  }

EOF

let g:go_doc_keywordprg_enabled = 0
let g:go_fmt_command = 'goimports'
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_term_enabled = 1
let g:go_addtags_transform = 'camelcase'
let g:go_auto_sameids = 0
let g:go_term_mode = 'split'
let g:go_gopls_enabled = 0
let g:go_def_mapping_enabled = 0

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'currentfunction', 'readonly', 'filename', 'modified' ] ]
      \ },
      \ }

let g:clap_disable_run_rooter = v:true

" Press Tab to scroll _down_ a list of auto-completions
let g:SuperTabDefaultCompletionType = ""

let g:completion_enable_snippet = 'vim-vsnip'

" You can use other key to expand snippet.
imap     vsnip#available(1)  ? '(vsnip-expand)'         : ''
imap     vsnip#available(1)  ? '(vsnip-expand-or-jump)' : ''
smap     vsnip#available(1)  ? '(vsnip-expand-or-jump)' : ''
imap     vsnip#available(1)  ? '(vsnip-jump-next)'      : ''
smap     vsnip#available(1)  ? '(vsnip-jump-next)'      : ''
imap   vsnip#available(-1) ? '(vsnip-jump-prev)'      : ''
smap   vsnip#available(-1) ? '(vsnip-jump-prev)'      : ''

Vim version (first three lines from :version):

NVIM v0.5.0-5a9226c80
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prot
otypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLAR
ATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20200529-59184-zneeh/build/config -I/tmp/neovim-20200529-59184-zneeh/src
 -I/usr/local/include -I/tmp/neovim-20200529-59184-zneeh/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/includ
e -I/tmp/neovim-20200529-59184-zneeh/build/src/nvim/auto -I/tmp/neovim-20200529-59184-zneeh/build/include
Compiled by viktor.kojouharov@Viktors-MacBook-Pro.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-5a9226c/share/nvim"

Run :checkhealth for more info
bhcleek commented 4 years ago

Can you duplicate the problem you're seeing without all of your other plugins loaded?

urandom commented 4 years ago

Yes, with only the nvim-lsp and vim-go plugins left, the problem is still reproducible.

bhcleek commented 4 years ago

The documentation you're seeing at the bottom of your screen is enabled by g:go_echo_go_info, which is enabled by default. Try disabling g:go_echo_go_info by adding let g:go_echo_go_info=0 in your vimc.

If you don't want to permanently disable that setting, because you want the information, then I'm happy to work with you to figure out why you're seeing more than a single line of info. (hint: I suspect it has something to do with this line in your vimrc:

vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
urandom commented 4 years ago

Ah, excellent, that cleared it off. I'm personally fine with disabling that feature. Though if setting neovim's lsp as an omnifunc really causes a problem, perhaps it would be worth investigating, since I probably won't be the only one doing that.

bhcleek commented 4 years ago

If you want to see if that was in fact the underlying issue, try removing the line that disables g:go_echo_go_info and the line that configures neovim's lsp as an omnifunc in your vimrc and see if you you still have the problem. If you don't (you should only see the type info for the chosen autocompletion), then I think g:go_echo_go_info is sufficient for people.

If you don't care to investigate more, I'm fine with that, too, and we can close this.

urandom commented 4 years ago

Unfortunately, if I remove that line, I won't have omni completion, so there won't be any completion items to test it on.

bhcleek commented 4 years ago

Vim-go can use gopls for completion if you'll remove let g:go_gopls_enabled = 0 from your vimrc.

urandom commented 4 years ago

So, after bringing init.vim to a bare minimum, with only vim-go enabled with its default settings, the behavior is still reproducible.

bhcleek commented 4 years ago

🤔 That's interesting.

Can you run it again with only vim-go enabled with its default settings and add let g:go_debug = ['lsp'] to your vimrc and then provide the gopls output here?

urandom commented 4 years ago

This is everything in the log buffer:


===== sent =====
Content-Length: 672

{"method": "initialize", "jsonrpc": "2.0", "id": 1, "params": {"rootUri": "file:///Users/user/projects/feature-toggles", "capabilities": {"workspace": {"workspaceFolders": true, "configuration": true, "didChangeConfiguration": {"dynamicRegistration": true}}, "textDocument": {"codeAction": {"codeActionLiteralSupport": {"codeActionKind": {"valueSet": ["source.organizeImports"]}}}, "completion": {"completionItem": {"snippetSupport": false}}, "hover": {"contentFormat": ["plaintext"]}}}, "processId": 4590, "workspaceFolders": [{"uri": "file:///Users/user/projects/feature-toggles", "name": "/Users/user/projects/feature-toggles"}]}}
===== stderr =====
2020/06/03 22:58:44 debug server listening on port 53266
===== received =====
Content-Length: 923

{"jsonrpc":"2.0","result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","source.organizeImports"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"renameProvider":true,"foldingRangeProvider":true,"executeCommandProvider":{"commands":["tidy","upgrade.dependency"]},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":""}},"id":1}
===== sent =====
Content-Length: 57

{"method": "initialized", "jsonrpc": "2.0", "params": {}}
===== sent =====
Content-Length: 1799

{"method": "textDocument/didOpen", "jsonrpc": "2.0", "params": {"textDocument": {"uri": "file:///Users/user/projects/feature-toggles/messaging/nats.go", "version": 1, "languageId": "go", "text": "package messaging\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/globusdigital/feature-toggles/toggle\"\n\t\"github.com/nats-io/nats.go\"\n)\n\nconst (\n\tDefaultNatsReconnectBufSize = 16 * 1024 * 1024\n\tDefaultNatsPingInterval     = time.Minute\n\tNatsSubject                 = \"feature-toggles\"\n)\n\ntype Nats struct {\n\tConn *nats.EncodedConn\n}\n\nfunc NewNats(url string, opts ...nats.Option) (Nats, error) {\n\tconn, err := nats.Connect(url, opts...)\n\tif err != nil {\n\t\treturn Nats{}, fmt.Errorf(\"connecting to NATS: %w\", err)\n\t}\n\n\tencoded, err := nats.NewEncodedConn(conn, nats.JSON_ENCODER)\n\tif err != nil {\n\t\treturn Nats{}, fmt.Errorf(\"creating json encoded connection: %v\", err)\n\t}\n\n\treturn Nats{encoded}, nil\n}\n\nfunc (b Nats) Close() {\n\tb.Conn.Close()\n}\n\nfunc (b Nats) Send(ctx context.Context, event toggle.Event) error {\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\tif err := b.Conn.Publish(NatsSubject, event); err != nil {\n\t\treturn fmt.Errorf(\"publishing event: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (s Nats) Receiver(ctx context.Context) <-chan toggle.Event {\n\tch := make(chan toggle.Event)\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tsub, err := s.Conn.Subscribe(NatsSubject, func(ev toggle.Event) {\n\t\t\tch <- ev\n\t\t})\n\t\tif err != nil {\n\t\t\tch <- toggle.Event{Type: toggle.ErrorEvent, Error: \"subscribing to nats subject: \" + err.Error()}\n\t\t\treturn\n\t\t}\n\t\tdefer sub.Unsubscribe()\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}()\n\n\treturn ch\n}\n"}}}
===== received =====
Content-Length: 268

{"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"},{"id":"workspace/didChangeWorkspaceFolders","method":"workspace/didChangeWorkspaceFolders"}]},"id":1}
===== sent =====
Content-Length: 43

{"id": 1, "jsonrpc": "2.0", "result": null}
===== received =====
Content-Length: 310

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///Users/user/projects/feature-toggles","section":"gopls"},{"scopeUri":"file:///Users/user/projects/feature-toggles","section":"gopls-/Users/user/projects/feature-toggles"}]},"id":2}
===== sent =====
Content-Length: 133

{"id": 2, "jsonrpc": "2.0", "result": [{"buildFlags": [], "hoverKind": "Structured"}, {"buildFlags": [], "hoverKind": "Structured"}]}
===== received =====
Content-Length: 2157

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2020/06/03 22:58:44 Build info\n----------\ngolang.org/x/tools/gopls v0.3.3\n    golang.org/x/tools/gopls@v0.3.3 h1:mTFqRDJQmpSsgDDWvbtGnSva1z9uX2XcDszSWa6DhBQ=\n    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\n    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=\n    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=\n    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=\n    golang.org/x/tools@v0.0.0-20200227200655-6862ededa516 h1:OX66ZzpltgCOuBSGdaeT77hS2z3ub2AB+EuGxvGRBLE=\n    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=\n    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=\n    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=\n\nGo info\n-------\ngo version go1.14.3 darwin/amd64\n\nGO111MODULE=\"\"\nGOARCH=\"amd64\"\nGOBIN=\"\"\nGOCACHE=\"/Users/user/Library/Caches/go-build\"\nGOENV=\"/Users/user/Library/Application Support/go/env\"\nGOEXE=\"\"\nGOFLAGS=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"darwin\"\nGOINSECURE=\"\"\nGONOPROXY=\"\"\nGONOSUMDB=\"\"\nGOOS=\"darwin\"\nGOPATH=\"/Users/user/go\"\nGOPRIVATE=\"\"\nGOPROXY=\"https://proxy.golang.org,direct\"\nGOROOT=\"/usr/local/Cellar/go/1.14.3/libexec\"\nGOSUMDB=\"sum.golang.org\"\nGOTMPDIR=\"\"\nGOTOOLDIR=\"/usr/local/Cellar/go/1.14.3/libexec/pkg/tool/darwin_amd64\"\nGCCGO=\"gccgo\"\nAR=\"ar\"\nCC=\"clang\"\nCXX=\"clang++\"\nCGO_ENABLED=\"0\"\nGOMOD=\"/Users/user/projects/feature-toggles/go.mod\"\nCGO_CFLAGS=\"-g -O2\"\nCGO_CPPFLAGS=\"\"\nCGO_CXXFLAGS=\"-g -O2\"\nCGO_FFLAGS=\"-g -O2\"\nCGO_LDFLAGS=\"-g -O2\"\nPKG_CONFIG=\"pkg-config\"\nGOGCCFLAGS=\"-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ky/99mqlqrd2rd46chcz3tqmxkw0000gn/T/go-build146176517=/tmp/go-build -gno-record-gcc-switches -fno-common\"\n"}}
===== received =====
Content-Length: 175

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2020/06/03 22:58:44 go/packages.Load\n\tsnapshot = 0\n\tquery = [./... builtin]\n\tpackages = 15"}}
===== sent =====
Content-Length: 1812

{"method": "textDocument/didChange", "jsonrpc": "2.0", "params": {"contentChanges": [{"text": "package messaging\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/globusdigital/feature-toggles/toggle\"\n\t\"github.com/nats-io/nats.go\"\n)\n\nconst (\n\tDefaultNatsReconnectBufSize = 16 * 1024 * 1024\n\tDefaultNatsPingInterval     = time.Minute\n\tNatsSubject                 = \"feature-toggles\"\n)\n\ntype Nats struct {\n\tConn *nats.EncodedConn\n}\n\nfunc NewNats(url string, opts ...nats.Option) (Nats, error) {\n\tconn, err := nats.Connect(url, opts...)\n\tif err != nil {\n\t\treturn Nats{}, fmt.Errorf(\"connecting to NATS: %w\", err)\n\t}\n\tconn.\n\n\tencoded, err := nats.NewEncodedConn(conn, nats.JSON_ENCODER)\n\tif err != nil {\n\t\treturn Nats{}, fmt.Errorf(\"creating json encoded connection: %v\", err)\n\t}\n\n\treturn Nats{encoded}, nil\n}\n\nfunc (b Nats) Close() {\n\tb.Conn.Close()\n}\n\nfunc (b Nats) Send(ctx context.Context, event toggle.Event) error {\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\tif err := b.Conn.Publish(NatsSubject, event); err != nil {\n\t\treturn fmt.Errorf(\"publishing event: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (s Nats) Receiver(ctx context.Context) <-chan toggle.Event {\n\tch := make(chan toggle.Event)\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tsub, err := s.Conn.Subscribe(NatsSubject, func(ev toggle.Event) {\n\t\t\tch <- ev\n\t\t})\n\t\tif err != nil {\n\t\t\tch <- toggle.Event{Type: toggle.ErrorEvent, Error: \"subscribing to nats subject: \" + err.Error()}\n\t\t\treturn\n\t\t}\n\t\tdefer sub.Unsubscribe()\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}()\n\n\treturn ch\n}\n"}], "textDocument": {"uri": "file:///Users/user/projects/feature-toggles/messaging/nats.go", "version": 2}}}
===== sent =====
Content-Length: 221

{"method": "textDocument/completion", "jsonrpc": "2.0", "id": 2, "params": {"textDocument": {"uri": "file:///Users/user/projects/feature-toggles/messaging/nats.go"}, "position": {"character": 6, "line": 26}}}
===== received =====
Content-Length: 342

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/user/projects/feature-toggles/messaging/nats.go","version":2,"diagnostics":[{"range":{"start":{"line":26,"character":1},"end":{"line":26,"character":1}},"severity":1,"source":"syntax","message":"expected identifier on left side of :="}]}}
bhcleek commented 4 years ago

The response to the textDocument/completion request is missing, but that's what I really need. 🤔

urandom commented 4 years ago

No idea, I tried it again, but the response is still not there.

bhcleek commented 4 years ago

Maybe do another operation after completion (e.g. do completion again or jump to a definition) to see if it's a previously undiscovered buffering issue...

varun06 commented 4 years ago

I also have similar issue where vim-go is not completing the parens () after I hit enter, I get the method name but not ().

Some more context - https://gophers.slack.com/archives/C07GBR52P/p1591278654374600

bhcleek commented 4 years ago

@varun06 that doesn't sound similar to this at all other than completion is involved. Please open a new issue if you need help with it.

bhcleek commented 4 years ago

@urandom should we close this or keep it open and keep digging in? I'm up for whatever works for you

urandom commented 4 years ago

@bhcleek It seems that no matter how many times I invoke the omni completion, the response is never printed in that logging buffer

urandom commented 4 years ago

This is the completion response when I use my original init.vim and start gopls with rpc.trace myself:

[Trace - 10:54:51.576 AM] Received response 'textDocument/completion - (3)' in 47ms.
Result: {"isIncomplete":true,"items":[{"label":"html","kind":9,"detail":"\"html\"","preselect":true,"sortText":"00000","filterText":"html","insertTextFormat":2,"textEdit":{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":3}},"newText":"html"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"\t\"html\"\n)\n"}]},{"label":"http","kind":9,"detail":"\"net/http\"","sortText":"00001","filterText":"html","insertTextFormat":2,"textEdit":{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":3}},"newText":"http"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"\t\"net/http\"\n)\n"}]},{"label":"httptest","kind":9,"detail":"\"net/http/httptest\"","sortText":"00002","filterText":"html","insertTextFormat":2,"textEdit":{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":3}},"newText":"httptest"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"\t\"net/http/httptest\"\n)\n"}]},{"label":"httptrace","kind":9,"detail":"\"net/http/httptrace\"","sortText":"00003","filterText":"html","insertTextFormat":2,"textEdit":{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":3}},"newText":"httptrace"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"\t\"net/http/httptrace\"\n)\n"}]},{"label":"httputil","kind":9,"detail":"\"net/http/httputil\"","sortText":"00004","filterText":"html","insertTextFormat":2,"textEdit":{"range":{"start":{"line":6,"character":1},"end":{"line":6,"character":3}},"newText":"httputil"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"\t\"net/http/httputil\"\n)\n"}]}]}

I assume it should be the same as with the bare one with only vim-go

bhcleek commented 4 years ago

That's really weird. My debug log always contains those responses 🤔

In any case, I'm finally able to duplicate your original issue. It seems to be specific to Neovim. I'll get a fix out as soon as I can.

bhcleek commented 4 years ago

I can duplicate this in Vim now, too.

bhcleek commented 4 years ago

@urandom #2907 should resolve this for you. Do you want to give it a try before I merge?

The reason I was having a hard time duplicating is that it seems that when UltiSnips is used too, it manages to hide the command-line output that vim-go writes when g:go_echo_go_info is enabled, so I wasn't seeing the problem that you were experiencing.