Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

godef jumps to non-exist file when in a buffer with unsaved change #2052

Closed
smartding opened this issue Nov 15, 2018 · 0 comments
Closed

godef jumps to non-exist file when in a buffer with unsaved change #2052

smartding opened this issue Nov 15, 2018 · 0 comments
Labels

Comments

@smartding
Copy link

smartding commented Nov 15, 2018

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

Calling :GoDef with my cursor on a variable name when in a buffer with unsaved change

What did you expect to happen?

should jump to the definition of the variable

What happened instead?

Jumped to some empty file with file name such as /tmp/nvimMx6ZbE/1. I checked the filesystem, the file doesn't exist.

This only happens when I set g:go_def_mode to godef. guru works, but is too slow for me.

Configuration (MUST fill this out):

  • vim-go version:
    commit 661e2b2

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
    call plug#begin('~/.vim/plugged')

    Plug 'fatih/vim-go'
    Plug 'ctrlpvim/ctrlp.vim'
    Plug 'scrooloose/nerdtree'
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'zchee/deoplete-go', { 'do': 'make'}
    Plug 'mileszs/ack.vim'
    Plug 'godlygeek/tabular'
    Plug 'plasticboy/vim-markdown'
    Plug 'tpope/vim-fugitive'
    Plug 'ekalinin/Dockerfile.vim', {'for' : 'Dockerfile'}
    Plug 'SirVer/ultisnips'
    Plug 'tpope/vim-commentary'
    Plug 'Raimondi/delimitMate'
    Plug 'ervandew/supertab'
    Plug 'vim-airline/vim-airline'
    Plug 'vim-airline/vim-airline-themes'

    call plug#end()

    set mouse=a
    set number
    set relativenumber
    set encoding=utf-8
    set hidden
    set nobackup
    set noshowmode
    set cursorline
    set splitright
    set splitbelow
    set ignorecase
    set smartcase
    set pumheight=10
    set lazyredraw

    set clipboard+=unnamedplus

    let g:go_highlight_functions = 1
    let g:go_highlight_function_arguments = 1
    let g:go_highlight_function_calls = 1
    let g:go_highlight_methods = 1
    let g:go_highlight_structs = 1
    let g:go_highlight_operators = 1
    let g:go_highlight_types = 1
    let g:go_highlight_fields = 1
    let g:go_highlight_extra_types = 1
    let g:go_highlight_build_constraints = 1
    let g:go_highlight_variable_declarations = 1
    let g:go_highlight_variable_assignments = 1
    let g:go_highlight_format_strings = 1
    let g:go_highlight_variable_declarations = 1
    let g:go_highlight_variable_assignments = 1

    let g:go_fmt_command = 'goimports' " fmt and manage imports
    let g:go_def_mode = 'godef' " change GoDef engine to godef, guru is too slow

    au FileType go nmap r (go-decls)
    au FileType go nmap t (go-decls-dir)
    au FileType go nmap d (go-def)
    au FileType go nmap l (go-metalinter)
    au FileType go nmap i (go-info)

  • Vim version (first three lines from :version):
    NVIM v0.3.1-1-g489d32f2b

  • Go version (go version):
    1.10.3 linux/amd64

  • Go environment (go env):
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/home/smart/.cache/go-build"
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/smart/go"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    CC="gcc"
    CXX="g++"
    CGO_ENABLED="1"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build103889154=/tmp/go-build -gno-record-gcc-switches"

@bhcleek bhcleek added the bug label Nov 15, 2018
bhcleek added a commit to bhcleek/vim-go that referenced this issue Nov 15, 2018
Teach vim-go how to jump to an identifier when the identifier is defined
in the active buffer with unsaved modifications.

Fixes fatih#2052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants