Use already opened buffer to goto definition/declaration if possible #12947
Unanswered
alexlnkp
asked this question in
Troubleshooting
Replies: 1 comment
-
What version of helix are you running? I haven't been able to reproduce this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently there's this rather annoying quirk:
If You have a few files open, say,
main.c
anddata.h
, and inmain.c
you include some struct fromdata.h
, then you canmiw
andgd
to goto definition of the struct to find out its fields/change the fields/anything really. The problem is that upon pressinggd
a completely new, separate buffer is opened for the samedata.h
. The only difference between the two is that the one opened bygd
has absolute path specified to it.This wouldn't be half as bad if it just littered the buffer list, I'd be able to live with that. The issue is that it's pretty easy to blindly switch to either of the buffers without fully realizing it, and that is an issue since now You need to do a
reload-all
every time you switch the buffers, just in case.Doing
gd
even on the symbols that are local to the current file (i.e. if you have a globalint x
in currently focused buffer and thengd
on it), then the another buffer is opened as well instead of just jumping to the definition.Now imagine if you modified one of those buffers somewhere in the beginning, but didn't write out the changes yet (or maybe you did, but forgot to
reload-all
afterwards). You get distracted by your build system and come back a little bit later. You open the other buffer and start writing stuff somewhere at the end of file, not knowing that now the two buffers diverge. Eventually You notice it, but the damage has already been done at that point, and all of that because You were looking at the contents of your file and not at the bottom left corner, where the buffer name resides. This is what happened to me a few times and it's quite frustrating, so I'd really appreciate if this gets somehow addressed, either by providing a config forg*
or just making lookup be performed in an already opened buffer by default.I tried searching for this but didn't manage to find any issues or PRs related to this.
I propose just checking list of currently opened buffers and searching it for definitions/declarations/etc first, and only then looking globally on the system.
Beta Was this translation helpful? Give feedback.
All reactions