thejustinwalsh / textproto-grammar

Syntax Highlighting for the Protocol Buffer Text Format
https://marketplace.visualstudio.com/items?itemName=thejustinwalsh.textproto-grammer
MIT License
14 stars 2 forks source link

feature: add support for highlighting syntax in Markdown previews #5

Closed marcusrbrown closed 3 years ago

marcusrbrown commented 3 years ago

This adds support of highlighting syntax within fenced code blocks in Markdown preview Web Views.

image

The biggest impact of this change is the extension now includes a code bundle. I do not make any effort to optimize the size of the bundle in this PR, I will add that feature in a separate one. Until that happens, packaging the extension will result in the following message:

$ vsce package
This extension consists of 419 files, out of which 197 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
 DONE  Packaged: /Users/mrbrown/github/igetgames/textproto-grammar/textproto-grammer-0.0.4.vsix (419 files, 878.4KB)

Note that the majority of these files come from Highlight.js to support other languages and themese. Bundling support will remove these extra files and minify the extension code, which will drastically reduce the extension size.

The Highlight.js language definition will need to be improved, I plan to tackle this when I circle back to update the TextMate grammar to be more correct. The version I included here is just to demonstrate the syntax highlighting working in the webview.

thejustinwalsh commented 3 years ago

🔥 🔥 🔥

marcusrbrown commented 3 years ago

I guess there isn't anything to hold off on, I'll get going on adding support for bundling.

thejustinwalsh commented 3 years ago

Maybe bundle with rollup to be cute? 🤣 Pros: API is slick, used it once, it's not Webpack. Cons: 🤷‍♂️ it's not Webpack.

marcusrbrown commented 3 years ago

I'll give it shot with rollup. Most extensions use Wepback, but I believe that is preference.

thejustinwalsh commented 3 years ago

The docs in the link about bundling from MS show you how to do it with WebPack so obviously I want to do it with rollup now... No preference either way tbh.

marcusrbrown commented 3 years ago

Ok, this one is good for review. Summary of changes over the last couple of days:

thejustinwalsh commented 3 years ago

Will get this rolled out ASAP! Thanks again!