liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.9k stars 87 forks source link

Can not open Vista when vim_lsp detect errors in source code #223

Closed zoumi closed 4 years ago

zoumi commented 4 years ago

Can not open Vista when vim_lsp detect errors in source code. Vista will show: vim_lsp is retriving symbos ..., please try again....

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.87. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

liuchengxu commented 4 years ago

Please fill the issue template. vim_lsp is retriving symbos ..., please try again.... this info does not mean to be an error.

zoumi commented 4 years ago

Describe the bug Can not open Vista when vim_lsp detect errors in source code.

Environment:

Vista info

    Current FileType: rust
Avaliable Executives: ['ctags', 'vim_lsp']
    Global Variables:
    let g:vista#executive#ctags#support_json_format = 1
    let g:vista#executives = ['ale', 'coc', 'ctags', 'lcn', 'nvim_lsp', 'vim_lsc', 'vim_lsp']
    let g:vista#extensions = ['markdown', 'rst']
    let g:vista#finders = ['fzf', 'skim']
    let g:vista#renderer#ctags = 'default'
    let g:vista#renderer#enable_icon = 1
    let g:vista#renderer#icons = {'subroutine': '羚', 'method': '', 'func': '', 'variables': '', 'namespace': '', 'field': '', 'interface': '', 'type': '', 'packages': '', 'property': '襁', 'implementation': '', 'default': '', 'augroup': 'פּ', 'macro': '', 'enumerator': '', 'const': '', 'macros': '', 'map': 'פּ', 'fields': '', 'functions': '', 'enum': '', 'function': '', 'target': '', 'typedef': '', 'variable': '', 'modules': '', 'constant': '', 'struct': '', 'types': '', 'module': '', 'typeParameter': '', 'package': '', 'class': '', 'member': '', 'var': '', 'union': '鬒'}
    let g:vista#renderer#kind_default_icon = ['╰─▸ ', '├─▸ ']
    let g:vista_ctags_executable = 'universal_ctags'
    let g:vista_executive_for = {'c': 'vim_lsp', 'rust': 'vim_lsp', 'cpp': 'vim_lsp'}
    let g:vista_sidebar_position = 'vertical topleft'

Steps to reproduce given the above info

1.Open a rust source file(with syntax error) of a cargo project 2.run cmd :Vista

Expected behavior tags list should be displayed.

Actual behavior tags list is not displayed.

Screenshot or gif (if possible)

liuchengxu commented 4 years ago

Please also provide the minimal vimrc, and make sure you have correctly setup the vim-lsp plugin.

zoumi commented 4 years ago

steps to reproduce still work for this vimrc. If I fix the syntax error, Vista will show the tag list.

set pyx=3
let g:iswindows = 0
if(has("win32") || has("win64") || has("win95") || has("win16"))
    let g:iswindows = 1
    source $VIMRUNTIME/vimrc_example.vim
    "source $VIMRUNTIME/mswin.vim
    behave mswin
    let &shellslash=0
endif

let g:ctags_bin="exuberant_ctags"
"set rtp+=$VIM

set langmenu=zh_CN.UTF-8
set helplang=cn

set encoding=utf-8
"set fileencoding=cp936
if iswindows
    set termencoding=cp936
endif
set fileencodings=ucs-bom,gb18030,utf-8,gb2312,default,cp936
set completeopt=menu,preview

set previewheight=1
autocmd CompleteDone * pclose
"set completeopt+=noselect
set completeopt+=noinsert
set complete = ".,w,b,u,k,i,]"  
"you can use <S-Tab> or CTRL-P to go straight back to what you typed.
set wildmode=longest,list,full
set wildmenu
set cscopepathcomp=1

set nocompatible              " be iMproved, required
filetype off                  " required

if iswindows
    set rtp+=$VIM/vimfiles/bundle/Vundle.vim
    call vundle#begin('$VIM/vimfiles/bundle/')
else
    " set the runtime path to include Vundle and initialize
    set rtp+=~/.vim/bundle/Vundle.vim
    " alternatively, pass a path where Vundle should install plugins
    call vundle#begin()
