Open bitbrain opened 2 years ago
Problem 3: only gdscript and shaders are supported. This seems to be a general limitation by Godot, as many games also come with .json, .csv or other files (e.g. translations) but I am unable to search across them.
You can change the file extensions that can be searched in the Project Settings.
To avoid the need for this setting, I suppose we could make Godot search in all resource files that are not binary (and exclude .tscn
), but detecting this can take some work.
Can we rename "file mask" to something like "include paths"? where you can specify the directory's or file types to be searched via globbing?
I've been working on this a bit. It has been on my list of things I wanted to try for a while now - and I love me some Jetbrains find-replace :) So why not? It has been fun!
@EricEzaM any chance you can raise a PR for this?
Hi @bitbrain, unfortunately I am not in the position to continue work on this feature. My branch is here for anyone who wishes to either continue where I left off or use some of my code in their own implementation. Please note it has not been rebased to latest develop, so if you checkout this branch it will be quite far behind master
, and when rebasing it there may be many conflicts.
https://github.com/EricEzaM/godot/tree/better-find-in-files
In the end I got the popup working quite well. I think I got a bit stuck with the performance of the tabbed window in the bottom dock when you requested to see the full results - I think I tried Tree
and ItemList
and due to the lack of virtualisation performance of the editor was very poor when trying to view 1000+ results. Like JetBrains apps, the popup limited results to 100 rows so it remained very responsive. I implemented the popup which says "there are a lot of results (1000+), are you sure you want to continue the search?", but even if you selected no, and it showed 1000, the UI was basically unusable.
The searching was done by offloading the searching work to a background thread, and there was a thread-safe API to access search status and results. This seemed to work well.
One day I may be able to return to work on this feature again but it likely won't be soon - sorry about that. I guess this is part of the open source experience™ 😂
Cheers
I've found some time/motivation and I am working on this again. Updates are available on the same branch linked above. It's getting there, but still quite a way to go before being 'done'.
https://github.com/godotengine/godot-proposals/assets/41730826/31c3839a-546c-4610-90cd-022faa223884
@EricEzaM would you mind raising a draft PR? This could accellerate the process and you could ask for feedback on implementation details.
Describe the project you are working on
I am working on an Untitled Single-Player 2D RPG where an adventurer explores a giant mountain area (project name: cave). The game consists of procedurally generated levels and custom built levels. All ported over to Godot 4.0! It comes with a lot of files that I am going to search (and replace) across when required:
This became especially apparent when upgrading to Godot 4.
Describe the problem or limitation you are having in your project
After working on my game for almost 2.5 years I have a lot of files. Searching across all the files becomes cumbersome as it involves the following steps:
click on the Script tab (search not available in 2D/3D node view)
Press CTRL+SHIFT+F to open the "Search in files..." dialog and enter search term with a typo
It shows 0 results and I have to repeat the process
There are three problems for me with this approach:
Problem 1: too many steps to search what I want. When I am currently in a node somewhere I always have to click into the Script tab first to search across files.
Problem 2: search is not responsive enough. In IDEs such as IntelliJ it is possible to search and get "realtime" results for occurences. In Godot it is quite cumbersome to search because on typos or further searches I have to repeat the above steps.
Problem 3: only gdscript and shaders are supported. This seems to be a general limitation by Godot, as many games also come with .json, .csv or other files (e.g. translations) but I am unable to search across them.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
From anywhere within Godot Engine, pressing CTRL+SHIFT+R to open a dialog like this:
Once the user starts typing a scrollable list of results appears. Clicking on any result will switch the Godot view to the Script tab and open the file and jump to the affected line.
Optionally, the user can select a file mask (perhaps dropdown or cleartext, e.g. *.txt) to search across other files.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not really. This is a usability feature that would save myself a lot of frustration long-term.
Is there a reason why this should be core and not an add-on in the asset library?
Most of the functionality described here is already Core but not streamlined from a UX perspective. This proposal aims to change that. The only optional functionality could be the filemask as non-Godot files are currently not really supported within the Godot editor.