From 27feec417accfbb44ef0093b760313a1b2a69077 Mon Sep 17 00:00:00 2001 From: Alice D Date: Mon, 25 Oct 2021 12:19:20 -0400 Subject: [PATCH] add ctags command --- doc/DEVELOPMENT.rst | 42 ++++++++++++++++++++++++++++++++++++++++-- meson.build | 4 ++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/doc/DEVELOPMENT.rst b/doc/DEVELOPMENT.rst index f077b619fa..47d27e444b 100644 --- a/doc/DEVELOPMENT.rst +++ b/doc/DEVELOPMENT.rst @@ -53,6 +53,24 @@ In general, things like ``for`` loops should have no spaces between the ``for`` # correct for(int i = 0; i < 10; i++) { log_debug(i); } +``ctags`` Support +''''''''''''''''' + +A ``.ctagsdb`` file can assist certain code editors (like ``vim``) with jump-to-definition support and other useful features. To generate a ``taisei/.ctagsdb`` file. + +.. code:: sh + + ninja ctags -C build/ + +You then have to let your editor know that a ``.ctagsdb`` file exists. + +Using ``.vimrc`` as an example: + +.. code:: sh + + # this will walk the project directory until it finds a .ctagsdb file + set tags=.ctagsdb; + Compiling Issues ---------------- @@ -86,14 +104,20 @@ Platform-Specific Tips macOS """"" +Tools +''''' + On macOS, you need to begin with installing the Xcode Command Line Tools: .. code:: sh xcode-select --install -There are additional command line tools that you'll need. You can acquire those -by using `Homebrew `__. +For other tools, such as ``meson``, you can acquire those by using +`Homebrew `__. + +Libraries +''''''''' As of 2021-08-05, you should **not** install the following packages via Homebrew, as the versions available do not compile against Taisei correctly. @@ -123,3 +147,17 @@ following option: .. code:: sh meson configure build/ --wrap-mode=forcefallback + +``ctags`` Error +''''''''''''''' + +You may run into an error when generating ``.ctagsdb`` file, such as ``illegal option -- L`` or something similar. This is because the version of ``ctags`` that ships with Xcode isn't directly supported by ``ninja``. + +You can install and alias the Homebrew version of ``ctags`` by doing the following: + +.. code:: sh + + brew install ctags + # either run this in console, or add to your shell profile + alias ctags='/usr/local/bin/ctags' + diff --git a/meson.build b/meson.build index a7e536aca5..d1858e16f3 100644 --- a/meson.build +++ b/meson.build @@ -518,6 +518,10 @@ foreach bindist_target : bindist_targets ) endforeach +run_target('ctags', + command : ['ctags', '-R', '--exclude=.git', '-f', '.ctagsdb', join_paths(meson.source_root(), 'src')] +) + summary = ''' Summary: