Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom word separators break GDScript Symbol lookup via context menu #94195

Open
HolonProduction opened this issue Jul 11, 2024 · 2 comments
Open

Comments

@HolonProduction
Copy link
Member

Tested versions

v4.3.beta3.official [82cedc8]

System information

Godot v4.3.beta3 - Fedora Linux 40 (Workstation Edition) - Wayland - Vulkan (Forward+)

Issue description

When configuring a custom word separator (as implemented in #92514) it is not possible anymore to lookup a symbol containing this separator (only applies to code lookup via context menu, since for some reason calculating words for lookup isn't consistent, maybe this should be the job of the ScriptLanguage and not the CodeEdit 🤔).
You can even end up on in wrong places if the part after the separator matches another lookup target.

var my_print
my_print # looking up over print will bring you to the print docs if _ is configured as separator

Steps to reproduce

  • configure a custom separator in the editor settings
  • name a variable containing this separator
  • spell it out
  • try to look it up

Minimal reproduction project (MRP)

Only contains a script where you can observe it, the editor settings need to be tweeked manually.

lookup.zip

@vgezer
Copy link
Contributor

vgezer commented Jul 14, 2024

I can confirm this. Ctrl + click points to the correct definition, but right clicking on "print" brings the print documentation. Any ideas how can I fix this?

@HolonProduction
Copy link
Member Author

The not easy, but probably better from a design standpoint, solution:
Rework the whole system, so that word separation for symbol lookup is handled by the ScriptLanguage (or let the script language provide a set of separators).

The quick and dirty fix:

  • the context menu entry uses get_word_under_caret
  • the ctrl + click combination uses TextEdit::get_word_at_pos
  • one works the other not, so just change the not working one to the working one

TextEdit::get_word_at_pos not respecting custom word separators might be a bug on its own though. Not sure 🤷

Or maybe the custom separator usage could be turned of while using the context menu, but that sounds a bit hacky to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants