Skip to content

extras: add full file name along with base file name#1804

Open
RobertCElliott wants to merge 1 commit intouniversal-ctags:masterfrom
RobertCElliott:master
Open

extras: add full file name along with base file name#1804
RobertCElliott wants to merge 1 commit intouniversal-ctags:masterfrom
RobertCElliott:master

Conversation

@RobertCElliott
Copy link
Copy Markdown

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

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
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.005%) to 84.417% when pulling 2e1b8c7 on RobertCElliott:master into 9323929 on universal-ctags:master.

@masatake
Copy link
Copy Markdown
Member

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.

@RobertCElliott
Copy link
Copy Markdown
Author

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.

@masatake
Copy link
Copy Markdown
Member

Oh, I see.

Copy link
Copy Markdown
Member

@masatake masatake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread main/entry.c
tag.extensionFields.endLine = endLine;
makeTagEntry (&tag);

/* add the full filename too */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. */

Comment thread main/entry.c
makeTagEntry (&tag);

/* add the full filename too */
if (base != fileName) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition will be (if you follow my idea):

if (base != fileName && isXtagEnabled (XTAG_QUALIFIED_TAGS))

Comment thread main/entry.c
initTagEntry (&tag, fileName, KIND_FILE_INDEX);
tag.isFileEntry = true;
tag.lineNumberEntry = true;
markTagExtraBit (&tag, XTAG_FILE_NAMES);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markTagExtraBit (&tag, XTAG_QUALIFIED_TAGS);

Comment thread man/ctags.1.rst.in
(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
Copy link
Copy Markdown
Member

@masatake masatake Jul 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the original document as is.
Instead, could you add "If --extras=+q is given, ..." ?

@RobertCElliott
Copy link
Copy Markdown
Author

RobertCElliott commented Jul 21, 2018 via email

@masatake
Copy link
Copy Markdown
Member

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 masatake added this to the 6.1 milestone Apr 29, 2023
@catap
Copy link
Copy Markdown
Contributor

catap commented Jun 13, 2023

@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? :)

@masatake
Copy link
Copy Markdown
Member

@catap I agree with you.

@masatake masatake modified the milestones: 6.1, 6.2 Jun 21, 2023
@masatake masatake modified the milestones: 6.2, 6.3 Dec 28, 2023
@masatake masatake modified the milestones: 6.3, 6.4 Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants