1

universal-ctags我已经在我的 Mac 上安装了最新版本的。我想索引yml文件,但运行ctags --list-languages没有yml列为支持的语言之一。但是,他们的文档说使用LibYamland支持 ymls AnsiblePlaybook libyaml,并且这两个解析器是新添加的。

我怎样才能解决这个问题?我在互联网上搜索了很多,但显然,还没有人遇到过这个问题。

4

2 回答 2

1

不幸的是,自制 ctags 不支持开箱即用的 yaml

使用自制 ctags:

ctags --list-features
#NAME                       DESCRIPTION
case-insensitive-filenames  TO BE WRITTEN
iconv                       can convert input/output encodings
option-directory            TO BE WRITTEN
packcc                      has peg based parser(s)
regex                       can use regular expression based pattern matching
wildcards                   can use glob matching
xpath                       linked with library for parsing xml input

所以我只是卸载了自制 ctags:

brew uninstall universal-ctags

然后手动运行 ctags 安装:

    $ git clone https://github.com/universal-ctags/ctags.git
    $ cd ctags
    $ ./autogen.sh
    $ ./configure --prefix=/where/you/want # defaults to /usr/local
    $ make
    $ make install # may require extra privileges depending on where to install

然后,利润:

ctags --list-features
#NAME                       DESCRIPTION
case-insensitive-filenames  TO BE WRITTEN
gnulib_fnmatch              linked with the Gnulib fnmatch library
gnulib_regex                linked with the Gnulib regular expression library
iconv                       can convert input/output encodings
interactive                 accepts source code from stdin
json                        supports json format output
option-directory            TO BE WRITTEN
optscript                   can use the interpreter
packcc                      has peg based parser(s)
regex                       can use regular expression based pattern matching
wildcards                   can use glob matching
xpath                       linked with library for parsing xml input
yaml                        linked with library for parsing yaml input
于 2021-09-14T05:45:08.717 回答
0

--list-languages 可能会将解析器列为“Yaml”。如果未列出,则您的 ctags 不会链接到 libyaml。的输出./ctags --list-features也很有帮助。如果 libyaml 正确链接到 ctags,--list-features可能会列出“yaml”。

于 2020-05-16T21:48:44.207 回答