vista.vim icon indicating copy to clipboard operation
vista.vim copied to clipboard

b:vista_nearest_method_or_function may not exist even with autocmd VimEnter for coc.nvim

Open Frederick888 opened this issue 3 years ago • 1 comments

Describe the bug b:vista_nearest_method_or_function may not exist even with the autocmd mentioned in readme.

Environment:

  • OS: Arch Linux
  • Vim/Neovim version: NeoVim v0.4.4
  • This plugin version: db1b3800a79ffa82791d7333431b669f1a82480b
  • I'm using universal-ctags:
    • Ctags version: 5.9.0(p5.9.20210110.0) (Arch package 1:r20210106+g08b1c490-1)
  • I'm using some LSP client:
    • Related Vim LSP client: coc.nvim
    • The Vim LSP client version: 898335d52ed925e8dd5dd3da3c25470d352b2e11
    • Have you tried updated to the latest version of this LSP client: Yes

Vista info


    Current FileType: java
Avaliable Executives: ['coc', 'ctags']
    Global Variables:
    let g:vista = {'get_tagline_under_cursor': function('3'), 'winnr': function('1'), 'raw_by_kind': {'field': [{'scopeKind': 'class', 'name': 'grid', 'scope': 'GridTest', 'line': 19, '_type': 'tag', 'kind': 'field', 'access': 'default'}], 'method': [{'scopeKind': 'class', 'signature': '()', 'name': 'invalidPlaceTest', 'scope': 'GridTest', 'line': 22, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotForwardBeforePlaceTest', 'scope': 'GridTest', 'line': 29, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotMoveOutOfBoundTest', 'scope': 'GridTest', 'line': 36, '_type': 'tag', 'kind': 'method', 'access': 'default'}], 'package': [{'name': 'com.frederick.bikedriving', 'line': 1, '_type': 'tag', 'kind': 'package'}], 'class': [{'name': 'GridTest', 'line': 17, '_type': 'tag', 'kind': 'class'}]}, 'tree': {}, 'source': {'fpath': '/home/frederick/Programming/Java/bikedriving/src/test/java/com/frederick/bikedriving/GridTest.java', 'bufnr': 1, 'get_winid': function('5'), 'fname': 'src/test/java/com/frederick/bikedriving/GridTest.java', 'winnr': 1, 'extension': function('10'), 'line': function('8'), 'get_winnr': function('4'), 'filetype': function('6'), 'lines': function('7'), 'winid': 1000, 'line_trimmed': function('9'), 'scope_seperator': function('11')}, 'with_scope': [{'scopeKind': 'class', 'name': 'grid', 'scope': 'GridTest', 'line': 19, '_type': 'tag', 'kind': 'field', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'invalidPlaceTest', 'scope': 'GridTest', 'line': 22, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotForwardBeforePlaceTest', 'scope': 'GridTest', 'line': 29, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotMoveOutOfBoundTest', 'scope': 'GridTest', 'line': 36, '_type': 'tag', 'kind': 'method', 'access': 'default'}], 'provider': 'ctags', 'without_scope': [{'name': 'com.frederick.bikedriving', 'line': 1, '_type': 'tag', 'kind': 'package'}, {'name': 'GridTest', 'line': 17, '_type': 'tag', 'kind': 'class'}], 'ctags_cmd': 'ctags --format=2 --excmd=pattern --fields=+nksSaf --extras=+F --sort=no --append=no --extras=  --language-force=java --java-kinds=pacefgim --output-format=json --fields=-PF -f- /tmp/frederick/.cache/nvim/vista/aaa8c2ad2fa24de7de6eb2f5d306513a03707b8d94b3354891d132f593218911.java', 'winid': function('2'), 'tmps': ['/tmp/frederick/.cache/nvim/vista/aaa8c2ad2fa24de7de6eb2f5d306513a03707b8d94b3354891d132f593218911.java'], 'functions': [{'lnum': 19, 'text': 'grid'}, {'lnum': 22, 'text': 'invalidPlaceTest', 'signature': '()'}, {'lnum': 29, 'text': 'cannotForwardBeforePlaceTest', 'signature': '()'}, {'lnum': 36, 'text': 'cannotMoveOutOfBoundTest', 'signature': '()'}], 'raw': [{'name': 'com.frederick.bikedriving', 'line': 1, '_type': 'tag', 'kind': 'package'}, {'name': 'GridTest', 'line': 17, '_type': 'tag', 'kind': 'class'}, {'scopeKind': 'class', 'name': 'grid', 'scope': 'GridTest', 'line': 19, '_type': 'tag', 'kind': 'field', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'invalidPlaceTest', 'scope': 'GridTest', 'line': 22, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotForwardBeforePlaceTest', 'scope': 'GridTest', 'line': 29, '_type': 'tag', 'kind': 'method', 'access': 'default'}, {'scopeKind': 'class', 'signature': '()', 'name': 'cannotMoveOutOfBoundTest', 'scope': 'GridTest', 'line': 36, '_type': 'tag', 'kind': 'method', 'access': 'default'}], 'kinds': ['package', 'class', 'field', 'method']}
    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 = ['clap', 'fzf', 'skim']
    let g:vista#renderer#ctags = 'default'
    let g:vista#renderer#enable_icon = 1
    let g:vista#renderer#icons = {'subroutine': '羚', 'method': '', 'func': '', 'variables': '', 'constructor': '略', 'field': '', 'interface': '', 'type': '', 'packages': '', 'property': '襁', 'implementation': '', 'default': '', 'augroup': 'פּ', 'macro': '', 'enumerator': '', 'const': '', 'macros': '', 'map': 'פּ', 'fields': '', 'functions': '', 'enum': '', 'function': '', 'target': '', 'typedef': '', 'namespace': '', 'enummember': '', 'variable': '', 'modules': '', 'constant': '', 'struct': '', 'types': '', 'module': '', 'typeParameter': '', 'package': '', 'class': '', 'member': '', 'var': '', 'union': '鬒'}
    let g:vista_blink = [2, 100]
    let g:vista_close_on_fzf_select = 0
    let g:vista_close_on_jump = 0
    let g:vista_cursor_delay = 400
    let g:vista_default_executive = 'ctags'
    let g:vista_disable_statusline = 0
    let g:vista_echo_cursor = 1
    let g:vista_enable_centering_jump = 1
    let g:vista_executive_for = {}
    let g:vista_find_absolute_nearest_method_or_function = 0
    let g:vista_find_nearest_method_or_function_delay = 300
    let g:vista_fold_toggle_icons = ['▼', '▶']
    let g:vista_fzf_preview = []
    let g:vista_icon_indent = ['└ ', '│ ']
    let g:vista_ignore_kinds = []
    let g:vista_no_mappings = 0
    let g:vista_sidebar_position = 'vertical botright'
    let g:vista_sidebar_width = 30
    let g:vista_stay_on_open = 1
    let g:vista_top_level_blink = [2, 100]
    let g:vista_update_on_text_changed = 0
    let g:vista_update_on_text_changed_delay = 500

Steps to reproduce given the above info

minimal vimrc (neccessary when this issue is about some Vim LSP client):

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

" vim-plug
call plug#begin()

Plug 'neoclide/coc.nvim', { 'branch': 'release' }
Plug 'liuchengxu/vista.vim'

call plug#end()

" vista.vim
autocmd VimEnter * call vista#RunForNearestMethodOrFunction()
let g:vista_default_executive = 'coc'
" or
" let g:vista_default_executive = 'ctags'

Open a file (tested on some random Java and Rust).

When using coc.nvim, I still have to at least :Vista once to make b:vista_nearest_method_or_function available (although :echo b:coc_current_function works already); when using ctags, I have to move cursor at least once otherwise right after NeoVim starts :echo b:vista_nearest_method_or_function says it doesn't exist.

Expected behavior With the autocmd, b:vista_nearest_method_or_function is filled automatically without needing any intervention.

Actual behavior Need to :Vista or move cursor otherwise b:vista_nearest_method_or_function doesn't exist.

Frederick888 avatar Jun 10 '21 13:06 Frederick888

Try #403.

liuchengxu avatar Jun 10 '21 23:06 liuchengxu