Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Editor (Language Server) - Could not find base class / Could not find type in the current scope #80822

Closed
michaelschufi opened this issue Aug 20, 2023 · 2 comments

Comments

@michaelschufi
Copy link

michaelschufi commented Aug 20, 2023

Godot version

v4.1.1.stable.official [bd6af8e]

System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 Threads)

Issue description

An external editor (in my case VS Code) cannot resolve classes. Even though it's working in the Godot Editor:

image

The same is happening for type annotations:

image

I may be just doing something wrong. But the editor can definitely connect to the language server ...

Steps to reproduce

1. Create three scripts

foo.gd

extends Node
class_name Foo

var foo_variable = "foo"

bar.gd

extends Foo
class_name Bar

func _physics_process(delta: float) -> void:
  print(self.foo_variable)

and baz.gd

class_name Baz

func my_function(foo: Foo):
  foo.foo_variable = 5

2. Open them in VS Code

(Make sure you have VS Code configured correctly, as per the README.md of the Godot VS Code extension.)

Open the bar.gd and baz.gd and hover over the errors.

Minimal reproduction project

https://github.com/michaelschufi/godot_base_class_not_found_repro

@ainformatico
Copy link

Same issue here using VScode and Godot 4.1.
I discovered the issue when creating @export vars in the parent class and then trying to use them in a child class.
VScode shows the errors, but the game runs without problem and the variables are available.

This is a real PITA.
While looking for solutions, found the following issues in https://github.com/godotengine/godot-vscode-plugin and they seem to point to a LSP bug:

Issues form this repo that seem related:

@HolonProduction
Copy link
Member

The MRP isn't available anymore and I can't find a cached version, but creating a new project with just those three scripts, I can't reproduce the issue in v4.4.dev.custom_build [92e51fc]

@HolonProduction HolonProduction added this to the 4.4 milestone Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants