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

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

Closed
fjrg76-com opened this issue Sep 16, 2023 · 16 comments

Comments

@fjrg76-com
Copy link

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:

  • OS: Linux Mint 20.3

  • Neovim version: 0.7.2 (the one I got with the ppa)

  • This plugin version: master (#466) (I downloaded the zip version)

  • I'm using universal-ctags: The one shipped with Linux Mint

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
  • I'm using some LSP client: I have no idea what it is.

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
Copy link
Author

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
Copy link

Nebuchadrezzar commented Oct 18, 2023

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
Copy link
Owner

#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
Copy link

ljxrrcj commented Nov 16, 2023

#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
Copy link
Owner

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
Copy link

ljxrrcj commented Nov 19, 2023

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
Copy link
Owner

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
Copy link

ljxrrcj commented Nov 20, 2023

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
Copy link
Owner

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.

let s:default_cmd_fmt = '%s %s %s --output-format=json --fields=-PF -f- %s'

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

@masatake
Copy link

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
Copy link

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
Copy link
Owner

--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
Copy link

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

@ljxrrcj
Copy link

ljxrrcj commented Nov 23, 2023

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
Copy link
Owner

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 #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
Copy link
Owner

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.

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

No branches or pull requests

5 participants