From 97dc1d193f9a4b7cc90a63c7cc01870dbf05db79 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 18 Sep 2024 14:24:09 -0400 Subject: [PATCH] Use `@tag.doctype` for HTML doctype highlights (#18024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the following extensions to use the `@tag.doctype` selector for highlighting HTML doctypes: - Astro - Elixir (HEEx) - HTML Additionally, it also changes the base selector for HTML tags from `@keyword` to `@tag`. | Before | After | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | Screenshot 2024-09-18 at 2 04 41 PM | Screenshot 2024-09-18 at 2 05 00 PM | Extracted this from https://github.com/zed-industries/zed/pull/16723. Release Notes: - N/A --------- Co-authored-by: 狐狸 <134658521+Huliiiiii@users.noreply.github.com> --- docs/src/extensions/languages.md | 1 + extensions/astro/languages/astro/highlights.scm | 2 +- extensions/elixir/languages/heex/highlights.scm | 2 +- extensions/html/languages/html/highlights.scm | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/extensions/languages.md b/docs/src/extensions/languages.md index c00328530322b259a288e13408202ea3c9d59752..174a27c6e61d1a76a69d2fe55194c6a12d587579 100644 --- a/docs/src/extensions/languages.md +++ b/docs/src/extensions/languages.md @@ -123,6 +123,7 @@ This query marks strings, object keys, and numbers for highlighting. The followi | @string.special | Captures special strings | | @string.special.symbol | Captures special symbols | | @tag | Captures tags | +| @tag.doctype | Captures doctypes (e.g., in HTML) | | @text.literal | Captures literal text | | @title | Captures titles | | @type | Captures types | diff --git a/extensions/astro/languages/astro/highlights.scm b/extensions/astro/languages/astro/highlights.scm index 491e8cc337c4cae4ee499c73435dc51ec621793f..a565e22b6e227530f1da2cb8cc7d936b14d9af4f 100644 --- a/extensions/astro/languages/astro/highlights.scm +++ b/extensions/astro/languages/astro/highlights.scm @@ -1,6 +1,6 @@ (tag_name) @tag (erroneous_end_tag_name) @keyword -(doctype) @constant +(doctype) @tag.doctype (attribute_name) @property (attribute_value) @string (comment) @comment diff --git a/extensions/elixir/languages/heex/highlights.scm b/extensions/elixir/languages/heex/highlights.scm index 5252b71facd533473dae9e1ffda76924fae65eee..9662c955242be396ffbb40ba8ae10182beea0765 100644 --- a/extensions/elixir/languages/heex/highlights.scm +++ b/extensions/elixir/languages/heex/highlights.scm @@ -27,7 +27,7 @@ "=" @operator ; HEEx inherits the DOCTYPE tag from HTML -(doctype) @constant +(doctype) @tag.doctype (comment) @comment diff --git a/extensions/html/languages/html/highlights.scm b/extensions/html/languages/html/highlights.scm index e2b8e35bf4a7902c4e7a489b757e92744fb6aa1b..6bb0c23374b8f4e6edd5fdc8ae13df444df42b9a 100644 --- a/extensions/html/languages/html/highlights.scm +++ b/extensions/html/languages/html/highlights.scm @@ -1,6 +1,6 @@ -(tag_name) @keyword +(tag_name) @tag (erroneous_end_tag_name) @keyword -(doctype) @constant +(doctype) @tag.doctype (attribute_name) @property (attribute_value) @string (comment) @comment