Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh custom rules #259

Open
NomarCub opened this issue Nov 6, 2022 · 3 comments
Open

Refresh custom rules #259

NomarCub opened this issue Nov 6, 2022 · 3 comments

Comments

@NomarCub
Copy link

NomarCub commented Nov 6, 2022

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.

@DavidAnson
Copy link
Owner

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.

@cdeyoung
Copy link

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.

@DavidAnson
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants