Skip to content

Add find all references to the script editor#118061

Open
Scrawach wants to merge 1 commit into
godotengine:masterfrom
Scrawach:feature-find-usage
Open

Add find all references to the script editor#118061
Scrawach wants to merge 1 commit into
godotengine:masterfrom
Scrawach:feature-find-usage

Conversation

@Scrawach

@Scrawach Scrawach commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Examples

menu-example
example-1.mp4
example-2.mp4

How it works

At first, it search for all scripts containing the specified pattern, using logic from Find in Files. Then, it try trace back using lookup_code of the found pattern in script. If it's successfully, it's reference. There are some edge cases that had to be handled separately: local variables/constants and global class names.

And I'm not sure how search for overridden methods should work.

@Scrawach Scrawach requested review from a team as code owners April 1, 2026 08:48
@Nintorch Nintorch added this to the 4.x milestone Apr 1, 2026
@Scrawach Scrawach force-pushed the feature-find-usage branch 4 times, most recently from e23df3a to 87a7ea7 Compare April 1, 2026 10:58
@Scrawach Scrawach requested a review from a team as a code owner April 1, 2026 10:58
@Scrawach Scrawach force-pushed the feature-find-usage branch 2 times, most recently from cecaecf to 01e8e64 Compare April 1, 2026 13:22
@Scrawach Scrawach marked this pull request as draft April 1, 2026 14:47
@Scrawach

Scrawach commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Found an issue here with reference searching for inherited classes methods. So I'm switching PR to draft for now, until it's resolved.

@Scrawach Scrawach force-pushed the feature-find-usage branch 2 times, most recently from 9f98820 to 360d65f Compare April 2, 2026 12:11
@Scrawach Scrawach marked this pull request as ready for review April 2, 2026 12:33
@Scrawach

Scrawach commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Find All References for overridden methods shows not only method usages, but also base and derived methods (without usage, just methods from classes). Essentially, these are references too, but I'm not sure about this behavior. It might make sense to show only the usages, excluding base or derived ones. 🤔

Comment thread editor/script/find_in_files.h Outdated
Comment thread editor/script/find_in_files.cpp Outdated
Comment thread editor/script/find_in_files.cpp Outdated
Comment thread doc/classes/ScriptEditorBase.xml Outdated
Comment thread editor/script/find_in_files.cpp
Comment thread editor/script/find_in_files.cpp
Comment thread editor/script/find_in_files.h Outdated
Comment thread editor/script/find_in_files.cpp Outdated
@Scrawach Scrawach force-pushed the feature-find-usage branch from 360d65f to 3991afa Compare April 13, 2026 21:21
@KoBeWi

KoBeWi commented Apr 27, 2026

Copy link
Copy Markdown
Member

Related: #117949

The idea here seems the same (didn't look at the code), so it could be used as a base for renaming.

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.

Add "go to reference" functionality to the script editor

4 participants