godotengine / godotengine/godot

The list of global groups don't always autocomplete when using group related methods

Open
#103,243 3 comments 0 reactions 0 assignees View on GitHub
bug topic:editor topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in Godot 4.4 RC 1

### System information

Godot v4.4.rc1 - Windows 11 (build 26100) - Multi-window, 1 monitor - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 4080 Laptop GPU (NVIDIA; 32.0.15.6117) - 13th Gen Intel(R) Core(TM) i9-13900HX (32 threads)

### Issue description

I was wondering if the situation below is intended behavior for the Godot script editor. The list of available global groups only appears in any of the group related methods for a node which is referenced using `$` or `%` notation.

This problem seems related to godotengine/godot#99277 and this summary (https://github.com/godotengine/godot/issues/86172#issuecomment-1860646328) of autocomplete issues in Godot.

I can understand not wanting to give incorrect options for an unknown node in the case of node.get_node() or animations in the case of animation_player.play(). However, no matter what node (given that it has been typed or casted as a Node) you are calling `is_in_group()` on, providing the list of global groups shouldn't do any harm.

### Steps to reproduce

I've provided several examples of where the autocomplete works in the Godot Script editor, and where it does not.

```gdscript
extends Node2D

@onready var test_node: Node = Node.new() as Node
@onready var control: Control = $Control
@onready var control_1: Control = %Control

func _ready() -> void:

is_in_group("globalTestGroup") # Gives list of options
get_tree().get_nodes_in_group("globalTestGroup") # Gives list of options
control.is_in_group("globalTestGroup") # Gives list of options
control_1.is_in_group("globalTestGroup") # Gives list of options

var this_node: Node = self as Node

self.is_in_group("globalTestGroup") # Doesn't give list of options
this_node.is_in_group("globalTestGroup") # Doesn't give list of options
Node.new().is_in_group("globalTestGroup") # Doesn't give list of options
test_node.is_in_group("globalTestGroup") # Doesn't give list of options

func test_func(passed_node: Node):
passed_node.is_in_group("globalTestGroup") # Doesn't give list of options

if passed_node is Node:
passed_node.is_in_group("globalTestGroup") # Doesn't give list of options

```

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce the autocomplete behavior in the Godot Script editor using the provided GDScript examples, starting with calls to Node.is_in_group() on typed, casted, and referenced nodes. Trace the editor's completion handling for group-related methods. Done means the global group list appears consistently for valid Node receivers, including the cases that currently show no suggestions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.