Focus shader text editor when opened with quick open dialog
This is my first PR to the project so don't hesitate to ask me for improvements or any kind of modification.
I was a little bit annoyed that opening a shader with the Quick open dialog didn't focus it in the editor, so I added a line to focus the editor when opening a shader.
I'm not sure all the case are handled so feel free to comment on that.
I approve, this matches the behavior of the script editor.
I wondered how I could make this changed merged. Shall I add it to the next call agenda ?
@MartinDelille First off congrats on your first PR! Currently it's beta phase so there's a feature freeze. Your PR counts as a feature so it will have to wait until 4.4 stable is released.
Thank you for the feedback @paddy-exe !
I moved the focus grab to _switch_to_editor so it handles ShaderIncludes. The focus is indeed taken when the editor is loaded but I don't know how I can prevent that. Does it look acceptable now ?
Does it look acceptable now ?
You need to squash the commits, if it's ready - see https://contributing.godotengine.org/en/latest/organization/pull_requests/creating_pull_requests.html#modifying-a-pull-request
Done: e761c718f095818645d3e32e3c2fd4a8661ef12b
Has I said there is a little side effect: when reponing a project with opened shader, the shader editor will be focused. I think this is can be acceptable. If not I would appreciate a hint to optionally do the focus at startup. I think I would need to add the p_focus parameter to the edit() method but since it is an overriden method from the EditorPlugin class, it might have implication elsewhere.
I fixed the shader editor focus on startup using the restoring_layout member variable. What do you think about it ?
Thanks! Congratulations on your first merged contribution! 🎉
I'm so proud! Thank a lot for reviewing! ❤️