Tree Sitter: Add custom HTML queries.

Review Request #14521 — Created July 28, 2025 and updated

Information

Review Board
master

Reviewers

The HTML highlights queries implemented by nvim-treesitter are extremely
slow, and don't seem to actually buy us anything in the resulting
output. This change adds custom queries for HTML which are based on the
upstream queries from the tree-sitter-html implementation, but with
improved injections for inline CSS and JS within tags.

  • Ran unit tests.
  • Checked syntax highlighting of HTML and verified that everything
    looked good, including injected CSS and JS both in <script> and
    <style> tags, as well as on*="" andstyle=""` attributes.
  • Profiled syntax highlighting of HTML and verified that the performance
    of these queries was better (by 100x) than the nvim-treesitter HTML
    queries.
Summary ID
Tree Sitter: Add custom HTML queries.
The HTML highlights queries implemented by nvim-treesitter are extremely slow, and don't seem to actually buy us anything in the resulting output. This change adds custom queries for HTML which are based on the upstream queries from the tree-sitter-html implementation, but with improved injections for inline CSS and JS within tags. Testing Done: - Ran unit tests. - Checked syntax highlighting of HTML and verified that everything looked good, including injected CSS and JS both in `<script>` and `<style>` tags, as well as `on*="" and `style=""` attributes. - Profiled syntax highlighting of HTML and verified that the performance of these queries was better (by 100x) than the nvim-treesitter HTML queries.
633586a380e87d515bccf5eaae3d14b9d71707ce
Checks run (2 succeeded)
flake8 passed.
JSHint passed.