-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Refactor code editors #28607
Comments
Reopening, as the PR that will close #31739 doesn't resolve this issue. The refactoring work so far only touched CodeEdit and TextEdit, it's not related to editor classes. |
There have been improvements but there's still more work pending here. Won't happen for 4.0 though, and doesn't need to be tied to a specific milestone as it's internal refactoring. |
This will probably be my main focus for now, given Given this is going to be quite a large refactor, it would be ideal if as part of these changes we can hit several big features / proposals at the the same time. This is the roughly the current class diagram: Several pain points are:
The main feature, that is currently not possible that I'd like to tackle as part of this, is godotengine/godot-proposals/issues/414 allowing split views and having the same file open multiple times. Secondly, the Bear in mind this might change as I get into the details, I'm also not expecting to need to create all the classes on the following diagram but should serve as a guide / context for what I would like to move towards:
Having the |
This comment was marked as resolved.
This comment was marked as resolved.
Yes, still under heavy WIP, see: https://github.com/Paulb23/godot/tree/script-editor-resource |
Godot version:
3.1.x
Steps to reproduce:
script_text_editor.cpp
shader_editor_plugin.cpp
text_editor.cpp
What these 3 files have in common is that they implement literally the same thing 3 times. Some examples:
Same set of enums:
godot/editor/plugins/script_text_editor.h
Lines 99 to 104 in 21e2419
godot/editor/plugins/shader_editor_plugin.h
Lines 72 to 77 in 21e2419
godot/editor/plugins/text_editor.h
Lines 64 to 69 in 21e2419
Same edit menu:
godot/editor/plugins/shader_editor_plugin.cpp
Lines 502 to 508 in 21e2419
godot/editor/plugins/text_editor.cpp
Lines 577 to 584 in 21e2419
godot/editor/plugins/script_text_editor.cpp
Lines 1581 to 1587 in 21e2419
Same menu actions:
godot/editor/plugins/shader_editor_plugin.cpp
Lines 245 to 250 in 21e2419
godot/editor/plugins/text_editor.cpp
Lines 358 to 365 in 21e2419
godot/editor/plugins/script_text_editor.cpp
Lines 924 to 931 in 21e2419
There's muuuch more of it. And the worst part is when you want to add some feature to code editor. You basically need to repeat the code 3 times.
IMO the editors should be refactored to cut the repetitions as much as possible. There are differences here and there, but I bet it's possible to rewrite them in a way that doesn't repeat 80% of lines 3 times.
The text was updated successfully, but these errors were encountered: