lawspec 0.31.0 → 0.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -1
- package/README.md +86 -4
- package/api.mjs +14 -9
- package/authoring.mjs +899 -0
- package/beam-coverage.mjs +190 -65
- package/beam-doctor.mjs +343 -124
- package/bin/lawspec.mjs +1955 -657
- package/build.json +135 -129
- package/component-packages.mjs +662 -176
- package/component.d.ts +82 -20
- package/component.mjs +317 -94
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/doctor.mjs +558 -299
- package/examples-command.mjs +44 -23
- package/failure-database.mjs +60 -17
- package/files.mjs +122 -62
- package/index.d.ts +585 -312
- package/input-files.mjs +90 -25
- package/launcher.mjs +72 -31
- package/learn/adapters.mjs +226 -0
- package/learn/app.mjs +1279 -0
- package/learn/assert.mjs +33 -0
- package/learn/assets.mjs +15 -0
- package/learn/browser-runtime.mjs +58 -0
- package/learn/bundle.mjs +118 -0
- package/learn/compile-worker.mjs +106 -0
- package/learn/compiler.mjs +230 -0
- package/learn/coverage.json +8259 -0
- package/learn/curriculum.json +2955 -0
- package/learn/fantomas-worker.mjs +25 -0
- package/learn/format-worker.mjs +148 -0
- package/learn/fsharp.mjs +83 -0
- package/learn/harness-host.mjs +22 -0
- package/learn/index.html +326 -0
- package/learn/lawspec-core.mjs +223 -0
- package/learn/lawspec-language.mjs +69 -0
- package/learn/node-test.mjs +11 -0
- package/learn/presentation.mjs +73 -0
- package/learn/runner.mjs +72 -0
- package/learn/sandbox-frame.html +34 -0
- package/learn/sandbox.mjs +91 -0
- package/learn/store.mjs +141 -0
- package/learn/story.mjs +42 -0
- package/learn/style-options.json +16 -0
- package/learn/style.css +1023 -0
- package/learn/theme.js +77 -0
- package/learn/typescript.mjs +53 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
- package/learn/vendor/assemblies.json +1 -0
- package/learn/vendor/editor-worker.js +30 -0
- package/learn/vendor/editor.css +1 -0
- package/learn/vendor/editor.mjs +931 -0
- package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
- package/learn/vendor/esbuild.mjs +2683 -0
- package/learn/vendor/esbuild.wasm +0 -0
- package/learn/vendor/fable-library/Array.js +1347 -0
- package/learn/vendor/fable-library/Async.js +134 -0
- package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
- package/learn/vendor/fable-library/BigInt.js +306 -0
- package/learn/vendor/fable-library/BitConverter.js +138 -0
- package/learn/vendor/fable-library/Boolean.js +22 -0
- package/learn/vendor/fable-library/CHANGELOG.md +242 -0
- package/learn/vendor/fable-library/Char.js +202 -0
- package/learn/vendor/fable-library/Choice.js +184 -0
- package/learn/vendor/fable-library/CollectionUtil.js +182 -0
- package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
- package/learn/vendor/fable-library/Date.js +841 -0
- package/learn/vendor/fable-library/DateOffset.js +261 -0
- package/learn/vendor/fable-library/DateOnly.js +124 -0
- package/learn/vendor/fable-library/Decimal.js +238 -0
- package/learn/vendor/fable-library/Double.js +47 -0
- package/learn/vendor/fable-library/Encoding.js +185 -0
- package/learn/vendor/fable-library/Event.js +93 -0
- package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
- package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
- package/learn/vendor/fable-library/FSharp.Core.js +156 -0
- package/learn/vendor/fable-library/Global.js +29 -0
- package/learn/vendor/fable-library/Guid.js +161 -0
- package/learn/vendor/fable-library/Int32.js +135 -0
- package/learn/vendor/fable-library/List.js +1323 -0
- package/learn/vendor/fable-library/Long.js +47 -0
- package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
- package/learn/vendor/fable-library/Map.js +1396 -0
- package/learn/vendor/fable-library/MapUtil.js +130 -0
- package/learn/vendor/fable-library/MutableMap.js +339 -0
- package/learn/vendor/fable-library/MutableSet.js +233 -0
- package/learn/vendor/fable-library/Native.js +14 -0
- package/learn/vendor/fable-library/Numeric.js +75 -0
- package/learn/vendor/fable-library/Observable.js +113 -0
- package/learn/vendor/fable-library/Option.js +104 -0
- package/learn/vendor/fable-library/README.md +3 -0
- package/learn/vendor/fable-library/Random.js +172 -0
- package/learn/vendor/fable-library/Range.js +45 -0
- package/learn/vendor/fable-library/Reflection.js +479 -0
- package/learn/vendor/fable-library/RegExp.js +141 -0
- package/learn/vendor/fable-library/Result.js +165 -0
- package/learn/vendor/fable-library/Seq.js +1417 -0
- package/learn/vendor/fable-library/Seq2.js +111 -0
- package/learn/vendor/fable-library/Set.js +1816 -0
- package/learn/vendor/fable-library/String.js +674 -0
- package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
- package/learn/vendor/fable-library/System.Text.js +200 -0
- package/learn/vendor/fable-library/System.js +289 -0
- package/learn/vendor/fable-library/TimeOnly.js +122 -0
- package/learn/vendor/fable-library/TimeSpan.js +180 -0
- package/learn/vendor/fable-library/Timer.js +67 -0
- package/learn/vendor/fable-library/Types.js +198 -0
- package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
- package/learn/vendor/fable-library/Uri.js +165 -0
- package/learn/vendor/fable-library/Util.js +796 -0
- package/learn/vendor/fable-library/big.d.ts +338 -0
- package/learn/vendor/fable-library/lib/big.js +825 -0
- package/learn/vendor/fable-library/package.json +24 -0
- package/learn/vendor/fable-library/quotation.js +618 -0
- package/learn/vendor/fable.js +430 -0
- package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.poiijdbsl9.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
- package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
- package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
- package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
- package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
- package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
- package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
- package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
- package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
- package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
- package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
- package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
- package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
- package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
- package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.js +1233 -0
- package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
- package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
- package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
- package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
- package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
- package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
- package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
- package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
- package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
- package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
- package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
- package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
- package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
- package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
- package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
- package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
- package/learn/vendor/fast-check-LICENSE.txt +21 -0
- package/learn/vendor/fast-check.mjs +37 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
- package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
- package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
- package/learn/vendor/formatter-licenses/README.md +12 -0
- package/learn/vendor/manifest.json +1354 -0
- package/learn/vendor/metadata/Browser.Blob.dll +0 -0
- package/learn/vendor/metadata/Browser.Dom.dll +0 -0
- package/learn/vendor/metadata/Browser.Event.dll +0 -0
- package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
- package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
- package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
- package/learn/vendor/metadata/FSharp.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
- package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
- package/learn/vendor/metadata/System.Collections.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
- package/learn/vendor/metadata/System.Console.dll +0 -0
- package/learn/vendor/metadata/System.Core.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
- package/learn/vendor/metadata/System.Globalization.dll +0 -0
- package/learn/vendor/metadata/System.IO.dll +0 -0
- package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
- package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
- package/learn/vendor/metadata/System.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
- package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
- package/learn/vendor/metadata/System.Threading.dll +0 -0
- package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
- package/learn/vendor/metadata/System.dll +0 -0
- package/learn/vendor/metadata/mscorlib.dll +0 -0
- package/learn/vendor/metadata/netstandard.dll +0 -0
- package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
- package/learn/vendor/prettier/babel.mjs +16 -0
- package/learn/vendor/prettier/brace-style.mjs +376 -0
- package/learn/vendor/prettier/estree.mjs +44 -0
- package/learn/vendor/prettier/standalone.mjs +29 -0
- package/learn/vendor/prettier/typescript.mjs +22 -0
- package/learn/vendor/prettier-LICENSE.txt +7 -0
- package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
- package/learn/vendor/typescript-LICENSE.txt +55 -0
- package/learn/vendor/typescript-libs.json +1 -0
- package/learn/vendor/typescript.mjs +451 -0
- package/learn/vendor/zod-LICENSE.txt +21 -0
- package/learn/web-format.mjs +8 -0
- package/learn.mjs +126 -0
- package/lsp.mjs +444 -133
- package/mcp.mjs +250 -0
- package/native-evidence.mjs +668 -182
- package/native-examples.mjs +56 -19
- package/native-host.mjs +136 -42
- package/native-parsers/clojure.LICENSE +121 -0
- package/native-parsers/clojure.wasm +0 -0
- package/native-parsers/csharp.LICENSE +21 -0
- package/native-parsers/csharp.wasm +0 -0
- package/native-parsers/elixir.LICENSE +176 -0
- package/native-parsers/elixir.wasm +0 -0
- package/native-parsers/erlang.LICENSE +201 -0
- package/native-parsers/erlang.wasm +0 -0
- package/native-parsers/fsharp.LICENSE +21 -0
- package/native-parsers/fsharp.wasm +0 -0
- package/native-parsers/gleam.LICENSE +202 -0
- package/native-parsers/gleam.wasm +0 -0
- package/native-parsers/go.LICENSE +21 -0
- package/native-parsers/go.wasm +0 -0
- package/native-parsers/groovy.LICENSE +21 -0
- package/native-parsers/groovy.wasm +0 -0
- package/native-parsers/haskell.LICENSE +21 -0
- package/native-parsers/haskell.wasm +0 -0
- package/native-parsers/java.LICENSE +21 -0
- package/native-parsers/java.wasm +0 -0
- package/native-parsers/javascript.LICENSE +21 -0
- package/native-parsers/javascript.wasm +0 -0
- package/native-parsers/kotlin.LICENSE +9 -0
- package/native-parsers/kotlin.wasm +0 -0
- package/native-parsers/lock.json +114 -0
- package/native-parsers/prolog.LICENSE +21 -0
- package/native-parsers/prolog.wasm +0 -0
- package/native-parsers/python.LICENSE +21 -0
- package/native-parsers/python.wasm +0 -0
- package/native-parsers/rust.LICENSE +21 -0
- package/native-parsers/rust.wasm +0 -0
- package/native-parsers/scala.LICENSE +21 -0
- package/native-parsers/scala.wasm +0 -0
- package/native-parsers/swift.LICENSE +21 -0
- package/native-parsers/swift.wasm +0 -0
- package/native-parsers/typescript.LICENSE +21 -0
- package/native-parsers/typescript.wasm +0 -0
- package/node-events-reporter.mjs +41 -17
- package/package.json +5 -3
- package/project.mjs +338 -0
- package/proof.d.ts +93 -19
- package/proof.mjs +1538 -447
- package/read-only-hpack.mjs +6 -5
- package/scala-build-state.mjs +131 -41
- package/scala-coverage.mjs +57 -34
- package/scalars.mjs +23 -8
- package/templates.mjs +566 -617
- package/test-command.mjs +1671 -521
package/lsp.mjs
CHANGED
|
@@ -1,235 +1,546 @@
|
|
|
1
1
|
// Generated from templates/npm/lsp.mjs by lawspec-dev generate. Do not edit.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {readFile, readdir, stat} from 'node:fs/promises';
|
|
3
|
+
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
5
|
+
import {createCompiler} from './api.mjs';
|
|
6
6
|
import {findManifest, readManifest} from './component.mjs';
|
|
7
7
|
|
|
8
|
-
export function utf16Position(text, location)
|
|
8
|
+
export function utf16Position(text, location)
|
|
9
|
+
{
|
|
9
10
|
const line = Math.max(0, location.line - 1);
|
|
10
11
|
const content = text.split('\n')[line] ?? '';
|
|
11
|
-
let column = 1,
|
|
12
|
-
|
|
12
|
+
let column = 1,
|
|
13
|
+
character = 0;
|
|
14
|
+
for (const value of content)
|
|
15
|
+
{
|
|
13
16
|
if (column >= location.column) break;
|
|
14
17
|
column += value === '\t' ? 8 - ((column - 1) % 8) : 1;
|
|
15
18
|
character += value.length;
|
|
16
19
|
}
|
|
17
|
-
return {
|
|
20
|
+
return {line, character};
|
|
18
21
|
}
|
|
19
|
-
const endPosition = text =>
|
|
22
|
+
const endPosition = text =>
|
|
23
|
+
{
|
|
20
24
|
const lines = text.split('\n');
|
|
21
|
-
return {
|
|
25
|
+
return {line: lines.length - 1, character: lines.at(-1).length};
|
|
22
26
|
};
|
|
23
|
-
const within = (position, range) =>
|
|
24
|
-
|
|
27
|
+
const within = (position, range) =>
|
|
28
|
+
(position.line > range.start.line ||
|
|
29
|
+
(position.line === range.start.line &&
|
|
30
|
+
position.character >= range.start.character)) &&
|
|
31
|
+
(position.line < range.end.line ||
|
|
32
|
+
(position.line === range.end.line &&
|
|
33
|
+
position.character < range.end.character));
|
|
25
34
|
|
|
26
35
|
// A framed JSON-RPC transport keeps UTF-8 byte lengths distinct from editor
|
|
27
36
|
// UTF-16 positions. It accepts fragmented and coalesced messages.
|
|
28
|
-
export async function serveLanguage(
|
|
29
|
-
|
|
37
|
+
export async function serveLanguage(
|
|
38
|
+
input = process.stdin,
|
|
39
|
+
output = process.stdout,
|
|
40
|
+
suppliedCompiler,
|
|
41
|
+
)
|
|
42
|
+
{
|
|
43
|
+
const compiler = suppliedCompiler ?? (await createCompiler());
|
|
30
44
|
const documents = new Map();
|
|
31
|
-
let workspace = process.cwd(),
|
|
32
|
-
|
|
45
|
+
let workspace = process.cwd(),
|
|
46
|
+
buffer = Buffer.alloc(0),
|
|
47
|
+
queue = Promise.resolve(),
|
|
48
|
+
shuttingDown = false;
|
|
49
|
+
let last = {sources: [], result: null},
|
|
50
|
+
warnMatches = false;
|
|
33
51
|
let finish;
|
|
34
|
-
const ended = new Promise(resolve =>
|
|
35
|
-
|
|
52
|
+
const ended = new Promise(resolve =>
|
|
53
|
+
{
|
|
54
|
+
finish = resolve;
|
|
55
|
+
});
|
|
56
|
+
const send = value =>
|
|
57
|
+
{
|
|
36
58
|
const payload = Buffer.from(JSON.stringify(value));
|
|
37
59
|
output.write(`Content-Length: ${payload.length}\r\n\r\n`);
|
|
38
60
|
output.write(payload);
|
|
39
61
|
};
|
|
40
|
-
async function projectSources()
|
|
62
|
+
async function projectSources()
|
|
63
|
+
{
|
|
41
64
|
const sources = new Map();
|
|
42
|
-
async function visit(file)
|
|
65
|
+
async function visit(file)
|
|
66
|
+
{
|
|
43
67
|
const info = await stat(file);
|
|
44
|
-
if (info.isDirectory())
|
|
45
|
-
|
|
68
|
+
if (info.isDirectory())
|
|
69
|
+
for (const name of (await readdir(file)).sort())
|
|
70
|
+
await visit(path.join(file, name));
|
|
71
|
+
else if (file.endsWith('.lawspec'))
|
|
72
|
+
sources.set(file, {path: file, content: await readFile(file, 'utf8')});
|
|
46
73
|
}
|
|
47
74
|
let config;
|
|
48
75
|
let root = workspace;
|
|
49
|
-
try
|
|
76
|
+
try
|
|
77
|
+
{
|
|
50
78
|
const file = await findManifest(workspace);
|
|
51
79
|
config = await readManifest(file);
|
|
52
80
|
root = path.dirname(file);
|
|
53
|
-
}
|
|
81
|
+
}
|
|
82
|
+
catch (error)
|
|
83
|
+
{
|
|
54
84
|
if (!/No lawspec\.edn found/.test(error.message)) throw error;
|
|
55
85
|
}
|
|
56
|
-
for (const entry of config?.sources ?? [])
|
|
57
|
-
|
|
86
|
+
for (const entry of config?.sources ?? [])
|
|
87
|
+
await visit(path.resolve(root, entry));
|
|
88
|
+
for (const [uri, document] of documents)
|
|
89
|
+
sources.set(fileURLToPath(uri), {
|
|
90
|
+
path: fileURLToPath(uri),
|
|
91
|
+
content: document.text,
|
|
92
|
+
});
|
|
58
93
|
return [...sources.values()];
|
|
59
94
|
}
|
|
60
|
-
function location(location, sources = last.sources)
|
|
95
|
+
function location(location, sources = last.sources)
|
|
96
|
+
{
|
|
61
97
|
const source = sources.find(s => s.path === location.file);
|
|
62
98
|
if (!source) return null;
|
|
63
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
uri: pathToFileURL(source.path).href,
|
|
101
|
+
position: utf16Position(source.content, location),
|
|
102
|
+
};
|
|
64
103
|
}
|
|
65
|
-
function span(span)
|
|
66
|
-
|
|
67
|
-
|
|
104
|
+
function span(span)
|
|
105
|
+
{
|
|
106
|
+
const start = location(span.start ?? span.spanStart),
|
|
107
|
+
end = location(span.end ?? span.spanEnd);
|
|
108
|
+
return start && end
|
|
109
|
+
? {uri: start.uri, range: {start: start.position, end: end.position}}
|
|
110
|
+
: null;
|
|
68
111
|
}
|
|
69
|
-
async function check()
|
|
112
|
+
async function check()
|
|
113
|
+
{
|
|
70
114
|
const sources = await projectSources();
|
|
71
|
-
const result = await compiler.check({
|
|
72
|
-
|
|
73
|
-
|
|
115
|
+
const result = await compiler.check({
|
|
116
|
+
sources,
|
|
117
|
+
languageProfile: '1.0-rc.2',
|
|
118
|
+
verification: {layers: []},
|
|
119
|
+
...(warnMatches ? {warnMatches: true} : {}),
|
|
120
|
+
});
|
|
121
|
+
last = {sources, result};
|
|
122
|
+
for (const [uri, document] of documents)
|
|
123
|
+
{
|
|
74
124
|
const file = fileURLToPath(uri);
|
|
75
|
-
const diagnostics = [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
125
|
+
const diagnostics = [
|
|
126
|
+
...(result.diagnostics ?? []),
|
|
127
|
+
...(result.warnings ?? []),
|
|
128
|
+
]
|
|
129
|
+
.filter(d => !d.at || d.at.file === file)
|
|
130
|
+
.map(d =>
|
|
131
|
+
{
|
|
132
|
+
const start = d.at
|
|
133
|
+
? utf16Position(document.text, d.at)
|
|
134
|
+
: {line: 0, character: 0};
|
|
135
|
+
const content = document.text.split('\n')[start.line] ?? '';
|
|
136
|
+
const end = {
|
|
137
|
+
...start,
|
|
138
|
+
character: Math.min(
|
|
139
|
+
content.length,
|
|
140
|
+
start.character +
|
|
141
|
+
([...content.slice(start.character)][0]?.length ?? 0),
|
|
142
|
+
),
|
|
143
|
+
};
|
|
144
|
+
const range = d.span
|
|
145
|
+
? (span(d.span)?.range ?? {start, end})
|
|
146
|
+
: {start, end};
|
|
147
|
+
return {
|
|
148
|
+
range,
|
|
149
|
+
severity: d.severity === 'warning' ? 2 : 1,
|
|
150
|
+
code: d.code,
|
|
151
|
+
source: 'LawSpec',
|
|
152
|
+
message: d.message,
|
|
153
|
+
...(d.related?.length
|
|
154
|
+
? {
|
|
155
|
+
relatedInformation: d.related.flatMap(item =>
|
|
156
|
+
{
|
|
157
|
+
const origin = span(item.span);
|
|
158
|
+
return origin
|
|
159
|
+
? [
|
|
160
|
+
{
|
|
161
|
+
location: {uri: origin.uri, range: origin.range},
|
|
162
|
+
message: item.message,
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
: [];
|
|
166
|
+
}),
|
|
167
|
+
}
|
|
168
|
+
: {}),
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
send({
|
|
172
|
+
jsonrpc: '2.0',
|
|
173
|
+
method: 'textDocument/publishDiagnostics',
|
|
174
|
+
params: {uri, version: document.version, diagnostics},
|
|
85
175
|
});
|
|
86
|
-
send({ jsonrpc: '2.0', method: 'textDocument/publishDiagnostics', params: { uri, version: document.version, diagnostics } });
|
|
87
176
|
}
|
|
88
177
|
}
|
|
89
|
-
function declarations()
|
|
178
|
+
function declarations()
|
|
179
|
+
{
|
|
90
180
|
const result = last.result;
|
|
91
181
|
if (!result) return [];
|
|
92
182
|
const entries = [];
|
|
93
|
-
for (const unit of result.units ?? [])
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
183
|
+
for (const unit of result.units ?? [])
|
|
184
|
+
for (const d of unit.declarations)
|
|
185
|
+
{
|
|
186
|
+
const origin = d.origin?.kind === 'source' ? span(d.origin.span) : null;
|
|
187
|
+
if (origin)
|
|
188
|
+
entries.push({
|
|
189
|
+
id: d.id,
|
|
190
|
+
name: d.name,
|
|
191
|
+
kind: 12,
|
|
192
|
+
detail: d.typeText ?? 'Type information unavailable',
|
|
193
|
+
...origin,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
for (const d of result.dataTypes ?? [])
|
|
197
|
+
{
|
|
98
198
|
const origin = d.origin?.kind === 'source' ? span(d.origin.span) : null;
|
|
99
|
-
if (origin)
|
|
199
|
+
if (origin)
|
|
200
|
+
entries.push({
|
|
201
|
+
id: d.id,
|
|
202
|
+
name: d.name,
|
|
203
|
+
kind: 23,
|
|
204
|
+
detail: 'Type',
|
|
205
|
+
...origin,
|
|
206
|
+
});
|
|
100
207
|
}
|
|
101
|
-
for (const law of
|
|
208
|
+
for (const law of [
|
|
209
|
+
...(result.laws ?? []),
|
|
210
|
+
...(result.temporalLaws ?? []),
|
|
211
|
+
])
|
|
212
|
+
{
|
|
102
213
|
const origin = location(law.location);
|
|
103
|
-
if (origin)
|
|
104
|
-
|
|
214
|
+
if (origin)
|
|
215
|
+
entries.push({
|
|
216
|
+
id: law.id,
|
|
217
|
+
name: law.name,
|
|
218
|
+
kind: 12,
|
|
219
|
+
detail: law.description || 'Law',
|
|
220
|
+
uri: origin.uri,
|
|
221
|
+
range: {
|
|
222
|
+
start: origin.position,
|
|
223
|
+
end: {...origin.position, character: origin.position.character + 3},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
105
226
|
}
|
|
106
227
|
return entries;
|
|
107
228
|
}
|
|
108
|
-
function documentaryLinks()
|
|
109
|
-
|
|
110
|
-
|
|
229
|
+
function documentaryLinks()
|
|
230
|
+
{
|
|
231
|
+
return (last.result?.laws ?? []).flatMap(law =>
|
|
232
|
+
(law.references ?? []).filter(
|
|
233
|
+
reference =>
|
|
234
|
+
reference?.kind === 'law' || reference?.kind === 'function',
|
|
235
|
+
),
|
|
236
|
+
);
|
|
111
237
|
}
|
|
112
|
-
function documentaryDeclaration(id)
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
238
|
+
function documentaryDeclaration(id)
|
|
239
|
+
{
|
|
240
|
+
const reference = documentaryLinks().find(
|
|
241
|
+
reference => reference.target.id === id,
|
|
242
|
+
);
|
|
243
|
+
const target = reference?.target,
|
|
244
|
+
origin = target && span(target.span);
|
|
245
|
+
return origin
|
|
246
|
+
? {
|
|
247
|
+
id,
|
|
248
|
+
name: target.name,
|
|
249
|
+
detail: reference.kind === 'law' ? 'Law' : 'Function',
|
|
250
|
+
...origin,
|
|
251
|
+
}
|
|
252
|
+
: null;
|
|
116
253
|
}
|
|
117
|
-
function uses()
|
|
254
|
+
function uses()
|
|
255
|
+
{
|
|
118
256
|
const result = last.result;
|
|
119
257
|
if (!result) return [];
|
|
120
258
|
const entries = [];
|
|
121
|
-
function walk(value)
|
|
259
|
+
function walk(value)
|
|
260
|
+
{
|
|
122
261
|
if (!value || typeof value !== 'object') return;
|
|
123
|
-
if (value.node?.kind === 'call' && value.origin?.kind === 'source')
|
|
262
|
+
if (value.node?.kind === 'call' && value.origin?.kind === 'source')
|
|
263
|
+
{
|
|
124
264
|
const origin = span(value.origin.span);
|
|
125
|
-
if (origin) entries.push({
|
|
126
|
-
}
|
|
127
|
-
for (const child of Object.values(value)) if (typeof child === 'object') {
|
|
128
|
-
if (Array.isArray(child)) child.forEach(walk); else walk(child);
|
|
265
|
+
if (origin) entries.push({id: value.node.declaration, ...origin});
|
|
129
266
|
}
|
|
267
|
+
for (const child of Object.values(value))
|
|
268
|
+
if (typeof child === 'object')
|
|
269
|
+
{
|
|
270
|
+
if (Array.isArray(child)) child.forEach(walk);
|
|
271
|
+
else walk(child);
|
|
272
|
+
}
|
|
130
273
|
}
|
|
131
|
-
walk(result.laws);
|
|
132
|
-
|
|
274
|
+
walk(result.laws);
|
|
275
|
+
walk(result.definitions);
|
|
276
|
+
for (const reference of documentaryLinks())
|
|
277
|
+
{
|
|
133
278
|
const origin = span(reference.target.referenceSpan);
|
|
134
|
-
if (origin) entries.push({
|
|
279
|
+
if (origin) entries.push({id: reference.target.id, ...origin});
|
|
135
280
|
}
|
|
136
281
|
return entries;
|
|
137
282
|
}
|
|
138
|
-
function selected(params)
|
|
139
|
-
|
|
140
|
-
candidates
|
|
141
|
-
|
|
283
|
+
function selected(params)
|
|
284
|
+
{
|
|
285
|
+
const candidates = [...uses(), ...declarations()].filter(
|
|
286
|
+
d =>
|
|
287
|
+
d.uri === params.textDocument.uri && within(params.position, d.range),
|
|
288
|
+
);
|
|
289
|
+
candidates.sort(
|
|
290
|
+
(a, b) =>
|
|
291
|
+
a.range.end.line -
|
|
292
|
+
a.range.start.line -
|
|
293
|
+
(b.range.end.line - b.range.start.line) ||
|
|
294
|
+
a.range.end.character -
|
|
295
|
+
a.range.start.character -
|
|
296
|
+
(b.range.end.character - b.range.start.character),
|
|
297
|
+
);
|
|
142
298
|
return candidates[0];
|
|
143
299
|
}
|
|
144
|
-
async function handle(message)
|
|
300
|
+
async function handle(message)
|
|
301
|
+
{
|
|
145
302
|
const params = message.params ?? {};
|
|
146
303
|
let result = null;
|
|
147
|
-
switch (message.method)
|
|
304
|
+
switch (message.method)
|
|
305
|
+
{
|
|
148
306
|
case 'initialize':
|
|
149
|
-
if (
|
|
307
|
+
if (
|
|
308
|
+
params.initializationOptions?.warnMatches !== undefined &&
|
|
309
|
+
typeof params.initializationOptions.warnMatches !== 'boolean'
|
|
310
|
+
)
|
|
150
311
|
throw new Error('warnMatches must be a Boolean');
|
|
151
312
|
warnMatches = params.initializationOptions?.warnMatches ?? false;
|
|
152
|
-
workspace = params.rootUri
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
313
|
+
workspace = params.rootUri
|
|
314
|
+
? fileURLToPath(params.rootUri)
|
|
315
|
+
: (params.rootPath ?? workspace);
|
|
316
|
+
result = {
|
|
317
|
+
capabilities: {
|
|
318
|
+
textDocumentSync: 1,
|
|
319
|
+
positionEncoding: 'utf-16',
|
|
320
|
+
documentFormattingProvider: true,
|
|
321
|
+
documentSymbolProvider: true,
|
|
322
|
+
hoverProvider: true,
|
|
323
|
+
definitionProvider: true,
|
|
324
|
+
referencesProvider: true,
|
|
325
|
+
},
|
|
326
|
+
serverInfo: {name: 'LawSpec', version: '0.31.3'},
|
|
327
|
+
};
|
|
156
328
|
break;
|
|
157
|
-
case 'initialized':
|
|
158
|
-
|
|
329
|
+
case 'initialized':
|
|
330
|
+
break;
|
|
331
|
+
case 'workspace/didChangeConfiguration':
|
|
332
|
+
{
|
|
159
333
|
const next = params.settings?.lawspec?.warnMatches;
|
|
160
|
-
if (next !== undefined && typeof next !== 'boolean')
|
|
334
|
+
if (next !== undefined && typeof next !== 'boolean')
|
|
335
|
+
throw new Error('lawspec.warnMatches must be a Boolean');
|
|
161
336
|
warnMatches = next ?? false;
|
|
162
|
-
await check();
|
|
337
|
+
await check();
|
|
338
|
+
break;
|
|
163
339
|
}
|
|
164
|
-
case 'shutdown':
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
case '
|
|
340
|
+
case 'shutdown':
|
|
341
|
+
shuttingDown = true;
|
|
342
|
+
break;
|
|
343
|
+
case 'exit':
|
|
344
|
+
input.pause();
|
|
345
|
+
finish();
|
|
346
|
+
return;
|
|
347
|
+
case 'textDocument/didOpen':
|
|
348
|
+
documents.set(params.textDocument.uri, params.textDocument);
|
|
349
|
+
await check();
|
|
350
|
+
break;
|
|
351
|
+
case 'textDocument/didChange':
|
|
352
|
+
{
|
|
168
353
|
const document = documents.get(params.textDocument.uri);
|
|
169
|
-
if (params.contentChanges.some(change => change.range))
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
354
|
+
if (params.contentChanges.some(change => change.range))
|
|
355
|
+
throw new Error('LawSpec requires full-document synchronization');
|
|
356
|
+
if (document && params.contentChanges.length)
|
|
357
|
+
documents.set(params.textDocument.uri, {
|
|
358
|
+
...document,
|
|
359
|
+
text: params.contentChanges.at(-1).text,
|
|
360
|
+
version: params.textDocument.version,
|
|
361
|
+
});
|
|
362
|
+
await check();
|
|
363
|
+
break;
|
|
173
364
|
}
|
|
174
|
-
case 'textDocument/didClose':
|
|
175
|
-
|
|
176
|
-
|
|
365
|
+
case 'textDocument/didClose':
|
|
366
|
+
documents.delete(params.textDocument.uri);
|
|
367
|
+
send({
|
|
368
|
+
jsonrpc: '2.0',
|
|
369
|
+
method: 'textDocument/publishDiagnostics',
|
|
370
|
+
params: {uri: params.textDocument.uri, diagnostics: []},
|
|
371
|
+
});
|
|
372
|
+
break;
|
|
373
|
+
case 'textDocument/formatting':
|
|
374
|
+
{
|
|
177
375
|
const document = documents.get(params.textDocument.uri);
|
|
178
|
-
if (!document)
|
|
376
|
+
if (!document)
|
|
377
|
+
{
|
|
378
|
+
result = [];
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
179
381
|
const sourcePath = fileURLToPath(params.textDocument.uri);
|
|
180
|
-
const response = await compiler.format({
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
382
|
+
const response = await compiler.format({
|
|
383
|
+
sources: await projectSources(),
|
|
384
|
+
languageProfile: '1.0-rc.2',
|
|
385
|
+
verification: {layers: []},
|
|
386
|
+
});
|
|
387
|
+
if (response.diagnostics?.length)
|
|
388
|
+
{
|
|
389
|
+
result = [];
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
const formatted = response.formattedSources.find(
|
|
393
|
+
s => s.path === sourcePath,
|
|
394
|
+
);
|
|
395
|
+
result =
|
|
396
|
+
formatted && formatted.content !== document.text
|
|
397
|
+
? [
|
|
398
|
+
{
|
|
399
|
+
range: {
|
|
400
|
+
start: {line: 0, character: 0},
|
|
401
|
+
end: endPosition(document.text),
|
|
402
|
+
},
|
|
403
|
+
newText: formatted.content,
|
|
404
|
+
},
|
|
405
|
+
]
|
|
406
|
+
: [];
|
|
185
407
|
break;
|
|
186
408
|
}
|
|
187
|
-
case 'textDocument/documentSymbol':
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
409
|
+
case 'textDocument/documentSymbol':
|
|
410
|
+
result = declarations()
|
|
411
|
+
.filter(d => d.uri === params.textDocument.uri)
|
|
412
|
+
.map(d => ({
|
|
413
|
+
name: d.name,
|
|
414
|
+
detail: d.detail,
|
|
415
|
+
kind: d.kind,
|
|
416
|
+
range: d.range,
|
|
417
|
+
selectionRange: d.range,
|
|
418
|
+
}));
|
|
419
|
+
break;
|
|
420
|
+
case 'textDocument/hover':
|
|
421
|
+
{
|
|
422
|
+
const use = selected(params),
|
|
423
|
+
declaration =
|
|
424
|
+
use &&
|
|
425
|
+
(declarations().find(d => d.id === use.id) ??
|
|
426
|
+
documentaryDeclaration(use.id));
|
|
427
|
+
result = declaration
|
|
428
|
+
? {
|
|
429
|
+
contents: {
|
|
430
|
+
kind: 'plaintext',
|
|
431
|
+
value: `${declaration.name}\n${declaration.detail}`,
|
|
432
|
+
},
|
|
433
|
+
range: use.range,
|
|
434
|
+
}
|
|
435
|
+
: null;
|
|
192
436
|
break;
|
|
193
437
|
}
|
|
194
|
-
case 'textDocument/definition':
|
|
195
|
-
|
|
196
|
-
|
|
438
|
+
case 'textDocument/definition':
|
|
439
|
+
{
|
|
440
|
+
const use = selected(params),
|
|
441
|
+
declaration =
|
|
442
|
+
use &&
|
|
443
|
+
(declarations().find(d => d.id === use.id) ??
|
|
444
|
+
documentaryDeclaration(use.id));
|
|
445
|
+
result = declaration
|
|
446
|
+
? {uri: declaration.uri, range: declaration.range}
|
|
447
|
+
: null;
|
|
197
448
|
break;
|
|
198
449
|
}
|
|
199
|
-
case 'textDocument/references':
|
|
450
|
+
case 'textDocument/references':
|
|
451
|
+
{
|
|
200
452
|
const use = selected(params);
|
|
201
|
-
const declared =
|
|
202
|
-
|
|
203
|
-
.
|
|
453
|
+
const declared =
|
|
454
|
+
use &&
|
|
455
|
+
(declarations().find(d => d.id === use.id) ??
|
|
456
|
+
documentaryDeclaration(use.id));
|
|
457
|
+
result = use
|
|
458
|
+
? [
|
|
459
|
+
...uses(),
|
|
460
|
+
...(params.context?.includeDeclaration && declared
|
|
461
|
+
? [declared]
|
|
462
|
+
: []),
|
|
463
|
+
]
|
|
464
|
+
.filter(d => d.id === use.id)
|
|
465
|
+
.map(d => ({uri: d.uri, range: d.range}))
|
|
466
|
+
: [];
|
|
204
467
|
break;
|
|
205
468
|
}
|
|
206
|
-
case '$/cancelRequest':
|
|
207
|
-
|
|
469
|
+
case '$/cancelRequest':
|
|
470
|
+
break;
|
|
471
|
+
default:
|
|
472
|
+
if (message.id !== undefined)
|
|
473
|
+
send({
|
|
474
|
+
jsonrpc: '2.0',
|
|
475
|
+
id: message.id,
|
|
476
|
+
error: {code: -32601, message: 'Method not found'},
|
|
477
|
+
});
|
|
478
|
+
return;
|
|
208
479
|
}
|
|
209
|
-
if (message.id !== undefined)
|
|
480
|
+
if (message.id !== undefined)
|
|
481
|
+
send({jsonrpc: '2.0', id: message.id, result});
|
|
210
482
|
}
|
|
211
|
-
input.on('data', data =>
|
|
483
|
+
input.on('data', data =>
|
|
484
|
+
{
|
|
212
485
|
buffer = Buffer.concat([buffer, data]);
|
|
213
|
-
for (;;)
|
|
486
|
+
for (;;)
|
|
487
|
+
{
|
|
214
488
|
const headerEnd = buffer.indexOf('\r\n\r\n');
|
|
215
489
|
if (headerEnd < 0) break;
|
|
216
|
-
const length = /^Content-Length:\s*(\d+)\s*$/im.exec(
|
|
217
|
-
|
|
218
|
-
|
|
490
|
+
const length = /^Content-Length:\s*(\d+)\s*$/im.exec(
|
|
491
|
+
buffer.subarray(0, headerEnd).toString(),
|
|
492
|
+
);
|
|
493
|
+
if (!length || Number(length[1]) > 16 * 1024 * 1024)
|
|
494
|
+
{
|
|
495
|
+
send({
|
|
496
|
+
jsonrpc: '2.0',
|
|
497
|
+
id: null,
|
|
498
|
+
error: {code: -32700, message: 'Invalid Content-Length'},
|
|
499
|
+
});
|
|
500
|
+
input.pause();
|
|
501
|
+
finish();
|
|
502
|
+
break;
|
|
219
503
|
}
|
|
220
504
|
const end = headerEnd + 4 + Number(length[1]);
|
|
221
505
|
if (buffer.length < end) break;
|
|
222
|
-
const body = buffer.subarray(headerEnd + 4, end);
|
|
223
|
-
|
|
506
|
+
const body = buffer.subarray(headerEnd + 4, end);
|
|
507
|
+
buffer = buffer.subarray(end);
|
|
508
|
+
queue = queue.then(async () =>
|
|
509
|
+
{
|
|
224
510
|
let message;
|
|
225
|
-
try
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
511
|
+
try
|
|
512
|
+
{
|
|
513
|
+
message = JSON.parse(body.toString());
|
|
514
|
+
}
|
|
515
|
+
catch
|
|
516
|
+
{
|
|
517
|
+
send({
|
|
518
|
+
jsonrpc: '2.0',
|
|
519
|
+
id: null,
|
|
520
|
+
error: {code: -32700, message: 'Parse error'},
|
|
521
|
+
});
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
try
|
|
525
|
+
{
|
|
526
|
+
if (shuttingDown && !['exit', 'shutdown'].includes(message.method))
|
|
527
|
+
throw new Error('Server is shutting down');
|
|
229
528
|
await handle(message);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
529
|
+
}
|
|
530
|
+
catch (error)
|
|
531
|
+
{
|
|
532
|
+
if (message.id !== undefined)
|
|
533
|
+
send({
|
|
534
|
+
jsonrpc: '2.0',
|
|
535
|
+
id: message.id,
|
|
536
|
+
error: {code: -32603, message: error.message},
|
|
537
|
+
});
|
|
538
|
+
else
|
|
539
|
+
send({
|
|
540
|
+
jsonrpc: '2.0',
|
|
541
|
+
method: 'window/logMessage',
|
|
542
|
+
params: {type: 1, message: error.message},
|
|
543
|
+
});
|
|
233
544
|
}
|
|
234
545
|
});
|
|
235
546
|
}
|