Analyze GDScript dependencies recursively when doing autocompletion #84266
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.
Second part of fixing #78003
Related to #84264
To allow for cyclic references Godot does not analyze other scripts when references to them are found in a script, since this recursive approach would lead to problems with cyclic references.
This also means that other
CLASS
types are not necessarily completely resolved when they are encountered since they are basically a "shallow" reference. This is fine for running GDScript, but when doing autocompletion it means that we can't get the type for interfered type chains, since this type would be generated by the analyzer in conjunction with the interfered types from analyzing the dependencies.My idea to solving this, is to change analyzer behavior when doing autocompletion, to recursively resolve dependencies. In edge cases with cyclic references this might fail, but this would only mean we can't provide autocompletion for it. And those cases wouldn't receive completion at the moment anyway.
That said I'm unsure about this implementation. I suspect it may lead to error spam in certain edge cases. I couldn't find one until now however.