Making or embedding code editor in Godot

Godot Version

v4.4.1.stable.mono.official [49a5bc7b6]

Question

I need a code editor (of some form) in my Godot game. I’ve tried CodeEdit node, but it seems quite difficult to work with (especially with code completion).

Is it better to work with the CodeEdit node or instead try to embed a lightweight existing editor?

Either way, please also help me with resources or guides for their implementation. Thank you in advance!

I’m pretty sure CodeEdit is what Godot uses itself for its IDE.

What are you actually hoping to use this for? The answer you’re looking for may vary widely depending on whether you’re going to use it to add small scripts to a large number of objects, or make large, complex scripts. Also on what language you’re hoping to offer.

1 Like

So I need it to support Lua with custom library, but these library are written in C# so I’m planning to just use stub file for them.

I haven’t tried doing this, but my gut feeling is you may be in for a bit of a fight with CodeEdit due to the differences between Lua and GDScript formatting. I’m not sure how well code highlighting will work, or how to connect it to a language server.

The best option might actually be to dive under the hood and look at the C++ code that implements CodeEdit. Either you’ll see how to make it support Lua, or you’ll need to clone it into a LuaCodeEdit and customize it for your needs.

I see, thank you for your insight. Have a good day! ^^

Oh yeah, since this question is unlikely to get resolved, can you point me to resources or code snippet for basic auto completion? Thank you!