From 5c89b88a37a2e1e36c031469462d6ee85ff2c13c Mon Sep 17 00:00:00 2001 From: rockerBOO Date: Mon, 16 Nov 2020 04:28:40 -0500 Subject: [PATCH] feat: add highlight test --- queries/highlights.scm | 32 +++++++++++------ test/highlight/test_css.css | 70 +++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 test/highlight/test_css.css diff --git a/queries/highlights.scm b/queries/highlights.scm index 763661a..40c6586 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -23,8 +23,11 @@ "only" @operator (attribute_selector (plain_value) @string) -(pseudo_element_selector (tag_name) @attribute) -(pseudo_class_selector (class_name) @attribute) + +((property_name) @variable + (#match? @variable "^--")) +((plain_value) @variable + (#match? @variable "^--")) (class_name) @property (id_name) @property @@ -32,15 +35,12 @@ (property_name) @property (feature_name) @property +(pseudo_element_selector (tag_name) @attribute) +(pseudo_class_selector (class_name) @attribute) (attribute_name) @attribute (function_name) @function -((property_name) @variable - (#match? @variable "^--")) -((plain_value) @variable - (#match? @variable "^--")) - "@media" @keyword "@import" @keyword "@charset" @keyword @@ -59,6 +59,18 @@ (float_value) @number (unit) @type -"#" @punctuation.delimiter -"," @punctuation.delimiter -":" @punctuation.delimiter +[ + "#" + "," + "." + ":" + "::" + ";" +] @punctuation.delimiter + +[ + "{" + ")" + "(" + "}" +] @punctuation.bracket diff --git a/test/highlight/test_css.css b/test/highlight/test_css.css new file mode 100644 index 0000000..e67a805 --- /dev/null +++ b/test/highlight/test_css.css @@ -0,0 +1,70 @@ +:root { + /* <- attribute */ +/* <- punctuation.delimiter */ + --color1: #000; + /* <- property */ + /* ^ string.special */ + /* ^ punctuation.delimiter */ + --color2: rgba(255, 255, 255, 1); + /* ^ function */ + /* ^ punctuation.delimiter */ + + --font-family: 'Times New Roman', sans-serif; + --spacing: .3em; + + --gap: 8px; +} + +body { +/* <- tag */ + font-family: var(--font-family); + /* ^ function */ + /* ^ punctuation.bracket */ + /* ^ variable */ +} + +a { + color: blue; +} + +a:href { + color: green; +} + +#logo { +/* <- punctuation.delimiter */ +/* ^ property */ + /* ^ punctuation.bracket */ + font-family: sans-serif; + /* <- property */ + /* ^ punctuation.delimiter */ + /* ^ punctuation.delimiter */ + font: normal bold 1rem / 1.4 'Times New Roman', sans-serif; + /* ^ punctuation.delimiter */ + /* ^ operator */ + /* ^ number */ + /* ^ punctuation.delimiter */ + /* ^ string */ + /* ^ number */ + /* ^ type */ + padding: 0px 0px; + /* ^ punctuation.delimiter */ + /* ^ number */ + /* ^ type */ + /* <- property */ +} +/* <- punctuation.bracket */ + +@media (max-width: 1024px) { + /* ^ number */ + /* ^ type */ + /* ^ property */ +/* <- keyword */ + /* ^ punctuation.bracket */ + /* ^ punctuation.bracket */ + .container { + /* <- property */ + /* <- punctuation.delimiter */ + display: flex; + } +}