Fix failing "Go to Definition" for some types#994
Merged
Conversation
Collaborator
|
This looks great, thanks! (And thanks in advance for keeping track of the other issues.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ProjectSettingsopens, but it's missing a bunch of properties.This happens because of this:
godot-vscode-plugin/src/providers/documentation_builder.ts
Line 144 in e99adb0
ProjectSettingshas 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:The regex character class
[A-z_0-9]does not match/(ASCII 47 is outside theA=65 toz=122 range). Sopartsisnull, the function returnsundefined, and the caller crashes onelements.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.