Prashant Pandey
Prashant Pandey

Reputation: 4642

universal-ctags YAML Support

I have installed the latest version of universal-ctags on my Mac. I want to index yml files but running ctags --list-languages does not list yml as one of the supported languages. However, their documentation says that ymls are supported using LibYaml and AnsiblePlaybook libyaml, and that these two parsers have been newly added.

How can I fix this? I searched a lot on the Internet but apparently, no one has faced this problem yet.

Upvotes: 3

Views: 643

Answers (2)

abbood
abbood

Reputation: 23548

Homebrew ctags doesn't support yaml out of the box unfortunately

using homebrew 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

so I simply uninstalled homebrew ctags:

brew uninstall universal-ctags

and than ran the ctags installation manually:

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

then, profit:

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

Update

I tried doing this on Mac OS Montery 12.3.1 (M1) and I got this error when running

./autogen.sh

..
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
Can't exec "aclocal": No such file or directory at /opt/homebrew/Cellar/autoconf/2.71/share/autoconf/Autom4te/FileUtils.pm line 274.
autoreconf: error: aclocal failed with exit status: 2

so I simply fixed it by running this

brew install automake

Upvotes: 1

Masatake YAMATO
Masatake YAMATO

Reputation: 1300

--list-languages may list the parser as "Yaml". If it is not listed, your ctags doesn't link to libyaml. The output of ./ctags --list-features is also helpful. If libyaml is linked to ctags properly, --list-features may list "yaml".

Upvotes: 1

Related Questions