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

"Expected Nothing" in all JSON files and NBT tags #1609

Closed
Lunaticol opened this issue Sep 30, 2024 · 26 comments · Fixed by #1695
Closed

"Expected Nothing" in all JSON files and NBT tags #1609

Lunaticol opened this issue Sep 30, 2024 · 26 comments · Fixed by #1695
Assignees
Labels
🐛 bug Something isn't working /core

Comments

@Lunaticol
Copy link

I keep getting "expected nothing" errors on all of my tags. from my knowledge these tags should be correct as they load perfectly fine in game. image

@misode
Copy link
Member

misode commented Sep 30, 2024

Could you run the Spyglass: Show Output command (after bringing up the command palette with Ctrl+Shift+P), and then share that log file here?

@Lunaticol
Copy link
Author

https://mclo.gs/9ZkLyjP

@misode
Copy link
Member

misode commented Sep 30, 2024

Can you try resetting your project cache? You can do this by running the Spyglass: Reset Project Cache command. You may need to reload vscode and/or close all opened files afterwards.

If this doesn't fix it, you can try the second option: Run the Spyglass Open Cache Folder command, close vscode, and then delete everything in the cache folder.

@Lunaticol
Copy link
Author

Resetting and Clearing the cache did not work. it all just tells me the same error agian

@misode
Copy link
Member

misode commented Oct 7, 2024

Do you only have this issue with tags? Or also with other json files or NBT in mcfunctions?

@Lunaticol
Copy link
Author

I'm only seeing it effect my Functions and Tags
Image

@Lunaticol
Copy link
Author

Lunaticol commented Oct 23, 2024

affects advancements to
Image

@Lunaticol
Copy link
Author

affects recipes to Image

@Tschipcraft
Copy link

Tschipcraft commented Nov 23, 2024

Happens to me as well, but only on one project I'm working on. Resetting the cache did not work.
Affects tags, advancements, pack.mcmeta, json after tellraw+particle and NBT in mcfunction. External json files are unaffected.
My log: https://mclo.gs/VYTd5uV

@misode
Copy link
Member

misode commented Nov 23, 2024

@Tschipcraft Thanks for the info! I still have very little idea what causes this. Could you try the following:

  1. Run Spyglass: Open Cache Folder -> This should open C:/Users/********/AppData/Local/spyglassmc-nodejs/Cache/
  2. Uninstall the "Datapack Helper Plus by Spyglass" vscode extension from the Vscode menu
  3. Close all open windows of Vscode
  4. Remove everything in the cache folder from above
  5. Go to C:\Users\********\.vscode\extensions and remove the extension folder that starts with spgoding.datapack-language-server-
  6. Reopen Vscode in your project folder and re-install the "Datapack Helper Plus by Spyglass" extension
  7. When Spyglass is done initializing, please share the log again if it is still not working.

@Lunaticol
Copy link
Author

log.txt
The odd thing is that it works fine in other datapacks??? Ive even moved everything out of the specific datapack it was bugging in and the copied folders work just fine outside of the datapack I'm working on. I have even deleted the entire thing and re-copied it from github and still get errors.

@Tschipcraft
Copy link

Tschipcraft commented Nov 24, 2024

I tried as well, but same problems. My log: https://mclo.gs/7bZQUEa

@misode
Copy link
Member

misode commented Nov 24, 2024

Were both of those logs from the first restart after following all those steps? Because I still see Skipped thanks to valid cache in memory logs which indicate that the extension is reusing some possibly old state.

@Tschipcraft
Copy link

Tschipcraft commented Nov 24, 2024

Yeah, I saw those in mine too. I had to restart VS Code for the extension to fully load after reinstalling. I could do it again and get the log right after if that's helpful
Edit: Even after not restarting, it still says Skipped thanks to valid cache in memory (https://mclo.gs/teRkPBg)
The files in the cache folder did get newly created though
Image

@Lunaticol
Copy link
Author

Same with above

@Plagiatus
Copy link

Plagiatus commented Dec 9, 2024

For me it depends on how I open the datapack. If I open it

a) directly or
b) through the folder directly above (e.g. the datapacks folder of a world)

the datapack(s) and spyglass load fine for me.

