on master help sign in
.
commit90f59d290d8c7cc0316b8cdf14ac332c1176376c authoriko <ilyakooo0@gmail.com> dateFri 11 Mar 2022, 15:54 (5 years ago) parent979cc86
2 files changed+74−25
Haskell Language Server.novaextension/Scripts/main.js+1−1 Haskell Language Server.novaextension/Syntaxes/Haskell.xml+73−24
Haskell Language Server.novaextension/Scripts/main.js+1−1
@@ -23,7 +23,7 @@ exports.activate = function () {
2323 startServer();
2424 });
2525 nova.commands.register("format", formatFile);
26− // startServer();
26+ startServer();
2727};
2828exports.deactivate = function () {
2929 // Clean up state before the extension is deactivated
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+73−24
@@ -1,9 +1,9 @@
11<?xml version="1.0" encoding="UTF-8"?>
22<syntax name="haskell">
33 <meta>
4− <name>Haskell</name>
5− <type>compiled</type>
6− <preferred-file-extension>hs</preferred-file-extension>
4+ <name>Haskell</name>
5+ <type>compiled</type>
6+ <preferred-file-extension>hs</preferred-file-extension>
77 </meta>
88
99 <detectors>
@@ -41,7 +41,7 @@
4141 <indentation>
4242 <increase>
4343 <expression>
44− (case|class|do|let|where).*
44+ (case|class|do|let|where|=).*
4545 </expression>
4646 </increase>
4747 <decrease>
@@ -92,7 +92,6 @@
9292 <include syntax="self" collection="tuple" />
9393
9494
95−
9695 <!-- Needed for do binds -->
9796 <!-- <include syntax="self" collection="pattern-match" /> -->
9897 </collection>
@@ -314,7 +313,7 @@
314313 </ends-with>
315314 <subscopes>
316315 <include syntax="self" collection="case-match" />
317− <include syntax="self" collection="expressions"/>
316+ <include syntax="self" collection="expressions" />
318317 </subscopes>
319318 </scope>
320319 </collection>
@@ -746,8 +745,11 @@
746745
747746 <collection name="module">
748747 <scope name="haskell.definition.module.package">
748+ <symbol type="package">
749+ <context behavior="subtree" foldable="true" export-local="true" />
750+ </symbol>
749751 <starts-with>
750− <expression>^(module)\s+(\w|\.)+</expression>
752+ <expression>^(module)\s+((\w|\.)+)</expression>
751753 <capture number="1" name="haskell.construct.keyword.module" />
752754 <capture number="2" name="haskell.definition.module.package" />
753755 </starts-with>
@@ -755,32 +757,72 @@
755757 <expression>(where)</expression>
756758 <capture number="1" name="haskell.construct.keyword.module" />
757759 </ends-with>
758− <subscopes export-symbols="true">
759− <scope name="identifier.constant">
760+ <subscopes>
761+ <scope name="identifier.haskell.type">
762+ <symbol type="expression" />
763+ <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
764+ <capture number="1" name="identifier.type" />
765+ </scope>
766+ <scope name="identifier.variable">
767+ <symbol type="expression" />
760768 <expression>(\w|')+</expression>
769+ <capture number="0" name="identifier.haskell.function" />
761770 </scope>
762771 </subscopes>
763772 </scope>
764773 </collection>
765774
766775 <collection name="import">
767− <scope name="haskell.construct.keyword.import">
768− <expression>^import\s</expression>
769− </scope>
770− <scope name="haskell.construct.keyword.qualified">
771− <expression>qualified</expression>
772− </scope>
773− <scope name="haskell.construct.keyword.as">
774− <expression>as</expression>
775− </scope>
776− <scope name="haskell.identifier.module.package">
777− <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
776+ <scope name="haskell.construct.import">
777+ <starts-with>
778+ <expression>^(import)\s</expression>
779+ <capture number="1" name="haskell.construct.keyword.import" />
780+ </starts-with>
781+ <ends-with>
782+ <expression>(?=^\S)</expression>
783+ </ends-with>
784+ <subscopes>
785+ <scope name="haskell.construct.qualified">
786+ <expression>qualified</expression>
787+ <capture number="0" name="haskell.construct.keyword.qualified" />
788+ </scope>
789+
790+ <scope name="haskell.construct.hiding">
791+ <symbol type="keyword">
792+ <context behavior="subtree" />
793+ </symbol>
794+ <starts-with>
795+ <expression>(hiding)\h*(?=\()</expression>
796+ <capture number="1" name="haskell.construct.keyword.hiding" />
797+ </starts-with>
798+ <ends-with>
799+ <expression>(?=\))</expression>
800+ </ends-with>
801+ <subscopes anchored="true">
802+ <include syntax="self" collection="import-list" />
803+ </subscopes>
804+ </scope>
805+
806+ <scope name="haskell.construct.keyword.as">
807+ <symbol type="package" />
808+ <expression>as(\h+([A-Z]\w*))?</expression>
809+ <capture number="2" name="haskell.package.qualified.name" />
810+ </scope>
811+ <scope name="haskell.identifier.module.package">
812+ <symbol type="package" />
813+ <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
814+ <capture number="0" name="haskell.package.name" />
815+ </scope>
816+ <include syntax="self" collection="import-list" />
817+ </subscopes>
778818 </scope>
779− <include syntax="self" collection="import-list" />
780819 </collection>
781820
782821 <collection name="import-list">
783822 <scope name="import-list">
823+ <symbol>
824+ <context behavior="subtree" export-local="true" />
825+ </symbol>
784826 <starts-with>
785827 <expression>(\()</expression>
786828 <capture number="1" name="haskell.import-list.bracket" />
@@ -790,8 +832,15 @@
790832 <capture number="1" name="haskell.import-list.bracket" />
791833 </ends-with>
792834 <subscopes>
793− <scope name="identifier.decorator">
794− <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
835+ <scope name="haskell.identifier.struct">
836+ <symbol type="reference" scope="local" />
837+ <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
838+ <capture number="1" name="haskell.import-list.identifier.type.name" />
839+ </scope>
840+ <scope name="haskell.identifier.function">
841+ <symbol type="reference" scope="local" />
842+ <expression>(\w|')+</expression>
843+ <capture number="0" name="haskell.import-list.function.name" />
795844 </scope>
796845 </subscopes>
797846 </scope>
@@ -877,4 +926,4 @@
877926
878927
879928 </collections>
880−</syntax>
929+</syntax>