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

Re: [PATCH 2/3] completion: extract completing ctags symbol names into helper function

From
Jeff King <peff@peff.net>
Date
Mar 24, 2017, 00:40 UTC
Message-ID
<20170324004018.rqtcrx7oewaooizh@sigill.intra.peff.net>
In-Reply-To
<20170323153839.24283-3-szeder.dev@gmail.com>
On Thu, Mar 23, 2017 at 04:38:38PM +0100, SZEDER Gábor wrote:
Show 16 quoted lines
> The previous commit doubled the number of __git_match_ctag()'s
> positional parameters, and, to keep the position of existing
> parameters for the sake of backwards compatibility, the prefix,
> current word and suffix parameters ended up in different order than in
> other functions accepting the same parameters.  Then there is a
> condition checking the existence of the tag file before invoking this
> function.
> 
> We could still live with this if there were only a single callsite,
> but the next commit will add a few more, so it's worth providing a
> cleaner interface.
> 
> Add the wrapper function __git_complete_symbol(), which encompasses
> the condition for checking the presence of the tag file and filling
> COMPREPLY, and accepts '--opt=val'-style options with default values
> that keep callsites simpler.
Nice cleanup. The resulting code in _git_grep() is much more readable.

I use the same completion for "vim -t". Now I can cheat and switch it to __git_complete_symbol. :)

-Peff
Previous: SZEDER GáborNext: SZEDER Gábor
Message 5 of 9 in “completion: updates to ctags symbol names”
  1. 0/3 completion: updates to ctags symbol namesSZEDER Gábor, Mar 23, 2017
  2. 1/3 completion: put matching ctags symbol names directly into COMPREPLYSZEDER Gábor, Mar 23, 2017
  3. Jeff KingMar 24, 2017
  4. 2/3 completion: extract completing ctags symbol names into helper functionSZEDER Gábor, Mar 23, 2017
  5. Jeff KingMar 24, 2017
  6. 3/3 completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'SZEDER Gábor, Mar 23, 2017
  7. Jeff KingMar 24, 2017
  8. SZEDER GáborMar 30, 2017
  9. Jeff KingApr 1, 2017

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.