Support Find Usages for Godot C# signals from definition

Godot uses a lot of source generators to automatically create bindings for the engine and user C# code. In particular, signals ("events") are declared by annotating a delegate type with an attribute:

[Signal]
public delegate void CardDrawnEventHandler();

This expands in a separate generated file to an event member called CardDrawn with add/remove accessors.

Currently I can only list usages of these event members by:

  1. Finding some existing usage of them, for example by textual search, or memorizing a place it's used;
  2. Go To Definition;
  3. This will take me to the generated code, which I then Find Usages on the member definition.

That's kinda annoying and error-prone, would be cool if there was an inlay or some other way of navigating to these uses directly from the [Signal] definition.

0
5 comments

Hello Leonardo,

I might be misunderstood the problem. Do you need to quickly find the usages of the [Signal] attribute? You can this via the “Find Usages” action invoked with a caret on “Signal”:

Another thing is that you can access the source-generated code from the solution explorer, this way:

If that doesn't help, please tell me. Have a nice day!

0

Hi Dmitry, thanks for your response.

Do you need to quickly find the usages of the [Signal] attribute?

No, I mean Find Usages for the code-generated member itself. As in, for a given ThingEventHandler signal definition, the Thing member: places that un/subscribe to it, and places that call it, like you would with a regular event member.

--- 

The exact UX is open, could be an inlay like how the Unity integraton's “asset usages” work, or just command-clicking/regular “Find Usages” on the delegate name searching for both usages of the delegate as well as the event, or anything like that.

I just would like to not have to go through the generated code file to find references.

0

So, just to be sure we are on the same page, you request an action for Find Usages of @CardDrawn EventHandler declared in the generated.cs from [Signal] attribute usage, is that correct?

In other words, the same as clicking “Find Usages” on @CardDrawn, but without needing to have its usage in current file and without needing to open the generated.cs:

0

Got it, thank you for the clarification. We have this corresponding feature request open on our tracker: RIDER-138363 FindUsages Godot C# signal in tscn

Please watch it for further updates. Have a nice day!

0

Please sign in to leave a comment.