godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.26k stars 101 forks source link

Engine and GDExtension api surface as a set of gd files #12641

Open van800 opened 2 weeks ago

van800 commented 2 weeks ago

Describe the project you are working on

I am working on a JetBrains Rider integration with Godot

Describe the problem or limitation you are having in your project

In a JetBrains Rider plugin, I use a custom GDScript parser to provide support for both user code and the foundational Godot class set. The latter is generated from the [XML files in the Godot repository], which works well for built-in engine classes.

However, this approach breaks when GDExtension modules are involved. Since their APIs are not represented in the XML files, the plugin lacks the necessary type and member information to provide accurate code analysis, navigation, and completion. To support GDExtensions properly, I would need a way to obtain a similar API surface — either by parsing metadata or by generating .gd stubs on the user’s side.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

To resolve this, I propose contributing a mechanism to the Godot engine itself that would allow automatic generation of .gd API stubs for both built-in and GDExtension-based classes. These stubs would be helpful for language tooling, allowing external editors or IDE plugins to provide accurate support without needing deep runtime introspection or reverse-engineering.

This feature would:

Unify the handling of built-in and GDExtension classes in external tools.

Encourage broader support for GDExtensions in external development tools like Rider, VS Code, etc.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Similar to --gdextension-docs.

If this enhancement will not be used often, can it be worked around with a few lines of script?

-

Is there a reason why this should be core and not an add-on in the asset library?

-

van800 commented 2 weeks ago

discussed in https://chat.godotengine.org/channel/gdscript?msg=HX3FBEyHWE36CaEqr

van800 commented 2 weeks ago

extension_api.json can't be considered a substitution for the gdscript api surface. There are at least some built-in constants and methods, which are not listed there. See https://github.com/godotengine/godot/issues/107824

van800 commented 2 weeks ago

I considered to try using xml docs, since those can be generated for both engine and gdextensions in the project. https://youtrack.jetbrains.com/issue/RIDER-127007/Different-approach-to-GD-sdk