godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.9k stars 20.16k forks source link

Inner classes do not highlight or get intellisense autocomplete #74943

Open BaIthamel opened 1 year ago

BaIthamel commented 1 year ago

Godot version

3.5.1 stable and 4.0 stable

System information

Windows 7 and MacOS 12.6

Issue description

When declaring an inner class or instancing an inner class there is no highlighting or intellisense complete for the class name. There is also limited intellisense complete when using a typed variable of the class. I have found that there is no autocomplete for class properties or functions in the evaluation of an if statement but autocomplete does work in the body of a function (but only when the variable is explicitly typed).

Steps to reproduce

Minimal reproduction script in any project should have highlighting on the class declaration and on the class instance.

Minimal reproduction project

`extends Node

func _init() -> void: var new_class := Name.new()

class Name: var some_var`

vicguedez commented 1 year ago

FWIW in Godot 4.1.1.stable doing var new_class := Name.new() as Name will make the intellisense work for inner classes. Seems like it will work at any depth: Class.InnerA.InnerB.String. returns suggestions for String type.

What solves the issue is the combination of := with as Name, any of the followings wont work:

var new_class = Name.new() as Name
var new_class: Name = Name.new()
var new_class := Name.new()

Edit: code block.

HolonProduction commented 9 months ago

Can't reproduce the Autocompletion problems on v4.2.rc.custom_build [fa4a65387]

Image

Image

There is still no highlighting however.