godotengine / godotengine/godot
Autocomplete following `func ` does not display options until user begins typing name
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in v4.8.dev.custom_build [8bc207870]
### System information
Godot v4.8.dev (8bc207870) - macOS Tahoe (26.6.2) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M4 Pro (Apple9) - Apple M4 Pro (14 threads) - 24.00 GiB memory - CoreAudio (44100 Hz, Stereo/mono)
### Issue description
On my computer, when running tests with
```
godot --test -ts="*[GDScript]*"
```
I get the following failures:
```
TEST SUITE: [Modules][GDScript][Completion]
TEST CASE: [Editor] Check suggestion list
./modules/gdscript/tests/test_completion.h:211: ERROR: CHECK( include.is_empty() ) is NOT correct!
values: CHECK( false )
logged: An autocompletion option is missing for '.../godot/modules/gdscript/tests/scripts/completion/common/override_function_static.gd'.
./modules/gdscript/tests/test_completion.h:211: ERROR: CHECK( include.is_empty() ) is NOT correct!
values: CHECK( false )
logged: An autocompletion option is missing for '.../godot/modules/gdscript/tests/scripts/completion/common/override_function_full_name.gd'.
===============================================================================
[doctest] test cases: 6 | 5 passed | 1 failed | 1420 skipped
[doctest] assertions: 58725 | 58723 passed | 2 failed |
[doctest] Status: FAILURE!
```
To further test this, I copied the `override_function_static.gd` file and `class_a.notest.gd` file it relies on into a Godot project and tried triggering autocompletion for it a few different ways.
https://github.com/user-attachments/assets/131590a8-6809-457b-b6e7-01d0be81c91b
It seems very inconsistent:
- Sometimes `static func ` doesn't provide any autocompletion at all. If I start typing a name, such as with an `_`, then autocompletion does start, and I can backspace the `_` to get the options.
- Occasionally, `static func ` provides a seemingly unfiltered list of candidates.
This inconsistent behavior appears to also happen with just `func` - typing `func` on its own, I frequently get no suggestions until I begin typing a name, at which point the autocomplete begins to work.
### Steps to reproduce
Use the following files:
```gdscript
# class_a.gd
extends Node
class InnerA:
class InnerInnerA:
enum EnumOfInnerInnerA {
ENUM_VALUE_1,
ENUM_VALUE_2,
}
enum EnumOfInnerA {
ENUM_VALUE_1,
ENUM_VALUE_2,
}
signal signal_of_inner_a
var property_of_inner_a
func func_of_inner_a():
pass
enum EnumOfA {
ENUM_VALUE_1,
ENUM_VALUE_2,
}
signal signal_of_a
var property_of_a
func func_of_a():
pass
func _func_of_a_underscore():
pass
static func func_of_a_static():
pass
func func_of_a_args(a: int):
pass
func func_of_a_callable(call := func():
var x_of_a = 10):
pass
```
```gdscript
# override_function_static.gd
extends "res://class_a.gd"
```
Open `override_function_static.gd` in the script editor and start typing `static func `. The autocomplete behavior will be inconsistent, as seen in the video above.
### Minimal reproduction project (MRP)
See above
Contributor guide
Research direction
Start with modules/gdscript/tests/test_completion.h and the [Editor] Check suggestion list case, then reproduce with modules/gdscript/tests/scripts/completion/common/override_function_static.gd and the provided class_a.gd fixture. Compare completion after `static func ` and `func`; done means the expected options appear without first typing a function-name character and the completion test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100