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

Vista ctags get an empty windows with errors. #386

Closed
markwu opened this issue Feb 14, 2021 · 16 comments
Closed

Vista ctags get an empty windows with errors. #386

markwu opened this issue Feb 14, 2021 · 16 comments

Comments

@markwu
Copy link

markwu commented Feb 14, 2021

Describe the bug
:Vista ctags get an empty windows with errors.

Environment:

  • OS: macOS 10.15.7
  • Vim: 8.2.2510
  • NeoVim: v0.5.0-dev+5ad32885d
  • This plugin version: 05d1fb2
  • I'm using universal-ctags:
    • Ctags version: Universal Ctags 5.9.0(0ccd81f6)

Vista info

    Current FileType:
Avaliable Executives: ['ctags']
    Global Variables:
    let g:vista = {'get_tagline_under_cursor': function('3'), 'winnr': function('1'), 'source': {'fname': '', 'bufnr': 1, 'get_winid': function
('5'), 'winid': 1000, 'winnr': 1, 'extension': function('10'), 'line': function('8'), 'get_winnr': function('4'), 'filetype': function('6'), 'l
ines': function('7'), 'line_trimmed': function('9'), 'scope_seperator': function('11'), 'fpath': ''}, 'provider': 'ctags', 'ctags_cmd': 'ctags
--format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --extras=   --output-format=json --fields=-PF -f- /var/folders/y2/
qvr3832j08340b8y6sbdv6dm0000gn/T/5bc9d68a7b31b38e37e90d0d212d42903d9b34e9896412489facb671d0fe6de7', 'winid': function('2'), 'tmps': []}
    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 = 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

set nocompatible
filetype off

source ~/.vim/bundle/vim-plug/plug.vim
call plug#begin('~/.vim/bundle/')

Plug 'junegunn/vim-plug'
Plug 'liuchengxu/vista.vim'

call plug#end()

syntax on
filetype plugin indent on

**Steps and errors
vista

@markwu
Copy link
Author

markwu commented Feb 14, 2021

I tried coc, it has the same errors.

vista

@liuchengxu
Copy link
Owner

Can not reproduce. Use g:vista_log_file(:h g:vista_log_file), and add some debugging statements via vista#Debug(...) to see what's going on,

@markwu
Copy link
Author

markwu commented Feb 15, 2021

Here comes the vista.log for Vista ctags

2021-02-16 01:08:36 ["executive::ctags::s:BuildCmd origin_fpath:/Users/markwu/Projects/vim-test/bundle/vista.vim/autoload/vista.vim"]
2021-02-16 01:08:36 ["executive::ctags::s:ApplyExecute calling s:RunAsyncCommon(ctags --format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --extras=  --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- /var/folders/y2/qvr3832j08340b8y6sbdv6dm0000gn/T/de6754042e7faa0d64c8cd91cf61a78d99c15e632b353d1d652ef2816966ab03.vim)"]
2021-02-16 01:08:36 ["executive::ctags::s:BuildCmd origin_fpath:/Users/markwu/Projects/vim-test/bundle/vista.vim/autoload/vista.vim"]
2021-02-16 01:08:36 ["executive::ctags::s:ApplyExecute calling s:RunAsyncCommon(ctags --format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --extras=  --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- /var/folders/y2/qvr3832j08340b8y6sbdv6dm0000gn/T/de6754042e7faa0d64c8cd91cf61a78d99c15e632b353d1d652ef2816966ab03.vim)"]
2021-02-16 01:08:36 ["executive::ctags::s:ApplyExtracted s:fpath:/Users/markwu/Projects/vim-test/bundle/vista.vim/autoload/vista.vim, s:reload_only:v:false, s:should_display:v:true"]
2021-02-16 01:08:36 ["[LSPProcess]should_display, processed_data:{'function': [{'lnum': 7, 'text': '', 'signature': '(dir)'}, {'lnum': 18, 'text': '', 'signature': '()'}, {'lnum': 25, 'text': '', 'signature': '(kind)'}, {'lnum': 29, 'text': '', 'signature': '(provider)'}, {'lnum': 38, 'text': '', 'signature': '(provider,AUF)'}, {'lnum': 44, 'text': '', 'signature': '()'}, {'lnum': 65, 'text': '', 'signature': '(Fn,Args)'}, {'lnum': 69, 'text': '', 'signature': '(filetype)'}, {'lnum': 81, 'text': '', 'signature': '()'}, {'lnum': 93, 'text': '', 'signature': '()'}, {'lnum': 110, 'text': '', 'signature': '()'}, {'lnum': 122, 'text': '', 'signature': '(...)'}, {'lnum': 128, 'text': '', 'signature': '(arg)'}, {'lnum': 160, 'text': '', 'signature': '(fst,snd)'}, {'lnum': 192, 'text': '', 'signature': '(bang,...)'}], 'variable': [{'lnum': 5, 'text': ''}, {'lnum': 11, 'text': ''}, {'lnum': 12, 'text': ''}, {'lnum': 13, 'text': ''}, {'lnum': 15, 'text': ''}, {'lnum': 31, 'text': ''}, {'lnum': 34, 'text': ''}, {'lnum': 46, 'text': ''}, {'lnum': 48, 'text': ''}, {'lnum': 120, 'text': ''}, {'lnum': 131, 'text': ''}, {'lnum': 149, 'text': ''}, {'lnum': 200, 'text': ''}, {'lnum': 209, 'text': ''}]}"]
2021-02-16 01:08:36 ["event.BufEnter",2,"/Users/markwu/Projects/vim-test/__vista__"]
2021-02-16 01:08:37 ["executive::ctags::s:ApplyExtracted s:fpath:/Users/markwu/Projects/vim-test/bundle/vista.vim/autoload/vista.vim, s:reload_only:v:false, s:should_display:v:true"]
2021-02-16 01:08:37 ["[LSPProcess]should_display, processed_data:{'function': [{'lnum': 7, 'text': '', 'signature': '(dir)'}, {'lnum': 18, 'text': '', 'signature': '()'}, {'lnum': 25, 'text': '', 'signature': '(kind)'}, {'lnum': 29, 'text': '', 'signature': '(provider)'}, {'lnum': 38, 'text': '', 'signature': '(provider,AUF)'}, {'lnum': 44, 'text': '', 'signature': '()'}, {'lnum': 65, 'text': '', 'signature': '(Fn,Args)'}, {'lnum': 69, 'text': '', 'signature': '(filetype)'}, {'lnum': 81, 'text': '', 'signature': '()'}, {'lnum': 93, 'text': '', 'signature': '()'}, {'lnum': 110, 'text': '', 'signature': '()'}, {'lnum': 122, 'text': '', 'signature': '(...)'}, {'lnum': 128, 'text': '', 'signature': '(arg)'}, {'lnum': 160, 'text': '', 'signature': '(fst,snd)'}, {'lnum': 192, 'text': '', 'signature': '(bang,...)'}], 'variable': [{'lnum': 5, 'text': ''}, {'lnum': 11, 'text': ''}, {'lnum': 12, 'text': ''}, {'lnum': 13, 'text': ''}, {'lnum': 15, 'text': ''}, {'lnum': 31, 'text': ''}, {'lnum': 34, 'text': ''}, {'lnum': 46, 'text': ''}, {'lnum': 48, 'text': ''}, {'lnum': 120, 'text': ''}, {'lnum': 131, 'text': ''}, {'lnum': 149, 'text': ''}, {'lnum': 200, 'text': ''}, {'lnum': 209, 'text': ''}]}"]

@markwu
Copy link
Author

markwu commented Feb 16, 2021

I think it might be universal-ctags change something, Vista ctags works about one ago, but failed in recent commit. I can't tell which commit cause this.

I revert to the version about one years ago Universal Ctags 0.0.0(d22e13ef), it works.

@markwu
Copy link
Author

markwu commented Feb 16, 2021

Okay, I found it. It seems you didn't use the same universal-ctags version as mine to test, that's why you can not reproduce the bug.

After this commit universal-ctags/ctags@c0421c5 in universal-ctags repository, Vista ctags can't work anymore.

@markwu
Copy link
Author

markwu commented Feb 16, 2021

About the failed of Vista coc, I have no idea at this moment.

@liuchengxu
Copy link
Owner

liuchengxu commented Feb 16, 2021

@masatake The latest commit of u-ctags does not produce the name field anymore using the following command, any insights?

$ ctags --format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --extras=  --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- autoload/vista.vim
# `name` field is missing
{"_type": "tag", "line": 5, "kind": "variable"}
......

@masatake
Copy link

masatake commented Feb 16, 2021

I'm sorry. I changed.

Instead of --fields=nksSaf you should use
A. --fields=+nksSaf, or
B. --fields=NFPTtnksSaf

This means you should add optional fields you need to field enabled by default (A) or set all fields you need (B).

Both A and B must work with the latest u-ctags and relatively older u-ctags.

@liuchengxu
Copy link
Owner

Thanks for the info @masatake, anything I can do in vista.vim to detect if the u-ctags is recent enough so that people using the older u-ctags won't complain?

@masatake
Copy link

masatake commented Feb 16, 2021

Thanks for the info @masatake, anything I can do in vista.vim to detect if the u-ctags is recent enough so that people using the older u-ctags won't complain?

I don't find a good answer to the question.
How about ./configure alike approach?

  1. vista developers list up all fields (field list) needed in vista.vim. You can choose them from ctags --list-fields.
  2. Before vista.vim calls ctags, vista.vim inquiries ctags which fields are available with following command line:
      u-ctags  --quiet --options=NONE --fields='NFPTtnksSaf' --_fatal-warnings /dev/null
    
    Here NFPTtnksSaf is the field list.
  3. vista.vim checks the exit status. If it is 0, all fields vista.vim needs are available.

In step 2., u-ctags reports which field is not available to stderr.

@masatake
Copy link

You can send a pull request that includes test cases that verifies ctags behavior that vista.vim expects.
u-ctags developers can know their changes breaking the interface before merging.
I cannot promise u-ctags never breaks the interface, but I will notify the change.

@liuchengxu
Copy link
Owner

Just tested --fields=+nksSaf works with both the latest and the older version.

You can send a pull request that includes test cases that verifies ctags behavior that vista.vim expects.

I'm happy to do that, could you point out where should I add such a test? @masatake

@masatake
Copy link

I wrote an example test case for vista.vim.
See masatake/ctags@a7fe9f2 at my repository.
It already works. You can extend the test case and/or add more test cases under Tmai.
See the commit log.

This is an interesting challenge for me to make an eco-system. I would like to apply this approach to other client tools. This is the first one. Inputs are welcome.

@liuchengxu
Copy link
Owner

I'll look into that tomorrow 👍, and happy to see vista.vim can be the first one of many in the future :(.

@markwu
Copy link
Author

markwu commented Feb 17, 2021

I confirm this issue fixed in commit cdccc47. Should I report Vista coc in another issue? Or I can put it here?

@liuchengxu
Copy link
Owner

Please file a new issue, looks like the response of coc.nvim's API changed.

liuchengxu referenced this issue in masatake/ctags Feb 17, 2021
<REMOVE ME>
This is an example for a test case verifying ctags satisfies an expection of a client tool.

* See <https://docs.ctags.io/en/latest/tips.html#tmain-a-facility-for-testing-main-part> to
  write and run a test case for Tmain target.
* Use `Tmain: ` as the prefix of the header of the commit log.
* Put files composint a test case to Tmain/client-<the name of client>-<aspect of testing>.d/ .
* Put a README Tmain/client-<the name of client>-<aspect of testing>.d/ in addition to putting
  the standard Tmain test files like run.sh. The README is the message to developers of u-ctags.
* Don't include unessary white-spaces in README and run.sh.
</REMOVE ME>

<REMOVE ME: MY TODO>
I must write this to our docs.
</REMOVE ME: MY TODO>
liuchengxu added a commit to liuchengxu/ctags that referenced this issue Feb 17, 2021
masatake pushed a commit to universal-ctags/ctags that referenced this issue Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants