Skip to content

Introduce EditorLanguage and move ScriptLanguage::complete_code into it.#117946

Open
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
HolonProduction:editor-language-kickoff
Open

Introduce EditorLanguage and move ScriptLanguage::complete_code into it.#117946
HolonProduction wants to merge 1 commit intogodotengine:masterfrom
HolonProduction:editor-language-kickoff

Conversation

@HolonProduction
Copy link
Copy Markdown
Member

Initial boilerplate for godotengine/godot-proposals#14566

This PR introduces EditorLanguage and moves complete_code into it.

Data structures related to completion remain in ScriptLanguage for the time being and will be moved in a followup.

AI DisclosureGH Copilot was used to do some of the refactoring and boilerplate. This was done in an interactive VSCode Chat session with automatic model selection. I did go into this with a clear idea and instructed the AI with individual steps for which I verified and adjusted the results. None of the comments are written by AI.

Copy link
Copy Markdown
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, complete_code in an extension still works.

Comment thread modules/gdscript/gdscript_editor.cpp
* Note: This class is unstable and work-in-progress, stability is only ensured for the things currently exposed through `ScriptLanguageExtension`.
* The goal is to move all editor functionality out of `ScriptLanguage` over time.
*/
class EditorLanguage {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a little generic and could be confused for localization.
What do you think about DocumentEditorLanguage? This way it is more connected to the built in editor too (after we rename the classes to use document #28607 (comment))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My issue with a longer name is that it will be pretty annoying for accessing nested types and enums. Maybe we could put it in a namespace to disambiguate, but I guess that would be bad for exposing it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think DocumentEditorLanguage is too long, its even a character shorter than ScriptLanguageExtension. There's also always autocomplete.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comparison isn't really fair. DocumentEditorLanguageExtension is longer than ScriptLanguageExtension. Although we might be able to just make the basetype hold all the GDVIRTUAL methods instead of having an extension wrapper 🤔 In that case DocumentEditorLanguage would be fine I guess.

Comment thread editor/script/editor_language.h Outdated
Comment thread editor/script/editor_language.h Outdated
Comment thread modules/gdscript/editor/editor_language.h Outdated
@HolonProduction HolonProduction force-pushed the editor-language-kickoff branch from a77f235 to ac50500 Compare April 2, 2026 15:15
Copy link
Copy Markdown
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Can be continued in follow ups.

@kitbdev kitbdev modified the milestones: 4.x, 4.7 Apr 2, 2026
@@ -36,6 +36,10 @@
#include "core/variant/native_ptr.h"
#include "core/variant/typed_array.h"

#ifdef TOOLS_ENABLED
#include "editor/script/editor_language.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't include editor files in core/.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of can't are we talking about? Is there a technical reason for it, or are we just talking about bad architecture?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #53295

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So architecture. Sure it's not measurable in includes, but the fact that editor functionality is part of ScriptLanguage is breaking encapsulation in a worse way than this IMO. As described in godotengine/godot-proposals#14566 the idea is to remove this association once all editor functionality has been removed (at this point the adapter code could be moved into the editor as well). So for me this is a worthwhile temporary tradeoff.

@HolonProduction HolonProduction force-pushed the editor-language-kickoff branch from ac50500 to 1a2b1e5 Compare April 12, 2026 10:18
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.

4 participants