ctags
ctags copied to clipboard
extras: add full file name along with base file name
For --extras=+f, add the full file name along with the base file name.
For example, this allows using vim's -t argument: vim -t main/entry.c rather than requiring the -t be dropped: vim main/entry.c
Coverage increased (+0.005%) to 84.417% when pulling 2e1b8c72fb7c071bedffbe7176799b1e373eb2f4 on RobertCElliott:master into 9323929b97c01510d5b0b7eee967b7eb46532b6b on universal-ctags:master.
You have opened and closed pull requests repeatedly. I wonder what happened to you. Is this ready for reviewing and commenting?
BTW, I recommend you to make a topic branch for hacking ctags instead of committing to your master branch. See https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows for more details.
Sorry, it took a while to understand the self-tests kicked off by the pull request and get them to run locally (the simple-glide one still doesn't run). I'm more familiar with using git send-email to send patches rather than pushing to github.
Oh, I see.
Another idea I had was to add all partial paths, e.g., a/b/c/main.c, b/c/main.c, and c/main.c (along with main.c). Thoughts?
Robert Elliott, HPE Persistent Memory
From: Masatake YAMATO [email protected] Sent: Saturday, July 21, 2018 3:17 AM To: universal-ctags/ctags Cc: Elliott, Robert (Persistent Memory); Author Subject: Re: [universal-ctags/ctags] extras: add full file name along with base file name (#1804)
@masatake requested changes on this pull request.
Instead of changing the output of --extras=+f, I would like you to extend the output of --extras=+qf. So the extended function aligns with the other functions of ctags.
In that case, you don't have to update the expected output of test cases. Instead, you have to add a simple test case verifying --extras=+qf output. Tmain the place to put your test case.
In main/entry.chttps://github.com/universal-ctags/ctags/pull/1804#discussion_r204205462:
makeTagEntry (&tag);
-
/* add the full filename too */
I think it is better to emit full filename only when --extras=+q is given. So the comment will be :
/* add the full filename too if --extras=+q is given. */
In main/entry.chttps://github.com/universal-ctags/ctags/pull/1804#discussion_r204205499:
makeTagEntry (&tag);
-
/* add the full filename too */
-
if (base != fileName) {
The condition will be (if you follow my idea):
if (base != fileName && isXtagEnabled (XTAG_QUALIFIED_TAGS))
In main/entry.chttps://github.com/universal-ctags/ctags/pull/1804#discussion_r204205518:
makeTagEntry (&tag);
-
/* add the full filename too */
-
if (base != fileName) {
-
initTagEntry (&tag, fileName, KIND_FILE_INDEX);
-
tag.isFileEntry = true;
-
tag.lineNumberEntry = true;
-
markTagExtraBit (&tag, XTAG_FILE_NAMES);
markTagExtraBit (&tag, XTAG_QUALIFIED_TAGS);
In man/ctags.1.rst.inhttps://github.com/universal-ctags/ctags/pull/1804#discussion_r204205552:
@@ -715,10 +715,10 @@ are not listed here. They are experimental or debugging purpose. Equivalent to
--file-scope
.
f/inputFile
-
Include an entry for the base file name of every source file
-
(e.g. "example.c"), which addresses the first line of the file.
-
If ``end:`` field is enabled, the end line number of the file
-
can be attached to the tag.
-
Include entries for the base and full file names of every source
Keep the original comment as is. Instead, could you add "If --extras=+q is given, ..." ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/universal-ctags/ctags/pull/1804#pullrequestreview-139252313, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADeVJQ7DSanxZMkGGr_bXFNKLtmUd7Goks5uIuOYgaJpZM4VZUnt.
Another idea I had was to add all partial paths, e.g., a/b/c/main.c, b/c/main.c, and c/main.c (along with main.c). Thoughts?
I feel adding all partial paths to the output when --extras=+qf
is too much, and is not suitable for q
extra. If you want all partial paths, add a new extra for the purpose.
See xtagDefinitions in main/xtag.c and xtagType in main/xtag.h. You can use an extra name from a command line like:
$ u-ctags --extras='+qf{aName}' input...
@masatake this PR seems like a blocker for 6.1: https://github.com/universal-ctags/ctags/milestone/8
Shall it be rescheduled for 6.2? :)
@catap I agree with you.