Skip to content

Commit dbf3a63

Browse files
committed
Auto merge of #27386 - chris-morgan:ctags-stuff-update, r=alexcrichton
As there’s no C++ runtime any more there’s really no point in having anything but Rust tags being made. I’ve also taken the liberty of excluding the compiler parts of this in the `librust%,,` pattern substitution. Whether or not this is “correct” will depend on whether you want tags for the compiler or for general use. For myself, I want it for general use. I’m not sure how much people use the tags files anyway. I definitely do, but with Racer existing the tags files aren’t quite so necessary.
2 parents 5fcaf95 + aede1c7 commit dbf3a63

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

mk/ctags.mk

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,11 @@
1515

1616
.PHONY: TAGS.emacs TAGS.vi
1717

18-
# This is using a blacklist approach, probably more durable than a whitelist.
19-
# We exclude: external dependencies (llvm, rt/{msvc,vg}),
20-
# tests (compiletest, test) and a couple of other things (rt/arch, etc)
21-
CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/llvm,, \
22-
$(patsubst ${CFG_SRC_DIR}src/compiletest,, \
23-
$(patsubst ${CFG_SRC_DIR}src/test,, \
24-
$(patsubst ${CFG_SRC_DIR}src/etc,, \
25-
$(patsubst ${CFG_SRC_DIR}src/rt,, \
26-
$(patsubst ${CFG_SRC_DIR}src/rt/arch,, \
27-
$(patsubst ${CFG_SRC_DIR}src/rt/msvc,, \
28-
$(patsubst ${CFG_SRC_DIR}src/rt/vg,, \
29-
$(wildcard ${CFG_SRC_DIR}src/*) $(wildcard ${CFG_SRC_DIR}src/rt/*) \
30-
))))))))
31-
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=-javascript --recurse ${CTAGS_LOCATIONS}
32-
# We could use `--languages=Rust`, but there is value in producing tags for the
33-
# C++ parts of the code base too (at the time of writing, those are .h and .cpp
34-
# files in src/rt, src/rt/sync and src/rustllvm); we mainly just want to
35-
# exclude the external dependencies.
18+
CTAGS_LOCATIONS=$(wildcard ${CFG_SRC_DIR}src/lib*)
19+
CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/librust%,, \
20+
$(patsubst ${CFG_SRC_DIR}src/lib%test,, \
21+
$(wildcard ${CFG_SRC_DIR}src/lib*))) ${CFG_SRC_DIR}src/libtest
22+
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=Rust --recurse ${CTAGS_LOCATIONS}
3623

3724
TAGS.emacs:
3825
ctags -e -f $@ ${CTAGS_OPTS}

src/etc/ctags.rust

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
66
--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/
77
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
8-
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
9-
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
10-
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/
8+
--regex-Rust=/^[ \t]*(pub[ \t]+)?(static|const)[ \t]+(mut[ \t]+)?([a-zA-Z0-9_]+)/\4/c,consts,static constants/
9+
--regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\3/t,traits,traits/
10+
--regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\5 \7 \8/i,impls,trait implementations/
1111
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/

0 commit comments

Comments
 (0)