on 4eccdad help sign in
5 files changed+315−424
since splitsnapshots
unifiedsplit
Haskell Language Server.novaextension/Scripts/download.js+1−42 Haskell Language Server.novaextension/Scripts/main.js+6−5 Haskell Language Server.novaextension/Scripts/utils.js+1−92 Haskell Language Server.novaextension/Syntaxes/Haskell.xml+148−85 Haskell Language Server.novaextension/extension.json+159−200
Haskell Language Server.novaextension/Scripts/download.js+1−42
@@ -5,8 +5,6 @@ const {
55const {
66 readStream,
77 getStorage,
8− call,
9− hasCustomEnv
108} = require("utils");
119
1210exports.getHLS = getHLS;
@@ -45,9 +43,6 @@ async function downloadTool(name) {
4543 const storagePath = getStorageForTool(name);
4644 console.log("Downloading " + storagePath);
4745 const urls = await getHLSAssets();
48− if (!(name in urls)) {
49− sendPermanentNotification("There is no pre-built HLS for GHC " + name ,"There is no pre-built version of HLS for GHC " + name + ". You can either build HLS yourself or update your project to one of the pre-built versions: https://github.com/haskell/haskell-language-server/releases")
50− }
5146 const response = await fetch(urls[name]);
5247 if (!response.ok) {
5348 console.error(response.statusText);
@@ -133,7 +128,7 @@ async function getGHCVersion() {
133128 sendPermanentNotification(
134129 tool + " not installed!",
135130 "Please install " + tool +
136− " and restart Haskell Language Server.",
131+ " and restart Haskell Language Server.",
137132 );
138133 } else {
139134 sendPermanentNotification("Couldn't detect GHC version", x);
@@ -146,28 +141,7 @@ async function getGHCVersion() {
146141 return promise;
147142}
148143async function getHLS() {
149− const explicitPath = nova.workspace.config.get("haskell-language-server-path")
150− if (explicitPath) {
151− sendNotification("HLS path specified in settings", "Using the path to haskell-language-server specified in settings.")
152− return explicitPath
153− }
154−
155− const localHLSPath = await which("haskell-language-server").catch((_) => null)
156− if (hasCustomEnv() && localHLSPath) {
157− return localHLSPath
158− }
159−
160144 const version = await getGHCVersion();
161− if (localHLSPath) {
162− sendNotification("Found HLS", "Found haskell-language-server in PATH. Checking if it is the right version.")
163− const v = await getHLSVersion(localHLSPath)
164− if (v === version) {
165− sendNotification("Using local HLS", "The haskell-language-server in PATH has the right version. Using it.")
166− return localHLSPath
167− } else {
168− sendNotification("Not using local HLS", "The haskell-language-server in PATH is built fot GHC " + v + " but we need GHC " + version + ". Trying other alternatives.")
169− }
170− }
171145 return await getTool(version);
172146}
173147
@@ -182,18 +156,3 @@ function getToolName(name) {
182156function notifyToolDownloading(name) {
183157 sendNotification("Downloading tool", "Downloading " + getToolName(name));
184158}
185−
186−function getHLSVersion(path) {
187− return call(path, {
188− args: ["--version"],
189− })
190− .then((x) => x.match(/\(GHC: (\S+)\)/)[1].trim())
191− .catch((err) => sendPermanentNotification("HLS version check failed", err))
192−}
193−
194−function which(name) {
195− return call("/usr/bin/which", {
196− args: [name],
197− shell: true,
198− }).then((p) => p.trim())
199−}
Haskell Language Server.novaextension/Scripts/main.js+6−5
@@ -9,9 +9,8 @@ const {
99 getHLSConfig,
1010} = require("configuration");
1111const {
12− getFileName, createEnv, getEnv
12+ getFileName,
1313} = require("utils");
14−
1514exports.activate = function () {
1615 nova.commands.register("stop", (_workspace) => {
1716 stopServer();
@@ -108,12 +107,10 @@ function applyAllLSPEdits(edits, text) {
108107}
109108let lspClient = null;
110109async function startServer() {
111− await createEnv()
112110 stopServer();
113111 const path = await getServerPath();
114− const env = await getEnv()
115112 const serverOptions = {
116− path, env,
113+ path: path,
117114 args: ["lsp", "--cwd", nova.workspace.path],
118115 };
119116 const clientOptions = {
@@ -140,3 +137,7 @@ function stopServer() {
140137function getServerPath() {
141138 return getHLS();
142139}
140+
141+// function getLogPath() {
142+// return getStorage() + "/haskell-language-server.log";
143+// }
Haskell Language Server.novaextension/Scripts/utils.js+1−92
@@ -1,8 +1,3 @@
1−const {
2− sendNotification,
3− sendPermanentNotification,
4−} = require("notifications");
5−
61function readStream(readableStream) {
72 return new Promise((resolve, _reject) => {
83 const reader = readableStream.getReader();
@@ -53,90 +48,4 @@ function traceRaw(x) {
5348 return x;
5449}
5550
56−async function call(path, args) {
57− const env = await getEnv()
58− const process = new Process(path, {...args, ...{env}});
59− const promise = new Promise((resolve, reject) => {
60− process.onDidExit((exitCode) => {
61− console.log(exitCode)
62− if (exitCode == 0) {
63− readStream(process.stdout).then((x) => {
64− resolve(x);
65− });
66− } else {
67− readStream(process.stderr).then((x) => {
68− reject(x)
69− });
70− }
71− });
72− })
73− process.start()
74− return promise
75−}
76−
77−
78−function parseEnvs(x) {
79− const env = {}
80− for (line of x.split("\n")) {
81− const res = line.match(/(.*?)=(.*)/)
82− if (res) {
83− env[res[1]] = res[2]
84− }
85− }
86−
87− console.log(JSON.stringify(env))
88−
89− return env
90−}
91−
92−let envCache = null
93−
94−async function createEnv() {
95− const generator = nova.workspace.config.get("env-generator")
96− if (generator) {
97− const [prog, ...args] = generator.split(/\s+/)
98− sendNotification("Generating environment", "Executing " + generator + ".")
99− const process = new Process(prog, {
100− shell: true,
101− args,
102− cwd: nova.workspace.path
103− });
104− const promise = new Promise((resolve, reject) => {
105− process.onDidExit((exitCode) => {
106− console.log(exitCode)
107− if (exitCode == 0) {
108− readStream(process.stdout).then((x) => {
109− resolve(x);
110− });
111− } else {
112− readStream(process.stderr).then((x) => {
113− reject(x)
114− });
115− }
116− });
117− })
118− process.start()
119−
120− const envStr = await promise
121− .catch((err) => sendPermanentNotification("Generating environment failed", err))
122− envCache = parseEnvs(envStr)
123− } else {
124− envCache = {}
125− }
126−}
127−
128−async function getEnv() {
129− console.log(JSON.stringify(envCache))
130− if (!envCache) {
131− await createEnv()
132− }
133− return envCache
134−}
135−
136−
137−function hasCustomEnv() {
138− return (nova.workspace.config.get("env-generator") !== null)
139−}
140−
141−module.exports = { readStream, getStorage, getFileName, trace, traceRaw, call, createEnv, hasCustomEnv, getEnv };
142−
51+module.exports = { readStream, getStorage, getFileName, trace, traceRaw };
Haskell Language Server.novaextension/Syntaxes/Haskell.xml+148−85
@@ -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>
@@ -57,6 +57,7 @@
5757 <include syntax="self" collection="type-family-definition" />
5858 <include syntax="self" collection="pattern-definition" />
5959 <include syntax="self" collection="type-definition" />
60+ <!-- <include syntax="self" collection="type-annotation" /> -->
6061 <include syntax="self" collection="GADT-definition" />
6162 <include syntax="self" collection="instance" />
6263 <include syntax="self" collection="typeclass" />
@@ -65,6 +66,7 @@
6566
6667 <template-scopes>
6768 <include syntax="self" collection="Quote" />
69+ <include syntax="self" collection="comments" />
6870 </template-scopes>
6971
7072 <collections>
@@ -77,16 +79,7 @@
7779 </collection>
7880
7981 <collection name="expressions">
80− <scope name="haskell.construct.keyword.at">
81− <expression>@</expression>
82− </scope>
83− <scope name="haskell.construct.keyword.case-arrow">
84− <expression>-&gt;</expression>
85− </scope>
86− <scope name="haskell.construct.keyword.bind-arrow">
87− <expression>&lt;-</expression>
88− </scope>
89− <include syntax="self" collection="keywords" />
82+ <include syntax="self" collection="do-bind" />
9083 <include syntax="self" collection="literal" />
9184 <include syntax="self" collection="operators" />
9285 <include syntax="self" collection="record-match" />
@@ -94,12 +87,33 @@
9487 <include syntax="self" collection="view-pattern" />
9588 <include syntax="self" collection="lambda-case" />
9689 <include syntax="self" collection="lambda-head" />
97− <include syntax="self" collection="case-expression" />
90+ <include syntax="self" collection="type-applications" />
91+ <include syntax="self" collection="outer-case-expression" />
9892 <include syntax="self" collection="qconid" />
9993 <include syntax="self" collection="qvarid" />
10094 <include syntax="self" collection="tuple" />
10195 </collection>
10296
97+ <collection name="type-applications">
98+ <scope name="type-applications">
99+ <starts-with>
100+ <expression>(\s@)\(</expression>
101+ <capture number="1" name="haskell.keyword.operator.typeapplication" />
102+ </starts-with>
103+ <ends-with>
104+ <expression>)</expression>
105+ </ends-with>
106+ <subscopes>
107+ <include syntax="self" collection="type" />
108+ </subscopes>
109+ </scope>
110+ <scope name="type-applications-single">
111+ <expression>(@)(\w+)</expression>
112+ <capture number="1" name="haskell.keyword.operator.typeapplication" />
113+ <capture number="2" name="haskell.identifier.type" />
114+ </scope>
115+ </collection>
116+
103117 <collection name="Quote">
104118 <scope name="haskell.quasiquote.string-template">
105119 <starts-with>
@@ -136,7 +150,6 @@
136150 <capture number="1" name="haskell.pattern.record.bracket" />
137151 </ends-with>
138152 <subscopes>
139− <include syntax="self" collection="comments" />
140153 <include syntax="self" collection="expressions" />
141154 <scope name="record-sep">
142155 <expression>=</expression>
@@ -159,7 +172,6 @@
159172 <capture number="1" name="haskell.pattern.record.bracket" />
160173 </ends-with>
161174 <subscopes>
162− <include syntax="self" collection="comments" />
163175 <scope name="haskell.pattern.record.wildcard">
164176 <expression>\.\.</expression>
165177 </scope>
@@ -186,7 +198,6 @@
186198 <capture number="1" name="haskell.list.bracket" />
187199 </ends-with>
188200 <subscopes>
189− <include syntax="self" collection="comments" />
190201 <include syntax="self" collection="expressions" />
191202 </subscopes>
192203 </scope>
@@ -229,6 +240,48 @@
229240 </scope>
230241 </collection>
231242
243+ <collection name="case-match">
244+ <scope name="case-match">
245+ <starts-with>
246+ <expression>(?=((\h*)\S.*-&gt;($|\h)))</expression>
247+ </starts-with>
248+ <ends-with>
249+ <expression>-&gt;</expression>
250+ </ends-with>
251+ <subscopes anchored="true">
252+ <include syntax="self" collection="expressions" />
253+ </subscopes>
254+ </scope>
255+ </collection>
256+
257+ <collection name="inner-case-expressions">
258+ <scope name="inner-case-expressions">
259+ <starts-with>
260+ <expression>(?=((\h*)\S.*-&gt;($|\h)))</expression>
261+ </starts-with>
262+ <ends-with>
263+ <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
264+ </ends-with>
265+ <subscopes anchored="true" skip-whitespace="false">
266+ <include syntax="self" collection="case-match" />
267+ <include syntax="self" collection="expressions" />
268+ </subscopes>
269+ </scope>
270+ </collection>
271+
272+ <collection name="outer-case-expression">
273+ <scope name="outer-case-expression">
274+ <starts-with>
275+ <expression>(?=case)</expression>
276+ </starts-with>
277+ <ends-with />
278+ <subscopes anchored="true" skip-whitespace="false">
279+ <include syntax="self" collection="case-expression" />
280+ <include syntax="self" collection="inner-case-expressions" repeat="true" />
281+ </subscopes>
282+ </scope>
283+ </collection>
284+
232285 <collection name="tuple">
233286 <symbol type="expression" />
234287 <scope name="haskell.tuple">
@@ -241,73 +294,73 @@
241294 <capture number="1" name="haskell.tuple.bracket" />
242295 </ends-with>
243296 <subscopes>
244− <include syntax="self" collection="comments" />
245297 <include syntax="self" collection="expressions" />
246298 </subscopes>
247299 </scope>
248300 </collection>
249301
250302 <collection name="typeclass">
251− <scope name="haskell.definition.class.head">
252− <symbol type="class" scope="global" name-selector="haskell.keyword.construct.class.name">
253− <context behavior="whitespace" foldable="true" />
254− </symbol>
303+ <symbol type="interface" />
304+ <scope name="haskell.definition.class">
255305 <starts-with>
256306 <expression>^(\h*)(class)($|\h)</expression>
257307 <capture number="2" name="haskell.keyword.construct.class" />
258308 </starts-with>
259− <ends-with />
260− <subscopes anchored="true">
261− <scope name="haskell.keyword.construct.class.name">
262− <starts-with>
263− <expression></expression>
264− </starts-with>
265− <ends-with>
266− <expression>(?=(where|^\s*$))</expression>
267− </ends-with>
268− <subscopes>
269− <include syntax="self" collection="comments" />
270− <include syntax="self" collection="type" />
271− </subscopes>
272− </scope>
273− <scope name="haskell.keyword.construct.where" optional="true">
309+ <ends-with>
310+ <template>^(?!\s+\1\S)(?!\s*$)</template>
311+ </ends-with>
312+ <subscopes>
313+ <scope name="haskell.keyword.construct.where">
274314 <expression>where</expression>
275315 </scope>
316+ <include syntax="self" collection="type" />
317+ <include syntax="self" collection="type-definition" />
318+ <!-- <include syntax="self" collection="type-annotation" /> -->
319+ <include syntax="self" collection="definition" />
276320 </subscopes>
277321 </scope>
278322 </collection>
279323
280324 <collection name="instance">
281325 <scope name="haskell.instance">
282− <symbol type="category" name-selector="haskell.keyword.construct.instance.name">
326+ <symbol type="category">
283327 <context behavior="whitespace" foldable="true" />
284328 </symbol>
285329 <starts-with>
286330 <expression>^(\h*)(instance)($|\h)</expression>
287331 <capture number="2" name="haskell.keyword.construct.instance" />
288332 </starts-with>
289− <ends-with />
290− <subscopes anchored="true">
291− <scope name="haskell.keyword.construct.instance.name">
333+ <ends-with>
334+ <template>^(?!\s+\1\S)(?!\s*$)</template>
335+ </ends-with>
336+ <subscopes anchored="true" skip-whitespace="false">
337+ <scope name="haskell.construct.instance.head">
292338 <starts-with>
293339 <expression></expression>
294340 </starts-with>
295341 <ends-with>
296− <expression>(?=(where|^\s*$))</expression>
342+ <expression>where</expression>
343+ <capture number="0" name="haskell.keyword.construct.where" />
297344 </ends-with>
298345 <subscopes>
299− <include syntax="self" collection="type" />
346+ <include syntax="self" collection="type" optional="true" repeat="true" />
300347 </subscopes>
301348 </scope>
302− <scope name="haskell.keyword.construct.where" optional="true">
303− <expression>where</expression>
304− </scope>
349+ <include syntax="self" collection="instance-body" />
305350 </subscopes>
306351 </scope>
307352 </collection>
308353
354+ <collection name="instance-body">
355+ <include syntax="self" collection="definition" />
356+ <include syntax="self" collection="type-definition" />
357+ </collection>
358+
309359 <collection name="type-family-definition">
310360 <scope name="haskell.definition.type-family.type">
361+ <symbol type="type" scope="global">
362+ <context behavior="subtree" foldable="false" />
363+ </symbol>
311364 <starts-with>
312365 <expression>^(\h*)(type\h+family)</expression>
313366 <capture number="2" name="haskell.keyword.construct.type-family" />
@@ -346,7 +399,6 @@
346399 <template>^(?!\s+\1\S)(?!\s*$)</template>
347400 </ends-with>
348401 <subscopes>
349− <include syntax="self" collection="comments" />
350402 <include syntax="self" collection="type" optional="true" repeat="true" />
351403 <scope>
352404 <expression>=</expression>
@@ -358,7 +410,7 @@
358410
359411 <collection name="definition">
360412 <scope name="haskell.definition.type.function">
361− <symbol type="function">
413+ <symbol type="function" scope="local">
362414 <context behavior="whitespace" foldable="true" />
363415 </symbol>
364416 <starts-with>
@@ -370,15 +422,35 @@
370422 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
371423 </ends-with>
372424 <subscopes>
373− <include syntax="self" collection="comments" />
374425 <include syntax="self" collection="type-annotation" />
375426 <include syntax="self" collection="implementation" />
376427 </subscopes>
377428 </scope>
378429 </collection>
379430
431+ <collection name="do-bind">
432+ <scope name="do-bind">
433+ <symbol>
434+ <context behavior="whitespace"></context>
435+ </symbol>
436+ <starts-with>
437+ <expression>^(?=((\h*)\S.+&lt;-($|\h)))</expression>
438+ </starts-with>
439+ <ends-with>
440+ <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
441+ </ends-with>
442+ <subscopes>
443+ <include syntax="self" collection="do-pattern" />
444+ <include syntax="self" collection="expressions" />
445+ <!-- <scope name="bind-arrow">
446+ <expression>&lt;-</expression>
447+ </scope> -->
448+ </subscopes>
449+ </scope>
450+ </collection>
451+
380452 <collection name="implementation">
381− <scope name="haskell.definition.type.function.implementation">
453+ <scope name="haskell.definition.type.function">
382454 <starts-with>
383455 <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
384456 <capture number="2" name="haskell.keyword.construct.default" />
@@ -388,7 +460,6 @@
388460 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
389461 </ends-with>
390462 <subscopes>
391− <include syntax="self" collection="comments" />
392463 <include syntax="self" collection="pattern-match" optional="true" repeat="true" />
393464 <scope>
394465 <expression>=</expression>
@@ -401,7 +472,7 @@
401472 </collection>
402473
403474 <collection name="type-annotation">
404− <scope name="haskell.definition.type.function.type-signature">
475+ <scope name="haskell.definition.type.function">
405476 <starts-with>
406477 <expression>^(\h*)`?(\w(\w|')*)`?\h*::($|\h)</expression>
407478 <capture number="2" name="haskell.identifier.function" />
@@ -410,7 +481,6 @@
410481 <template>^(?!\s+\1\S)(?!\s*$)</template>
411482 </ends-with>
412483 <subscopes>
413− <include syntax="self" collection="comments" />
414484 <include syntax="self" collection="type" />
415485 </subscopes>
416486 </scope>
@@ -430,7 +500,6 @@
430500 <template>^(?!\s+\1\S)(?!\s*$)</template>
431501 </ends-with>
432502 <subscopes>
433− <include syntax="self" collection="comments" />
434503 <include syntax="self" collection="type" />
435504 </subscopes>
436505 </scope>
@@ -450,7 +519,6 @@
450519 <template>^(?!\s+\1\S)(?!\s*$)</template>
451520 </ends-with>
452521 <subscopes>
453− <include syntax="self" collection="comments" />
454522 <scope name="haskell.keyword.construct.where">
455523 <expression>where</expression>
456524 </scope>
@@ -466,16 +534,15 @@
466534 <collection name="gadt-constructor">
467535 <scope name="haskell.identifier.type.struct.data.constructor">
468536 <symbol type="constructor">
469− <context behavior="subtree" foldable="true" />
537+ <context behavior="whitespace" />
470538 </symbol>
471− <starts-with>
472− <expression>(^|=|\||^)\h+([A-Z](\w|')*)</expression>
473− <capture number="2" name="haskell.identifier.data.name" />
474− </starts-with>
475− <ends-with />
476− <subscopes anchored="true">
477− <include syntax="self" collection="record-definition" />
478− </subscopes>
539+ <expression>(^|=|\|)\h+([A-Z](\w|')*)</expression>
540+ <capture number="2" name="haskell.identifier.data.name" />
541+ </scope>
542+ <scope name="identifier.type.struct.GADT.constructor">
543+ <symbol type="constructor"></symbol>
544+ <expression>^\h+([A-Z](\w|')*)</expression>
545+ <capture number="1" name="haskell.identifier.data.name" />
479546 </scope>
480547 </collection>
481548
@@ -484,7 +551,6 @@
484551 <expression>deriving(\h+(newtype|stock|anyclass))?</expression>
485552 </scope>
486553 <scope name="haskell.record.construct.deriving.keyword">
487− <include syntax="self" collection="comments" />
488554 <expression>via</expression>
489555 </scope>
490556 </collection>
@@ -503,7 +569,6 @@
503569 <capture number="1" name="haskell.record.bracket" />
504570 </ends-with>
505571 <subscopes>
506− <include syntax="self" collection="comments" />
507572 <include syntax="self" collection="record-definition-field-name" />
508573 <include syntax="self" collection="type" />
509574 </subscopes>
@@ -535,7 +600,6 @@
535600 <expression>\)</expression>
536601 </ends-with>
537602 <subscopes>
538− <include syntax="self" collection="comments" />
539603 <scope name="haskell.construct.type.typle.comma">
540604 <expression>\,</expression>
541605 </scope>
@@ -550,7 +614,6 @@
550614 <expression>\]</expression>
551615 </ends-with>
552616 <subscopes>
553− <include syntax="self" collection="comments" />
554617 <include syntax="self" collection="type" />
555618 </subscopes>
556619 </scope>
@@ -585,7 +648,6 @@
585648 <template>^(?!\s+\1\S)(?!\s*$)</template>
586649 </ends-with>
587650 <subscopes>
588− <include syntax="self" collection="comments" />
589651 <scope name="haskell.keyword.construct.where">
590652 <expression>where</expression>
591653 </scope>
@@ -605,7 +667,6 @@
605667 <capture number="1" name="haskell.type-list.bracket" />
606668 </ends-with>
607669 <subscopes>
608− <include syntax="self" collection="comments" />
609670 <include syntax="self" collection="type" />
610671 </subscopes>
611672 </scope>
@@ -622,7 +683,6 @@
622683 <capture number="1" name="haskell.keyword.construct.lambda" />
623684 </ends-with>
624685 <subscopes>
625− <include syntax="self" collection="comments" />
626686 <include syntax="self" collection="pattern-match" />
627687 </subscopes>
628688 </scope>
@@ -644,7 +704,6 @@
644704 <template>^(?!\1\s*\S)(?!s*$)</template>
645705 </ends-with>
646706 <subscopes>
647− <include syntax="self" collection="comments" />
648707 <include syntax="self" collection="definition" />
649708 </subscopes>
650709 </scope>
@@ -684,12 +743,12 @@
684743
685744
686745 <collection name="strings">
687− <scope name="haskell.string.double-quoted" spell-check="true">
746+ <scope name="haskell.string.double-quoted">
688747 <starts-with>
689− <expression>&quot;</expression>
748+ <expression>"</expression>
690749 </starts-with>
691750 <ends-with>
692− <expression>&quot;</expression>
751+ <expression>"</expression>
693752 </ends-with>
694753 <subscopes>
695754 <scope name="haskell.string.escape-sequences">
@@ -726,7 +785,6 @@
726785 </ends-with>
727786 <subscopes>
728787 <scope name="identifier.haskell.type">
729− <symbol type="expression" />
730788 <symbol type="expression" />
731789 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
732790 <capture number="1" name="identifier.type" />
@@ -751,7 +809,6 @@
751809 </ends-with>
752810 <subscopes>
753811 <scope name="haskell.construct.qualified">
754− <symbol type="expression" />
755812 <expression>qualified</expression>
756813 <capture number="0" name="haskell.construct.keyword.qualified" />
757814 </scope>
@@ -769,7 +826,6 @@
769826 </ends-with>
770827 <subscopes anchored="true">
771828 <include syntax="self" collection="import-list" />
772− <symbol type="expression" />
773829 </subscopes>
774830 </scope>
775831
@@ -803,7 +859,6 @@
803859 </ends-with>
804860 <subscopes>
805861 <scope name="haskell.identifier.struct">
806− <symbol type="expression" />
807862 <symbol type="reference" scope="local" />
808863 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
809864 <capture number="1" name="haskell.import-list.identifier.type.name" />
@@ -817,6 +872,13 @@
817872 </scope>
818873 </collection>
819874
875+ <!-- <collection name="special">
876+ <scope>
877+ <expression>(;|,)</expression>
878+ </scope>
879+ </collection> -->
880+
881+
820882 <collection name="reservedop">
821883 <scope name="keyword.operator">
822884 <expression>(\.\.|:|::|=|\\|\||&lt;-|-&gt;|@|~|=>)</expression>
@@ -824,11 +886,10 @@
824886 </collection>
825887
826888 <collection name="keywords">
827− <scope name="haskell.keyword.self">
889+ <scope name="haskell.keyword.modifier">
828890 <symbol type="keyword" />
829891 <strings>
830892 <string>do</string>
831− <string>mdo</string>
832893 <string>in</string>
833894 <string>infix</string>
834895 <string>infixl</string>
@@ -866,18 +927,20 @@
866927 <strings>
867928 <string>undefined</string>
868929 <string>_</string>
869− <string>@</string>
870930 </strings>
871931 </scope>
872932 </collection>
873933
874934 <collection name="comments">
875935 <scope name="haskell.comment.single" spell-check="true">
876− <symbol type="comment" />
877− <expression> --.*$</expression>
936+ <starts-with>
937+ <expression>--</expression>
938+ </starts-with>
939+ <ends-with>
940+ <expression>$</expression>
941+ </ends-with>
878942 </scope>
879943 <scope name="haskell.comment.block" spell-check="true">
880− <symbol type="comment" />
881944 <starts-with>
882945 <expression>{-</expression>
883946 </starts-with>
Haskell Language Server.novaextension/extension.json+159−200
@@ -6,333 +6,292 @@
66 "version": "1.0",
77 "categories": ["languages", "formatters"],
88 "main": "main.js",
9− "entitlements":
10− {
9+ "entitlements": {
1110 "process": true,
1211 "filesystem": "readwrite",
1312 "requests": true
1413 },
15− "configWorkspace": [
16− {
14+ "configWorkspace": [{
1715 "key": "haskell-language-server-path",
1816 "title": "Haskell Language Server path",
1917 "description": "If you want to use a custom HLS build for this project, then specify the path to it here.",
2018 "type": "path",
2119 "placeholder": "/usr/local/bin/example"
22− },
23− {
24− "key": "env-generator",
25− "title": "Environment generator",
26− "description": "You can specify a shell command which will be used to generate the environment, in which the extension will be executes. This is useful if you want to utilize `nix-shell`, `direnv` or any similar command.\n\nExpects the command to have the same stdout as the `env` command.",
27− "type": "enum",
28− "allowsCustom": true,
29− "values": ["nix-shell --run env", "direnv exec env"]
30− },
31− {
20+ }, {
3221 "type": "section",
3322 "title": "Haskell Language Server settings",
34− "description":"Some of the features are not supported in Nova. Some of them are explicitly marked as not supported, but it is not exhaustive.",
35− "children": [
36− {
37− "key": "haskell.formattingProvider",
38− "title": "Code formatter",
39− "type": "enum",
40− "values": [
41− "brittany",
42− "floskell",
43− "fourmolu",
44− "ormolu",
45− "stylish-haskell",
46− "none"
47− ],
48− "default": "ormolu",
49− "description": "The formatter to use when formatting a document or range. Ensure the plugin is enabled."
50− },
51− {
52− "key": "haskell.checkProject",
53− "title": "Check whole project",
54− "type": "boolean",
55− "default": false,
56− "description": "Whether to typecheck the entire project on load. It could lead to bad perfomance in large projects."
57− },
58− {
59− "title": "Completions",
23+ "children": [{
24+ "key": "haskell.formattingProvider",
25+ "title": "Code formatter",
26+ "type": "enum",
27+ "values": [
28+ "brittany",
29+ "floskell",
30+ "fourmolu",
31+ "ormolu",
32+ "stylish-haskell",
33+ "none"
34+ ],
35+ "default": "ormolu",
36+ "description": "The formatter to use when formatting a document or range. Ensure the plugin is enabled."
37+ }, {
38+ "key": "haskell.checkProject",
39+ "title": "Check whole project",
40+ "type": "boolean",
41+ "default": false,
42+ "description": "Whether to typecheck the entire project on load. It could drive to bad perfomance in large projects."
43+ }, {
44+ "key": "haskell.maxCompletions",
45+ "type": "number",
46+ "title": "Maximum number of completions",
47+ "description": "Maximum number of completions sent to the editor.",
48+ "default": 40
49+ }, {
50+ "type": "section",
51+ "title": "Plugin settings",
52+ "children": [{
6053 "type": "section",
61− "children": [
62− {
63− "key": "haskell.plugin.ghcide-completions.config.autoExtendOn",
64− "title": "Extend with out-of-scope identifiers",
65− "description": "Extends the import list automatically when completing a out-of-scope identifier",
54+ "title": "Import lens",
55+ "description": "Not currently implemented in Nova",
56+ "children": [{
57+ "key": "haskell.plugin.importLens.codeActionsOn",
58+ "title": "Enable code actions",
59+ "type": "boolean",
6660 "default": true,
67− "type": "boolean"
68− },
69− {
70− "key": "haskell.plugin.ghcide-completions.config.snippetsOn",
71− "title": "Insert snippets",
72− "description": "Inserts snippets when using code completions",
61+ "description": "Enables explicit imports code actions"
62+ }, {
63+ "key": "haskell.plugin.importLens.codeLensOn",
64+ "title": "Enable code lens",
65+ "type": "boolean",
7366 "default": true,
74− "type": "boolean"
75− },
76− {
77− "key": "haskell.maxCompletions",
78− "type": "number",
79− "title": "Maximum number of completions",
80− "description": "Maximum number of completions sent to the editor.",
81− "default": 40
67+ "description": "Enables explicit imports code lenses"
8268 }]
83− },
84− {
69+ }, {
8570 "title": "HLint",
8671 "type": "section",
87− "children": [
88− {
72+ "children": [{
8973 "key": "haskell.plugin.hlint.codeActionsOn",
9074 "title": "Enable code actions",
9175 "type": "boolean",
9276 "default": true,
9377 "description": "Enables hlint code actions (apply hints)"
94− },
95− {
78+ }, {
9679 "key": "haskell.plugin.hlint.diagnosticsOn",
9780 "title": "Enable diagnostics",
9881 "type": "boolean",
9982 "default": true,
10083 "description": "Enables hlint diagnostics"
101− },
102− {
103− "key": "haskell.plugin.hlint.config.flags",
104− "title": "Flags",
105− "description": "Flags used by hlint",
106− "default": [],
107− "type": "stringArray"
108− }]
109− },
110− {
111− "type": "section",
112− "title": "Import lens",
113− "description": "Not currently implemented in Nova",
114− "children": [
115− {
116− "key": "haskell.plugin.importLens.codeActionsOn",
117− "title": "Enable code actions",
118− "type": "boolean",
119− "default": true,
120− "description": "Enables explicit imports code actions"
121− },
122− {
123− "key": "haskell.plugin.importLens.codeLensOn",
124− "title": "Enable code lens",
125− "type": "boolean",
126− "default": true,
127− "description": "Enables explicit imports code lenses"
84+ }, {
85+ "title": "Configuration",
86+ "type": "section",
87+ "children": [{
88+ "key": "haskell.plugin.hlint.config.flags",
89+ "title": "Flags",
90+ "description": "Flags used by hlint",
91+ "default": [],
92+ "type": "stringArray"
93+ }]
12894 }]
129− },
130−
131− {
95+ }, {
13296 "title": "Eval",
13397 "type": "section",
134− "children": [
135− {
98+ "children": [{
13699 "key": "haskell.plugin.eval.globalOn",
137100 "title": "Enable",
138101 "type": "boolean",
139102 "default": true,
140103 "description": "Enables eval plugin"
141104 }]
142− },
143− {
105+ }, {
144106 "title": "Module name",
145107 "type": "section",
146− "children": [
147− {
108+ "children": [{
148109 "key": "haskell.plugin.moduleName.globalOn",
149110 "title": "Enable",
150111 "type": "boolean",
151112 "default": true,
152113 "description": "Enables module name plugin"
153114 }]
154− },
155− {
115+ }, {
156116 "title": "Splice",
157117 "type": "section",
158− "children": [
159− {
118+ "children": [{
160119 "key": "haskell.plugin.splice.globalOn",
161120 "title": "Enable",
162121 "type": "boolean",
163122 "default": true,
164123 "description": "Enables splice plugin (expand template haskell definitions)"
165124 }]
166− },
167− {
125+ }, {
168126 "title": "Haddock comments",
169127 "type": "section",
170− "children": [
171− {
128+ "children": [{
172129 "key": "haskell.plugin.haddockComments.globalOn",
173130 "title": "Enable",
174131 "type": "boolean",
175132 "default": true,
176133 "description": "Enables haddock comments plugin"
177134 }]
178− },
179− {
135+ }, {
180136 "title": "Class",
181137 "type": "section",
182− "children": [
183− {
138+ "children": [{
184139 "key": "haskell.plugin.class.globalOn",
185140 "title": "Enable",
186141 "type": "boolean",
187142 "default": true,
188143 "description": "Enables type class plugin"
189144 }]
190− },
191− {
145+ }, {
192146 "title": "Retrie",
193147 "type": "section",
194− "children": [
195− {
148+ "children": [{
196149 "key": "haskell.plugin.retrie.globalOn",
197150 "title": "Enable",
198151 "type": "boolean",
199152 "default": true,
200153 "description": "Enables retrie plugin"
201154 }]
202− },
203− {
155+ }, {
204156 "title": "Wingman",
205157 "type": "section",
206− "children": [
207− {
158+ "children": [{
208159 "key": "haskell.plugin.tactics.globalOn",
209160 "title": "Enable",
210161 "type": "boolean",
211162 "default": true,
212163 "description": "Enables Wingman (tactics) plugin"
213− },
214− {
215− "key": "haskell.plugin.tactics.config.auto_gas",
216− "title": "Gas",
217− "description": "The depth of the search tree when performing \"Attempt to fill hole\". Bigger values will be able to derive more solutions, but will take exponentially more time.",
218− "default": 4,
219− "type": "number"
220− },
221− {
222− "key": "haskell.plugin.tactics.config.hole_severity",
223− "title": "Hole severity",
224− "description": "The severity to use when showing hole diagnostics.",
225− "values": [
226− 1,
227− 2,
228− 3,
229− 4,
230− null
231− ],
232− "default": null,
233− "type": "enum"
234− },
235− {
236− "key": "haskell.plugin.tactics.config.max_use_ctor_actions",
237− "title": "Max number of constructors",
238− "type": "number",
239− "default": 5,
240− "description": "Maximum number of `Use constructor <x>` code actions that can appear"
241− },
242− {
243− "key": "haskell.plugin.tactics.config.timeout_duration",
244− "title": "Timeout",
245− "description": "The timeout for Wingman actions, in seconds",
246− "default": 2,
247− "type": "number"
248− },
249− {
250− "key": "haskell.plugin.tactics.config.proofstate_styling",
251− "title": "Proof states",
252− "description": "Should Wingman emit styling markup when showing metaprogram proof states?",
253− "default": true,
254− "type": "boolean"
164+ }, {
165+ "title": "Configuration",
166+ "type": "section",
167+ "children": [{
168+ "key": "haskell.plugin.tactics.config.auto_gas",
169+ "title": "Gas",
170+ "description": "The depth of the search tree when performing \"Attempt to fill hole\". Bigger values will be able to derive more solutions, but will take exponentially more time.",
171+ "default": 4,
172+ "type": "number"
173+ }, {
174+ "key": "haskell.plugin.tactics.config.hole_severity",
175+ "title": "Hole severity",
176+ "description": "The severity to use when showing hole diagnostics.",
177+ "values": [
178+ 1,
179+ 2,
180+ 3,
181+ 4,
182+ null
183+ ],
184+ "default": null,
185+ "type": "enum"
186+ }, {
187+ "key": "haskell.plugin.tactics.config.max_use_ctor_actions",
188+ "title": "Max number of constructors",
189+ "type": "number",
190+ "default": 5,
191+ "description": "Maximum number of `Use constructor <x>` code actions that can appear"
192+ }, {
193+ "key": "haskell.plugin.tactics.config.timeout_duration",
194+ "title": "Timeout",
195+ "description": "The timeout for Wingman actions, in seconds",
196+ "default": 2,
197+ "type": "number"
198+ }, {
199+ "key": "haskell.plugin.tactics.config.proofstate_styling",
200+ "title": "Proof states",
201+ "description": "Should Wingman emit styling markup when showing metaprogram proof states?",
202+ "default": true,
203+ "type": "boolean"
204+ }]
255205 }]
256− },
257− {
206+ }, {
258207 "title": "Pragmas",
259208 "type": "section",
260− "children": [
261− {
209+ "children": [{
262210 "key": "haskell.plugin.pragmas.codeActionsOn",
263211 "title": "Enable code actions",
264212 "type": "boolean",
265213 "default": true,
266214 "description": "Enables pragmas code actions"
267− },
268− {
215+ }, {
269216 "key": "haskell.plugin.pragmas.completionOn",
270217 "title": "Enable completions",
271218 "type": "boolean",
272219 "default": true,
273220 "description": "Enables pragmas completions"
274221 }]
275− },
276− {
277− "title": "Type lenses",
222+ }, {
223+ "title": "Completions",
224+ "type": "section",
225+ "children": [{
226+ "title": "Configuration",
227+ "type": "section",
228+ "children": [{
229+ "key": "haskell.plugin.ghcide-completions.config.autoExtendOn",
230+ "title": "Extend with out-of-scope identifiers",
231+ "description": "Extends the import list automatically when completing a out-of-scope identifier",
232+ "default": true,
233+ "type": "boolean"
234+ }, {
235+ "key": "haskell.plugin.ghcide-completions.config.snippetsOn",
236+ "title": "Insert snippets",
237+ "description": "Inserts snippets when using code completions",
238+ "default": true,
239+ "type": "boolean"
240+ }]
241+ }]
242+ }, {
278243 "description": "Not currently implemented in Nova",
279244 "type": "section",
280− "children": [
281− {
245+ "children": [{
282246 "key": "haskell.plugin.ghcide-type-lenses.globalOn",
283247 "title": "Enable",
284248 "type": "boolean",
285249 "default": true,
286250 "description": "Enables type lenses plugin"
287− },
288− {
289− "key": "haskell.plugin.ghcide-type-lenses.config.mode",
290− "title": "Mode",
291− "type": "enum",
292− "default": true,
293− "description": "Control how type lenses are shown",
294− "values": ["always", "exported", "diagnostics"]
251+ }, {
252+ "title": "Configuration",
253+ "type": "section",
254+ "children": [{
255+ "key": "haskell.plugin.ghcide-type-lenses.config.mode",
256+ "title": "Mode",
257+ "type": "enum",
258+ "default": true,
259+ "description": "Control how type lenses are shown",
260+ "values": ["always", "exported", "diagnostics"]
261+ }]
295262 }]
296− },
297− {
263+ }, {
298264 "title": "Refine imports",
299265 "type": "section",
300− "children": [
301− {
266+ "children": [{
302267 "key": "haskell.plugin.refineImports.globalOn",
303268 "title": "Enable",
304269 "type": "boolean",
305270 "default": true,
306271 "description": "Enables refine imports plugin"
307272 }]
308− }
309− ]
273+ }]
274+ }]
310275 }],
311276 "activationEvents": ["onLanguage:haskell", "onLanguage:hs"],
312− "commands":
313− {
314− "editor": [
315− {
277+ "commands": {
278+ "editor": [{
316279 "title": "Format file with Haskell Language Server",
317280 "command": "format",
318281 "when": "editorSyntax == 'haskell' && editorHasFocus",
319− "filters":
320− {
282+ "filters": {
321283 "syntaxes": ["haskell"]
322284 }
323285 }],
324− "extensions": [
325− {
286+ "extensions": [{
326287 "title": "Stop",
327288 "paletteTitle": "Stop Haskell Language Server",
328289 "command": "stop"
329− },
330− {
290+ }, {
331291 "title": "Restart",
332292 "paletteTitle": "Restart Haskell Language Server",
333293 "command": "restart"
334− },
335− {
294+ }, {
336295 "title": "Clear cached versions",
337296 "paletteTitle": "Clear cached versions of Haskell Language Server",
338297 "command": "clear-cache"