godot icon indicating copy to clipboard operation
godot copied to clipboard

Add shortcut for Lookup Symbol action

Open laspencer91 opened this issue 1 year ago • 3 comments

Closes #86773

  • Allows keyboard navigation by symbol lookups.
  • Performs the same functionality as CTRL + Click on a symbol.

This shortcut is essential for users who desire mouseless navigation in the code editor.

laspencer91 avatar May 03 '24 06:05 laspencer91

I think this line

context_menu->add_item(TTR("Lookup Symbol"), LOOKUP_SYMBOL);

Should be changed for:

context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_symbol"), LOOKUP_SYMBOL);

That way, the context menu will have the right name and shortcut.

Currently with this PR: image

image

That will rename the option "Lookup symbol" for "Go to symbol" in the context menu which is probably better and more standard with the other items in the "Go to" menu in my opinion.


Also, I'm not sure about Ctrl-Alt-Enter as the default shortcut. That shortcut is used by VMWare and Remote Desktop to send Ctrl-Alt-Del to the remote machine. I did not personally seen this shortcut be used in an editor? The default in VSCode and Visual Studio. In IntelliJ and Rider, it's Ctrl-B I think, maybe Ctrl-B ?

Hilderin avatar Jul 08 '24 15:07 Hilderin

Approved in principle but a bit too fast - @Hilderin's feedback above is good and should be taken into account before merge.

akien-mga avatar Sep 09 '24 07:09 akien-mga

Also, I'm not sure about Ctrl-Alt-Enter as the default shortcut. That shortcut is used by VMWare and Remote Desktop to send Ctrl-Alt-Del to the remote machine. I did not personally seen this shortcut be used in an editor? The default in VSCode and Visual Studio. In IntelliJ and Rider, it's Ctrl-B I think, maybe Ctrl-B ?

I agree Ctrl+Alt+Enter seems unconventional. I don't think we can use Ctrl+B though, AFAIK it's used for going to the next bookmark: https://docs.godotengine.org/en/stable/tutorials/editor/default_key_mapping.html (And on macOS for running the project, which may clash with the bookmark one already?)

akien-mga avatar Oct 04 '24 09:10 akien-mga

In VSCode, at least, Go To Definition (which i believe is the closest thing to the "Lookup Symbol" feature) is bound to F12 by default.

Besides, i think it will be better not to block this feature on some bikeshedding around the default shortcut. If there's no clear "winner", let the shortcut be unbound by default until a consensus is reached.

elenakrittik avatar Dec 25 '24 17:12 elenakrittik

@laspencer91 This feature seems needed by a lot of users. Do you think you could rebase and make the adjustment suggested? If not, it will be my pleasure to finish it.

Hilderin avatar Jan 06 '25 13:01 Hilderin

Superseded by https://github.com/godotengine/godot/pull/101565. Thanks for the contribution!

akien-mga avatar Jan 17 '25 19:01 akien-mga