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

Double clicking JSON files in FileSystem tab throws errors #66820

Closed
arotter opened this issue Oct 3, 2022 · 1 comment · Fixed by #72259
Closed

Double clicking JSON files in FileSystem tab throws errors #66820

arotter opened this issue Oct 3, 2022 · 1 comment · Fixed by #72259

Comments

@arotter
Copy link

arotter commented Oct 3, 2022

Godot version

v4.0.beta2.official [f8745f2]

System information

Windows 10 21H2 (Build 19044.2075)

Issue description

In beta1 was able to double click a JSON file shown in the FileSystem tab to open it in the script editor view as a text file. Doing the same in beta2 throws the following errors for the file:

ERROR: Failed loading resource: res://static_data/weapons/DamageBehaviors.json. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core/io/resource_loader.cpp:221)
ERROR: Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
   at: load_resource (editor/editor_node.cpp:1248)

Accessing the file via FileAccess and parsing it via JSON.parse() works without problems, as does dragging the file from FileSystem into the script editor's vertical tab space.

Steps to reproduce

  1. Add JSON file to folder in res://
  2. Double click on file
  3. File doesn't open as expected, errors in console

Using the attached project:

  1. Open project
  2. Double click res://static_data/weapons/DamageBehaviors.json
  3. File doesn't open as expected, errors in console

Minimal reproduction project

BugReproduction.zip

@akien-mga akien-mga added this to the 4.0 milestone Oct 3, 2022
@akien-mga akien-mga moved this to To Assess in 4.x Priority Issues Oct 3, 2022
@akien-mga akien-mga moved this from To Assess to Todo in 4.x Priority Issues Oct 3, 2022
@akien-mga
Copy link
Member

That's due to #65295. JSON is now treated as a resource file but it's not an imported one, and apparently the FileSystem dock logic for double click doesn't know how to handle this.

DrewV3 added a commit to DrewV3/godot that referenced this issue Oct 22, 2022
Fixes error thrown when clicking on a json file in the file dock
@KoBeWi KoBeWi moved this from Todo to In Progress in 4.x Priority Issues Nov 23, 2022
reduz added a commit to reduz/godot that referenced this issue Jan 14, 2023
* It was not a resource, hence it was not working to load it as such.
* Changed so, when opened in editor, a parse error will not fail load and the text will be kept.
* This should allow proper editing from within the code editor, including syntax checking and saving files as-is in text.

Partially addresses godotengine#66820.

The code editor still needs to be changed for this to work.
Streq pushed a commit to Streq/godot that referenced this issue Feb 9, 2023
* It was not a resource, hence it was not working to load it as such.
* Changed so, when opened in editor, a parse error will not fail load and the text will be kept.
* This should allow proper editing from within the code editor, including syntax checking and saving files as-is in text.

Partially addresses godotengine#66820.

The code editor still needs to be changed for this to work.
@github-project-automation github-project-automation bot moved this from In Progress to Done in 4.x Priority Issues Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
2 participants