Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve autocompletion with get_node #79386

Merged

Conversation

HolonProduction
Copy link
Contributor

@HolonProduction HolonProduction commented Jul 12, 2023

Fixes #73638
Fixes #73164
Fixes #82592
Fixes (partially) #78860

by prioritizing annotated types over get_node. Also adds the script of the node if no type is annotated. Currently the sorting does seem broken with SCRIPT type though and the members won't show up at the top (#85239 should fix the sorting problem).

Through adding the script to the type this also
Fixes #82258

@HolonProduction HolonProduction requested a review from a team as a code owner July 12, 2023 17:35
@YuriSizov YuriSizov added this to the 4.2 milestone Jul 18, 2023
@dalexeev dalexeev modified the milestones: 4.2, 4.3 Oct 27, 2023
@HolonProduction

This comment was marked as duplicate.

@YuriSizov YuriSizov added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Oct 30, 2023
@YuriSizov
Copy link
Contributor

Hey, this needs a rebase against the up-to-date master.

@HolonProduction
Copy link
Contributor Author

Done

Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid PR. Fixes a lot of paper cuts with the GDScript editor.

@akien-mga akien-mga merged commit dc367be into godotengine:master Dec 5, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.2.1.

@YuriSizov YuriSizov removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Dec 5, 2023
@Henrique-Henrique
Copy link

Is it intentional for it to only work in the class body?

Captura de tela 2023-12-09 113531
Captura de tela 2023-12-09 113540

@HolonProduction
Copy link
Contributor Author

HolonProduction commented Dec 9, 2023

When resolving the type of a subscript access we call two different methods. One is meant to deduct the type of a get_node call on the the node which the script is attached to. This PR fixes this method to don't do this if the type is annotated.

If this method does not resolve a get_node call we try again with a more general purpose method to deduct the type of an identifier, icon_scope or icon in your case.

This method has the issue of always using the type of the last assigned expression (which is just Node for get_node) for local variables instead of the annotated type. It is a separate issue which is addressed in #85224 or #74888.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment