Skip to content

tags, enh: show roles instead of <R>#187

Merged
AmaiKinono merged 1 commit into
universal-ctags:masterfrom
masatake:show-roles
Apr 11, 2025
Merged

tags, enh: show roles instead of <R>#187
AmaiKinono merged 1 commit into
universal-ctags:masterfrom
masatake:show-roles

Conversation

@masatake
Copy link
Copy Markdown
Member

@masatake masatake commented Apr 8, 2025

Close #186

Comment thread citre-common-tag.el Outdated
:type 'string
:group 'citre)

(defcustom citre-tag-roles-marker (lambda (roles)
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'd suggest changing this to citre-tag-roles-format and it should defaults to <%s>, as I don't think the roles field needs to be transformed in a more complex way (If you need to, please let me know). The propertization can be done in citre--make-tag-annotation-str.

Also, I consider it good to disable roles annotation if this is nil, so users who don't need this behavior can simply set this to nil and have the old behavior.

Comment thread citre-common-tag.el Outdated
"A function marking added for roles of references in tags.
If a tag has no roles field, use `citre-tag-reference-mark` as fallback.

The function takes roles as a string and returns a marked string."
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've rewrite it a bit, please see if this is easier to understand:

  "A format string for roles annotation.
If a tag is a reference tag and has roles field, this is used to format
the roles field of the tag.  If this is nil, or the tag doesn't have a
roles field, `citre-tag-reference-mark' is used to indicate that it is a
reference tag."

@AmaiKinono
Copy link
Copy Markdown
Member

Thanks! I've fixed the CI problem, so you can rebase this on the master branch and it should runs fine.

@masatake masatake force-pushed the show-roles branch 2 times, most recently from f9c8337 to 99ff9d0 Compare April 10, 2025 10:41
Comment thread citre-tags.el Outdated
citre-tags-definition-default-sorter)
:require '(name ext-abspath pattern)
:optional '(ext-kind-full line typeref scope extras))))
:optional '(ext-kind-full line typeref scope extras
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 don't think this works. For example:

(setq x t)
'(line ,@(when x '(roles)))
;; => (line (\,@ (when x '(roles))))

`(line ,@(when x '(roles)))
;; => (line roles)
Suggested change
:optional '(ext-kind-full line typeref scope extras
:optional `(ext-kind-full line typeref scope extras

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry for the mistake. Updated.

Close universal-ctags#186

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@AmaiKinono AmaiKinono merged commit 3e3c6e5 into universal-ctags:master Apr 11, 2025
10 checks passed
@AmaiKinono
Copy link
Copy Markdown
Member

Thanks!

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.

Show the name of roles instead of <R>

2 participants