godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.17k stars 98 forks source link

Retain script being edited as unique in each scene tab in the same way find/replace is unique to each tab editor instance #2282

Open invisiblesun opened 3 years ago

invisiblesun commented 3 years ago

Describe the project you are working on

I am doing game development using godot 3.2

Describe the problem or limitation you are having in your project

Scene tabs have their own Find context, but do not retain the script being edited. In my case I am often working on several scenes where I am editing the scripts of the children of the scene. Clicking on a scene resets the edited script to that of the root node. I lose most of my context by having to constantly re-select the node I was just editing.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I think retaining the script file being edited to the scene tab instance may solve this issue cleanly in the same way that the search terms of find and find/replace are unique and retained for each scene tab script editor.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I don't think 2 this is too difficult to code because each scene tab already maintains a unique context of find/replace. Extending the code to retain script being edited then referencing that value on a tab switch to check if that script may be displayed would suffice I think, if it cannot then the current behavior is fine.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Anyone editing more than one scene that has child node scripts will benefit.

Is there a reason why this should be core and not an add-on in the asset library?

Yes as part of the editor basic workflow.

Calinou commented 3 years ago

in the same way that the search terms of find and find/replace are unique and retained for each scene tab script editor.

Actually, this behavior doesn't seem to be desired by most people. Most other code editors will share the search/replace texts across tabs. Someone attempted to change this in the past, but it was deemed too difficult to do for now: https://github.com/godotengine/godot/pull/28793

invisiblesun commented 3 years ago

I agree that search would be nicer as a global context, I would vote for that. However, I refer to it in the sense that code already exists to provide a per-scene tab/panel find/replace context and that this might be extended to handle remembering the actively edited script for that context.