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

Editor: Fix Ctrl+Click on enum values ​​does nothing #101127

Merged

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Jan 4, 2025

@dalexeev dalexeev force-pushed the gds-edit-fix-enum-value-ctrl-click branch from 71add55 to 4cef91e Compare January 4, 2025 14:29
@HolonProduction
Copy link
Member

This doesn't work across preloaded scripts. It jumps to the right line but not to the right file.

# a.gd
enum Test {
    E1,
    E2,
}
# b.gd
const A := preload("a.gd")

func _init():
    A.Test.E1 # Looking up E1 here doesn't jump to a.gd

@akien-mga
Copy link
Member

const A := preload("a.gd")

func _init():
    A.Test.E1 # Looking up E1 here doesn't jump to a.gd

Tested this, it seems to also be reproducible in 4.3.stable.

If you can confirm, I think we could still merge this PR as a regression fix, and open a new issue for the problem of preloaded scripts?

@HolonProduction
Copy link
Member

In 4.3 enums values seem to jump to the documentation, which apparently only works if the script (a.gd) has a class_name, if this isn't the case it just doesn't jump. That's probably worth to open an issue about, but it is different problem than jumping to the right line in the wrong file.

@HolonProduction
Copy link
Member

After #91060, the lookup result produced for enum values in this case is just wrong, this PR tries to fix it by setting the right line and while this might fix the jump (if paired with also setting the right script) it doesn't fix the wrong lookup result, which still points to a class constant of a.gd with the same name as the enum value. For some reason, as long as no such class member exists the editor still targets the enum value for documentation tooltips (we should investigate that, it seems wrong to me), but if such a class member exists the doc tooltip will prefer it over the enum value.

Let's say I add a new constant to a.gd like this:

# a.gd

## :)
const E1 = "test"

enum Test {
    E1,
    E2,
}

I'll get this tooltip:
image

That's the underlying issue we should fix IMO. #101089 is just a symptom of it, from how I understand the code.

@Repiteo Repiteo merged commit 0b6a717 into godotengine:master Feb 4, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Feb 4, 2025

Thanks!

@akien-mga
Copy link
Member

This was approved and merged a bit fast without taking into account the bug @HolonProduction identified above, and the competing PR they opened: #102401.

@dalexeev dalexeev deleted the gds-edit-fix-enum-value-ctrl-click branch February 4, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl-Click on enum value/member does nothing
5 participants