Issue: Workspace settings.json duplicates user settings.json #109

Closed
opened 2026-10-05 02:25:49 +02:00 by adam · 11 comments
Owner

Describe the bug

I created a custom content types via user settings.json (user settings).

On every launch of vscode, the plugin creates .vscode/settings.json (workspace settings) merging custom content type + custom description fields and lastmod field.

This causes duplicated fields on every relaunches. (on every launch of vscode, same fields are added to the workspace settings)

Note the lowercased updated and summary are the custom Modified Field and Description field set in user settings.

screen 7

To Reproduce
Steps to reproduce the behavior:

Step 1: In user settings.json

  "frontMatter.taxonomy.seoDescriptionLength": 180,
  "frontMatter.taxonomy.modifiedField": "updated",
  "frontMatter.taxonomy.seoDescriptionField": "summary",
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "fields": [
        {
          "title": "Published",
          "name": "date",
          "type": "datetime"
        },
        {
          "title": "Updated",
          "name": "updated",
          "type": "datetime"
        }
      ]
    }
  ],

Step 2: Close and relaunch vscode

Step 3: .vscode/settings.json (workspace settings)

{
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "fields": [
        {
          "title": "Published",
          "name": "date",
          "type": "datetime"
        },
        {
          "title": "Updated",
          "name": "updated",
          "type": "datetime"
        },
        {
          "name": "updated",
          "type": "datetime"
        },
        {
          "name": "summary",
          "type": "string"
        },
        {
          "name": "updated",
          "type": "datetime"
        },
        {
          "name": "summary",
          "type": "string"
        }
      ]
    }
  ]
}

This file will keep adding same fields on every vscode relaunch.

Expected behavior

Make workspace settings as optional / unify to one settings file?

**Describe the bug** I created a custom content types via user `settings.json` (user settings). On every launch of vscode, the plugin creates `.vscode/settings.json` (workspace settings) merging custom content type + custom description fields and lastmod field. This causes duplicated fields on every relaunches. (on every launch of vscode, same fields are added to the workspace settings) Note the lowercased `updated` and `summary` are the custom Modified Field and Description field set in user settings. <img width="341" alt="screen 7" src="https://user-images.githubusercontent.com/1472065/135998100-15a76f60-2822-4cd4-aefa-e4a0a0d9bba4.png"> **To Reproduce** Steps to reproduce the behavior: ## Step 1: In `user settings.json` ```json "frontMatter.taxonomy.seoDescriptionLength": 180, "frontMatter.taxonomy.modifiedField": "updated", "frontMatter.taxonomy.seoDescriptionField": "summary", "frontMatter.taxonomy.contentTypes": [ { "name": "default", "fields": [ { "title": "Published", "name": "date", "type": "datetime" }, { "title": "Updated", "name": "updated", "type": "datetime" } ] } ], ``` ## Step 2: Close and relaunch vscode ## Step 3: `.vscode/settings.json` (workspace settings) ```json { "frontMatter.taxonomy.contentTypes": [ { "name": "default", "fields": [ { "title": "Published", "name": "date", "type": "datetime" }, { "title": "Updated", "name": "updated", "type": "datetime" }, { "name": "updated", "type": "datetime" }, { "name": "summary", "type": "string" }, { "name": "updated", "type": "datetime" }, { "name": "summary", "type": "string" } ] } ] } ``` This file will keep adding same fields on every vscode relaunch. **Expected behavior** Make workspace settings as optional / unify to one settings file? <!-- github-sync-id:1016105272 -->
adam closed this issue 2026-10-05 02:25:50 +02:00
Author
Owner

@flikteoh thanks for opening the issue. I'll investigate this and try to fix it.

@flikteoh thanks for opening the issue. I'll investigate this and try to fix it. <!-- github-comment-id:934247345 -->
Author
Owner

The issue is fixed in the beta version. In your case, it will only add the missing summary field, but it will not touch the updated field.

Since version 4, the global settings frontmatter.json file got introduced. It makes it easier to share settings with others, as not everyone shares their settings.json file with others. Related to this, I have added a prompt (one time) that asks if you wish to promote your local settings to the frontmatter.json file. This was already in place but required manual action.

Screenshot 2021-10-05 at 13 21 10

The issue is fixed in the beta version. In your case, it will only add the missing `summary` field, but it will not touch the `updated` field. Since version 4, the global settings `frontmatter.json` file got introduced. It makes it easier to share settings with others, as not everyone shares their `settings.json` file with others. Related to this, I have added a prompt (one time) that asks if you wish to promote your local settings to the `frontmatter.json` file. This was already in place but required manual action. ![Screenshot 2021-10-05 at 13 21 10](https://user-images.githubusercontent.com/2900833/136014433-7563acfa-ad7d-4966-b2f3-708dd3dbf4bd.png) <!-- github-comment-id:934322526 -->
Author
Owner

The issue is fixed in the beta version. In your case, it will only add the missing summary field, but it will not touch the updated field.

Since version 4, the global settings frontmatter.json file got introduced. It makes it easier to share settings with others, as not everyone shares their settings.json file with others. Related to this, I have added a prompt (one time) that asks if you wish to promote your local settings to the frontmatter.json file. This was already in place but required manual action.

Screenshot 2021-10-05 at 13 21 10

Does this mean we can copy the config from user settings.json into frontmatter.json to have the panel showing only date and updated?

> The issue is fixed in the beta version. In your case, it will only add the missing `summary` field, but it will not touch the `updated` field. > > Since version 4, the global settings `frontmatter.json` file got introduced. It makes it easier to share settings with others, as not everyone shares their `settings.json` file with others. Related to this, I have added a prompt (one time) that asks if you wish to promote your local settings to the `frontmatter.json` file. This was already in place but required manual action. > > ![Screenshot 2021-10-05 at 13 21 10](https://user-images.githubusercontent.com/2900833/136014433-7563acfa-ad7d-4966-b2f3-708dd3dbf4bd.png) Does this mean we can copy the config from user `settings.json` into `frontmatter.json` to have the panel showing only `date` and `updated`? <!-- github-comment-id:934460473 -->
Author
Owner

Hi @estruyf thanks for your prompt respond to the issue.

I have tried out the beta version. It does stop duplicating updated field.

However, summary continues to show up on Front Matter panel.

Is there no way to make plugin prioritize user settings.json on contentTypes since if user explicitly set it to exclude a particular field?

For use case like the description/summary field, it feels a bit redundant to be there since it can be easier to edit/manage on the writing panel itself.

I get a little confused on whether we should be configuring settings via .vscode/settings.json or user/settings.json or frontmatter.json ?

On the side, also found some error:

screen 4

Thank you

Hi @estruyf thanks for your prompt respond to the issue. I have tried out the beta version. It does stop duplicating `updated` field. However, `summary` continues to show up on Front Matter panel. Is there no way to make plugin prioritize user `settings.json` on `contentTypes` since if user explicitly set it to exclude a particular field? For use case like the `description/summary` field, it feels a bit redundant to be there since it can be easier to edit/manage on the writing panel itself. I get a little confused on whether we should be configuring settings via `.vscode/settings.json` or `user/settings.json` or `frontmatter.json` ? On the side, also found some error: <img width="1117" alt="screen 4" src="https://user-images.githubusercontent.com/1472065/136122241-bf0dbcfc-4b13-4d59-8d70-63b83443be53.png"> Thank you <!-- github-comment-id:935153333 -->
Author
Owner

Thanks @flikteoh for testing this out.

About the summary field that it keeps popping up, this is because you specified to use summary for the SEO description. The default content type is using description that is why it gets replaced to what you are using. We could add a property on the field to specify if it is hidden, but something else you could do, is specify your own content type. As you are now using the default one, you could also using your own. This is something Front Matter will not touch.

In order for the extension to progress, it will focus on using the frontmatter.json file as the main configuration. Overriding settings on user level will still be possible. Anything that is defined on the global file, can be overwritten in the local settings.json configuration.

For the schema, I'll try to find out why this might occur, as the file is available.

Thanks @flikteoh for testing this out. About the summary field that it keeps popping up, this is because you specified to use `summary` for the SEO description. The default content type is using `description` that is why it gets replaced to what you are using. We could add a property on the field to specify if it is hidden, but something else you could do, is specify your own content type. As you are now using the default one, you could also using your own. This is something Front Matter will not touch. In order for the extension to progress, it will focus on using the `frontmatter.json` file as the main configuration. Overriding settings on user level will still be possible. Anything that is defined on the global file, can be overwritten in the local `settings.json` configuration. For the schema, I'll try to find out why this might occur, as the file is available. <!-- github-comment-id:935612604 -->
Author
Owner

The schema seems to be an issue in VS Code itself, there is an open issue on this. On the insiders version, this is already fixed it seems. I'll keep the issue open to follow it up.

The schema seems to be an issue in VS Code itself, there is an open issue on this. On the insiders version, this is already fixed it seems. I'll keep the issue open to follow it up. <!-- github-comment-id:935829719 -->
Author
Owner

Thank you @estruyf

I have finally figured out what are the right way to move the configs to frontmatter.json

Everything seems to work as we needed now.

Was is a plugin requirement to have these files scattered around root folder, .vscode, .templates, .frontmatter?

Or can they all be collected under one single folder for easier management? ie: .frontmatter/templates .frontmatter/settings.json,.frontmatter/frontmatter.json etc?

Thank you @estruyf I have finally figured out what are the right way to move the configs to frontmatter.json Everything seems to work as we needed now. Was is a plugin requirement to have these files scattered around `root folder`, `.vscode`, `.templates`, `.frontmatter`? Or can they all be collected under one single folder for easier management? ie: `.frontmatter/templates` `.frontmatter/settings.json`,`.frontmatter/frontmatter.json` etc? <!-- github-comment-id:935889436 -->
Author
Owner

It wasn't a plugin requirement to scatter files around. .vscode is the default way, but this is more on a personal level. That is why the frontmatter.json file was created. Not every project is a personal project, and not every project shares its .vscode folder.

On the .templates and .frontmatter folder, I understand that they could be combined. In the case of .templates, this can already be achieved by updating the frontmatter.templates.folder setting.

The frontmatter.json is currently expected on the root. It is also used for finding out the main project folder when using multi-folder workspace in VSCode.

It wasn't a plugin requirement to scatter files around. `.vscode` is the default way, but this is more on a personal level. That is why the `frontmatter.json` file was created. Not every project is a personal project, and not every project shares its `.vscode` folder. On the `.templates` and `.frontmatter` folder, I understand that they could be combined. In the case of `.templates`, this can already be achieved by updating the [frontmatter.templates.folder](https://frontmatter.codes/docs/settings#frontmatter.templates.folder) setting. The `frontmatter.json` is currently expected on the root. It is also used for finding out the main project folder when using multi-folder workspace in VSCode. <!-- github-comment-id:936057141 -->
Author
Owner

It wasn't a plugin requirement to scatter files around. .vscode is the default way, but this is more on a personal level. That is why the frontmatter.json file was created. Not every project is a personal project, and not every project shares its .vscode folder.

On the .templates and .frontmatter folder, I understand that they could be combined. In the case of .templates, this can already be achieved by updating the frontmatter.templates.folder setting.

The frontmatter.json is currently expected on the root. It is also used for finding out the main project folder when using multi-folder workspace in VSCode.

That's understandable. Thanks for clarifying!

My issue is resolved. Do close this when you think it is ok.

> It wasn't a plugin requirement to scatter files around. `.vscode` is the default way, but this is more on a personal level. That is why the `frontmatter.json` file was created. Not every project is a personal project, and not every project shares its `.vscode` folder. > > On the `.templates` and `.frontmatter` folder, I understand that they could be combined. In the case of `.templates`, this can already be achieved by updating the [frontmatter.templates.folder](https://frontmatter.codes/docs/settings#frontmatter.templates.folder) setting. > > The `frontmatter.json` is currently expected on the root. It is also used for finding out the main project folder when using multi-folder workspace in VSCode. That's understandable. Thanks for clarifying! My issue is resolved. Do close this when you think it is ok. <!-- github-comment-id:936065866 -->
Author
Owner

Thanks for your feedback! Appreciated to think with me on this one. I'll close it once the new version got released.

Thanks for your feedback! Appreciated to think with me on this one. I'll close it once the new version got released. <!-- github-comment-id:936081412 -->
Author
Owner

@flikteoh thank you for becoming a sponsor! 🙏 I just added you to the readme + website as one of the sponsors.

@flikteoh thank you for becoming a sponsor! 🙏 I just added you to the readme + website as one of the sponsors. <!-- github-comment-id:936105748 -->
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#109