estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...
https://frontmatter.codes
MIT License
1.95k stars 77 forks source link

Issue: Automatically adding/re-adding FM files to *all* my VS code projects whenever I open them #774

Closed tohagan closed 6 months ago

tohagan commented 6 months ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Install Front Matter (non-beta)
  2. Open any VS Code project without FM files
  3. The following files get added each time I open a VSCode project and I have to keep deleting them every time I re-open a VSCode project.

image

Expected behavior

Should only initialize an FM project when the dashboard is first opened. Probably should ask to do so.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

estruyf commented 6 months ago

That is weird, those files only get generated when the initialize command is executed.

What gets logged to the output in VSCode for Front Matter? https://frontmatter.codes/docs/troubleshooting#looking-what-is-happening-behind-the-scenes

estruyf commented 6 months ago

Oh, I might have an idea!

Can you verify if you have any frontMatter. settings in your ./.vscode/settings.json file? Besides the initialization, there is also an option to create the frontmatter.json file. As the extension verifies, you use any CMS settings in the current project/workspace.

tohagan commented 6 months ago

settings.json contained this setting but I don't believe I'd ever pressed the "Initialize Project" button. Oh well at least removing this might cure it.

{
  "frontMatter.content.pageFolders": []
}
estruyf commented 6 months ago

It could be by accident; the initialize button creates a frontmatter.json file, and settings are added. Only manually can you add settings to the settings.json file.

Good to know it was due to that.

tohagan commented 6 months ago

Ok I'm seeing this issue again in a different workspace with multiple subprojects. I definitely didn't bump the Initialize button on this project. It's creating a frontmatter.json file. Nothing related in ./.vscode/settings.json for either workspace or workspace projects.

I just found that keying Ctrl-S to save a file I've just edited pops up this from FrontMatter asking me to select a workspace project instead of saving the file. So that might explain what's happening.

image

estruyf commented 6 months ago

@tohagan that is a different kind of issue, will open a new one for it.