kubeshop / vscode-monokle

An extension for Visual Studio Code to validate your Kubernetes configuration
https://marketplace.visualstudio.com/items?itemName=kubeshop.monokle
MIT License
6 stars 0 forks source link

Workspace (if git folder) is not re-validated on branch change #70

Closed f1ames closed 11 months ago

f1ames commented 12 months ago

This is a recent regression introduced in https://github.com/kubeshop/vscode-monokle/pull/62. As mentioned there:

Reworked how extension watches for file changes. Before it was generic (provided by VSCode API) watcher and now dedicated events are used - workspace.onDidChangeTextDocument (onType), workspace.onDidSaveTextDocument (onSave), workspace.onDidCreateFiles and workspace.onDidDeleteFiles (for both). The important difference is that, generic watcher also reacted when files were changed by 3rd-party processes, while those listeners reacts only for changes triggered by VSC (or it's API) - still I think it's reasonable in context of better efficiency we get from dedicated listeners.

So it worked before due to global filewatcher, and now with dedicated file change events it doesn't (as branch switch is external trigger). Since the above PR brought performance improvements, my first take on this would be having dedicated mechanism which can detect git branch switches (e.g. watcher on .git dir).

WitoDelnat commented 11 months ago

One suggestion is to add a git-branch monitor to the .git/HEAD file? Branch changes update the content here and we could re-validate when changes are detected. Monitoring just a single file should also be quite performant.