on master help sign in
type families
commit5e4aae9c8ab2d78987228ad21d30819b820d5fc8 authoriko <ilyakooo0@gmail.com> dateWed 16 Mar 2022, 12:56 (5 years ago) parent90f59d2
1 file changed+82−11
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+82−11
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+82−11
@@ -393,20 +393,56 @@
393393 </collection>
394394
395395 <collection name="type-family-definition">
396− <scope name="haskell.definition.type.type-family">
397− <symbol type="type" />
396+ <scope name="haskell.definition.type-family.type">
397+ <symbol type="type">
398+ <context behavior="subtree" foldable="false" />
399+ </symbol>
398400 <starts-with>
399− <expression>^(\h*)(type\h+family)\h+`?(\w(\w|')*)`?($|\h)</expression>
401+ <expression>^(\h*)(type\h+family)</expression>
400402 <capture number="2" name="haskell.keyword.construct.type-family" />
401403 </starts-with>
402404 <ends-with>
403405 <template>^(?!\s+\1\S)(?!\s*$)</template>
404406 </ends-with>
405− <subscopes>
406− <scope name="haskell.keyword.construct.where">
407− <expression>where</expression>
407+ <subscopes anchored="true" skip-whitespace="false">
408+ <scope name="haskell.type-family.head">
409+ <starts-with>
410+ <expression></expression>
411+ </starts-with>
412+ <ends-with>
413+ <expression>where</expression>
414+ <capture number="0" name="haskell.keyword.construct.where" />
415+ </ends-with>
416+ <subscopes anchored="true">
417+ <scope name="haskell.identifier.type-family.type.name">
418+ <expression>\S+</expression>
419+ </scope>
420+ <include syntax="self" collection="type" repeat="true" optional="true" />
421+ </subscopes>
408422 </scope>
409− <include syntax="self" collection="type" />
423+
424+ <include syntax="self" collection="type-family-case-definition" optional="true" repeat="true" />
425+ </subscopes>
426+ </scope>
427+ </collection>
428+
429+ <collection name="type-family-case-definition">
430+ <scope name="haskell.definition.type-family.type.case">
431+ <starts-with>
432+ <expression>^(\h*)(?=\S)</expression>
433+ </starts-with>
434+ <ends-with>
435+ <template>^(?!\s+\1\S)(?!\s*$)</template>
436+ </ends-with>
437+ <subscopes anchored="true">
438+ <scope name="haskell.identifier.type-family.type.name">
439+ <expression>\S+</expression>
440+ </scope>
441+ <include syntax="self" collection="type" optional="true" repeat="true" />
442+ <scope>
443+ <expression>=</expression>
444+ </scope>
445+ <include syntax="self" collection="type" optional="true" repeat="true" />
410446 </subscopes>
411447 </scope>
412448 </collection>
@@ -594,15 +630,48 @@
594630 </collection>
595631
596632 <collection name="type">
633+ <scope name="haskell.type.construct.tuple">
634+ <starts-with>
635+ <expression>\(</expression>
636+ </starts-with>
637+ <ends-with>
638+ <expression>\)</expression>
639+ </ends-with>
640+ <subscopes>
641+ <scope name="haskell.construct.type.typle.comma">
642+ <expression>\,</expression>
643+ </scope>
644+ <include syntax="self" collection="type" />
645+ </subscopes>
646+ </scope>
647+ <scope name="haskell.type.list">
648+ <starts-with>
649+ <expression>'?\[</expression>
650+ </starts-with>
651+ <ends-with>
652+ <expression>\]</expression>
653+ </ends-with>
654+ <subscopes>
655+ <include syntax="self" collection="type" />
656+ </subscopes>
657+ </scope>
658+ <scope name="haskell.type.star">
659+ <expression>\*</expression>
660+ </scope>
661+ <scope name="haskell.keyword.construct.type-annotation-operator">
662+ <expression>::</expression>
663+ </scope>
597664 <include syntax="self" collection="type-list" />
598− <scope name="haskell.identifier.type">
599− <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
665+ <scope>
666+ <expression>(([A-Z](\w|')*\.)*)'*([A-Z](\w|')*)</expression>
667+ <capture number="1" name="haskell.identifier.package.module" />
668+ <capture number="4" name="haskell.identifier.type" />
600669 </scope>
601670 <scope name="haskell.keyword.construct.forall">
602671 <expression>forall</expression>
603672 </scope>
604673 <scope name="haskell.identifier.type.variable">
605− <expression>\w(\w|')*</expression>
674+ <expression>(?!=)((?!(\(|\)|\,))\S)((?!(\(|\)|\,))\S)*</expression>
606675 </scope>
607676 <scope name="haskell.keyword.construct.function-arrow">
608677 <expression>-&gt;</expression>
@@ -688,7 +757,9 @@
688757
689758 <collection name="qvarid">
690759 <scope name="haskell.identifier.function">
691− <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
760+ <expression>(([A-Z](\w|')*\.)*)(\w(\w|')*)</expression>
761+ <capture number="1" name="haskell.identifier.package.module" />
762+ <capture number="4" name="haskell.identifier.type" />
692763 </scope>
693764 </collection>
694765