-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: counsel-gtags-dwim also find include files #27
Comments
acknowledged, although this might take me a bit since this package is scoring very low among my priorities |
Is there a ggtags command that does this? something like |
Here is the function (defun ggtags-find-tag-dwim (name &optional what)
"Find NAME by context.
If point is at a definition tag, find references, and vice versa.
If point is at a line that matches `ggtags-include-pattern', find
the include file instead.
When called interactively with a prefix arg, always find
definition tags."
(interactive
(let ((include (and (not current-prefix-arg) (ggtags-include-file))))
(ggtags-ensure-project)
(if include (list include 'include)
(list (ggtags-read-tag 'definition current-prefix-arg)
(and current-prefix-arg 'definition)))))
(ggtags-check-project) ; For `ggtags-current-project-root' below.
(cond
((eq what 'include)
(ggtags-find-file name))
((or (eq what 'definition)
(not buffer-file-name)
(not (ggtags-project-has-refs (ggtags-find-project)))
(not (ggtags-project-file-p buffer-file-name)))
(ggtags-find-definition name))
(t (ggtags-find-tag
(format "--from-here=%d:%s"
(line-number-at-pos)
;; Note `ggtags-find-tag' binds `default-directory' to
;; project root.
(shell-quote-argument
(ggtags-project-relative-file buffer-file-name)))
"--" (shell-quote-argument name))))) |
this was implemented recently in
I hardly advice you switch to EDIT: AY CHIHUAHUA... Leaving open in case someone else will do a PR (or if @kha-dinh has solved by other means) |
Right now it only finds either definition or reference.
In ggtags, dwim also finds header files when pointing to the include section.
It would be nice to have something similar.
The text was updated successfully, but these errors were encountered: