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

show incorrect function name in Linux kernel source code #352

Open liangkarl opened 4 years ago

liangkarl commented 4 years ago

Describe the bug When I simply open the main.c and toggle window by :Vista!!, the function name of those carrying "init" descriptor would show "init" only, instead of the real function name. static bool __init obsolete_checksetup(char *line) -------> __init:[line number] image

Environment:

Vista info

    Current FileType: c
Avaliable Executives: ['coc', 'ctags']
    Global Variables:
    let g:vista = {'floating_visible': v:false, 'get_tagline_under_cursor': function('20'), 'winnr': function('18'), 'silent': v:false, 'source': {'fpath': '/home/karl/projects/linux/linux/init/main.c', 'bufnr': 11, 'get_winid': function('22'), 'fname': 'main.c', 'winnr': 1, 'extension': function('27'), 'line': function('25'), 'get_winnr': function('21'), 'filetype': function('23'), 'lines': function('24'), 'winid': 1000, 'line_trimmed': function('26'), 'scope_seperator': function('28')}, 'bufnr': 14, 'provider': 'coc', 'pos': [{'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, 2, '1resize 30|vert 1resize 91|2resize 30|vert 2resize 50|3resize 8|vert 3resize 1|4resize 8|vert 4resize 1|5resize 8|vert 5resize 51|'], 'ctags_cmd': 'ctags --format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --language-force=c --c-kinds=pfsdevghtmu -f- /home/karl/.cache/nvim/vista/261d8863dbe5c8719e88b2eb6121de4fc35ea8dafc2cc49c21249497f2d58506.c', 'winid': 1011, 'tmps': ['/home/karl/.cache/nvim/vista/72ea055bb50e4dbc9e5b1b42181c6e4f1a5694e3ba8130f33093c9180324cfb3.startify', '/home/karl/.cache/nvim/vista/b425f767461b4333ef8add77a7f9750879837211a632793185c67c409776ef2b.cpp', '/home/karl/.cache/nvim/vista/b425f767461b4333ef8add77a7f9750879837211a632793185c67c409776ef2b.cpp', '/home/karl/.cache/nvim/vista/261d8863dbe5c8719e88b2eb6121de4fc35ea8dafc2cc49c21249497f2d58506.c'], 'functions': [{'lnum': 105, 'col': 12, 'range': {'end': {'character': 29, 'line': 104}, 'start': {'character': 0, 'line': 104}}, 'selectionRange': {'end': {'character': 22, 'line': 104}, 'start': {'character': 11, 'line': 104}}, 'level': 0, 'kind': 'Function', 'text': 'kernel_init'}, {'lnum': 107, 'col': 13, 'range': {'end': {'character': 25, 'line': 106}, 'start': {'character': 0, 'line': 106}}, 'selectionRange': {'end': {'character': 20, 'line': 106}, 'start': {'character': 12, 'line': 106}}, 'level': 0, 'kind': 'Function', 'text': 'init_IRQ'}, {'lnum': 108, 'col': 13, 'range': {'end': {'character': 26, 'line': 107}, 'start': {'character': 0, 'line': 107}}, 'selectionRange': {'end': {'character': 21, 'line': 107}, 'start': {'character': 12, 'line': 107}}, 'level': 0, 'kind': 'Function', 'text': 'fork_init'}, {'lnum': 109, 'col': 13, 'range': {'end': {'character': 32, 'line': 108}, 'start': {'character': 0, 'line': 108}}, 'selectionRange': {'end': {'character': 27, 'line': 108}, 'start': {'character': 12, 'line': 108}}, 'level': 0, 'kind': 'Function', 'text': 'radix_tree_init'}, {'lnum': 121, 'col': 1, 'range': {'end': {'character': 26, 'line': 120}, 'start': {'character': 0, 'line': 120}}, 'selectionRange': {'end': {'character': 13, 'line': 120}, 'start': {'character': 0, 'line': 120}}, 'level': 0, 'kind': 'Function', 'text': 'EXPORT_SYMBOL'}, {'lnum': 129, 'col': 13, 'range': {'end': {'character': 26, 'line': 128}, 'start': {'character': 0, 'line': 128}}, 'selectionRange': {'end': {'character': 21, 'line': 128}, 'start': {'character': 12, 'line': 128}}, 'level': 0, 'kind': 'Function', 'text': 'time_init'}, {'lnum': 150, 'col': 1, 'range': {'end': {'character': 40, 'line': 149}, 'start': {'character': 0, 'line': 149}}, 'selectionRange': {'end': {'character': 17, 'line': 149}, 'start': {'character': 0, 'line': 149}}, 'level': 0, 'kind': 'Function', 'text': 'EXPORT_SYMBOL_GPL'}, {'lnum': 162, 'col': 1, 'range': {'end': {'character': 27, 'line': 161}, 'start': {'character': 0, 'line': 161}}, 'selectionRange': {'end': {'character': 13, 'line': 161}, 'start': {'character': 0, 'line': 161}}, 'level': 0, 'kind': 'Function', 'text': 'EXPORT_SYMBOL'}, {'lnum': 212, 'col': 1, 'range': {'end': {'character': 29, 'line': 211}, 'start': {'character': 0, 'line': 211}}, 'selectionRange': {'end': {'character': 13, 'line': 211}, 'start': {'character': 0, 'line': 211}}, 'level': 0, 'kind': 'Function', 'text': 'EXPORT_SYMBOL'}, {'lnum': 227, 'col': 1, 'range': {'end': {'character': 33, 'line': 226}, 'start': {'character': 0, 'line': 226}}, 'selectionRange': {'end': {'character': 11, 'line': 226}, 'start': {'character': 0, 'line': 226}}, 'level': 0, 'kind': 'Function', 'text': 'early_param'}, {'lnum': 365, 'col': 20, 'range': {'end': {'character': 44, 'line': 364}, 'start': {'character': 0, 'line': 364}}, 'selectionRange': {'end': {'character': 35, 'line': 364}, 'start': {'character': 19, 'line': 364}}, 'level': 0, 'kind': 'Function', 'text': 'setup_nr_cpu_ids'}, {'lnum': 366, 'col': 20, 'range': {'end': {'character': 60, 'line': 365}, 'start': {'character': 0, 'line': 365}}, 'selectionRange': {'end': {'character': 35, 'line': 365}, 'start': {'character': 19, 'line': 365}}, 'level': 0, 'kind': 'Function', 'text': 'smp_prepare_cpus'}, {'lnum': 500, 'col': 1, 'range': {'end': {'character': 53, 'line': 499}, 'start': {'character': 0, 'line': 499}}, 'selectionRange': {'end': {'character': 10, 'line': 499}, 'start': {'character': 0, 'line': 499}}, 'level': 0, 'kind': 'Function', 'text': 'core_param'}, {'lnum': 505, 'col': 20, 'range': {'end': {'character': 0, 'line': 506}, 'start': {'character': 0, 'line': 504}}, 'selectionRange': {'end': {'character': 40, 'line': 504}, 'start': {'character': 19, 'line': 504}}, 'level': 0, 'kind': 'Function', 'text': 'initcall_debug_enable'}, {'lnum': 823, 'col': 1, 'range': {'end': {'character': 0, 'line': 828}, 'start': {'character': 0, 'line': 821}}, 'selectionRange': {'end': {'character': 23, 'line': 822}, 'start': {'character': 0, 'line': 822}}, 'level': 0, 'kind': 'Function', 'text': 'trace_initcall_start_cb'}, {'lnum': 832, 'col': 1, 'range': {'end': {'character': 0, 'line': 842}, 'start': {'character': 0, 'line': 830}}, 'selectionRange': {'end': {'character': 24, 'line': 831}, 'start': {'character': 0, 'line': 831}}, 'level': 0, 'kind': 'Function', 'text': 'trace_initcall_finish_cb'}, {'lnum': 861, 'col': 20, 'range': {'end': {'character': 0, 'line': 865}, 'start': {'character': 0, 'line': 860}}, 'selectionRange': {'end': {'character': 42, 'line': 860}, 'start': {'character': 19, 'line': 860}}, 'level': 0, 'kind': 'Function', 'text': 'do_trace_initcall_start'}, {'lnum': 867, 'col': 20, 'range': {'end': {'character': 0, 'line': 871}, 'start': {'character': 0, 'line': 866}}, 'selectionRange': {'end': {'character': 43, 'line': 866}, 'start': {'character': 19, 'line': 866}}, 'level': 0, 'kind': 'Function', 'text': 'do_trace_initcall_finish'}, {'lnum': 1053, 'col': 20, 'range': {'end': {'character': 0, 'line': 1055}, 'start': {'character': 0, 'line': 1052}}, 'selectionRange': {'end': {'character': 32, 'line': 1052}, 'start': {'character': 19, 'line': 1052}}, 'level': 0, 'kind': 'Function', 'text': 'mark_readonly'}], 'raw': [{'name': 'kernel_init', 'vlnum': 4, 'line': 105, 'kind': 'Function'}, {'name': 'init_IRQ', 'vlnum': 5, 'line': 107, 'kind': 'Function'}, {'name': 'fork_init', 'vlnum': 6, 'line': 108, 'kind': 'Function'}, {'name': 'radix_tree_init', 'vlnum': 7, 'line': 109, 'kind': 'Function'}, {'name': 'early_boot_irqs_disabled', 'vlnum': 28, 'line': 118, 'kind': 'Variable'}, {'name': 'system_states', 'vlnum': 25, 'line': 120, 'kind': 'Enum'}, {'name': 'system_state', 'vlnum': 29, 'line': 120, 'kind': 'Variable'}, {'name': 'EXPORT_SYMBOL', 'vlnum': 8, 'line': 121, 'kind': 'Function'}, {'name': 'time_init', 'vlnum': 9, 'line': 129, 'kind': 'Function'}, {'name': '__initdata', 'vlnum': 30, 'line': 131, 'kind': 'Variable'}, {'name': '__initdata', 'vlnum': 31, 'line': 134, 'kind': 'Variable'}, {'name': 'saved_command_line', 'vlnum': 32, 'line': 136, 'kind': 'Variable'}, {'name': 'static_command_line', 'vlnum': 33, 'line': 138, 'kind': 'Variable'}, {'name': 'initcall_command_line', 'vlnum': 34, 'line': 140, 'kind': 'Variable'}, {'name': 'execute_command', 'vlnum': 35, 'line': 142, 'kind': 'Variable'}, {'name': 'ramdisk_execute_command', 'vlnum': 36, 'line': 143, 'kind': 'Variable'}, {'name': 'static_key_initialized', 'vlnum': 37, 'line': 149, 'kind': 'Variable'}, {'name': 'EXPORT_SYMBOL_GPL', 'vlnum': 10, 'line': 150, 'kind': 'Function'}, {'name': 'reset_devices', 'vlnum': 38, 'line': 161, 'kind': 'Variable'}, {'name': 'EXPORT_SYMBOL', 'vlnum': 11, 'line': 162, 'kind': 'Function'}, {'name': '__init', 'vlnum': 39, 'line': 164, 'kind': 'Variable'}, {'name': 'argv_init', 'vlnum': 40, 'line': 172, 'kind': 'Variable'}, {'name': 'envp_init', 'vlnum': 41, 'line': 173, 'kind': 'Variable'}, {'name': 'panic_later', 'vlnum': 42, 'line': 174, 'kind': 'Variable'}, {'name': 'panic_param', 'vlnum': 43, 'line': 174, 'kind': 'Variable'}, {'name': 'obs_kernel_param', 'vlnum': 60, 'line': 176, 'kind': 'Struct'}, {'name': '__setup_start', 'vlnum': 44, 'line': 176, 'kind': 'Variable'}, {'name': '__init', 'vlnum': 45, 'line': 178, 'kind': 'Variable'}, {'name': 'EXPORT_SYMBOL', 'vlnum': 12, 'line': 212, 'kind': 'Function'}, {'name': '__init', 'vlnum': 46, 'line': 214, 'kind': 'Variable'}, {'name': 'early_param', 'vlnum': 13, 'line': 227, 'kind': 'Function'}, {'name': '__init', 'vlnum': 47, 'line': 229, 'kind': 'Variable'}, {'name': '__init', 'vlnum': 48, 'line': 249, 'kind': 'Variable'}, {'name': '__init', 'vlnum': 49, 'line': 351, 'kind': 'Variable'}, {'name': 'setup_max_cpus', 'vlnum': 50, 'line': 364, 'kind': 'Variable'}, {'name': 'setup_nr_cpu_ids', 'vlnum': 14, 'line': 365, 'kind': 'Function'}, {'name': 'smp_prepare_cpus', 'vlnum': 15, 'line': 366, 'kind': 'Function'}, {'name': '__init', 'vlnum': 51, 'line': 375, 'kind': 'Variable'}, {'name': '__ref', 'vlnum': 52, 'line': 397, 'kind': 'Variable'}, {'name': 'core_param', 'vlnum': 16, 'line': 500, 'kind': 'Function'}, {'name': 'initcall_debug_enable', 'vlnum': 17, 'line': 505, 'kind': 'Function'}, {'name': '__init', 'vlnum': 53, 'line': 513, 'kind': 'Variable'}, {'name': 'trace_initcall_start_cb', 'vlnum': 18, 'line': 823, 'kind': 'Function'}, {'name': 'trace_initcall_finish_cb', 'vlnum': 19, 'line': 832, 'kind': 'Function'}, {'name': 'initcall_calltime', 'vlnum': 54, 'line': 845, 'kind': 'Variable'}, {'name': 'do_trace_initcall_start', 'vlnum': 20, 'line': 861, 'kind': 'Function'}, {'name': 'do_trace_initcall_finish', 'vlnum': 21, 'line': 867, 'kind': 'Function'}, {'name': '__init_or_module', 'vlnum': 55, 'line': 875, 'kind': 'Variable'}, {'name': 'initcall_level_names', 'vlnum': 56, 'line': 929, 'kind': 'Variable'}, {'name': '__init', 'vlnum': 57, 'line': 940, 'kind': 'Variable'}, {'name': 'mark_readonly', 'vlnum': 22, 'line': 1053, 'kind': 'Function'}, {'name': '__ref', 'line': 1059, 'kind': 'Variable'}], 'vlnum2tagname': {'50': 'setup_max_cpus', '51': '__init', '52': '__ref', '53': '__init', '54': 'initcall_calltime', '55': '__init_or_module', '56': 'initcall_level_names', '57': '__init', '4': 'kernel_init', '5': 'init_IRQ', '6': 'fork_init', '7': 'radix_tree_init', '8': 'EXPORT_SYMBOL', '9': 'time_init', '30': '__initdata', '31': '__initdata', '32': 'saved_command_line', '33': 'static_command_line', '34': 'initcall_command_line', '35': 'execute_command', '36': 'ramdisk_execute_command', '37': 'static_key_initialized', '38': 'reset_devices', '39': '__init', '60': 'obs_kernel_param', '10': 'EXPORT_SYMBOL_GPL', '11': 'EXPORT_SYMBOL', '12': 'EXPORT_SYMBOL', '13': 'early_param', '14': 'setup_nr_cpu_ids', '15': 'smp_prepare_cpus', '16': 'core_param', '17': 'initcall_debug_enable', '18': 'trace_initcall_start_cb', '19': 'trace_initcall_finish_cb', '40': 'argv_init', '41': 'envp_init', '42': 'panic_later', '43': 'panic_param', '44': '__setup_start', '45': '__init', '46': '__init', '47': '__init', '48': '__init', '49': '__init', '20': 'do_trace_initcall_start', '21': 'do_trace_initcall_finish', '22': 'mark_readonly', '25': 'system_states', '28': 'early_boot_irqs_disabled', '29': 'system_state'}}
    let g:vista#executive#ctags#support_json_format = 0
    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': '', '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_blink = [2, 100]
    let g:vista_close_on_jump = 0
    let g:vista_cursor_delay = 400
    let g:vista_default_executive = 'ctags'
    let g:vista_disable_statusline = 1
    let g:vista_echo_cursor = 1
    let g:vista_executive_for = {'vim': 'coc', 'c': 'coc', 'javascript': 'coc', 'html': 'coc', 'typescript': 'coc', 'cpp': 'coc', 'css': 'coc', 'python': 'coc'}
    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 = ['right:50%']
    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 = 50
    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

Expected behavior Show correct function name

Actual behavior Show descriptor name of function

Screenshot or gif (if possible) image

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

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

masatake commented 1 year ago

You may use Exuberant Ctags Try Universal Ctags instead.