Skip to content

GDScript: Add "Quick Fix" to create function stub matching signal connection - #124417

Open
Meorge wants to merge 3 commits into
godotengine:masterfrom
Meorge:feat/code-actions-signal-stub
Open

Meorge wants to merge 3 commits into
godotengine:masterfrom
Meorge:feat/code-actions-signal-stub

Conversation

@Meorge

@Meorge Meorge commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What problem(s) does this PR solve?

Additional information

Note

This PR is dependent on #121338 being merged first. It looks like the branch, and thus the PR itself, include #121338's commits in it so this could technically be merged on its own and it would supersede #121338. But I think it would be better to merge #121338 on its own first, then have these changes reviewed and merged separately.

This PR adds a "Quick Fix" code action, which detects when a non-existent function name is provided to a Signal.connect() call, and creates a function stub with the signal's signature below the current function.

Godot.-.CA.Signal.Stub.mp4

To Do

  • Confirm signal detection works when the signal belongs to the script class (i.e., defined with signal some_name(...) up above in the file)
  • Confirm signal detection works when the signal is from the class the script inherits from (i.e., script has extends SomeOtherClass)
  • Move detection/construction of code actions from gdscript_analyzer.cpp into push_error(), perhaps by adding a "code action hint" optional parameter to push_error()
  • Ensure a code action that aims to insert text at the end of the file creates space for it
  • Create tests
  • Respect type hint settings for created function arguments and return type

@Meorge

Meorge commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Tests have been added!

@Meorge
Meorge force-pushed the feat/code-actions-signal-stub branch from 46c093d to bae13fc Compare October 17, 2026 04:46
@Meorge Meorge changed the title GDScript: Add "Quick Fix" to create function stub matching signal connection (WIP) GDScript: Add "Quick Fix" to create function stub matching signal connection Oct 17, 2026
@Meorge
Meorge marked this pull request as ready for review October 17, 2026 04:46
@Meorge
Meorge requested review from a team as code owners October 17, 2026 04:46
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.

2 participants