vscode-front-matter icon indicating copy to clipboard operation
vscode-front-matter copied to clipboard

Feedback: re-load configuration

Open davidsneighbour opened this issue 2 years ago • 5 comments

I have a system where my frontmatter.json is built automatically. After I rebuilt my frontmatter.json, while VSCode is open it does not seem to reload the configuration file. "Watch"ing and automatically reloading on frontmatter.json might be too resource-using, but there is also no "reload configuration and reload VSCode" in the CTRL+P menu. I would somehow expect Frontmatter to have either automatic reload of the config (on change) or some form of manual reload (via CTRL+P or other means).

Currently I am closing down VSCode and restart to load the changes.

If it is intended to reload the configuration on change, it's not working in my case ;)

  1. https://github.com/davidsneighbour/kollitsch.dev - clone
  2. run npm install and npm run build:frontmatter to recreate frontmatter.json

davidsneighbour avatar Aug 04 '22 16:08 davidsneighbour

Interesting @davidsneighbour there is both a watcher and a VS Code listener bound to the frontmatter.json file. I'll try and see what is going on.

estruyf avatar Aug 04 '22 18:08 estruyf

I can only reproduce it when you start without any frontmatter.json file, and run your npm run build:frontmatter script. In that case, the listeners are not bound to any file and will not trigger an update. Looking for a fix / new command to rebind these.

estruyf avatar Aug 04 '22 19:08 estruyf

https://user-images.githubusercontent.com/2900833/182934280-997fff16-599f-40db-a6a0-748411160035.mov

estruyf avatar Aug 04 '22 19:08 estruyf

The beta has a new frontMatter.config.reload (Front Matter: Reload config) command. An additional thing not shown in the above video is an auto-binding mechanism.

When there is no frontmatter.json file in the project, the listeners will go to a listeners pool. Waiting until there is a file created. Once created, they will be automatically bound.

estruyf avatar Aug 04 '22 19:08 estruyf

I am testing around with this. I have the feeling that maybe wireit might have an influence here. I need to simplify my project ;)

I always have the frontmatter.json created before I start, so in the case where I feel it does not update there is always a frontmatter.json created and gets changed while running the watch-job.

davidsneighbour avatar Aug 07 '22 14:08 davidsneighbour

You wrote

Interesting @davidsneighbour there is both a watcher and a VS Code listener bound to the frontmatter.json file. I'll try and see what is going on.

Could it be that wireit and VSCode compete for the file(s) to watch? I am still every now and then experiencing this whole "it doesn't seem to update" situation.

I'll try to remove wireit from my frontmatter setup, might bring some insights.

davidsneighbour avatar Aug 14 '22 14:08 davidsneighbour

Have you tried out the new: frontMatter.config.reload command?

estruyf avatar Aug 14 '22 14:08 estruyf

That actually works. I wonder if one can run this from outside of VSCode (maybe via npm scripts). We should close this issue as it's obviously just an issue in my chaotic project ;)

davidsneighbour avatar Aug 14 '22 15:08 davidsneighbour

I have an extension for that, you might be able to combine it.

https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-remote-control

estruyf avatar Aug 14 '22 15:08 estruyf