Draft: Move Most Linting Logic to Web Workers #1047
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #337
Relates to #927
Relates to #872
This should unblock #488 which gets us closer to #183
To make the linting experience better for users, it is better if we can run the linting logic on a separate thread from the main thread. This will allow the user to be able to work on things if linting a file is taking a while. Most rules can run in the web workers. But the ones that deal with moment or obsidian specific logic have to remain on the main thread since they cannot have their data passed to and from the web worker (this is a limitation due to the complexity of the moment object) and because the source code is not available at compile time which makes it impossible to inline the logic from obsidian. So we have to compromise a little here. But this should still be a net improvement for users with larger files or who use mass linting options on their vaults. This will need to be in BETA for some time if possible. So I will need to setup BRAT for this change.
TODO:
RulesRunner
class for references to the lint file managerutils
folder as alint
orlint-runner
file since it is just a set of related functions that are useful when running linting operationsIf we want to have more than 1 worker running at a time: