on master help sign in
wip
commit0d7f086127cd4908bc9dc73c85a7b1a741169711 authoriko <ilyakooo0@gmail.com> dateFri 18 Mar 2022, 16:44 (5 years ago) parent2939a48
1 file changed+56−33
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+56−33
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+56−33
@@ -79,6 +79,9 @@
7979 </collection>
8080
8181 <collection name="expressions">
82+ <scope>
83+ <expression></expression>
84+ </scope>
8285 <include syntax="self" collection="do-bind" />
8386 <include syntax="self" collection="literal" />
8487 <include syntax="self" collection="operators" />
@@ -310,7 +313,7 @@
310313 <ends-with>
311314 <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
312315 </ends-with>
313− <subscopes>
316+ <subscopes anchored="true" skip-whitespace="false">
314317 <include syntax="self" collection="case-match" />
315318 <include syntax="self" collection="expressions" />
316319 </subscopes>
@@ -371,7 +374,9 @@
371374
372375 <collection name="instance">
373376 <scope name="haskell.instance">
374− <symbol type="category" />
377+ <symbol type="category">
378+ <context behavior="whitespace" foldable="true" />
379+ </symbol>
375380 <starts-with>
376381 <expression>^(\h*)(instance)($|\h)</expression>
377382 <capture number="2" name="haskell.keyword.construct.instance" />
@@ -379,21 +384,32 @@
379384 <ends-with>
380385 <template>^(?!\s+\1\S)(?!\s*$)</template>
381386 </ends-with>
382− <subscopes>
383− <scope name="haskell.keyword.construct.where">
384− <expression>where</expression>
387+ <subscopes anchored="true" skip-whitespace="false">
388+ <scope name="haskell.construct.instance.head">
389+ <starts-with>
390+ <expression></expression>
391+ </starts-with>
392+ <ends-with>
393+ <expression>where</expression>
394+ <capture number="0" name="haskell.keyword.construct.where" />
395+ </ends-with>
396+ <subscopes>
397+ <include syntax="self" collection="type" optional="true" repeat="true" />
398+ </subscopes>
385399 </scope>
386− <include syntax="self" collection="type" />
387− <include syntax="self" collection="type-definition" />
388− <include syntax="self" collection="type-annotation" />
389− <include syntax="self" collection="definition" />
400+ <include syntax="self" collection="instance-body" />
390401 </subscopes>
391402 </scope>
392403 </collection>
393404
405+ <collection name="instance-body">
406+ <include syntax="self" collection="definition" />
407+ <include syntax="self" collection="type-definition" />
408+ </collection>
409+
394410 <collection name="type-family-definition">
395411 <scope name="haskell.definition.type-family.type">
396− <symbol type="type">
412+ <symbol type="type" scope="global">
397413 <context behavior="subtree" foldable="false" />
398414 </symbol>
399415 <starts-with>
@@ -445,16 +461,13 @@
445461
446462 <collection name="definition">
447463 <scope name="haskell.definition.type.function">
448− <symbol type="function">
449− <display-name>
450− <component selector="haskell.definition.type.function" />
451− </display-name>
452−
464+ <symbol type="function" scope="local">
465+ <context behavior="whitespace" foldable="true" />
453466 </symbol>
454467 <starts-with>
455468 <expression>^(?=(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h))</expression>
456469 <capture number="2" name="haskell.keyword.construct.default" />
457− <capture number="3" name="haskell.identifier.function" />
470+ <capture number="3" name="haskell.identifier.function.name" />
458471 </starts-with>
459472 <ends-with>
460473 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
@@ -468,6 +481,9 @@
468481
469482 <collection name="do-bind">
470483 <scope name="do-bind">
484+ <symbol>
485+ <context behavior="whitespace"></context>
486+ </symbol>
471487 <starts-with>
472488 <expression>^(?=((\h*)\S.+&lt;-($|\h)))</expression>
473489 </starts-with>
@@ -504,7 +520,6 @@
504520
505521 <collection name="implementation">
506522 <scope name="haskell.definition.type.function">
507− <local scope="within-construct" />
508523 <starts-with>
509524 <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
510525 <capture number="2" name="haskell.keyword.construct.default" />
@@ -513,9 +528,14 @@
513528 <ends-with>
514529 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
515530 </ends-with>
516− <subscopes>
517− <include syntax="self" collection="where-clause" />
518− <include syntax="self" collection="expressions" />
531+ <subscopes anchored="true">
532+ <include syntax="self" collection="pattern-match" optional="true" repeat="true" />
533+ <scope>
534+ <expression>=</expression>
535+ <capture number="0" name="haskell.construct.function.keyword.eq" />
536+ </scope>
537+ <include syntax="self" collection="expressions" optional="true" repeat="true" />
538+ <include syntax="self" collection="where-clause" optional="true" />
519539 </subscopes>
520540 </scope>
521541 </collection>
@@ -537,10 +557,13 @@
537557
538558 <collection name="type-definition">
539559 <scope name="haskell.definition.type">
560+ <symbol type="type" scope="global">
561+ <context behavior="whitespace" foldable="true" />
562+ </symbol>
540563 <starts-with>
541564 <expression>^(\h*)(type)\h+(\w(\w|')*)</expression>
542565 <capture number="2" name="haskell.keyword.construct.type" />
543− <capture number="3" name="haskell.identifier.type" />
566+ <capture number="3" name="haskell.identifier.type.name" />
544567 </starts-with>
545568 <ends-with>
546569 <template>^(?!\s+\1\S)(?!\s*$)</template>
@@ -553,7 +576,7 @@
553576
554577 <collection name="GADT-definition">
555578 <scope name="haskell.definition.struct.GADT">
556− <symbol type="struct">
579+ <symbol type="struct" scope="global">
557580 <context behavior="subtree" foldable="false" />
558581 </symbol>
559582 <starts-with>
@@ -594,7 +617,7 @@
594617
595618 <collection name="deriving-clause">
596619 <scope name="haskell.record.construct.deriving.keyword">
597− <expression>deriving\h+(newtype|stock|anyclass)</expression>
620+ <expression>deriving(\h+(newtype|stock|anyclass))?</expression>
598621 </scope>
599622 </collection>
600623
@@ -628,6 +651,13 @@
628651 </collection>
629652
630653 <collection name="type">
654+ <scope name="haskell.keyword.construct.function-arrow">
655+ <expression>-&gt;</expression>
656+ </scope>
657+ <scope name="haskell.keyword.construct.fat-arrow">
658+ <expression>=&gt;</expression>
659+ </scope>
660+ <include syntax="self" collection="strings" />
631661 <scope name="haskell.type.construct.tuple">
632662 <starts-with>
633663 <expression>\(</expression>
@@ -661,7 +691,7 @@
661691 </scope>
662692 <include syntax="self" collection="type-list" />
663693 <scope>
664− <expression>(([A-Z](\w|')*\.)*)'*([A-Z](\w|')*)</expression>
694+ <expression>(([A-Z](\w|')*\.)*)'*\!?([A-Z](\w|')*)</expression>
665695 <capture number="1" name="haskell.identifier.package.module" />
666696 <capture number="4" name="haskell.identifier.type" />
667697 </scope>
@@ -669,13 +699,7 @@
669699 <expression>forall</expression>
670700 </scope>
671701 <scope name="haskell.identifier.type.variable">
672− <expression>(?!=)((?!(\(|\)|\,))\S)((?!(\(|\)|\,))\S)*</expression>
673− </scope>
674− <scope name="haskell.keyword.construct.function-arrow">
675− <expression>-&gt;</expression>
676− </scope>
677− <scope name="haskell.keyword.construct.fat-arrow">
678− <expression>=&gt;</expression>
702+ <expression>(?!where)(?!=)((?!(\(|\)|\,|\!))\S)((?!(\(|\)|\,))\S)*</expression>
679703 </scope>
680704 </collection>
681705
@@ -738,7 +762,6 @@
738762
739763 <collection name="where-clause">
740764 <scope name="haskell.construct.where">
741− <local scope="within-parent" />
742765 <starts-with>
743766 <expression>^(\h*)(where)</expression>
744767 <capture number="2" name="haskell.construct.keyword.where" />
@@ -995,4 +1018,4 @@
9951018
9961019
9971020 </collections>
998−</syntax>
1021+</syntax>