OILS / devtools / ctags.sh View on Github | oils.pub

69 lines, 20 significant
1#!/usr/bin/env bash
2#
3# Function to generate tags files, e.g. for Vim Ctrl-] lookup.
4#
5# Usage:
6# devtools/ctags.sh <function name>
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12ubuntu-deps() {
13 sudo apt install exuberant-ctags
14}
15
16# Creates a 9 MB file.
17index-python() {
18 pushd Python-2.7.13/
19 ctags --recurse
20 ls -l tags
21 popd
22}
23
24oils-ctags-out() {
25
26 # Vim complains unless we have this
27 echo $'!_TAG_FILE_SORTED\t0'
28
29 # We want an explicit manifest to avoid walking _chroot/ and so forth. ctags
30 # --exclude doesn't work well.
31
32 devtools/repo.sh find-src-files | ctags --filter | sort
33}
34
35index-oils() {
36 time oils-ctags-out > tags
37
38 # This file ends up at 992 KB
39 # It's 11832 symbols/lines
40 # That's way too many; doesn't work that well
41 # Comment/string/def lexers should do better
42
43 ls -l tags
44}
45
46# TODO:
47#
48# The ctags file is easy to generate!
49#
50# - Select the list of files
51# - SYMBOL \t FILENAME \t VI-COMMAND ;" EXTENSION
52# - you can just use a line number?
53# - well then it's out of date if you insert something, so that's why they
54# use /
55#
56# Intermediate format - OTAGS
57# - SYMBOL FILENAME LINE
58# - and then GENERATE ctags from this - with /^ command. I guess you escape \/
59# - GENERATE HTML or JSON from this
60# - you can have a big list of symbols to highlight
61#
62# - osh --tool ctags FILE*
63# - warn about duplicates
64#
65# Idea for comment/string/def lexers, i.e. CSD:
66#
67# See devtools/README.md
68
69"$@"