Open NomarCub opened 1 year ago
So far as I know, this is a limitation of VS Code and is referenced by this part of the documentation:
Because JavaScript code is cached after being loaded, edits to .markdownlint.cjs and .markdownlint-cli2.cjs require a restart of VS Code.
It might be enough to close and reopen the current workspace, but there is no clean way I know of to unload a script that has already been loaded so that it can be loaded again with new content. This may be possible under Node, but I've been burned before by the custom loader that VS Code uses.
This is a valid complaint, but I don't think I can do anything about it.
Just to clarify, is this only an issue when changing the .markdownlint.cjs
and .markdownlist-cli2.cjs
files, or is this an issue when changing the custom-rule JavaScript files as well?
The reason I ask is that I'm not changing either of these configuration files, but when editing or debugging the custom-rule JavaScript files, I have to restart VS Code after every edit in order for Markdownlint to recognize the changes. I'm trying to determine if this is something wrong with my configuration, an issue with Markdownlint, or a VS Code problem.
Thanks in advance for any information/clarification you can provide.
As I understand, this will apply to all JavaScript files. Once a file is interpreted and loaded by VS Code, it cannot be updated without a restart.
Something you may be able to do in newer builds of Code that is slightly easier is to reload/refresh extensions. I think I saw a command for that and it probably does enough to purge the cache and load the changes you've made.
When custom rules in the local workspace are changed, there's no way to make the extension refresh its rules. Toggling linting does nothing, only reloading VSCode entirely helps. Custom rules should be watched and reloaded when changed, or there should at least be an option to reload them or the entire config.