Conversation
|
does it also handle doc comments? if so that would be pretty cool. |
|
This is the number one feature request of the in-engine script editor, so I look forward to give it a spin! This is perhaps a stupid question, but I’m asking it anyway; what are the limitations of this simpler method? Or in other words, what cases can this simpler method never address that the more complex implementation by @adamscott’s PR can? |
Potentially, the alternative could detect symbol usages in more complex contexts. Like Essentially, this is assisted renaming, which is entirely justified for dynamic and gradually typed languages like GDScript. Our main goal is to eliminate false-positive detection of symbol usages (checkboxes should be automatically selected only for safe occurrences). False-negative detection is less of a problem; the user can manually check occurrences that the editor cannot confidently classify (due to dynamic context or implicit access). |
|
First of all: This is approach is totally valid, it's what the language server has been doing for years. IMO this should not live in editor code. We need to stop treating A few takeaways from the language server that might be relevant to this PR:
|
|
Another limitation is that |
|
Is it also acceptable that this simpler solution can be implemented as a stopgap in case users do want more than assisted renaming?
this is a pretty big caveat… hmm… |
|
I am writing to say that this is absolutely something we need. I go to VSCode to solve my godot problem, which is not what I like to do while working with godot. |
|
Every step towards any refactoring functionality within Godot is the right step. I would still love to see the other PR #102380 |
The simple approach won't work for that. It'd need to be implemented separately and is much more complex. |
| rename_input->set_theme_type_variation("TreeLineEdit"); | ||
| rename_input->set_custom_minimum_size(Vector2(200 * EDSCALE, 0)); | ||
| rename_popup->add_child(rename_input); | ||
| rename_input->connect("text_submitted", callable_mp(this, &ScriptTextEditor::_confirm_rename)); |
There was a problem hiding this comment.
| rename_input->connect("text_submitted", callable_mp(this, &ScriptTextEditor::_confirm_rename)); | |
| rename_input->connect(SceneStringName(text_submitted), callable_mp(this, &ScriptTextEditor::_confirm_rename)); |

Closes godotengine/godot-proposals#899
Probably supersedes #102380
This PR adds Rename Symbol functionality, which renames symbols. Unlike the other PR, I've taken a very simple approach: lookup the symbol to be renamed, do an exact Find in Files search, filter out results based on the lookup. Seems to perform well enough.
Differentiating class identifier from a string/comment:
dnHxeq4Gz5.mp4
Differentiating same-named local variables from different methods:
iNkwIAEcmH.mp4
I have tested it with my MetSys addon and it performs really well. The symbols can be renamed across files, and it even differentiates name aliases.

However I discovered a bug in the process (#117948), which makes some references incorrectly unmarked. You can still review the results manually and check them. (there shouldn't be false-positives, i.e. references checked, but belonging to other symbol)