Completion in TextEdit Node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By skitzoid

Hi, I’d like to know how to utilise the completion feature in the TextEdit Node.
It appears as if we should be able to access code completion since the node has a signal called request_completion and the override properties show:

  • completion_lines
  • completion_max_width
  • completion_scroll_width

There’s even styles like:

  • completion_background_color
  • completion_existing_color
  • completion_font_color
  • completion_scroll_color
  • completion_selected_color

But the docs mention nothing on how to use the TextEdit node’s completion. I’d like to utilise the autocomplete feature without having to dig through C++ and extract out a custom control.

It’s interesting question and nicely formatted. I’ll try to discover something tomorrow

USBashka | 2022-07-30 13:34

:bust_in_silhouette: Reply From: USBashka

Uhh. Unfortunately, TextEdit functional is very limited in GDScript and you can’t setup custom autocompletion directly. In 4.0 however code functional was moved to the brand new CodeEdit that gives full control (see the docs it’s really cool)

So the possible solutions is

  • Wait for Godot 4.0 (at least the first beta)

  • Somehow catch the node with complition options and manipulate them

  • Make your own autocomplete menu and update it when get_word_under_cursor() matchs something

Beautifully said, and nicely formatted.
CodeEdit looks exciting, I just wonder how long it’ll take until Godot 4.0 is stable.
Thanks for investigating and even explaining possible solutions :slight_smile: ~ For the meantime I think it’ll be easiest to make a custom auto-complete menu
Cheers for the help

skitzoid | 2022-07-30 15:58

The beta is going to release in early September, so I expect to see stable 4.0 in the end of the year (but for me it’s okay to start using it from the first beta)

USBashka | 2022-07-30 16:05