However, when I open the world folder with the datapacks folder inside of that, that's when I see this issue.

Edit to add: spyglass output.txt


For me all JSON files (advancements, recipes, item modifiers, loot tables, tags) are affected.

As for commands, it seems that only those that include NBT data (summon, data, execute store storage), item components (item replace) or JSON text (title, tellraw) are affected by this issue. (not macro lines)


Another issue that seems to come in tandem with this (as it's not there if the folder is loaded directly as described above), is that all my functions are unrecognized and thus a warning is shown: cannot find function foo:bar (rule: undeclaredSymbol). I assume this is considered a separate issue, but I noticed it seems to coincide with this issue.

@misode misode changed the title "Expected Nothing" Error when making tags (1.20.1) "Expected Nothing" in all JSON files and NBT tags Dec 10, 2024
misode added a commit to misode/SPYGlass that referenced this issue Dec 27, 2024
@misode
Copy link
Member

misode commented Dec 27, 2024

@Lunaticol @Tschipcraft @Plagiatus I have added some debug log messages in v4.4.1. It would be really helpful to get logs after you:

  1. Make sure the vscode extension is updated to the latest version
  2. Open the cache folder and close vscode completely
  3. Wipe the entire cache folder (downloader and symbols)
  4. Reopen vscode in your project and give it time to initialize
  5. Immediately share the log here, without reloading or resetting the project cache

@Lunaticol
Copy link
Author

https://mclo.gs/z1LrOiT

I noticed while trying to get the logs that it'll only start sprouting errors whenever "Received notification 'textDocument/publishDiagnostics' " appeared.

@misode
Copy link
Member

misode commented Dec 27, 2024

Thank you. Unfortunately (or fortunately), the issue wasn't caught by the new debugs. At least I can verify that the mcdoc archive is successfully downloaded and its content is complete. I will have to add some more debug messages.

@Tschipcraft
Copy link

https://mclo.gs/uH7OT9u

@misode
Copy link
Member

misode commented Dec 28, 2024

Okay I got another version adding some more debug logs.

Download v4.4.2, and like earlier, make sure the cache is completely clear. Thanks again for all your participation while trying to figure this out!

@misode misode pinned this issue Dec 28, 2024
@Tschipcraft
Copy link

Tschipcraft commented Dec 28, 2024

https://mclo.gs/dZGhG2c

The number of files to bind matches the number of files with that extension in the project

@misode
Copy link
Member

misode commented Dec 28, 2024

Eureka! @Tschipcraft Could you share the contents of your .gitignore file?

The "files to bind" summary should also be listing mcdoc files and all files in the vanilla data pack and resource pack, and it doesn't in your log. The problematic log is

[Project#getTrackedFiles] Listed 16950 supported files
[Project#getTrackedFiles] After ignoring, keeping 237 tracked files

The problem here is that the exclude config is also applying to the dependency files, not only to the project files.

When you've shared the gitignore, can you try setting the following spyglass.json config? Until there is a fix, I think this should be a workaround.

{
  "env": {
    "exclude": []
  }
}

@Plagiatus
Copy link

(I am not the provider of the above logs but) that sounds about right. My gitignore is this: https://github.com/Plagiatus/MapmakingTemplate/blob/main/.gitignore

It ignores everything except a few select folders, because I load my entire world into the git and only push relevant files.

@misode misode added 🐛 bug Something isn't working /core labels Dec 28, 2024
@misode misode self-assigned this Dec 28, 2024
@Lunaticol
Copy link
Author

I can confirm adding the code below to your spyglass.json does indeed fix the issue.

{
  "env": {
    "exclude": []
  }
}

For anyone else who might be confused on how to do this, just create a spyglass.json file like you would pack.mcmeta and add the code above, or just drop the linked file directly into it.

Should look like this
Image

To answer the question above, this is my .gitignore file: https://github.com/Lunaticol/Lunas-Origins/blob/main/.gitignore

@Tschipcraft
Copy link

Tschipcraft commented Dec 28, 2024

Same here 🎉, the .gitignore if still needed: https://github.com/Tschipcraft/spawnanimations/blob/v1.10/.gitignore

@misode misode unpinned this issue Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working /core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants