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

Suppress errors on autocompletion for preload() #15851

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

poke1024
Copy link
Contributor

See #15766

Suppresses the errors that currently show up on each keypress in resource path completion, e.g.:

ERROR: _load: No loader found for resource: res://
   At: core/io/resource_loader.cpp:190.
ERROR: _load: No loader found for resource: res://r
   At: core/io/resource_loader.cpp:190.
ERROR: _load: No loader found for resource: res://re
   At: core/io/resource_loader.cpp:190.
ERROR: _load: No loader found for resource: res://res
   At: core/io/resource_loader.cpp:190.

@@ -461,7 +461,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (for_completion && ScriptCodeCompletionCache::get_sigleton()) {
res = ScriptCodeCompletionCache::get_sigleton()->get_cached_resource(path);
} else {
res = ResourceLoader::load(path);
res = ResourceLoader::load(path, "", false, true); // suppress errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing all the above hack, why not simply doing

if (FileAccess:exists(path)) {
   res = ResourceLoader::load(path);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite true, changed.

@reduz reduz merged commit 7369b00 into godotengine:master Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants