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

Mcdoc simplified type caches are not cleared when changing versions #1655

Closed
misode opened this issue Nov 27, 2024 · 0 comments · Fixed by #1671
Closed

Mcdoc simplified type caches are not cleared when changing versions #1655

misode opened this issue Nov 27, 2024 · 0 comments · Fixed by #1671
Milestone

Comments

@misode
Copy link
Member

misode commented Nov 27, 2024

How to reproduce

  1. Create an empty workspace with a single pack.mcmeta version in it:
{
  "pack": {
    "description": {
      "text": "My data pack",
      "shadow_color": 123
    },
    "pack_format": 61
  }
}
  1. Reload the window so 1.21.4 is currently loaded and reset the project cache to make sure the cache is clean
  2. ✅ Notice that the shadow_color field added in 1.21.4 is correctly recognized
  3. Replace pack format 61 with 57 to select 1.21.3 as loaded version
  4. Reload the window and wait until initialization is done
  5. ❌ Notice that there is no "unknown key" warning for the shadow_color field, even after closing and reopening the file
  6. Reset the project cache
  7. ✅ Now there is an "unknown key" warning

Analysis

Since the mcdoc symbols are being contributed by the @vanilla-mcdoc dependency, their cache is only cleared when the hashes of those files change (when a new version of vanilla-mcdoc is pushed to the repo), not when the currently loaded version is changed.

The since and until attributes do not cause a type to be marked as "having dynamic data" (with good reason, otherwise almost none of the types could get simplified), however this means that the cached simplified types need to be cleared when changing versions.

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

Successfully merging a pull request may close this issue.

1 participant