Feat/optimize snippets #450
Open
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.
optimize snippet expansion and
runSnippetCursor.It doesn't differ that much from 0.5-0.7ms to 0.2-0.3ms, but running regex first and then excluded environments is faster in math.
The
ShouldRunInSnippetModeis better if its first for text and worse for math, probably because there are more math snippets but it doesn't differ that much that it should be changed.For expansion:
view.dispatchis very slow for large documents so adding to the queue, adding tabstops, replacing the snippet syntax and inserting the replacement is all done in one call now.Its still 2 calls for automatic snippets and it could be maybe be done in one call by changing the code that handles when a snippet is undone and redone, but I don't currently have an idea how I would implement that.