godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

Adding class_name in the gdscript file causes class name already exists error #424

Closed tokengamedev closed 6 months ago

tokengamedev commented 1 year ago

Godot version

3.5 stable

VS Code version

1.71.2

Godot Tools VS Code extension version

1.3.1

System information

Windows 11

Issue description

Adding class_name to a gdscript file causes the error Unique global already exists, parsing error. This does not happen in the Godot script editor

Impact:

This error stops other parsing errors to be displayed in the file. It also sometimes stops display of outline for the file. This causes a lot of inconvenience, as I needed all the errors while refactoring code.

Workaround:

After searching for various ways to resolve, like restarting Godot and others, the error still comes up. No workaround for this. any help to mitigate this will be welcome

Steps to reproduce

  1. Create a class file at "res://my_test.gd"
  2. Add the following code to the file

extends Reference class_name MyTest

The error below for not terminating the method definition with ":", should be displayed, but it is not.

func some_function(param1: String) print(param1)


3. Continue working for sometime
4. Following error happens
![image](https://user-images.githubusercontent.com/84369217/191280693-873d2554-f294-47df-a2fd-1b3d796c9215.png)
DaelonSuzuka commented 1 year ago

This is a known issue with Godot's Language Server. Restarting Godot usually works for me, but certainly not always.

I've recently discovered a technique to inspect and potentially modify or suppress information coming from the language server, and this is one of several candidates for such a suppression.

DaelonSuzuka commented 6 months ago

This rarely if ever happens for me anymore using Godot 3.5+ or Godot 4.