@moonbit/moonbit-lsp 0.1.1 → 0.1.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/lsp-server.js +1 -0
- package/package.json +2 -2
package/lsp-server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";var c5t=Object.create;var rQ=Object.defineProperty;var a5t=Object.getOwnPropertyDescriptor;var l5t=Object.getOwnPropertyNames;var p5t=Object.getPrototypeOf,_5t=Object.prototype.hasOwnProperty;var y5t=(N,I,v0)=>I in N?rQ(N,I,{enumerable:!0,configurable:!0,writable:!0,value:v0}):N[I]=v0;var Ru=(N,I)=>()=>(I||N((I={exports:{}}).exports,I),I.exports),P7=(N,I)=>{for(var v0 in I)rQ(N,v0,{get:I[v0],enumerable:!0})},w5t=(N,I,v0,J0)=>{if(I&&typeof I=="object"||typeof I=="function")for(let nr of l5t(I))!_5t.call(N,nr)&&nr!==v0&&rQ(N,nr,{get:()=>I[nr],enumerable:!(J0=a5t(I,nr))||J0.enumerable});return N};var c5=(N,I,v0)=>(v0=N!=null?c5t(p5t(N)):{},w5t(I||!N||!N.__esModule?rQ(v0,"default",{value:N,enumerable:!0}):v0,N));var g5=(N,I,v0)=>(y5t(N,typeof I!="symbol"?I+"":I,v0),v0);var QD=Ru(b8=>{"use strict";Object.defineProperty(b8,"__esModule",{value:!0});b8.stringArray=b8.array=b8.func=b8.error=b8.number=b8.string=b8.boolean=void 0;function k5t(N){return N===!0||N===!1}b8.boolean=k5t;function bA0(N){return typeof N=="string"||N instanceof String}b8.string=bA0;function m5t(N){return typeof N=="number"||N instanceof Number}b8.number=m5t;function Y5t(N){return N instanceof Error}b8.error=Y5t;function R5t(N){return typeof N=="function"}b8.func=R5t;function $A0(N){return Array.isArray(N)}b8.array=$A0;function T5t(N){return $A0(N)&&N.every(I=>bA0(I))}b8.stringArray=T5t});var dt0=Ru(Z2=>{"use strict";Object.defineProperty(Z2,"__esModule",{value:!0});Z2.Message=Z2.NotificationType9=Z2.NotificationType8=Z2.NotificationType7=Z2.NotificationType6=Z2.NotificationType5=Z2.NotificationType4=Z2.NotificationType3=Z2.NotificationType2=Z2.NotificationType1=Z2.NotificationType0=Z2.NotificationType=Z2.RequestType9=Z2.RequestType8=Z2.RequestType7=Z2.RequestType6=Z2.RequestType5=Z2.RequestType4=Z2.RequestType3=Z2.RequestType2=Z2.RequestType1=Z2.RequestType=Z2.RequestType0=Z2.AbstractMessageSignature=Z2.ParameterStructures=Z2.ResponseError=Z2.ErrorCodes=void 0;var vS=QD(),Ct0;(function(N){N.ParseError=-32700,N.InvalidRequest=-32600,N.MethodNotFound=-32601,N.InvalidParams=-32602,N.InternalError=-32603,N.jsonrpcReservedErrorRangeStart=-32099,N.serverErrorStart=-32099,N.MessageWriteError=-32099,N.MessageReadError=-32098,N.PendingResponseRejected=-32097,N.ConnectionInactive=-32096,N.ServerNotInitialized=-32002,N.UnknownErrorCode=-32001,N.jsonrpcReservedErrorRangeEnd=-32e3,N.serverErrorEnd=-32e3})(Ct0||(Z2.ErrorCodes=Ct0={}));var At0=class N extends Error{constructor(I,v0,J0){super(v0),this.code=vS.number(I)?I:Ct0.UnknownErrorCode,this.data=J0,Object.setPrototypeOf(this,N.prototype)}toJson(){let I={code:this.code,message:this.message};return this.data!==void 0&&(I.data=this.data),I}};Z2.ResponseError=At0;var A9=class N{constructor(I){this.kind=I}static is(I){return I===N.auto||I===N.byName||I===N.byPosition}toString(){return this.kind}};Z2.ParameterStructures=A9;A9.auto=new A9("auto");A9.byPosition=new A9("byPosition");A9.byName=new A9("byName");var wa=class{constructor(I,v0){this.method=I,this.numberOfParams=v0}get parameterStructures(){return A9.auto}};Z2.AbstractMessageSignature=wa;var It0=class extends wa{constructor(I){super(I,0)}};Z2.RequestType0=It0;var Nt0=class extends wa{constructor(I,v0=A9.auto){super(I,1),this._parameterStructures=v0}get parameterStructures(){return this._parameterStructures}};Z2.RequestType=Nt0;var Mt0=class extends wa{constructor(I,v0=A9.auto){super(I,1),this._parameterStructures=v0}get parameterStructures(){return this._parameterStructures}};Z2.RequestType1=Mt0;var Ot0=class extends wa{constructor(I){super(I,2)}};Z2.RequestType2=Ot0;var Et0=class extends wa{constructor(I){super(I,3)}};Z2.RequestType3=Et0;var Ut0=class extends wa{constructor(I){super(I,4)}};Z2.RequestType4=Ut0;var Lt0=class extends wa{constructor(I){super(I,5)}};Z2.RequestType5=Lt0;var Ht0=class extends wa{constructor(I){super(I,6)}};Z2.RequestType6=Ht0;var Wt0=class extends wa{constructor(I){super(I,7)}};Z2.RequestType7=Wt0;var Bt0=class extends wa{constructor(I){super(I,8)}};Z2.RequestType8=Bt0;var Ft0=class extends wa{constructor(I){super(I,9)}};Z2.RequestType9=Ft0;var Zt0=class extends wa{constructor(I,v0=A9.auto){super(I,1),this._parameterStructures=v0}get parameterStructures(){return this._parameterStructures}};Z2.NotificationType=Zt0;var Jt0=class extends wa{constructor(I){super(I,0)}};Z2.NotificationType0=Jt0;var Qt0=class extends wa{constructor(I,v0=A9.auto){super(I,1),this._parameterStructures=v0}get parameterStructures(){return this._parameterStructures}};Z2.NotificationType1=Qt0;var Vt0=class extends wa{constructor(I){super(I,2)}};Z2.NotificationType2=Vt0;var Kt0=class extends wa{constructor(I){super(I,3)}};Z2.NotificationType3=Kt0;var Xt0=class extends wa{constructor(I){super(I,4)}};Z2.NotificationType4=Xt0;var Gt0=class extends wa{constructor(I){super(I,5)}};Z2.NotificationType5=Gt0;var qt0=class extends wa{constructor(I){super(I,6)}};Z2.NotificationType6=qt0;var zt0=class extends wa{constructor(I){super(I,7)}};Z2.NotificationType7=zt0;var ht0=class extends wa{constructor(I){super(I,8)}};Z2.NotificationType8=ht0;var gt0=class extends wa{constructor(I){super(I,9)}};Z2.NotificationType9=gt0;var DA0;(function(N){function I(nr){let me=nr;return me&&vS.string(me.method)&&(vS.string(me.id)||vS.number(me.id))}N.isRequest=I;function v0(nr){let me=nr;return me&&vS.string(me.method)&&nr.id===void 0}N.isNotification=v0;function J0(nr){let me=nr;return me&&(me.result!==void 0||!!me.error)&&(vS.string(me.id)||vS.number(me.id)||me.id===null)}N.isResponse=J0})(DA0||(Z2.Message=DA0={}))});var rn0=Ru(NY=>{"use strict";var CA0;Object.defineProperty(NY,"__esModule",{value:!0});NY.LRUCache=NY.LinkedMap=NY.Touch=void 0;var $8;(function(N){N.None=0,N.First=1,N.AsOld=N.First,N.Last=2,N.AsNew=N.Last})($8||(NY.Touch=$8={}));var eQ=class{constructor(){this[CA0]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(I){return this._map.has(I)}get(I,v0=$8.None){let J0=this._map.get(I);if(J0)return v0!==$8.None&&this.touch(J0,v0),J0.value}set(I,v0,J0=$8.None){let nr=this._map.get(I);if(nr)nr.value=v0,J0!==$8.None&&this.touch(nr,J0);else{switch(nr={key:I,value:v0,next:void 0,previous:void 0},J0){case $8.None:this.addItemLast(nr);break;case $8.First:this.addItemFirst(nr);break;case $8.Last:this.addItemLast(nr);break;default:this.addItemLast(nr);break}this._map.set(I,nr),this._size++}return this}delete(I){return!!this.remove(I)}remove(I){let v0=this._map.get(I);if(v0)return this._map.delete(I),this.removeItem(v0),this._size--,v0.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let I=this._head;return this._map.delete(I.key),this.removeItem(I),this._size--,I.value}forEach(I,v0){let J0=this._state,nr=this._head;for(;nr;){if(v0?I.bind(v0)(nr.value,nr.key,this):I(nr.value,nr.key,this),this._state!==J0)throw new Error("LinkedMap got modified during iteration.");nr=nr.next}}keys(){let I=this._state,v0=this._head,J0={[Symbol.iterator]:()=>J0,next:()=>{if(this._state!==I)throw new Error("LinkedMap got modified during iteration.");if(v0){let nr={value:v0.key,done:!1};return v0=v0.next,nr}else return{value:void 0,done:!0}}};return J0}values(){let I=this._state,v0=this._head,J0={[Symbol.iterator]:()=>J0,next:()=>{if(this._state!==I)throw new Error("LinkedMap got modified during iteration.");if(v0){let nr={value:v0.value,done:!1};return v0=v0.next,nr}else return{value:void 0,done:!0}}};return J0}entries(){let I=this._state,v0=this._head,J0={[Symbol.iterator]:()=>J0,next:()=>{if(this._state!==I)throw new Error("LinkedMap got modified during iteration.");if(v0){let nr={value:[v0.key,v0.value],done:!1};return v0=v0.next,nr}else return{value:void 0,done:!0}}};return J0}[(CA0=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(I){if(I>=this.size)return;if(I===0){this.clear();return}let v0=this._head,J0=this.size;for(;v0&&J0>I;)this._map.delete(v0.key),v0=v0.next,J0--;this._head=v0,this._size=J0,v0&&(v0.previous=void 0),this._state++}addItemFirst(I){if(!this._head&&!this._tail)this._tail=I;else if(this._head)I.next=this._head,this._head.previous=I;else throw new Error("Invalid list");this._head=I,this._state++}addItemLast(I){if(!this._head&&!this._tail)this._head=I;else if(this._tail)I.previous=this._tail,this._tail.next=I;else throw new Error("Invalid list");this._tail=I,this._state++}removeItem(I){if(I===this._head&&I===this._tail)this._head=void 0,this._tail=void 0;else if(I===this._head){if(!I.next)throw new Error("Invalid list");I.next.previous=void 0,this._head=I.next}else if(I===this._tail){if(!I.previous)throw new Error("Invalid list");I.previous.next=void 0,this._tail=I.previous}else{let v0=I.next,J0=I.previous;if(!v0||!J0)throw new Error("Invalid list");v0.previous=J0,J0.next=v0}I.next=void 0,I.previous=void 0,this._state++}touch(I,v0){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(v0!==$8.First&&v0!==$8.Last)){if(v0===$8.First){if(I===this._head)return;let J0=I.next,nr=I.previous;I===this._tail?(nr.next=void 0,this._tail=nr):(J0.previous=nr,nr.next=J0),I.previous=void 0,I.next=this._head,this._head.previous=I,this._head=I,this._state++}else if(v0===$8.Last){if(I===this._tail)return;let J0=I.next,nr=I.previous;I===this._head?(J0.previous=void 0,this._head=J0):(J0.previous=nr,nr.next=J0),I.next=void 0,I.previous=this._tail,this._tail.next=I,this._tail=I,this._state++}}}toJSON(){let I=[];return this.forEach((v0,J0)=>{I.push([J0,v0])}),I}fromJSON(I){this.clear();for(let[v0,J0]of I)this.set(v0,J0)}};NY.LinkedMap=eQ;var jt0=class extends eQ{constructor(I,v0=1){super(),this._limit=I,this._ratio=Math.min(Math.max(0,v0),1)}get limit(){return this._limit}set limit(I){this._limit=I,this.checkTrim()}get ratio(){return this._ratio}set ratio(I){this._ratio=Math.min(Math.max(0,I),1),this.checkTrim()}get(I,v0=$8.AsNew){return super.get(I,v0)}peek(I){return super.get(I,$8.None)}set(I,v0){return super.set(I,v0,$8.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};NY.LRUCache=jt0});var IA0=Ru(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});tQ.Disposable=void 0;var AA0;(function(N){function I(v0){return{dispose:v0}}N.create=I})(AA0||(tQ.Disposable=AA0={}))});var MY=Ru(nn0=>{"use strict";Object.defineProperty(nn0,"__esModule",{value:!0});var en0;function tn0(){if(en0===void 0)throw new Error("No runtime abstraction layer installed");return en0}(function(N){function I(v0){if(v0===void 0)throw new Error("No runtime abstraction layer provided");en0=v0}N.install=I})(tn0||(tn0={}));nn0.default=tn0});var KD=Ru(VD=>{"use strict";Object.defineProperty(VD,"__esModule",{value:!0});VD.Emitter=VD.Event=void 0;var P5t=MY(),NA0;(function(N){let I={dispose(){}};N.None=function(){return I}})(NA0||(VD.Event=NA0={}));var xn0=class{add(I,v0=null,J0){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(I),this._contexts.push(v0),Array.isArray(J0)&&J0.push({dispose:()=>this.remove(I,v0)})}remove(I,v0=null){if(!this._callbacks)return;let J0=!1;for(let nr=0,me=this._callbacks.length;nr<me;nr++)if(this._callbacks[nr]===I)if(this._contexts[nr]===v0){this._callbacks.splice(nr,1),this._contexts.splice(nr,1);return}else J0=!0;if(J0)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...I){if(!this._callbacks)return[];let v0=[],J0=this._callbacks.slice(0),nr=this._contexts.slice(0);for(let me=0,be=J0.length;me<be;me++)try{v0.push(J0[me].apply(nr[me],I))}catch(n1){(0,P5t.default)().console.error(n1)}return v0}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},nQ=class N{constructor(I){this._options=I}get event(){return this._event||(this._event=(I,v0,J0)=>{this._callbacks||(this._callbacks=new xn0),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(I,v0);let nr={dispose:()=>{this._callbacks&&(this._callbacks.remove(I,v0),nr.dispose=N._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(J0)&&J0.push(nr),nr}),this._event}fire(I){this._callbacks&&this._callbacks.invoke.call(this._callbacks,I)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};VD.Emitter=nQ;nQ._noop=function(){}});var sQ=Ru(XD=>{"use strict";Object.defineProperty(XD,"__esModule",{value:!0});XD.CancellationTokenSource=XD.CancellationToken=void 0;var S5t=MY(),b5t=QD(),un0=KD(),xQ;(function(N){N.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:un0.Event.None}),N.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:un0.Event.None});function I(v0){let J0=v0;return J0&&(J0===N.None||J0===N.Cancelled||b5t.boolean(J0.isCancellationRequested)&&!!J0.onCancellationRequested)}N.is=I})(xQ||(XD.CancellationToken=xQ={}));var $5t=Object.freeze(function(N,I){let v0=(0,S5t.default)().timer.setTimeout(N.bind(I),0);return{dispose(){v0.dispose()}}}),uQ=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$5t:(this._emitter||(this._emitter=new un0.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},sn0=class{get token(){return this._token||(this._token=new uQ),this._token}cancel(){this._token?this._token.cancel():this._token=xQ.Cancelled}dispose(){this._token?this._token instanceof uQ&&this._token.dispose():this._token=xQ.None}};XD.CancellationTokenSource=sn0});var MA0=Ru(GD=>{"use strict";Object.defineProperty(GD,"__esModule",{value:!0});GD.SharedArrayReceiverStrategy=GD.SharedArraySenderStrategy=void 0;var D5t=sQ(),eO;(function(N){N.Continue=0,N.Cancelled=1})(eO||(eO={}));var fn0=class{constructor(){this.buffers=new Map}enableCancellation(I){if(I.id===null)return;let v0=new SharedArrayBuffer(4),J0=new Int32Array(v0,0,1);J0[0]=eO.Continue,this.buffers.set(I.id,v0),I.$cancellationData=v0}async sendCancellation(I,v0){let J0=this.buffers.get(v0);if(J0===void 0)return;let nr=new Int32Array(J0,0,1);Atomics.store(nr,0,eO.Cancelled)}cleanup(I){this.buffers.delete(I)}dispose(){this.buffers.clear()}};GD.SharedArraySenderStrategy=fn0;var in0=class{constructor(I){this.data=new Int32Array(I,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===eO.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},on0=class{constructor(I){this.token=new in0(I)}cancel(){}dispose(){}},vn0=class{constructor(){this.kind="request"}createCancellationTokenSource(I){let v0=I.$cancellationData;return v0===void 0?new D5t.CancellationTokenSource:new on0(v0)}};GD.SharedArrayReceiverStrategy=vn0});var an0=Ru(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.Semaphore=void 0;var C5t=MY(),cn0=class{constructor(I=1){if(I<=0)throw new Error("Capacity must be greater than 0");this._capacity=I,this._active=0,this._waiting=[]}lock(I){return new Promise((v0,J0)=>{this._waiting.push({thunk:I,resolve:v0,reject:J0}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,C5t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let I=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let v0=I.thunk();v0 instanceof Promise?v0.then(J0=>{this._active--,I.resolve(J0),this.runNext()},J0=>{this._active--,I.reject(J0),this.runNext()}):(this._active--,I.resolve(v0),this.runNext())}catch(v0){this._active--,I.reject(v0),this.runNext()}}};fQ.Semaphore=cn0});var EA0=Ru(OY=>{"use strict";Object.defineProperty(OY,"__esModule",{value:!0});OY.ReadableStreamMessageReader=OY.AbstractMessageReader=OY.MessageReader=void 0;var pn0=MY(),qD=QD(),ln0=KD(),A5t=an0(),OA0;(function(N){function I(v0){let J0=v0;return J0&&qD.func(J0.listen)&&qD.func(J0.dispose)&&qD.func(J0.onError)&&qD.func(J0.onClose)&&qD.func(J0.onPartialMessage)}N.is=I})(OA0||(OY.MessageReader=OA0={}));var iQ=class{constructor(){this.errorEmitter=new ln0.Emitter,this.closeEmitter=new ln0.Emitter,this.partialMessageEmitter=new ln0.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(I){this.errorEmitter.fire(this.asError(I))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(I){this.partialMessageEmitter.fire(I)}asError(I){return I instanceof Error?I:new Error(`Reader received error. Reason: ${qD.string(I.message)?I.message:"unknown"}`)}};OY.AbstractMessageReader=iQ;var _n0;(function(N){function I(v0){let J0,nr,me,be=new Map,n1,Ce=new Map;if(v0===void 0||typeof v0=="string")J0=v0??"utf-8";else{if(J0=v0.charset??"utf-8",v0.contentDecoder!==void 0&&(me=v0.contentDecoder,be.set(me.name,me)),v0.contentDecoders!==void 0)for(let Fe of v0.contentDecoders)be.set(Fe.name,Fe);if(v0.contentTypeDecoder!==void 0&&(n1=v0.contentTypeDecoder,Ce.set(n1.name,n1)),v0.contentTypeDecoders!==void 0)for(let Fe of v0.contentTypeDecoders)Ce.set(Fe.name,Fe)}return n1===void 0&&(n1=(0,pn0.default)().applicationJson.decoder,Ce.set(n1.name,n1)),{charset:J0,contentDecoder:me,contentDecoders:be,contentTypeDecoder:n1,contentTypeDecoders:Ce}}N.fromOptions=I})(_n0||(_n0={}));var yn0=class extends iQ{constructor(I,v0){super(),this.readable=I,this.options=_n0.fromOptions(v0),this.buffer=(0,pn0.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new A5t.Semaphore(1)}set partialMessageTimeout(I){this._partialMessageTimeout=I}get partialMessageTimeout(){return this._partialMessageTimeout}listen(I){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=I;let v0=this.readable.onData(J0=>{this.onData(J0)});return this.readable.onError(J0=>this.fireError(J0)),this.readable.onClose(()=>this.fireClose()),v0}onData(I){try{for(this.buffer.append(I);;){if(this.nextMessageLength===-1){let J0=this.buffer.tryReadHeaders(!0);if(!J0)return;let nr=J0.get("content-length");if(!nr){this.fireError(new Error(`Header must provide a Content-Length property.
|
|
2
3
|
${JSON.stringify(Object.fromEntries(J0))}`));return}let me=parseInt(nr);if(isNaN(me)){this.fireError(new Error(`Content-Length value must be a number. Got ${nr}`));return}this.nextMessageLength=me}let v0=this.buffer.tryReadBody(this.nextMessageLength);if(v0===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let J0=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(v0):v0,nr=await this.options.contentTypeDecoder.decode(J0,this.options);this.callback(nr)}).catch(J0=>{this.fireError(J0)})}}catch(v0){this.fireError(v0)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,pn0.default)().timer.setTimeout((I,v0)=>{this.partialMessageTimer=void 0,I===this.messageToken&&(this.firePartialMessage({messageToken:I,waitingTime:v0}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};OY.ReadableStreamMessageReader=yn0});var BA0=Ru(EY=>{"use strict";Object.defineProperty(EY,"__esModule",{value:!0});EY.WriteableStreamMessageWriter=EY.AbstractMessageWriter=EY.MessageWriter=void 0;var UA0=MY(),tO=QD(),I5t=an0(),LA0=KD(),N5t="Content-Length: ",HA0=`\r
|
|
3
4
|
`,WA0;(function(N){function I(v0){let J0=v0;return J0&&tO.func(J0.dispose)&&tO.func(J0.onClose)&&tO.func(J0.onError)&&tO.func(J0.write)}N.is=I})(WA0||(EY.MessageWriter=WA0={}));var oQ=class{constructor(){this.errorEmitter=new LA0.Emitter,this.closeEmitter=new LA0.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(I,v0,J0){this.errorEmitter.fire([this.asError(I),v0,J0])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(I){return I instanceof Error?I:new Error(`Writer received error. Reason: ${tO.string(I.message)?I.message:"unknown"}`)}};EY.AbstractMessageWriter=oQ;var wn0;(function(N){function I(v0){return v0===void 0||typeof v0=="string"?{charset:v0??"utf-8",contentTypeEncoder:(0,UA0.default)().applicationJson.encoder}:{charset:v0.charset??"utf-8",contentEncoder:v0.contentEncoder,contentTypeEncoder:v0.contentTypeEncoder??(0,UA0.default)().applicationJson.encoder}}N.fromOptions=I})(wn0||(wn0={}));var kn0=class extends oQ{constructor(I,v0){super(),this.writable=I,this.options=wn0.fromOptions(v0),this.errorCount=0,this.writeSemaphore=new I5t.Semaphore(1),this.writable.onError(J0=>this.fireError(J0)),this.writable.onClose(()=>this.fireClose())}async write(I){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(I,this.options).then(J0=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(J0):J0).then(J0=>{let nr=[];return nr.push(N5t,J0.byteLength.toString(),HA0),nr.push(HA0),this.doWrite(I,nr,J0)},J0=>{throw this.fireError(J0),J0}))}async doWrite(I,v0,J0){try{return await this.writable.write(v0.join(""),"ascii"),this.writable.write(J0)}catch(nr){return this.handleError(nr,I),Promise.reject(nr)}}handleError(I,v0){this.errorCount++,this.fireError(I,v0,this.errorCount)}end(){this.writable.end()}};EY.WriteableStreamMessageWriter=kn0});var FA0=Ru(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:!0});vQ.AbstractMessageBuffer=void 0;var M5t=13,O5t=10,E5t=`\r
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbit/moonbit-lsp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Language server for moonbit language",
|
|
5
5
|
"main": "./lsp-server.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"moonbit-lsp": "lsp-server.js"
|
|
7
|
+
"moonbit-lsp": "./lsp-server.js"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"language",
|