endif

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup'
"=================================================
"Plugin 'vim-scripts/winmanager'
"let g:winManagerWindowLayout = "Tagbar|NERD"
"let g:persistentBehaviour = 0
"nmap <silent> <F8> :WMToggle<cr>
"=================================================
"Run Async Shell Commands in Vim and Output to Quickfix Window
Plugin 'skywind3000/asyncrun.vim'
let g:asyncrun_encs = 'gbk'
let g:asyncrun_open = 8
let g:asyncrun_local = 1
"=================================================
"Plugin 'ctrlpvim/ctrlp.vim'
let g:ctrlp_cmd = 'CtrlPMixed'
"=================================================
Plugin 'liuchengxu/vim-clap'
"=================================================
let g:lsp_settings_servers_dir = '/e/lsp_servers'
Plugin 'prabirshrestha/async.vim'
Plugin 'prabirshrestha/asyncomplete.vim'
Plugin 'prabirshrestha/asyncomplete-lsp.vim'
Plugin 'prabirshrestha/vim-lsp'
Plugin 'mattn/vim-lsp-settings'
Plugin 'thomasfaingnaert/vim-lsp-snippets'
Plugin 'thomasfaingnaert/vim-lsp-ultisnips'
Plugin 'prabirshrestha/asyncomplete-tags.vim'
Plugin 'prabirshrestha/asyncomplete-buffer.vim'
Plugin 'prabirshrestha/asyncomplete-file.vim'
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <CR>    pumvisible() ? "\<C-y>" : "\<CR>"
function! s:my_asyncomplete_preprocessor(options, matches) abort 
    let l:dict = {} 
    for [l:source_name, l:matches] in items(a:matches) 
        let l:source_priority = get(asyncomplete#get_source_info(l:source_name),'priority',0)
        for l:item in l:matches['items'] 
            "if stridx(l:item['word'], a:options['base']) == 0
            if l:item['word'] =~ '^' . a:options['base'] 
                let l:item['priority'] = l:source_priority
                if has_key(l:dict,l:item['word'])
                    let l:old_item = get(l:dict, l:item['word'])
                    if l:old_item['priority'] <  l:source_priority
                        let l:dict[item['word']] = l:item
                    endif
                else
                    let l:dict[item['word']] = l:item
                endif
            endif 
        endfor 
    endfor 
    let l:items =  sort(values(l:dict),{a, b -> b['priority'] - a['priority']})
    call asyncomplete#preprocess_complete(a:options, l:items) 
endfunction 

let g:asyncomplete_preprocessor = [function('s:my_asyncomplete_preprocessor')]
au User asyncomplete_setup call asyncomplete#register_source(
            \ asyncomplete#sources#tags#get_source_options({
            \ 'name': 'tags',
            \ 'whitelist': ['c'],
            \ 'completor': function('asyncomplete#sources#tags#completor'),
            \ 'config': {
            \    'max_file_size': 50000000,
            \  },
            \ 'priority' : -100, 
            \ }))
au User asyncomplete_setup call asyncomplete#register_source(
            \ asyncomplete#sources#buffer#get_source_options({
            \ 'name': 'buffer',
            \ 'whitelist': ['*'],
            \ 'blacklist': ['go'],
            \ 'completor': function('asyncomplete#sources#buffer#completor'),
            \ 'config': {
            \    'max_buffer_size': 5000000,
            \  },
            \ 'priority' : -100, 
            \ }))
au User asyncomplete_setup call asyncomplete#register_source(
            \ asyncomplete#sources#file#get_source_options({
            \ 'name': 'file',
            \ 'whitelist': ['*'],
            \ 'completor': function('asyncomplete#sources#file#completor'),
            \ 'priority' : -100, 
            \ }))
"let g:lsp_log_file = expand('~/vim-lsp.log')
"=================================================
Plugin 'rust-lang/rust.vim'
"autocmd FileType rust let g:syntastic_rust_checkers = ['rustc']
"autocmd FileType rust let g:syntastic_rust_checkers = ['cargo']
"autocmd FileType rust compiler mycargo
"autocmd FileType rust setl makeprg=cargo\ build
"let g:rustfmt_command = 'cargo fmt -- '
let g:rust_fold = 0
"let g:rustfmt_options = 'overwrite'
let g:rustfmt_fail_silently = 1
"g:syntastic_rust_checkers = ['rustc']
"let g:rustfmt_autosave = 1
"autocmd BufNewFile,BufRead *.rs set formatprg=rustfmt
"autocmd BufWritePre *.rs silent! call rustfmt#Format()
autocmd FileType rust setl foldmethod=syntax
"=================================================
Plugin 'octol/vim-cpp-enhanced-highlight'
"=================================================
Plugin 'scrooloose/nerdtree'
let NERDTreeWinPos = 'right'
let NERDTreeWinSize = 30
let NERDTreeChDirMode = 2
let g:NERDTreeShowHidden = 1
"map <C-n> :NERDTreeFind <CR>
map <C-n> :NERDTreeToggle %:h<CR>
"=================================================
Plugin 'scrooloose/nerdcommenter'
let g:NERDCustomDelimiters = {
            \ 'c': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
            \ }
"=================================================
Plugin 'vim-syntastic/syntastic'
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*

