[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding support for xref jumping to headers/interfaces
From: |
Spencer Baugh |
Subject: |
Adding support for xref jumping to headers/interfaces |
Date: |
Fri, 24 Feb 2023 14:56:59 -0500 |
Hi,
xref provides support for jump-to-definition, but no support for
jump-to-interface. The latter would jump to the header or interface
file for an identifier. This functionality exists in some packages
already because it is particularly important in some languages, and I'm
looking for suggestions on how to expose it through xref.
For example, merlin, for OCaml, supports both jump-to-definition and
jump-to-interface. However, merlin's xref support only exposes
jump-to-definition (through xref-find-definitions), because there's no
natural way to expose jump-to-interface through xref.
It would be straightforward to extend xref with a new command
xref-find-interfaces. The main difficulty is picking a good UI to
expose this command. I've thought of a few options, but nothing that
seems obviously correct, so I welcome opinions.
Suppose there's a new command xref-find-interfaces. Then some options are:
1. xref-find-interfaces could be bound by default with some new binding.
I'm not sure what a good binding would be.
2. xref-find-definitions could call xref-find-interfaces if called with
a prefix argument. Note that this would change the current prefix
argument behavior of xref-find-definitions.
3. xref-find-definitions could call xref-find-interfaces if called after
some custom prefix is typed, like how other-window-prefix works.
4. xref-find-definitions could call xref-find-interfaces if a certain
customization variable is set.
5. Like option 5, but there could also be a new binding to
toggle that variable on and off.
I think the most satisfying of these is option 3, but maybe that's too
unusual of an interface for core Emacs?
Thoughts?
Thanks,
Spencer Baugh
- Adding support for xref jumping to headers/interfaces,
Spencer Baugh <=
- Re: Adding support for xref jumping to headers/interfaces, Eli Zaretskii, 2023/02/24
- Re: Adding support for xref jumping to headers/interfaces, Dmitry Gutov, 2023/02/24
- Re: Adding support for xref jumping to headers/interfaces, Stephen Leake, 2023/02/27
- Re: Adding support for xref jumping to headers/interfaces, Dmitry Gutov, 2023/02/27
- Re: Adding support for xref jumping to headers/interfaces, Yuan Fu, 2023/02/27
- Re: Adding support for xref jumping to headers/interfaces, Filipp Gunbin, 2023/02/28
- Re: Adding support for xref jumping to headers/interfaces, Richard Stallman, 2023/02/28
- Re: Adding support for xref jumping to headers/interfaces, John Yates, 2023/02/28
- Re: Adding support for xref jumping to headers/interfaces, Dmitry Gutov, 2023/02/28
- Re: Adding support for xref jumping to headers/interfaces, Konstantin Kharlamov, 2023/02/28