This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Fix markdown preview HTML file save with fenced code blocks. #567
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.
Description of the Change
Fixes issue #552, which is about markdown preview silently failing to "Save As..." when the markdown contains plain text fenced code blocks.
The patch here simply stops attempting to tokenize plain text fenced code blocks for syntax highlighting. It isn't necessary anyway.
You can read about the development of this patch in this comment:
#552 (comment)
This explains the code paths taken, and ultimately what the problem is (an unfulfilled promise when attempting to tokenize plain text).
Alternate Designs
A possible alternative fix might consider why no onDidTokenize callback happens when attempting to tokenize plain text. I don't believe the effects of such a fix would be any different than this patch, as there is no point in attempting to tokenize a plain text block.
Benefits
Issue #552 is fixed. Plain text (no language) fenced code blocks no longer cause file saves to fail.
Possible Drawbacks
None that I'm aware of.
Applicable Issues
Issue 552