Skip to content

🐛 Don't show “expected nothing” if root type cannot be resolved#1940

Open
NeunEinser wants to merge 1 commit intoSpyglassMC:mainfrom
NeunEinser:fix_expected_nothing
Open

🐛 Don't show “expected nothing” if root type cannot be resolved#1940
NeunEinser wants to merge 1 commit intoSpyglassMC:mainfrom
NeunEinser:fix_expected_nothing

Conversation

@NeunEinser
Copy link
Contributor

Work towards #1938

  • We should have graceful fallback behaviors for any missing meta-resources.
    • We would rather have no validations than false positives (full screens of nonsensical errors like "Expected nothing" is not acceptable)

With this change, in case the root type the mcdoc runtime checker is called with cannot be resolved, the any type will be used instead of empty union.

Usually in case something is not able to be resolved, an empty union is emitted, causing an “expected noting” error. In case this happens for the type runtime checker is called with, this will be replaced by the any type. Calling the runtime checker explicitly with an empty union will still produce “expected noting”, and in case a type that is referenced later cannot be resolved, “expected nothing” would still be emitted.

This disables all validations and completions for this case in a graceful way.

@NeunEinser
Copy link
Contributor Author

NeunEinser commented Dec 24, 2025

This can be tested by deleting the symbols folder in the Spyglass cache dir, and the two files called aHR0cHM6Ly9hcGkuc3B5Z2xhc3NtYy5jb20vdmFuaWxsYS1tY2RvYy90YXJiYWxs (base64 for “https://api.spyglassmc.com/vanilla-mcdoc/tarball”) in the http directory, and then disabling your internet access.

@NeunEinser
Copy link
Contributor Author

NeunEinser commented Dec 24, 2025

Thinking more about this, it could also make sense to default unresolved symbols in general to any (or unsafe, I forget what the difference is). Both references and dispatchers currently become an empty union when they cannot be resolved at all.

It is reasonable to assume either something with the definition is amiss, or data is missing / not loaded correctly. All these cases indicate an error elsewhere, outside of the file that is currently being validated. Defaulting to a kind of ”anything goes” type in these cases in general could actually make a lot of sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant