Issue: Choice field not updating when _ is used in the ID #187

Closed
opened 2026-10-05 02:32:14 +02:00 by adam · 7 comments
Owner

When using choice für an own content trype with an underscroe in "title" "title": "mydoc_sidebar" and after changing the frontmatter taxonomy from one choice to another or deleting the field. the underscore title name like in this example "title": "mydoc_sidebar" is not beeing written to the file.

After selecting another title name without an underscore
"title": "Choice 2"the title with the underscore can be selected
"title": "mydoc_sidebar" again.

This seems only to happen when like in this example there are qoutemarks set.
sidebar: '' in the field.

 "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "pageBundle": false,
      "fields": [
...
    {
      "name": "documentation",
      "pageBundle": false,
      "fields": [
        {
...
        {
          "title": "Sidebar",
          "name": "sidebar",
          "type": "choice",
          "choices": [
            {
              "id": "mydoc_sidebar",
              "title": "mydoc_sidebar"
            },
            {
              "id": "2",
              "title": "Choice 2"
            },
            {
              "id": "3",
              "title": "Choice 3"
            }
          ],
          "multiSelect": true
        },
...

image

When using choice für an own content trype with an underscroe in "title" `"title": "mydoc_sidebar"` and after changing the frontmatter taxonomy from one choice to another or deleting the field. the underscore title name like in this example `"title": "mydoc_sidebar"` is not beeing written to the file. After selecting another title name without an underscore `"title": "Choice 2"`the title with the underscore can be selected `"title": "mydoc_sidebar"` again. This seems only to happen when like in this example there are qoutemarks set. `sidebar: ''` in the field. ```json "frontMatter.taxonomy.contentTypes": [ { "name": "default", "pageBundle": false, "fields": [ ... { "name": "documentation", "pageBundle": false, "fields": [ { ... { "title": "Sidebar", "name": "sidebar", "type": "choice", "choices": [ { "id": "mydoc_sidebar", "title": "mydoc_sidebar" }, { "id": "2", "title": "Choice 2" }, { "id": "3", "title": "Choice 3" } ], "multiSelect": true }, ... ``` ![image](https://user-images.githubusercontent.com/97720470/150667643-bf31879f-1536-44ad-8c34-3e8ba800b212.png) <!-- github-sync-id:1111792445 -->
adam closed this issue 2026-10-05 02:32:14 +02:00
Author
Owner

I've been trying to reproduce the behavior, but not sure if I'm getting it right. Is this what you are doing as well?

https://user-images.githubusercontent.com/2900833/150673797-a5c1bc18-136f-4321-b6c3-408d53505e5b.mp4

If not, what do you do differently?

I've been trying to reproduce the behavior, but not sure if I'm getting it right. Is this what you are doing as well? https://user-images.githubusercontent.com/2900833/150673797-a5c1bc18-136f-4321-b6c3-408d53505e5b.mp4 If not, what do you do differently? <!-- github-comment-id:1019452980 -->
Author
Owner

@estruyf thx for your reply.

i am using wsl!
maybe this could be a reason for different outputs/behavior?

[2022-01-23 15:27:24.772] Resolving wsl+ubuntu, resolveAttempt: 1
[2022-01-23 15:27:25.359] Starting VS Code Server inside WSL (wsl2)
[2022-01-23 15:27:25.359] Extension version: 0.63.13

which tool do you use for video snippets? I will give a reply, for now i did not know how to take a video snippet right now.

have a nice start into the next week.

@estruyf thx for your reply. i am using wsl! maybe this could be a reason for different outputs/behavior? ```powershell [2022-01-23 15:27:24.772] Resolving wsl+ubuntu, resolveAttempt: 1 [2022-01-23 15:27:25.359] Starting VS Code Server inside WSL (wsl2) [2022-01-23 15:27:25.359] Extension version: 0.63.13 ``` which tool do you use for video snippets? I will give a reply, for now i did not know how to take a video snippet right now. have a nice start into the next week. <!-- github-comment-id:1019509595 -->
Author
Owner
https://user-images.githubusercontent.com/97720470/150686440-a0e9520a-1d7e-4296-a706-b2a872a09e64.mp4 Windows + G is a nice feature :-) Google also :-) <!-- github-comment-id:1019510694 -->
Author
Owner

@wemasoe can you show me your content type settings in a side-by-side view? WSL should not be making a difference in this case, as WSL only matters on file level / paths.

@wemasoe can you show me your content type settings in a side-by-side view? WSL should not be making a difference in this case, as WSL only matters on file level / paths. <!-- github-comment-id:1019939947 -->
Author
Owner
image

i do not know how to make a side by side in text format on github.
so only screenshot and code.

`{
    "name": "documentation",
    "pageBundle": false,
    "fields": [
      {
        "title": "Layout",
        "name": "layout",
        "type": "choice",
        "choices": [
          "default",
          "{{title}}",
          "{{slug}}"
        ]
      },
      {
        "title": "Title",
        "name": "title",
        "type": "string"
      },
      {
        "title": "Permalink",
        "name": "permalink",
        "type": "string",
        "default": "{{permalink}}"
      },
      {
        "title": "Parent",
        "name": "parent",
        "type": "choice",
        "choices": [
          "markdown",
          "{{title}}",
          "{{slug}}"
        ]
      },
      {
        "title": "Sidebar",
        "name": "sidebar",
        "type": "choice",
        "choices": [
          {
            "id": "mydoc_sidebar",
            "title": "mydoc_sidebar"
          },
          {
            "id": "2",
            "title": "Choice 2"
          },
          {
            "id": "3",
            "title": "Choice 3"
          }
        ],
        "multiSelect": true
      },
      {
        "title": "Tags",
        "name": "tags",
        "type": "tags"
      },
      {
        "title": "Permalink1",
        "name": "permalink1",
        "type": "choice",
        "choices": [
          "{{permalink}}",
          "{{title}}",
          "{{slug}}"
        ]
      },
      {
        "title": "Description",
        "name": "description",
        "type": "string",
        "default": "{{slug}}"

      },
      {
        "title": "Publishing date",
        "name": "date",
        "type": "datetime"
      },
      {
        "title": "Content preview",
        "name": "preview",
        "type": "image"
      },
      {
        "title": "Is in draft",
        "name": "draft",
        "type": "boolean"
      },
      {
        "title": "Categories",
        "name": "categories",
        "type": "categories"
      },
      {
        "title": "Navigation weight",
        "name": "weight",
        "type": "number"
      },
      {
        "title": "Type",
        "name": "type",
        "type": "choice",
        "choices": [
          "documentation",
          "default",
          "published"
        ]
      }
    ]
  }
],`
"frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "pageBundle": false,
      "fields": [
        {
          "title": "Title",
          "name": "title",
          "type": "string"
        },
        {
          "title": "Description",
          "name": "description",
          "type": "string"
        },
        {
          "title": "Publishing date",
          "name": "date",
          "type": "datetime"
        },
        {
          "title": "Content preview",
          "name": "preview",
          "type": "image"
        },
        {
          "title": "Is in draft",
          "name": "draft",
          "type": "boolean"
        },
        {
          "title": "Tags",
          "name": "tags",
          "type": "tags"
        },
        {
          "title": "Type",
          "name": "type",
          "type": "choice",
          "choices": [
            "documentation",
            "default",
            "published"
          ]
        },
        {
          "title": "Categories",
          "name": "categories",
          "type": "categories"
        }
      ]
    },

<img width="538" alt="image" src="https://user-images.githubusercontent.com/97720470/150825702-a48f46c4-466d-4263-9267-3a9f112ed77b.png"> i do not know how to make a side by side in text format on github. so only screenshot and code. ```json `{ "name": "documentation", "pageBundle": false, "fields": [ { "title": "Layout", "name": "layout", "type": "choice", "choices": [ "default", "{{title}}", "{{slug}}" ] }, { "title": "Title", "name": "title", "type": "string" }, { "title": "Permalink", "name": "permalink", "type": "string", "default": "{{permalink}}" }, { "title": "Parent", "name": "parent", "type": "choice", "choices": [ "markdown", "{{title}}", "{{slug}}" ] }, { "title": "Sidebar", "name": "sidebar", "type": "choice", "choices": [ { "id": "mydoc_sidebar", "title": "mydoc_sidebar" }, { "id": "2", "title": "Choice 2" }, { "id": "3", "title": "Choice 3" } ], "multiSelect": true }, { "title": "Tags", "name": "tags", "type": "tags" }, { "title": "Permalink1", "name": "permalink1", "type": "choice", "choices": [ "{{permalink}}", "{{title}}", "{{slug}}" ] }, { "title": "Description", "name": "description", "type": "string", "default": "{{slug}}" }, { "title": "Publishing date", "name": "date", "type": "datetime" }, { "title": "Content preview", "name": "preview", "type": "image" }, { "title": "Is in draft", "name": "draft", "type": "boolean" }, { "title": "Categories", "name": "categories", "type": "categories" }, { "title": "Navigation weight", "name": "weight", "type": "number" }, { "title": "Type", "name": "type", "type": "choice", "choices": [ "documentation", "default", "published" ] } ] } ],` ``` ```json "frontMatter.taxonomy.contentTypes": [ { "name": "default", "pageBundle": false, "fields": [ { "title": "Title", "name": "title", "type": "string" }, { "title": "Description", "name": "description", "type": "string" }, { "title": "Publishing date", "name": "date", "type": "datetime" }, { "title": "Content preview", "name": "preview", "type": "image" }, { "title": "Is in draft", "name": "draft", "type": "boolean" }, { "title": "Tags", "name": "tags", "type": "tags" }, { "title": "Type", "name": "type", "type": "choice", "choices": [ "documentation", "default", "published" ] }, { "title": "Categories", "name": "categories", "type": "categories" } ] }, ``` <!-- github-comment-id:1020302782 -->
Author
Owner

Thanks! This information helped a lot and should be fixed with the upcoming release. Already testable in the beta.

Thanks! This information helped a lot and should be fixed with the upcoming release. Already testable in the beta. <!-- github-comment-id:1020363079 -->
Author
Owner

@estruyf thank you, it works :-)

@estruyf thank you, it works :-) <!-- github-comment-id:1020605288 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#187