visual-studiovisual-studio-2022code-organization

How to nest suffix file names like "texts-fr.json" to "texts.json" in Visual Studio?


I have a folder with i18n texts with files like this: texts.json and its translations: texts-en.json, texts-fr.json etc.

I am trying to use fileSuffixToExtension to nest all other files under texts.json but it does not work. Apparently wildcard is not supported. Is it possible?

      "fileSuffixToExtension": {
        "add": {
            "-*.json": [
                ".json"
            ]
        }
      },

enter image description here


Solution

  • Right now apparently fileSuffixToExtension does not support wildcard because even the JSON schema recognize that:

    enter image description here

    So I have to manually add one entry for each language code (using some quick JS code to auto generate them).

    enter image description here

          "fileSuffixToExtension": {
            "add": {
                "-vsdoc.js": [
                    ".js"
                ],
                "-ar.json": [
                    ".json"
                ],
                "-bg.json": [
                    ".json"
                ],
                "-ca.json": [
                    ".json"
                ],
                "-cs.json": [
                    ".json"
                ],
                "-da.json": [
                    ".json"
                ],
                "-de.json": [
                    ".json"
                ],
                "-el.json": [
                    ".json"
                ],
                "-en.json": [
                    ".json"
                ],
                "-es.json": [
                    ".json"
                ],
                "-et.json": [
                    ".json"
                ],
                "-fa.json": [
                    ".json"
                ],
                "-fi.json": [
                    ".json"
                ],
                "-fr.json": [
                    ".json"
                ],
                "-he.json": [
                    ".json"
                ],
                "-hi.json": [
                    ".json"
                ],
                "-hr.json": [
                    ".json"
                ],
                "-hu.json": [
                    ".json"
                ],
                "-id.json": [
                    ".json"
                ],
                "-is.json": [
                    ".json"
                ],
                "-it.json": [
                    ".json"
                ],
                "-ja.json": [
                    ".json"
                ],
                "-ko.json": [
                    ".json"
                ],
                "-lt.json": [
                    ".json"
                ],
                "-lv.json": [
                    ".json"
                ],
                "-ms.json": [
                    ".json"
                ],
                "-nl.json": [
                    ".json"
                ],
                "-no.json": [
                    ".json"
                ],
                "-pl.json": [
                    ".json"
                ],
                "-pt.json": [
                    ".json"
                ],
                "-ro.json": [
                    ".json"
                ],
                "-ru.json": [
                    ".json"
                ],
                "-sk.json": [
                    ".json"
                ],
                "-sl.json": [
                    ".json"
                ],
                "-sr.json": [
                    ".json"
                ],
                "-sv.json": [
                    ".json"
                ],
                "-th.json": [
                    ".json"
                ],
                "-tl.json": [
                    ".json"
                ],
                "-tr.json": [
                    ".json"
                ],
                "-uk.json": [
                    ".json"
                ],
                "-ur.json": [
                    ".json"
                ],
                "-vi.json": [
                    ".json"
                ],
                "-zh-CN.json": [
                    ".json"
                ],
                "-zh-TW.json": [
                    ".json"
                ]
            }
          },
    

    I have submitted a feature request here