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

Implement LSP didSave notify and rename request [3.x] #48616

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

Razoric480
Copy link
Contributor

@Razoric480 Razoric480 commented May 10, 2021

This is a companion to #48615, but for 3.x. This implements the textDocument/rename request for the language server to find symbols such as function names, variables, properties, signals and otherwise, and rename them wherever they match the original symbol.

As a companion, this also adds the textDocument/didSave notification. This is because, by the time the text changes are received by the client, none of the variables have been renamed internally, which results in error. But saving the scripts SHOULD re-trigger a parsing of all changed scripts and thus find the new property names. However...

Known Issue

The 3.x parser is not as good as 4.0's, and so does not re-parse from the parent class variable names, even if they have changed. It requires the script to get validated, which does not happen even with a change in the filesystem.

Workaround

Open the parent class' script in Godot editor, which triggers a validation. Then going back to the LSP client clears the errors, after a save.

This seems to have been fixed by the most recent change, where we also reload the script resource's state for #50510.

@akien-mga akien-mga merged commit 6304709 into godotengine:3.x Aug 4, 2021
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants