liuchengxu / vista.vim

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

Plug-in doesn't get the job done because: "ctags: Warning: Cannot disable fixed field 'xxx' {pattern}" #467

Closed fjrg76-com closed 9 months ago

fjrg76-com commented 11 months ago

Describe the bug As the title says, whenever I want to load the plug-in (:Vista!!) I get such error twice:

ctags: Warning: Cannot disable fixed field 'P' {pattern} ctags: Warning: Cannot disable fixed field 'F' {input}

and then nothing happens.

Environment:

Vista info


    Current FileType: cpp
Avaliable Executives: ['ctags']
    Global Variables:
    let g:vista = {'lnum': 1, 'get_tagline_under_cursor': function('502'), 'winnr': function('500'), 'source': {'fname': 'src/components/Device/Device.cpp', 'bufnr': 4, 'get_winid': function('504'), 'winid': 1000, 'winnr': 3, 'extension': function('509'), 'line': function('507'), 'get_winnr': function('503'), 'filetype': function('505'), 'lines': function('506'), 'line_trimmed': function('508'), 'scope_seperator': function('510'), 'fpath': '/home/fjrg76/Escritorio/Taximeter/src/components/Device/Device.cpp'}, 'provider': 'ctags', 'skip_once_flag': v:false, 'ctags_cmd': 'ctags --format=2 --excmd=pattern --fields=+nksSaf --extras=+F --sort=no --append=no --language-force=c++ --c++-kinds=psvcdefghtmnu --output-format=json --fields=-PF -f- /home/fjrg76/.cache/nvim/vista/a79a49b257eb6eec1e44e5e3e59118db219e54c0bf3d19966f9f47fb8c339e95.cpp', 'winid': function('501'), 'tmps': ['/home/fjrg76/.cache/nvim/vista/a79a49b257eb6eec1e44e5e3e59118db219e54c0bf3d19966f9f47fb8c339e95.cpp']}
    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_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 = 1
    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_floating_border = 'none'
    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 Just type:

:Vista

Expected behavior A window should show with the source code tags (I guess).

Actual behavior A couple of warnings show up and nothing more happens. Captura de pantalla de 2023-09-15 21-23-51

Screenshot or gif (if possible) If applicable, add screenshots to help explain your problem.

fjrg76-com commented 11 months ago

Update:

Uninstall exuberant-ctags (if necessary) and uninstall universal-ctags Open Neovim and load any .c file Try: Vista ("Ctags must be installed", or so) With Neovim still opened, install universal-ctags Try: Vista (The tags window is opened!) Close Neovim Open Neovim and load any .c file Try: Vista ("ctags: Warning: Cannot disable fixed...") =(

Nebuchadrezzar commented 10 months ago

I've the same issue. Something changed with vista, since I've had it working using universal-ctags. When I recently updated vista, it broke, producing only an output reading: 'ctags: Warning: Cannot disable fixed field: "P"{pattern}'

I'm on Debian 10 (buster), using universal ctags version 0.0.0, and vim 9.0.

liuchengxu commented 10 months ago

https://github.com/liuchengxu/vista.vim/pull/466 updates the kinds option of ctags for go, which looks like the culprit of this ssue.

Can you try this patch and post the output of ctags --list-kinds=go as well?

diff --git a/autoload/vista/types/uctags/go.vim b/autoload/vista/types/uctags/go.vim
index 826a9e8..acc255e 100644
--- a/autoload/vista/types/uctags/go.vim
+++ b/autoload/vista/types/uctags/go.vim
@@ -15,7 +15,6 @@ let type_go.kinds = {
     \ 'm': {'long' : 'struct members', 'fold' : 0, 'stl' : 0},
     \ 'M': {'long' : 'struct anonymous members',     'fold' : 0, 'stl' : 0},
     \ 'n': {'long' : 'interface method specification', 'fold' : 0, 'stl' : 0},
-    \ 'P': {'long' : 'imports',        'fold' : 0, 'stl' : 0},
     \ 'a': {'long' : 'type aliases',        'fold' : 0, 'stl' : 0},
     \ }
ljxrrcj commented 9 months ago

466 updates the kinds option of ctags for go, which looks like the culprit of this ssue.

Can you try this patch and post the output of ctags --list-kinds=go as well?

diff --git a/autoload/vista/types/uctags/go.vim b/autoload/vista/types/uctags/go.vim
index 826a9e8..acc255e 100644
--- a/autoload/vista/types/uctags/go.vim
+++ b/autoload/vista/types/uctags/go.vim
@@ -15,7 +15,6 @@ let type_go.kinds = {
     \ 'm': {'long' : 'struct members', 'fold' : 0, 'stl' : 0},
     \ 'M': {'long' : 'struct anonymous members',     'fold' : 0, 'stl' : 0},
     \ 'n': {'long' : 'interface method specification', 'fold' : 0, 'stl' : 0},
-    \ 'P': {'long' : 'imports',        'fold' : 0, 'stl' : 0},
     \ 'a': {'long' : 'type aliases',        'fold' : 0, 'stl' : 0},
     \ }

hi liu, i tried your patch and here is the output of ctags --list-kinds=go image

the Vista.vim still not work and get error "[vista.vim] ctags: Warning: Cannot disable fixed field: 'P'{pattern}"

liuchengxu commented 9 months ago

Sorry for the persistent error, could you paste the output of :echo g:vista.ctags_cmd when the error occurred? I can't reproduce it in my environment.

ljxrrcj commented 9 months ago

Sorry for the persistent error, could you paste the output of :echo g:vista.ctags_cmd when the error occurred? I can't reproduce it in my environment.

Sure, here is the output image Is there any configure that i ignored?

liuchengxu commented 9 months ago

ctags wasn't even started :P You have to print it after the error has occurred. Try invoking :Vista or something to see the error ctags: Warning: Cannot disable fixed field: "P"{pattern} and then :echo g:vista.ctags_cmd.

ljxrrcj commented 9 months ago

ctags wasn't even started :P You have to print it after the error has occurred. Try invoking :Vista or something to see the error ctags: Warning: Cannot disable fixed field: "P"{pattern} and then :echo g:vista.ctags_cmd.

Oh thanks, here is the output of your procedure: image

And could you explain why the ctags was not even started? How do you get this conclusion?

liuchengxu commented 9 months ago

You'll see the error message and g:vista won't be unavailable if ctags did run.

Looks like the problem comes from here, but they actually remain unchanged for a long time, not sure why.

https://github.com/liuchengxu/vista.vim/blob/58dabc027909330970ac549e52bf799a723878c5/autoload/vista/executive/ctags.vim#L20

Since these are warnings instead of hard errors, we may suppress them silently. @masatake any suggestions? Thanks!

masatake commented 9 months ago

At a glance, F in --fields=-PF causes a trouble.

F       input          yes     NONE             s--    yes   r- input file

Do you really want to disable F, the field representing input files?

masatake commented 9 months ago

I revised my answer. You can turn off the fields P and F in the JSON output mode.


Universal Ctags 0.0.0, Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Jan  6 2019, 23:23:29
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml

It looks old. I recommend you to get newer one like:

% ctags --options=NONE --version 
ctags: Notice: No options will be read from files or environment
Universal Ctags 6.0.0, Copyright (C) 2015-2022 Universal Ctags Team
...
liuchengxu commented 9 months ago

--fields=-PF was inherited from tagbar if I recall correctly.

@ljxrrcj Can you try installing a newer u-ctags as suggested by masatake and see if the issue persists?

masatake commented 9 months ago

@ljxrrcj Nightly-build is available from https://github.com/universal-ctags/ctags-nightly-build/releases .

ljxrrcj commented 9 months ago

Thank you all! I tried the latest version of universal-ctags and the problem disappeared!

And I have another question now: is there a way to show the tags just by the order like Source Insight rather than by tags' types?

liuchengxu commented 9 months ago

And I have another question now: is there a way to show the tags just by the order like Source Insight rather than by tags' types?

It's definitely possible, the request already exists actually in https://github.com/liuchengxu/vista.vim/issues/452. The idea is to add a new renderer for the ctags output (https://github.com/liuchengxu/vista.vim/blob/master/autoload/vista/renderer.vim#L83-L92), but I don't have more bandwidth for developing new features of vista.vim, we need more contributors :P.

liuchengxu commented 9 months ago

The README has been updated with a note on newer ctags and a link to the ctags nighlty-build (thank you! @masatake), I believe this issue can be closed now.