emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xref completion


From: Dmitry Gutov
Subject: Re: Xref completion
Date: Mon, 7 Dec 2020 23:53:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 07.12.2020 11:27, Daniel Martín wrote:
Dmitry Gutov <dgutov@yandex.ru> writes:

On the one hand, it feels kinda faster, on the other, it lacks the
ability to "look around" when you really need it. In an ideal world, I
guess the UI would be somewhere in the middle.

One of the reasons I see people integrate Ivy/Helm with Xref is to have
fuzzy filtering of the results, but I don't see why we couldn't have
that in the *xref* buffer.

I think xref buffers have other ways of reaching the same goal. E.g., if we're talking about the results of project-find-regexp or xref-find-apropos, those commands themselves allow you to enter search queries where you can choose the appropriate amount of "fuzziness".

That said...

First I thought if we could implement this by extending an existing
Emacs command like flush-lines or occur to "teach" it about the
specificities of the *xref* buffer, but that doesn't seem very clean.

...adding a command like xref-flush-groups shouldn't hurt. You can file a feature request with 'M-x report-emacs-bug' and perhaps even attach a patch?

So perhaps we could add a new command that asks for a regexp in the
minibuffer and filters the results in the *xref* buffer to only contain
those items from a group that matches that regular expression.  With q
you will go back to show the complete list of xref items and groups.

Hmm, if mean dynamically? That sounds a bit more complicated but hey, there can be some way to implement this without too much effort.

Is
there any core Emacs package that performs a similar filtering?  We
could learn from its workflow, then.

swiper, perhaps?

Not a core package, but it is in GNU ELPA.

Why matching the group exclusively? In my opinion, matching the group
only is better because the typical use case I have in mind is a big
codebase with thousands of xref results that are spread around hundreds
of files.  You usually want to filter by the string that varies the
most, which in most cases is the group (eg. if I only want to see
results from unit tests, then I'd filter the *xref* buffer by
"*Tests.cpp"; If I only want to see results from header files, I'd
filter by "*.h").

Sounds reasonable. If you wanted to filter by summary contents anyway, you can just use swiper.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]