Skip to content

Fix failing "Go to Definition" for some types#994

Merged
DaelonSuzuka merged 1 commit into
godotengine:masterfrom
peterbozso:fix-924
Mar 13, 2026
Merged

Fix failing "Go to Definition" for some types#994
DaelonSuzuka merged 1 commit into
godotengine:masterfrom
peterbozso:fix-924

Conversation

@peterbozso
Copy link
Copy Markdown
Contributor

@peterbozso peterbozso commented Mar 13, 2026

Fixes #924

As explained in #924, "Go to Definition" doesn't work for some types.

There are three different problems described in that issue.

First problem

"Go to Definition" doesn't work for types with constructors and/or operators (like String or Vector2i).

This PR is a full fix only for this. Now those types get their documentation properly generated.

I also added a safeguard for the future: in case the LSP surfaces other properties not handled by this extension, the extension will still generate the documentation it can while printing the problem of unhandled property types to the debug log.

Second problem

"Go to Definition" doesn't work for types with properties containing multiple forward slashes (/) in their names, like ProjectSettings.

This is partially fixed in this PR too: the documentation for ProjectSettings opens, but it's missing a bunch of properties.

This happens because of this:

const parts = /\.([A-z_0-9]+)\:\s(.*)$/.exec(s.detail);

ProjectSettings has hundreds of properties with / in their names (e.g., application/boot_splash/bg_color, display/window/size/viewport_width). These come from the engine's ProjectSettings.xml doc file, where each engine setting is documented as a class member. The LSP produces detail strings like:

var ProjectSettings.application/boot_splash/bg_color: Color

The regex character class [A-z_0-9] does not match / (ASCII 47 is outside the A=65 to z=122 range). So parts is null, the function returns undefined, and the caller crashes on elements.index (line 242) with a similar TypeError.

After this PR is merged, I'll open a separate issue to track this.

Third problem

In the second half of this comment, I brought up a problem with navigation to TileMapLayer's methods. This bug is completely unrelated to the other two. I'll open a separate issue in the engine's repo to track that too.

@DaelonSuzuka
Copy link
Copy Markdown
Collaborator

This looks great, thanks! (And thanks in advance for keeping track of the other issues.)

@DaelonSuzuka DaelonSuzuka merged commit e39fc24 into godotengine:master Mar 13, 2026
4 checks passed
@Calinou Calinou added the bug label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot open some documents

3 participants