Autocomplete doesn't work

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

Hi! I have a trouble with autocomplete. I’m using Apple MacBook Air M1 2020 and Godot Engine v3.4.4.stable.official.419e713a2

First example:

extends MovementState
class_name GroundMovement

export(float) var _magnitude := 5.0

onready var _controls: PlayerControls = $"../../Controls" as PlayerControls

var _input_movement := Vector3.ZERO
var _movement := Vector3.ZERO

func should_enter() -> bool:
	return true # _body.is_on_floor()

func should_exit() -> bool:
	return false # !_body.is_on_floor()

func enter() -> void:
	print("Entered Ground state!")

func exit() -> void:
	print("Exited Ground state!")

func process_movement(delta: float) -> void:
    # _input_movement = _controls. - no autocomplete
	_input_movement = _controls.get_movement()
	_movement = _input_movement * _magnitude
	_body.move_and_slide(_movement, Vector3.UP, true)

Inside process_movement, when i type _input_movement = _controls. I get no autocomplete!

Here is PlayerControls source:

extends Node
class_name PlayerControls

var _movement := Vector3.ZERO

func get_movement() -> Vector3:
	_movement = Vector3.ZERO
	if Input.is_action_pressed("move_forward"):
		_movement.z += 1.0
	if Input.is_action_pressed("move_backward"):
		_movement.z += -1.0
	if Input.is_action_pressed("move_right"):
		_movement.x += 1.0
	if Input.is_action_pressed("move_left"):
		_movement.x -= 1.0
	return _movement.normalized()

Second example: I have a class that is supposed to be a movement state machine. Here is the code:

extends Node
class_name MovementStateMachine

var _current_state: MovementState = null

var _states := []

func _ready() -> void:
	for child in get_children():
		if child is MovementState:
			var new_state := child as MovementState
			print("Registered state %s" %
	_current_state = _get_new_state()
	if _current_state == null:
		push_error("Failed to get initial MovementState!")

func _get_new_state() -> MovementState:
	var current_state: MovementState = null

	for state in _states:
		current_state = state as MovementState
		# if current_state. - no autocomplete
		if current_state.should_enter():
			return current_state
	return null

func _process(delta: float) -> void:
	# _current_state. - no autocomplete

I’m using static typing and class_name, but autocomplete still doesn’t work! I will realy appreciate your help.

Maybe it’s a bug. Have you tried putting in code like this?

var _input_movement: Vector3 = Vector3.ZERO
var _movement: Vector3 = Vector3.ZERO

Ertain | 2022-04-20 23:35

:bust_in_silhouette: Reply From: sanlem

Suddenly today it started working. I’ve also tried rest`rting the editor several times yesterday.

:bust_in_silhouette: Reply From: Inces

Autocomplete of references to hard paths within one scene will not work, when different scene Tab is active in editor.