Skip to content

Feat: Auto Extension Fix #1653

@Kesuaheli

Description

@Kesuaheli

It frequently happens that one misspelled a file extension e.g. .mcfuntion instead of .mcfunction.
Misode hat the Idea if Spyglass could detect that. Which gave me the following concept:


I'm thinking of a popup notification in the bottom right. Which says something like, "The file you just created has an unknown extension for the function folder. Expected '.mcfunction'."
And then there are two buttons. One that just closes it. And one to automagically rename it. (Ik, the close button is redundant, as you can close a popup on the :95_x:. But I feel like it's better UX to have it next to the button that does stuff)

That same concept can be applied to all folders. For example:

  • function (functions) expects .mcfunction
  • tags/block (tags/blocks) expects .json
  • ...
    Same for resource pack:
  • blockstates expects .json
  • I don't exactly know the shader stuff, but I do know there's some special extensions...
  • textures expects .png
  • ...

A sort of config option would be cool; obviously. Maybe even overrides.
Simply turning that on/off.
By overrides, I mean a whitelist-ish thing, where you specify file extensions that Spyglass won't complain about. Example:

{
  "function": [
    ".foo"
  ],
  "tags/function": [
    ".bar",
    "barfoo"
  ]
}

Would result in a behaviour like:

  • When the user creates a file in data/*/function/ named not_a_function.foo, Spyglass doesn't show the renaming popup.
  • When the user creates a file in data/*/tags/function named hello_world_barfoo, Spyglass doesn't show the renaming popup. (because the created file ends in one of the given strings "barfoo".)

If the created file does not exist in the whitelist and the user decides to let Spyglass rename it, Spyglass cuts everything from (including) the last dot ., if any. And then the expected extension is added at the end. Example:

  • Renaming data/*/function/tick.mcfun:
    1. Cut: tick.mcfun
    2. Add: tick.mcfunction
  • Renaming data/*/tags/item/potato
    1. Cut: potato (unchanged, as there's no .)
    2. Add: potato.json
  • ...

Maybe also an option to set the expected extensions? Like this:

{
  "function": {
    "replace": ".mcfunction",
    "allow": [
      ".foo"
    ]
  },
  "tag/biome": {
    "replace": "_custom.json",
    "allow": [
      "foobar"
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions