git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] completion: match ctags symbol names in grep patterns

From
Jeff King <peff@peff.net>
Date
Oct 18, 2011, 15:04 UTC
Message-ID
<20111018150423.GA11593@sigill.intra.peff.net>
In-Reply-To
<7vd3duixdg.fsf@alter.siamese.dyndns.org>
On Tue, Oct 18, 2011 at 12:15:23AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> > It's debatable whether this belongs in the generic completion code, as
> > it really only works if your project uses ctags. But I find it to be a
> > huge timesaver for finding callsites of functions, especially when
> > coupled with "git jump grep" from the previous patch.
> 
> Could you elaborate a bit more on how this would help for finding
> callsites? You are looking at a function and do not want to break its
> callers, so at that point presumably you already know the name of the
> function, no?
> 
> Ahh, Ok, you do not necessarily want to type the long function name.

Exactly. Actually, it is often not so much "do not want to type" as "cannot remember the exact name", but the effect is the same. :)

I use the same completion for "vim -t" which will jump to the definition.

Show 7 quoted lines
> By the way, I notice that "make tags" runs "find ." looking for any files
> and directories that match "*.[hcS]" (so do $(ETAGS_TARGET) and cscope),
> without even excluding .git metadirectory.
> 
> Perhaps something like this is in order?
> [...]
> +FIND_SOURCE_FILES = git ls-files '*.[hcS]'

Makes sense to me. I doubt it matters much in practice, though, as we don't tend to have random untracked source files lying around.

My version of ctags will actually do the recursion itself with "ctags -R", picking out any files with with languages it knows about. But maybe not all versions do that.

Also, I have often found myself trying to do completion on shell functions. I wonder if it's worth adding them to the list (again, my version of ctags understands bourne shell just fine, but I don't know if all do).

-Peff
Previous: Junio C HamanoNext: SZEDER Gábor
Message 12 of 24 in “stupid git tricks”
  1. 0/3 stupid git tricksJeff King, Oct 18, 2011
  2. 1/3 contrib: add diff highlight scriptJeff King, Oct 18, 2011
  3. 2/3 contrib: add git-jump scriptJeff King, Oct 18, 2011
  4. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 18, 2011
  5. Junio C HamanoOct 18, 2011
  6. Jonathan NiederOct 18, 2011
  7. Junio C HamanoOct 18, 2011
  8. Matthieu MoyOct 18, 2011
  9. Junio C HamanoOct 18, 2011
  10. Jonathan NiederOct 18, 2011
  11. Junio C HamanoOct 18, 2011
  12. Jeff KingOct 18, 2011
  13. SZEDER GáborOct 21, 2011
  14. Jeff KingOct 21, 2011
  15. 1/3 contrib: add diff highlight scriptJeff King, Oct 21, 2011
  16. 2/3 contrib: add git-jump scriptJeff King, Oct 21, 2011
  17. Jeff KingOct 21, 2011
  18. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 21, 2011
  19. 4/3 completion: use __gitcomp_nl for ctag matchingJeff King, Oct 21, 2011
  20. SZEDER GáborOct 23, 2011
  21. Jeff KingOct 28, 2011
  22. SZEDER GáborOct 29, 2011
  23. Jeff KingNov 1, 2011
  24. Junio C HamanoNov 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.