greybel-languageserver-browser 1.9.1 → 1.9.2
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/index.js +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -161,7 +161,7 @@ New vulnerability found: \${vulnerability}`,"Test failed: No errors have been fo
|
|
|
161
161
|
\${callengeDescription}`],returns:["string"]},apply_patch:{type:"function",arguments:[{label:"path",type:"string"}],returnVariations:["error: file not found","error: The file to apply the patch cannot be binary","error: The patch code is not correct.","The patch had already been applied.","The patch has been applied correctly."],returns:["string","null"]},unit_testing:{type:"function",arguments:[{label:"errorLines",type:{type:"list",valueType:"number"}}],returnVariations:["error: file not found","Test failed: No potential issues have been found",`Starting testing in selected lines...
|
|
162
162
|
\${methods}
|
|
163
163
|
|
|
164
|
-
New vulnerability found: \${vulnerability}`,"Test failed: No errors have been found in one or more of the provided lines, or not all lines with errors have been provided."],returns:["string","null"]},payload:{type:"function",arguments:[{label:"memZone",type:"string"},{label:"pathFile",type:"string",default:{type:"string",value:""}}],returnVariations:["Error: The file must be a library","Error: The library is patched against this vulnerability.","Failed: No vulnerabilities have been found in the specified memory area.","Error acquiring partial object file. Unable to access to resource: ${pathFile}"],returns:["string",{type:"list",valueType:"map"},"null"]}}}});var VI=k((WH,V$)=>{V$.exports={type:"trafficNet",extends:"map",definitions:{camera_link_system:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: This device is not registered on any police network",1],returns:["number","string"]},locate_vehicle:{type:"function",arguments:[{label:"licensePlate",type:"string"},{label:"password",type:"string"}],returnVariations:["Error: This user cannot access the global camera system for another 24 hours.","Error: This network has disabled access to the traffic cameras.","error: Workstation not found. Unable to get the credentials info from ${credentials}","error: Incorrect password. Access denied.","Unknown error: Unable to access to local computer","error: Invalid license plate.","Error: Unable to use the camera at this time. Too many calls.","error: No internet access.","error: This device is not registered on any police network","locate_vehicle: License plate not found.","The vehicle could not be located in the camera system at this time.",1],returns:["number","string","null"]},get_credentials_info:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: This device is not registered on any police network","${job} ${name}"],returns:["string"]}}}});var HI=k((VH,H$)=>{H$.exports={type:"smartAppliance",extends:"map",definitions:{model:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction"],returns:["string"]},override_settings:{type:"function",arguments:[{label:"power",type:"number"},{label:"temperature",type:"number"}],returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction","override_settings: denied: The settings are locked for security reasons.",1],returns:["string","number","null"]},set_alarm:{type:"function",arguments:[{label:"enable",type:"number"}],returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction","set_alarm: denied: The alarm settings are locked for security reasons.",1],returns:["string","number","null"]}}}});var zI=k(se=>{"use strict";var be=se&&se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(se,"__esModule",{value:!0});se.getSiteDescription=se.getSiteLanguageFile=se.isNative=se.greyscriptMeta=void 0;N1();var z$=Vt(),G$=be(mI()),K$=be(gI()),Y$=be(yI()),J$=be(bI()),Q$=be(vI()),Z$=be(_I()),X$=be(wI()),e2=be(SI()),t2=be(xI()),n2=be(TI()),r2=be(kI()),i2=be(II()),s2=be(EI()),o2=be(RI()),a2=be(PI()),l2=be(CI()),u2=be(OI()),c2=be(AI()),p2=be(DI()),d2=be(LI()),h2=be(jI()),f2=be(MI()),m2=be(qI()),g2=be(FI()),y2=be(NI()),b2=be($I()),v2=be(BI()),_2=be(UI()),w2=be(WI()),S2=be(VI()),x2=be(HI());se.greyscriptMeta=new z$.Container;se.greyscriptMeta.addTypeSignatureFromPayload(Y$.default);se.greyscriptMeta.addTypeSignatureFromPayload(J$.default);se.greyscriptMeta.addTypeSignatureFromPayload(Q$.default);se.greyscriptMeta.addTypeSignatureFromPayload(n2.default);se.greyscriptMeta.addTypeSignatureFromPayload(Z$.default);se.greyscriptMeta.addTypeSignatureFromPayload(X$.default);se.greyscriptMeta.addTypeSignatureFromPayload(e2.default);se.greyscriptMeta.addTypeSignatureFromPayload(t2.default);se.greyscriptMeta.addTypeSignatureFromPayload(r2.default);se.greyscriptMeta.addTypeSignatureFromPayload(i2.default);se.greyscriptMeta.addTypeSignatureFromPayload(s2.default);se.greyscriptMeta.addTypeSignatureFromPayload(o2.default);se.greyscriptMeta.addTypeSignatureFromPayload(a2.default);se.greyscriptMeta.addTypeSignatureFromPayload(l2.default);se.greyscriptMeta.addTypeSignatureFromPayload(u2.default);se.greyscriptMeta.addTypeSignatureFromPayload(c2.default);se.greyscriptMeta.addTypeSignatureFromPayload(p2.default);se.greyscriptMeta.addTypeSignatureFromPayload(d2.default);se.greyscriptMeta.addTypeSignatureFromPayload(h2.default);se.greyscriptMeta.addTypeSignatureFromPayload(f2.default);se.greyscriptMeta.addTypeSignatureFromPayload(m2.default);se.greyscriptMeta.addTypeSignatureFromPayload(g2.default);se.greyscriptMeta.addTypeSignatureFromPayload(y2.default);se.greyscriptMeta.addTypeSignatureFromPayload(b2.default);se.greyscriptMeta.addTypeSignatureFromPayload(v2.default);se.greyscriptMeta.addTypeSignatureFromPayload(_2.default);se.greyscriptMeta.addTypeSignatureFromPayload(w2.default);se.greyscriptMeta.addTypeSignatureFromPayload(S2.default);se.greyscriptMeta.addTypeSignatureFromPayload(x2.default);se.greyscriptMeta.addMetaFromPayload("en",G$.default);var T2=function(t,e){return!!se.greyscriptMeta.getDefinition(t,e)};se.isNative=T2;var k2=function(t){switch(t===void 0&&(t="en"),t){case"en":return K$.default;default:throw new Error('Language "'.concat(t,'" is unknown.'))}};se.getSiteLanguageFile=k2;var I2=function(t,e){var n=(0,se.getSiteLanguageFile)(e);return n==null?void 0:n[t]};se.getSiteDescription=I2});var jv=k(Si=>{"use strict";var E2=Si&&Si.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),R2=Si&&Si.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&E2(e,t,n)};Object.defineProperty(Si,"__esModule",{value:!0});R2(zI(),Si)});var Ia=k(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});var P2=jv(),C2=Ss();Mv.default=new C2.TypeManager({container:P2.greyscriptMeta})});var Nv=k(rn=>{"use strict";var Fv=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.DocumentManager=rn.PROCESSING_TIMEOUT=rn.ActiveDocument=rn.DocumentURIBuilder=void 0;var O2=Fv((rr(),yt(nr))),A2=Kn(),D2=Fv(ru()),GI=q1(),Gr=zf(),xi=Pr(),L2=Fv(Ia()),Vs=class t{static fromTextDocument(e,n){return q(this,null,function*(){let r=Gr.URI.parse(e.uri),i=yield n.fs.getWorkspaceFolderUri(r);return new t(Gr.Utils.joinPath(r,".."),i)})}constructor(e,n=null){this.workspaceFolderUri=n,this.rootPath=e}getFromWorkspaceFolder(e){return this.workspaceFolderUri==null?(console.warn("Workspace folders are not available. Falling back to only relative paths."),Gr.Utils.joinPath(this.rootPath,e).toString()):Gr.Utils.joinPath(this.workspaceFolderUri,e).toString()}getFromRootPath(e){return Gr.Utils.joinPath(this.rootPath,e).toString()}getAlternativePathsWithContext(e,n){return e.startsWith("/")?n.getConfiguration().fileExtensions.map(r=>this.getFromWorkspaceFolder(`${e}.${r}`)):n.getConfiguration().fileExtensions.map(r=>this.getFromRootPath(`${e}.${r}`))}getOriginalPath(e){return e.startsWith("/")?this.getFromWorkspaceFolder(e):this.getFromRootPath(e)}getPathWithContext(e,n){return q(this,null,function*(){return n.fs.findExistingPath(this.getOriginalPath(e),...this.getAlternativePathsWithContext(e,n))})}};rn.DocumentURIBuilder=Vs;var Ep=class{constructor(e){this.documentManager=e.documentManager,this.content=e.content,this.textDocument=e.textDocument,this.document=e.document,this.errors=e.errors}getDirectory(){return Gr.Utils.joinPath(Gr.URI.parse(this.textDocument.uri),"..")}getNativeImportUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=new Vs(r,e),s=this.documentManager.context;return(yield Promise.all(n.nativeImports.filter(l=>l.directory).map(l=>q(this,null,function*(){let c=yield i.getPathWithContext(l.directory,s);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.NativeImport,location:c})})))).filter(l=>l!=null)})}getImportUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vs(r,e);return(yield Promise.all([...n.imports.filter(l=>l.path).map(l=>q(this,null,function*(){var a;let c=yield s.getPathWithContext(l.path,i);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.Import,location:c,args:[(a=l.name)==null?void 0:a.name]})}))])).filter(l=>l!=null)})}getIncludeUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vs(r,e);return(yield Promise.all([...n.includes.filter(l=>l.path).map(l=>q(this,null,function*(){let c=yield s.getPathWithContext(l.path,i);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.Include,location:c})}))])).filter(l=>l!=null)})}getDependencies(){return q(this,null,function*(){if(this.document==null)return[];if(this.dependencies)return this.dependencies;let e=yield this.documentManager.context.fs.getWorkspaceFolderUri(Gr.URI.parse(this.textDocument.uri)),[n,r,i]=yield Promise.all([this.getNativeImportUris(e),this.getImportUris(e),this.getIncludeUris(e)]),s=new Set([...n,...r,...i]);return this.dependencies=Array.from(s).map(xi.parseDependencyRawLocation),this.dependencies})}getImports(e=!0){return q(this,null,function*(){if(this.document==null)return[];let n=new Set,r=new Set([this.textDocument.uri]),i=s=>q(this,null,function*(){let o=yield s.getDependencies();for(let l of o){if(r.has(l.location))continue;let c=yield this.documentManager.open(l.location);r.add(l.location),c!==null&&(n.add({document:c,location:l}),c.document!==null&&e&&(yield i(c)))}});return yield i(this),Array.from(n)})}};rn.ActiveDocument=Ep;rn.PROCESSING_TIMEOUT=100;var qv=class extends O2.default{get context(){return this._context}setContext(e){return this._context=e,this}constructor(e=rn.PROCESSING_TIMEOUT){super(),this._context=null,this._timer=null,this.results=new D2.default({ttl:1e3*60*20,ttlAutopurge:!0}),this.scheduledItems=new Map,this.tickRef=this.tick.bind(this),this.processingTimeout=e}tick(){if(this.scheduledItems.size===0){this._timer=null;return}let e=Date.now(),n=Array.from(this.scheduledItems.values());for(let r=0;r<n.length;r++){let i=n[r];e-i.createdAt>this.processingTimeout&&(0,GI.schedule)(()=>this.refresh(i.document))}this._timer=setTimeout(this.tickRef,0)}refresh(e){let n=e.uri;if(!this.scheduledItems.has(n)&&this.results.has(n))return this.results.get(n);let r=this.create(e);return this.results.set(n,r),this.emit("parsed",e,r),this.scheduledItems.delete(n),r}create(e){let n=e.getText(),r=new A2.Parser(n,{unsafe:!0}),i=r.parseChunk();return this._context.documentMerger.flushCacheKey(e.uri),L2.default.analyze(e.uri,i),new Ep({documentManager:this,content:n,textDocument:e,document:i,errors:[...r.lexer.errors,...r.errors]})}schedule(e){var i;let n=e.uri,r=e.getText();return((i=this.results.get(n))==null?void 0:i.content)===r?!1:(this.scheduledItems.set(n,{document:e,createdAt:Date.now()}),this._timer===null&&(this._timer=setTimeout(this.tickRef,0)),!0)}open(e){return q(this,null,function*(){try{let n=yield this.context.fs.getTextDocument(e);return n==null?null:this.get(n)}catch(n){return null}})}get(e){return this.results.get(e.uri)||this.refresh(e)}getLatest(e,n=5e3){return new Promise(r=>{(0,GI.schedule)(()=>{if(!this.scheduledItems.has(e.uri))return r(this.get(e));let i=()=>{this.removeListener("parsed",s),r(this.get(e))},s=l=>{l.uri===e.uri&&(this.removeListener("parsed",s),clearTimeout(o),r(this.get(e)))},o=setTimeout(i,n);this.addListener("parsed",s)})})}clear(e){this.results.delete(e.uri),this.emit("cleared",e)}};rn.DocumentManager=qv});var Pp=k(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.MarkdownString=void 0;var $v=class{constructor(e=""){this.sanitize=!0,this.value=e}appendText(e){return this.value+=e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&"),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,n){return this.value+="\n```",this.value+=e,this.value+=`
|
|
164
|
+
New vulnerability found: \${vulnerability}`,"Test failed: No errors have been found in one or more of the provided lines, or not all lines with errors have been provided."],returns:["string","null"]},payload:{type:"function",arguments:[{label:"memZone",type:"string"},{label:"pathFile",type:"string",default:{type:"string",value:""}}],returnVariations:["Error: The file must be a library","Error: The library is patched against this vulnerability.","Failed: No vulnerabilities have been found in the specified memory area.","Error acquiring partial object file. Unable to access to resource: ${pathFile}"],returns:["string",{type:"list",valueType:"map"},"null"]}}}});var VI=k((WH,V$)=>{V$.exports={type:"trafficNet",extends:"map",definitions:{camera_link_system:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: This device is not registered on any police network",1],returns:["number","string"]},locate_vehicle:{type:"function",arguments:[{label:"licensePlate",type:"string"},{label:"password",type:"string"}],returnVariations:["Error: This user cannot access the global camera system for another 24 hours.","Error: This network has disabled access to the traffic cameras.","error: Workstation not found. Unable to get the credentials info from ${credentials}","error: Incorrect password. Access denied.","Unknown error: Unable to access to local computer","error: Invalid license plate.","Error: Unable to use the camera at this time. Too many calls.","error: No internet access.","error: This device is not registered on any police network","locate_vehicle: License plate not found.","The vehicle could not be located in the camera system at this time.",1],returns:["number","string","null"]},get_credentials_info:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: This device is not registered on any police network","${job} ${name}"],returns:["string"]}}}});var HI=k((VH,H$)=>{H$.exports={type:"smartAppliance",extends:"map",definitions:{model:{type:"function",returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction"],returns:["string"]},override_settings:{type:"function",arguments:[{label:"power",type:"number"},{label:"temperature",type:"number"}],returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction","override_settings: denied: The settings are locked for security reasons.",1],returns:["string","number","null"]},set_alarm:{type:"function",arguments:[{label:"enable",type:"number"}],returnVariations:["Unknown error: Unable to access to local computer","error: No internet access.","error: Device hardware malfunction","set_alarm: denied: The alarm settings are locked for security reasons.",1],returns:["string","number","null"]}}}});var zI=k(se=>{"use strict";var be=se&&se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(se,"__esModule",{value:!0});se.getSiteDescription=se.getSiteLanguageFile=se.isNative=se.greyscriptMeta=void 0;N1();var z$=Vt(),G$=be(mI()),K$=be(gI()),Y$=be(yI()),J$=be(bI()),Q$=be(vI()),Z$=be(_I()),X$=be(wI()),e2=be(SI()),t2=be(xI()),n2=be(TI()),r2=be(kI()),i2=be(II()),s2=be(EI()),o2=be(RI()),a2=be(PI()),l2=be(CI()),u2=be(OI()),c2=be(AI()),p2=be(DI()),d2=be(LI()),h2=be(jI()),f2=be(MI()),m2=be(qI()),g2=be(FI()),y2=be(NI()),b2=be($I()),v2=be(BI()),_2=be(UI()),w2=be(WI()),S2=be(VI()),x2=be(HI());se.greyscriptMeta=new z$.Container;se.greyscriptMeta.addTypeSignatureFromPayload(Y$.default);se.greyscriptMeta.addTypeSignatureFromPayload(J$.default);se.greyscriptMeta.addTypeSignatureFromPayload(Q$.default);se.greyscriptMeta.addTypeSignatureFromPayload(n2.default);se.greyscriptMeta.addTypeSignatureFromPayload(Z$.default);se.greyscriptMeta.addTypeSignatureFromPayload(X$.default);se.greyscriptMeta.addTypeSignatureFromPayload(e2.default);se.greyscriptMeta.addTypeSignatureFromPayload(t2.default);se.greyscriptMeta.addTypeSignatureFromPayload(r2.default);se.greyscriptMeta.addTypeSignatureFromPayload(i2.default);se.greyscriptMeta.addTypeSignatureFromPayload(s2.default);se.greyscriptMeta.addTypeSignatureFromPayload(o2.default);se.greyscriptMeta.addTypeSignatureFromPayload(a2.default);se.greyscriptMeta.addTypeSignatureFromPayload(l2.default);se.greyscriptMeta.addTypeSignatureFromPayload(u2.default);se.greyscriptMeta.addTypeSignatureFromPayload(c2.default);se.greyscriptMeta.addTypeSignatureFromPayload(p2.default);se.greyscriptMeta.addTypeSignatureFromPayload(d2.default);se.greyscriptMeta.addTypeSignatureFromPayload(h2.default);se.greyscriptMeta.addTypeSignatureFromPayload(f2.default);se.greyscriptMeta.addTypeSignatureFromPayload(m2.default);se.greyscriptMeta.addTypeSignatureFromPayload(g2.default);se.greyscriptMeta.addTypeSignatureFromPayload(y2.default);se.greyscriptMeta.addTypeSignatureFromPayload(b2.default);se.greyscriptMeta.addTypeSignatureFromPayload(v2.default);se.greyscriptMeta.addTypeSignatureFromPayload(_2.default);se.greyscriptMeta.addTypeSignatureFromPayload(w2.default);se.greyscriptMeta.addTypeSignatureFromPayload(S2.default);se.greyscriptMeta.addTypeSignatureFromPayload(x2.default);se.greyscriptMeta.addMetaFromPayload("en",G$.default);var T2=function(t,e){return!!se.greyscriptMeta.getDefinition(t,e)};se.isNative=T2;var k2=function(t){switch(t===void 0&&(t="en"),t){case"en":return K$.default;default:throw new Error('Language "'.concat(t,'" is unknown.'))}};se.getSiteLanguageFile=k2;var I2=function(t,e){var n=(0,se.getSiteLanguageFile)(e);return n==null?void 0:n[t]};se.getSiteDescription=I2});var jv=k(Si=>{"use strict";var E2=Si&&Si.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),R2=Si&&Si.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&E2(e,t,n)};Object.defineProperty(Si,"__esModule",{value:!0});R2(zI(),Si)});var Ia=k(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});var P2=jv(),C2=Ss();Mv.default=new C2.TypeManager({container:P2.greyscriptMeta})});var Nv=k(rn=>{"use strict";var Fv=rn&&rn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.DocumentManager=rn.PROCESSING_TIMEOUT=rn.ActiveDocument=rn.DocumentURIBuilder=void 0;var O2=Fv((rr(),yt(nr))),A2=Kn(),D2=Fv(ru()),GI=q1(),Gr=zf(),xi=Pr(),L2=Fv(Ia()),Vs=class t{static fromTextDocument(e,n){return q(this,null,function*(){let r=Gr.URI.parse(e.uri),i=yield n.fs.getWorkspaceFolderUri(r);return new t(Gr.Utils.joinPath(r,".."),i)})}constructor(e,n=null){this.workspaceFolderUri=n,this.rootPath=e}getFromWorkspaceFolder(e){return this.workspaceFolderUri==null?(console.warn("Workspace folders are not available. Falling back to only relative paths."),Gr.Utils.joinPath(this.rootPath,e).toString()):Gr.Utils.joinPath(this.workspaceFolderUri,e).toString()}getFromRootPath(e){return Gr.Utils.joinPath(this.rootPath,e).toString()}getAlternativePathsWithContext(e,n){return e.startsWith("/")?n.getConfiguration().fileExtensions.map(r=>this.getFromWorkspaceFolder(`${e}.${r}`)):n.getConfiguration().fileExtensions.map(r=>this.getFromRootPath(`${e}.${r}`))}getOriginalPath(e){return e.startsWith("/")?this.getFromWorkspaceFolder(e):this.getFromRootPath(e)}getPathWithContext(e,n){return q(this,null,function*(){return n.fs.findExistingPath(this.getOriginalPath(e),...this.getAlternativePathsWithContext(e,n))})}};rn.DocumentURIBuilder=Vs;var Ep=class{constructor(e){this.documentManager=e.documentManager,this.content=e.content,this.textDocument=e.textDocument,this.document=e.document,this.errors=e.errors}getDirectory(){return Gr.Utils.joinPath(Gr.URI.parse(this.textDocument.uri),"..")}getNativeImportUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=new Vs(r,e),s=this.documentManager.context;return(yield Promise.all(n.nativeImports.filter(l=>l.directory&&l.eval).map(l=>q(this,null,function*(){let c=yield i.getPathWithContext(l.directory,s);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.NativeImport,location:c})})))).filter(l=>l!=null)})}getImportUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vs(r,e);return(yield Promise.all([...n.imports.filter(l=>l.path).map(l=>q(this,null,function*(){var a;let c=yield s.getPathWithContext(l.path,i);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.Import,location:c,args:[(a=l.name)==null?void 0:a.name]})}))])).filter(l=>l!=null)})}getIncludeUris(e=null){return q(this,null,function*(){if(this.document==null)return[];let n=this.document,r=this.getDirectory(),i=this.documentManager.context,s=new Vs(r,e);return(yield Promise.all([...n.includes.filter(l=>l.path).map(l=>q(this,null,function*(){let c=yield s.getPathWithContext(l.path,i);return c==null?null:(0,xi.parseDependencyLocation)({type:xi.DependencyType.Include,location:c})}))])).filter(l=>l!=null)})}getDependencies(){return q(this,null,function*(){if(this.document==null)return[];if(this.dependencies)return this.dependencies;let e=yield this.documentManager.context.fs.getWorkspaceFolderUri(Gr.URI.parse(this.textDocument.uri)),[n,r,i]=yield Promise.all([this.getNativeImportUris(e),this.getImportUris(e),this.getIncludeUris(e)]),s=new Set([...n,...r,...i]);return this.dependencies=Array.from(s).map(xi.parseDependencyRawLocation),this.dependencies})}getImports(e=!0){return q(this,null,function*(){if(this.document==null)return[];let n=new Set,r=new Set([this.textDocument.uri]),i=s=>q(this,null,function*(){let o=yield s.getDependencies();for(let l of o){if(r.has(l.location))continue;let c=yield this.documentManager.open(l.location);r.add(l.location),c!==null&&(n.add({document:c,location:l}),c.document!==null&&e&&(yield i(c)))}});return yield i(this),Array.from(n)})}};rn.ActiveDocument=Ep;rn.PROCESSING_TIMEOUT=100;var qv=class extends O2.default{get context(){return this._context}setContext(e){return this._context=e,this}constructor(e=rn.PROCESSING_TIMEOUT){super(),this._context=null,this._timer=null,this.results=new D2.default({ttl:1e3*60*20,ttlAutopurge:!0}),this.scheduledItems=new Map,this.tickRef=this.tick.bind(this),this.processingTimeout=e}tick(){if(this.scheduledItems.size===0){this._timer=null;return}let e=Date.now(),n=Array.from(this.scheduledItems.values());for(let r=0;r<n.length;r++){let i=n[r];e-i.createdAt>this.processingTimeout&&(0,GI.schedule)(()=>this.refresh(i.document))}this._timer=setTimeout(this.tickRef,0)}refresh(e){let n=e.uri;if(!this.scheduledItems.has(n)&&this.results.has(n))return this.results.get(n);let r=this.create(e);return this.results.set(n,r),this.emit("parsed",e,r),this.scheduledItems.delete(n),r}create(e){let n=e.getText(),r=new A2.Parser(n,{unsafe:!0}),i=r.parseChunk();return this._context.documentMerger.flushCacheKey(e.uri),L2.default.analyze(e.uri,i),new Ep({documentManager:this,content:n,textDocument:e,document:i,errors:[...r.lexer.errors,...r.errors]})}schedule(e){var i;let n=e.uri,r=e.getText();return((i=this.results.get(n))==null?void 0:i.content)===r?!1:(this.scheduledItems.set(n,{document:e,createdAt:Date.now()}),this._timer===null&&(this._timer=setTimeout(this.tickRef,0)),!0)}open(e){return q(this,null,function*(){try{let n=yield this.context.fs.getTextDocument(e);return n==null?null:this.get(n)}catch(n){return null}})}get(e){return this.results.get(e.uri)||this.refresh(e)}getLatest(e,n=5e3){return new Promise(r=>{(0,GI.schedule)(()=>{if(!this.scheduledItems.has(e.uri))return r(this.get(e));let i=()=>{this.removeListener("parsed",s),r(this.get(e))},s=l=>{l.uri===e.uri&&(this.removeListener("parsed",s),clearTimeout(o),r(this.get(e)))},o=setTimeout(i,n);this.addListener("parsed",s)})})}clear(e){this.results.delete(e.uri),this.emit("cleared",e)}};rn.DocumentManager=qv});var Pp=k(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.MarkdownString=void 0;var $v=class{constructor(e=""){this.sanitize=!0,this.value=e}appendText(e){return this.value+=e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&"),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,n){return this.value+="\n```",this.value+=e,this.value+=`
|
|
165
165
|
`,this.value+=n,this.value+="\n```\n",this}toString(){return this.value}};Rp.MarkdownString=$v});var Cp=k(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.createHover=ze.createSignatureInfo=ze.appendTooltipBody=ze.appendTooltipHeader=ze.createTooltipHeader=ze.formatDefaultValue=ze.formatTypes=ze.formatKind=void 0;var bn=Ss(),KI=Pr(),YI=Pp(),j2={[bn.CompletionItemKind.Constant]:"constant",[bn.CompletionItemKind.Expression]:"expr",[bn.CompletionItemKind.Function]:"function",[bn.CompletionItemKind.Internal]:"internal",[bn.CompletionItemKind.InternalFunction]:"function",[bn.CompletionItemKind.InternalProperty]:"var",[bn.CompletionItemKind.ListConstructor]:"list",[bn.CompletionItemKind.Literal]:"literal",[bn.CompletionItemKind.MapConstructor]:"map",[bn.CompletionItemKind.Property]:"var",[bn.CompletionItemKind.Unknown]:"unknown",[bn.CompletionItemKind.Variable]:"var"};function Bv(t){return j2[t]||"unknown"}ze.formatKind=Bv;function Uv(t){return t==null?"":t.map(e=>e.toString().replace(",","\u066B")).join(" or ")}ze.formatTypes=Uv;function JI(t){return typeof t=="string"?`"${t}"`:t.toString()}ze.formatDefaultValue=JI;var M2=(t,e)=>{let n=e.getArguments()||[],r=Uv(e.getReturns())||"null";if(n.length===0)return`(${Bv(t.kind)}) ${t.label} (): ${r}`;let i=n.map(s=>`${s.getLabel()}${s.isOptional()?"?":""}: ${Uv(s.getTypes())}${s.getDefault()?` = ${JI(s.getDefault().value)}`:""}`).join(", ");return`(${Bv(t.kind)}) ${t.label} (${i}): ${r}`};ze.createTooltipHeader=M2;var q2=(t,e,n)=>{t.appendCodeblock(KI.LanguageId,(0,ze.createTooltipHeader)(e,n)),t.appendMarkdown(`***
|
|
166
166
|
`)};ze.appendTooltipHeader=q2;var F2=(t,e)=>{let n=e.getExample()||[];t.appendMarkdown(e.getDescription()+`
|
|
167
167
|
`),n.length>0&&(t.appendMarkdown(`#### Examples:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greybel-languageserver-browser",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Language server for GreyScript",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"greyscript-meta": "~4.2.3",
|
|
75
75
|
"greyscript-transpiler": "~1.6.5",
|
|
76
76
|
"miniscript-type-analyzer": "~0.20.4",
|
|
77
|
-
"greybel-languageserver-core": "~1.9.
|
|
77
|
+
"greybel-languageserver-core": "~1.9.1"
|
|
78
78
|
}
|
|
79
79
|
}
|