let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
let g:syntastic_auto_jump = 0
set sessionoptions-=blank
"let g:syntastic_debug = 63
"let g:syntastic_debug_file = "~/syntastic.log"
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
"==================================================
Plugin 'mattn/emmet-vim'
let g:user_emmet_install_global = 0
autocmd FileType html,htmldjango,css EmmetInstall
let g:user_emmet_mode='a'
"==================================================
Plugin 'tpope/vim-repeat'
"=================================================
Plugin 'Glench/Vim-Jinja2-Syntax'
"au BufNewFile,BufRead *.tera set filetype=htmldjango
au BufNewFile,BufRead *.tera set filetype=jinja
"=================================================
Plugin 'nathanaelkane/vim-indent-guides'
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
"=================================================
"Plugin 'gilligan/vim-lldb'
"================================================
"Plugin 'Shougo/neomru.vim'
"Plugin 'Shougo/denite.nvim'
"==================================================
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_theme='dark'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show= 1
" indent: mixed indent within a line
" long:   overlong lines
" trailing: trailing whitespace
" mixed-indent-file: different indentation in different lines
"let g:airline#extensions#whitespace#checks = [ 'indent','mixed-indent-file' ]
let g:airline#extensions#whitespace#enabled = 0
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif
let g:airline_symbols.linenr = '@'
"==================================================
Plugin 'Shougo/echodoc.vim'
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'popup'
" To use a custom highlight for the popup window,
" change Pmenu to your highlight group
highlight link EchoDocPopup Pmenu
"==================================================
"View and search LSP symbols, tags in Vim
Plugin 'liuchengxu/vista.vim'
let g:vista_sidebar_position = 'vertical topleft'
"let g:vista_icon_indent = ['╰─▸ ', '├─▸ ']
let g:vista_ctags_executable = "universal_ctags"
" Set the executive for some filetypes explicitly. Use the explicit executive
" instead of the default one for these filetypes when using `:Vista` without
" specifying the executive.
let g:vista_executive_for = {
  \ 'c': 'vim_lsp',
  \ 'cpp': 'vim_lsp',
  \ 'rust': 'vim_lsp',
  \ }
" The default icons can't be suitable for all the filetypes, you can extend it as you wish.
let g:vista#renderer#icons = {
\   "function": "\uf794",
\   "variable": "\uf71b",
\  }
"==================================================
"https://github.com/majutsushi/tagbar/wiki#rust
"Plugin 'majutsushi/tagbar'
let g:tagbar_ctags_bin = g:ctags_bin
let g:tagbar_left = 1
"==================================================
"vim-signature is a plugin to place, toggle and display marks
Plugin 'kshenoy/vim-signature'
"==================================================
"Plugin 'jsfaint/gen_tags.vim'
let gen_tags#gtags_auto_gen=1
let gen_tags#ctags_auto_gen=1
let g:gen_tags#ctags_opts = '--sort=yes --fields=+S'
"let gen_tags#statusline=1

let gen_tags#gtags_default_map = 0
function! CloseAllLocationList()
    windo if &buftype == "locationlist" | lclose | endif
endfunction

function! CloseOrKeepLocationList()
    if (getwinvar(0,"keep_open") == 1)
        :call setwinvar(0, 'keep_open', 0)
        :lw
    else
        if &buftype == "locationlist"
            :lclose
        endif
    endif
endfunction

function! LCS_Find(cmd,f_mode)
    let word = ""
    if a:f_mode == "f" || a:f_mode == "i"
        let word = expand('<cfile>')
    else
        let word = expand('<cword>')
    endif
    lclose
    silent exec a:cmd . ' ' . 'find ' . a:f_mode . ' ' . word
    if len(getloclist(0)) == 0
        return
    else
        lw
        :call setwinvar(0, "keep_open", 1)  
    endif
    windo :call CloseOrKeepLocationList()
endfunction

set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a- 
"=============================================================
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"set autochdir
if has('gui_running')
    "set guioptions-=T  " no toolbar
    "colorscheme elflord
    set lines=60 columns=108 linespace=0
    if has('gui_win32')
        "set guifont=Source_Code_Pro:h16:cANSI
        "set guifont=Source_Code_Pro_for_Powerline:h16:cANSI
        "set guifont=Consolas\ for\ Powerline\ FixedD:h14
        set guifont=Powerline\ Consolas:h14
    else
        set guifont=Powerline\ Consolas\ h14
        "set guifont=DejaVu\ Sans\ Mono\ 14
    endif
endif
set foldmethod=indent
set foldlevel=100
set  nu
syntax enable
set background=dark
colorscheme desert
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
zoumi commented 4 years ago

image

liuchengxu commented 4 years ago

The vimrc you posted is not minimal. Being a minimal vimrc, it should only contain the settings of vista.vim and the necessary vim-lsp plugin.

I'm guessing vim-lsp possibly does not invoke the callback when there is an error. You can also try the other vim LSP plugin, e.g., coc.nvim, to see if it's more related to the LSP server instead of the LSP client.