[Top][All Lists]

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

Re: xref-find-matches and stuff

From: Dmitry Gutov
Subject: Re: xref-find-matches and stuff
Date: Mon, 11 May 2015 04:38:24 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

On 05/09/2015 03:58 PM, Vitalie Spinu wrote:

It works for completion because you can reliably disambiguate from
context which completion to use. C in C, Python in py, files in strings
with "/" in them etc.

It's not always so simple:

- In some contexts, file paths can appear in the buffer outside of string literals. In sh-mode and eshell-mode, for instance, that is the rule rather than exception.

- Depending on the context, file paths may have different quoting rules. See `completion-table-with-quoting' and its uses for more context (I don't understand that area well myself).

Point is, while it's possible to provide the basic functionality without specializing, a perfect file completion is language and environment-dependent. So it's hard to serve with just one completion function.

> With xref context is often unrelated to where you
want to jump and, thus, is orthogonal to the selection of the "best"

Not that often. 95% of the time, I either jump to the thing at point (in the current project), or to a thing at least somewhat related to it: a caller, a callee, or simply a laterally related function in the same project or in one of its dependencies or dependants. The current project and its dependencies are usually possible to determine automatically.

No. Major mode just defines one backend. The end user defines a list of
backends to be used simultaneously.

Would the user even know which backends are possible to use, if the major mode doesn't add it to `xref-backends'?

By the way, the above is an example of "manual management of backends", which we've ostensibly agreed is undesirable. It may be good for a power user, but let's try to make things "just work" more often, for the average user.

  > Multi-language projects are an interesting example. But if there are
  > no references between the source file in different languages

Yet another argument for prompting on M-. by default ;)

And prompt for the project to jump to, every time?

  > Personally, I'd just make a "switch to another project" a separate
  > step here.

That's the same as picking a backend just before the jump. Could be, but
I hope for a better UI.

Selecting from a list of project might be a more transparent choice for a user, rather than picking from a list of backends.

  > It's not ideal, no argument here. However, being unavailable in
  > buffers without TAGS, or in some languages, means it can be safely
  > skipped in those circumstances.

No, it cannot. That's the main point. If I am in a non-tagged file I
still want to be able to jump to my tags.

This use case still could be served by an extra "switch to another project" step, I think.

As an non-ideal alternative, yes. I might be quite happy with being able
to rotate backends during the minibuffer completion.

To have this kind of capability could be fun, but I think the current completing-read interface is ill-suited for this. IOW, you'd have to start with writing a new completing-read-function (Helm might be a somewhat viable alternative, since it can already use several sources at a time, and displays the name of each in its buffer).

reply via email to

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