emacs-devel
[Top][All Lists]
Advanced

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

Re: Adding support for xref jumping to headers/interfaces


From: Dmitry Gutov
Subject: Re: Adding support for xref jumping to headers/interfaces
Date: Sun, 5 Mar 2023 23:21:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 05/03/2023 23:04, João Távora wrote:

On Sun, Mar 5, 2023, 20:40 Dmitry Gutov <dgutov@yandex.ru <mailto:dgutov@yandex.ru>> wrote:

    On 05/03/2023 22:32, João Távora wrote:
     > To clarify, i think the thin commands and the keybinds should be
    in the
     > major modes, but these commands should be thin and use xref as a
     > library. And the backend should be Eglot's,  if it happens to be
     > managing the buffer via LSP, else out can be whatever the major
    modes
     > sets up.

    xref-find-declarations should be bound by major modes? Which modes?


No, you misunderstand. I wrote "commands and keybinds should be in the major mode". Xref-find-declarations should not exist, because declaration is not a universal thing common to all languages. That was Helmut's point AFAIU, and i agree with it.

Okay, let's follow on with that idea.

Which modes? The ones where "declaration" is a thing.

So we'll have a dozen different commands called 'xxx-find-declarations' which will be implemented the same (?) way? Bound to the same key sequence?

If there a particular point to doing that? Do we expect other modes to reuse the same binding to do something else? That will reduce UI consistency, at the very least.

IOW xref should try to stay language-agnostic, but provide common framework for language-specific things like major modes to reach backends like Eglot or anything else

Most programming languages have something that corresponds to the term "declaration".

Mind you the same point made for xref can be made about LSP, language-agnostic on paper, but many a language-specific concept poorly disguised in there. But I see no reason to copy that flaw.

I don't mind the idea of extensibility (and packages like lsp-mode do this already: IIRC they have commands called lsp-find-declarations and lsp-find-implementations).

But insofar as languages do have shared syntactic concepts, I don't see why we wouldn't want to include more common ones.



reply via email to

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