[gtksourceview: 7/9] less.lang: Fix :extend() not highlighted inside rulesets



commit b0a0469e5c7530d0ca730755e0c8b2108a97aba5
Author: Jeffery To <jeffery to gmail com>
Date:   Tue Jun 2 17:06:55 2020 +0800

    less.lang: Fix :extend() not highlighted inside rulesets
    
    Highlighting for extends inside rulesets (&:extend(...)) was left out /
    broken in b0042e4aeb21362abe3a8908b3226833f41fa8d5.

 data/language-specs/less.lang       | 15 +++++++++++++++
 tests/syntax-highlighting/file.less |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/data/language-specs/less.lang b/data/language-specs/less.lang
index 8800a608..f5eb75d4 100644
--- a/data/language-specs/less.lang
+++ b/data/language-specs/less.lang
@@ -545,6 +545,7 @@
         <context ref="css:at-rule"/> <!-- because Less variables look like at-rules -->
         <context ref="detached-ruleset-call"/>
         <context ref="standalone-plugin-function-call"/>
+        <context ref="inside-ruleset-extend"/>
         <context ref="css:style-block-content" original="true"/>
         <context ref="css:selector"/>
         <context ref="css:style-block"/>
@@ -801,6 +802,9 @@
 
     <!-- Less selectors -->
 
+    <!-- Less does not appear to allow comments between the colon(s) and
+         pseudo-element/class name -->
+
     <context id="parent-combinator">
       <match>(&amp;)(\%{css:identifier-chars}?)</match>
       <include>
@@ -834,6 +838,17 @@
       </include>
     </context>
 
+    <context id="inside-ruleset-extend">
+      <start>(?=&amp;:extend\()</start>
+      <end>\%{statement-end}</end>
+      <include>
+        <context sub-pattern="0" where="end" style-ref="css:delimiter"/>
+        <context ref="css:embedded-lang-hook"/>
+        <context ref="css:comment"/>
+        <context ref="css:selector"/>
+      </include>
+    </context>
+
 
     <!-- selectors -->
 
diff --git a/tests/syntax-highlighting/file.less b/tests/syntax-highlighting/file.less
index a6f9d486..ddda6e06 100644
--- a/tests/syntax-highlighting/file.less
+++ b/tests/syntax-highlighting/file.less
@@ -229,7 +229,8 @@ body {
 
 // attached to selector
 #main:extend(.card-style),
-.sidebar :extend(div pre) {
+.sidebar :extend(div pre),
+:not(:extend(#footer)) { /* not allowed as argument to :not() */
     color: blue;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]