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

Editor thinks singleton is not in scopeuntil code is reloaded #32062

Open
carllacan opened this issue Sep 9, 2019 · 7 comments
Open

Editor thinks singleton is not in scopeuntil code is reloaded #32062

carllacan opened this issue Sep 9, 2019 · 7 comments

Comments

@carllacan
Copy link

Godot version:
Godot v3.1.1

OS/device including version:

Debian 9 64 bits

Issue description:

When you add a new .gd script to the project's autoload list and begin using it the editor flags your use of the singleton's name as an error, because it thinks it isn't on scope (even though, of course, it is always in scope).

Steps to reproduce:

Create a new script.

Add it to the project's autoload list.

Use the singleton's name anywhere in your project. Editor marks it as an error and tells you that the name of the singleton is not defined on this scope. Running the project works fine, though.

Close Godot, open it again and load your project. The editor now recognizes singletons are always in scope and doesn't warn you about the "error" anymore.

Minimal reproduction project:

N/A

@Zireael07
Copy link
Contributor

Yup, I've seen the same.

@rcorre
Copy link
Contributor

rcorre commented Jan 5, 2020

I'm experiencing this but reloading does not help. I use an external editor, and I run godot-headless --check-only -s $current_script.gd for syntax checking (though the same happens if I use the plain godot binary). I can see that the the singleton is listed in my project.godot:

[autoload]

Global="*res://global.gd"

I've noticed similar behavior for class_name, but reloading does fix that.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 28, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@carllacan
Copy link
Author

carllacan commented Jan 15, 2022

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

By the nature of this bug it is not possible to create a MRP. I've just reproduced the error in an empty project (this one: test2.zip) using v3.4.2.stable.official [45eaa2d], but, as described, the error message disappears once you close the project and open it again, so now if anyone loads it the message won't appear.

@KoBeWi
Copy link
Member

KoBeWi commented Jan 15, 2022

For me the error shows until I change something in the script. It's parsed again and the error disappears. I don't need to reload the project.

@carllacan
Copy link
Author

For me the error shows until I change something in the script. It's parsed again and the error disappears. I don't need to reload the project.

Yes, I've checked and I get the same. The issue is smaller than it used to be, then.

The opposite also happens: if you remove the script from Autoload the node is not marked as out-of-reach until you edit the script.

It might be a good idea to trigger a parse and an error update when the user adds/remove singletons from Autoload, or maybe even after the user makes any change in the project settings, since they might be other minor bugs like this.

Otherwise this issue could be closed.

@mizutani256
Copy link

I'm experiencing this but reloading does not help. I use an external editor, and I run godot-headless --check-only -s $current_script.gd for syntax checking (though the same happens if I use the plain godot binary). I can see that the the singleton is listed in my project.godot:

This seems to still happen as of Godot 3.5.2. Not in the editor per se, but when checking for script errors using the CLI autoloads are not in scope:

SCRIPT ERROR: Parse Error: The identifier "<autoload_name>" isn't declared in the current scope.

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

6 participants