diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..175b23e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +dist/*.js whitespace=-trailing-space diff --git a/.gitignore b/.gitignore index 4ff84b6..f99ba3a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ all-agents-combined.md #formatter #.vscode/** typings/** -out/test/** +/out/ #src/** **/*.map diff --git a/.serena/memories/language-intelligence.md b/.serena/memories/language-intelligence.md index 8794b72..de27e5b 100644 --- a/.serena/memories/language-intelligence.md +++ b/.serena/memories/language-intelligence.md @@ -3,11 +3,11 @@ - `.vbi` and `.vi` are proprietary InTouch QuickScript, not Visual Basic, VBA, VBScript, Pascal, or PowerShell. Do not route them to a foreign language server. -- Serena excludes QuickScript from semantic navigation until this repository - provides a native InTouch language server. Use targeted text search and - repository language evidence in the meantime. -- ProjectAtlas may index QuickScript as neutral text for file orientation and - lexical search, never as a source of semantic symbols or references. +- This repository provides a native InTouch QuickScript language server. Serena + uses its thin QuickScript adapter for semantic navigation of `.vbi` and `.vi`. +- ProjectAtlas may index QuickScript structurally for file orientation and + lexical search, while semantic language intelligence remains in the native + language server. - Current language evidence: `syntaxes/intouch.tmLanguage.json`, `src/const.ts`, `src/nestingdef.ts`, `src/formatCore.ts`, `src/test/suite/testfiles/`, and `docs/language/quickscript.md`. diff --git a/.serena/project.yml b/.serena/project.yml index 5222ef7..d8a4808 100644 --- a/.serena/project.yml +++ b/.serena/project.yml @@ -179,6 +179,7 @@ activation_command_timeout: 180.0 # The first language server is the default language and the respective language server will be used as a fallback. # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored. language_servers: +- quickscript - yaml - json - markdown diff --git a/.vscodeignore b/.vscodeignore index 037130b..70cba93 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,69 +1,50 @@ ### VSIX Ignore (bundled) ### -# Keep only runtime bundle (dist), grammar, themes, snippets, language config, images used by marketplace, license, readme. - -# Exclude development sources & build output not needed after bundling -src/ -out/ -backup/ -scripts/ - -# Node modules removed because code is bundled -node_modules/ - -# Dev / workspace meta -.git/ -.github/ -.vscode/ -.vscode-test/ -workspace.code-workspace +# Ship only the runtime bundle and user-facing extension assets. + +# Local agent, index, workspace, and repository metadata +.agents/** +.git/** +.github/** +.projectatlas/** +.serena/** +.vscode/** +.vscode-test/** +.gitignore +.vscodeignore +AGENTS.md +TODO.md launch.json renovate.json settings.json -TODO.md -tsconfig.json tslint.json -package-lock.json +workspace.code-workspace -# Tests & fixtures -src/test/ -**/*.test.vbi -**/*.tobe.vbi +# Development sources, tests, documentation, and build metadata +.Temp/** +LanguageDefinition/** +backup/** +docs/** +node_modules/** +other/** +out/** +packages/** +scripts/** +src/** +temp/** +eslint.config.mjs +package-lock.json +syntaxes/schema.json +tsconfig.json -# Exclude all heavy/readme showcase images (served via GitHub raw links in README) +# Marketplace images are hosted externally; retain only the extension icon. images/** !images/logo.png -# Exclude full LanguageDefinition directory (no language docs / assets in VSIX per request) -LanguageDefinition/** - -# Misc archives / binaries +# Generated and archival artifacts +dist/**/*.map *.7z -*.zip -*.zap* -*.iso *.exe - -# Existing packaged files +*.iso *.vsix - -# Temp folders -temp/ -other/ - -# Ignore all source maps except allow dist maps (help debugging if user enables) -**/*.map -!dist/*.map - -# Keep dist bundle -!dist/** - -# Allow essential files -!README.md -!LICENSE -!package.json -!language-configuration.json -!syntaxes/** -!themes/** -!snippets/** -!images/logo.png - +*.zap* +*.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 9812e5e..3267244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,28 @@ +## 1.6.0 + +- Replace the legacy formatter lexers with the shared QuickScript tokenizer and + recoverable structure parser. +- Add a native language server with diagnostics, symbols, completion, hover, + document-local variable navigation, and workspace QuickFunction navigation. +- Route VS Code formatting through the language client while preserving the + existing grammar, snippets, theme, and formatter command. +- Add editor-independent core tests, language-server protocol smoke tests, and + a manual `.vbi`/`.vi` HIL gate. +- Keep unclosed `{>` metadata blocks inside one multiline brace-comment token + while preserving diagnostics between same-line-closed nesting markers. +- Keep project-specific QuickFunctions external to the public static catalog; + workspace declarations remain dynamically discoverable. +- Accept corpus-evidenced Unicode and digit-prefixed identifiers, numeric + dotfields, and multiline `IF` continuation forms. +- Add configurable QuickScript quality diagnostics for non-ASCII identifiers + and problematic literal window names without changing language validity. +- Add canonical comment-based document metadata, InTouch KeyScript/shortcut and + Window-event classification, plus URI-aware cross-file QuickFunction + definition, references, hover, and completion independent of filename prefixes. + ### V1.4.0 - 29.11.2022 VitalyRuhl diff --git a/LanguageDefinition/ToDo_V1.5.x.md b/LanguageDefinition/ToDo_V1.5.x.md deleted file mode 100644 index d882885..0000000 --- a/LanguageDefinition/ToDo_V1.5.x.md +++ /dev/null @@ -1,20 +0,0 @@ -# ToDo V1.5.x (Ongoing Tasks) - -Status: 25.09.2025 - -Goal: Stabilize current formatting rules, consolidate tests, no behavioral changes outside the items listed here. - -## Rules / Clarifications (Documentation) - -- Parenthesis spacing in control structures: Target style "IF (a == b) THEN" (no space directly after `(` nor before `)`). -- Remove trailing whitespace at end of lines. -- Empty lines: At most one consecutive empty line—even inside comment blocks consisting only of tabs/spaces. -- EOL/EOF: Edge cases covered by separate tests; monitor. -- Implement EOL edge case test (mixed LF/CRLF + no final newline). -- add a error-finder in code like (e.g. missing semicolons, unmatched brackets, missing END-Keywords). - - - -## Tests -- Dynamic formatting settings testrunner: Implement a runner that can adjust settings (e.g. EmptyLinesAlsoInComment, allowedNumberOfEmptyLines) per test case to cover all configuration variants. -- idempotent formatting: Ensure that applying the formatter multiple times does not change the output after the first application (pure function behavior). but for all.test.vbi! diff --git a/README.md b/README.md index ee7fc2b..7a24ab4 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,25 @@ # Intouch-Language -- **Intouch-Language** is an open source extension created for **Visual Studio Code** (**Not official!**). It provides `syntax highlighting`, `snippets` and `auto-format` function for Intouch Basic. New since 2022.11.28 - own darkmode theme for VSC, names Intouch Dark. +- **Intouch-Language** is an open source extension created for **Visual Studio Code** (**Not official!**). It provides native QuickScript language-server support for `.vbi` and `.vi` files, including formatting, diagnostics, document metadata, QuickFunction discovery, cross-file definition and references, hover, completion, and document symbols. It also includes the Intouch Dark theme. - **Intouch** is a programming language for AVEVA (Wonderware) SCADA Intouch Applications. +## QuickScript Language Server + +The extension includes a native, editor-independent QuickScript language +server for `.vbi` and `.vi` files. It provides: + +- Parser-based formatting and diagnostics. +- Comment-based document metadata for QuickFunctions, Windows, Applications, + DataChanges, Conditions, and KeyScripts. +- Workspace QuickFunction discovery with cross-file definition and references. +- Hover, completion, and document symbols. +- Window event support for `OnShow`, `WhileRunning`, and `OnClose`. +- Non-callable Application, DataChange, Condition, and KeyScript symbols. + +Project-specific QuickFunctions are discovered from the current workspace; +private project catalogs are not bundled with the public extension. +


Intouch @@ -129,13 +145,16 @@ NOTE: The default VS Code theme does not color much. Switch to intouch theme (in ## Development and agent workflow Repository governance starts at [AGENTS.md](AGENTS.md). QuickScript language -boundaries and the planned language-server architecture are documented in +boundaries and the language-server architecture are documented in [docs/language/quickscript.md](docs/language/quickscript.md) and [docs/architecture/intouch-core-preparation.md](docs/architecture/intouch-core-preparation.md). +The supported comment-based script metadata convention is documented in +[docs/language/document-metadata.md](docs/language/document-metadata.md). -The current extension does not include a language server. Until a native -InTouch language server exists, `.vbi` and `.vi` are not semantically analysed -by a foreign language server. +The extension uses its own QuickScript language server for `.vbi` and `.vi`. +Formatting and semantic features share the editor-independent core tokenizer +and parser. Manual validation against real project files remains the release +gate; see [Manual QuickScript HIL](docs/testing/manual-hil.md). --- @@ -163,8 +182,12 @@ by a foreign language server. The following items are either recently resolved or planned but not yet implemented: - PLANNED: Range (selection) formatting. Current command formats the entire document. -- PLANNED: Diagnostics (unclosed IF/FOR, unexpected ENDIF/NEXT) – tracked in modernization plan. -- PLANNED: Tokenizer-based nesting & keyword uppercasing refactor for improved robustness. +- Diagnostics cover unclosed or invalid block nesting, duplicate local `DIM` + declarations, and unknown datatypes. +- Formatting uses the shared tokenizer and recoverable structure parser. +- Definition and references are document-local for variables and cross-file for + metadata-declared workspace QuickFunctions; project-wide variable indexing + and range formatting remain planned. - NOTE: Multiline IF continuation indentation intentionally uses base + 2 spaces before THEN; THEN line stays aligned with expression by design. - NOTE: Spacing inside string literals and single-line brace comments is preserved intentionally; only outer code regions are normalized. @@ -283,6 +306,6 @@ Become a patron, by simply clicking on this button (**very appreciated!**): ## Copyright -`2021-2025 (c)Vitaly Ruhl` +`2021-2026 (c)Vitaly Ruhl` License: GNU General Public License v3.0 diff --git a/dist/extension.js b/dist/extension.js index 49d26de..da0f1b1 100644 --- a/dist/extension.js +++ b/dist/extension.js @@ -1,15 +1,29 @@ -"use strict";var y=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var D=y(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.REGEX=g.KEYWORDS=g.TRENNER=g.NO_SPACE_ITEMS=g.DOUBLE_OPERATORS=g.SINGLE_OPERATORS=g.FORMATS=g.BACKSLASH=g.SQUOTE=g.DQUOTE=g.CRLF=g.LF=g.CR=g.TAB=void 0;g.TAB=" ";g.CR="\r";g.LF=` -`;g.CRLF=`\r -`;g.DQUOTE='"';g.SQUOTE="'";g.BACKSLASH="\\";g.FORMATS=[g.TAB,g.CR,g.LF,g.CRLF,g.DQUOTE,g.SQUOTE,g.BACKSLASH];g.SINGLE_OPERATORS=["=","+","-","<",">","*","/","%","!","~","|"];g.DOUBLE_OPERATORS=["==","<>","<=",">="];g.NO_SPACE_ITEMS=["(",")","[","]",";"];g.TRENNER=[";"," "];g.KEYWORDS=["NULL","EOF","AS","IF","ENDIF","ELSE","WHILE","FOR","next","DIM","THEN","EXIT","EACH","STEP","IN","RETURN","CALL","MOD","AND","NOT","IS","OR","XOR","Abs","TO","SHL","SHR","discrete","integer","real","message","sqr","sin","cos","tan","atn","exp","log","int","frac","round","rnd","sqrt"];var te=new RegExp(/(?![^{]*})\t/,"gm"),ne=new RegExp(/\s{1,}/,"gm"),ie=new RegExp(/\s{2,}/,"gm"),oe=new RegExp(/\s{2,}(?\/\?\s]+)/,"gm"),ge=new RegExp(/-?\d*\d/,"gm");g.REGEX={gm_TAB_NOT_IN_COMMENT:te,gm_MOR_1_WSP:ne,gm_MOR_2_WSP:ie,g_CHECK_OPEN_COMMENT:re,g_CHECK_CLOSE_COMMENT:se,gm_GET_NESTING:le,gm_GET_STRING:ae,gm_GET_WSP_IN_STRING:ce,gm_MOR_2_WSP_NO_TAB:oe,gm_GET_ALL_WORDS:fe,gm_GET_ALL_Numbers:ge}});var H=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.NESTINGS=k.EXCLUDE_KEYWORDS=void 0;k.EXCLUDE_KEYWORDS=["EXIT FOR"];k.NESTINGS=[{keyword:"if",middle:"else",end:"endif",multiline:"then"},{keyword:"for",middle:"",end:"next",multiline:""},{keyword:"while",middle:"",end:"next",multiline:""}]});var X=y(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.preFormat=K;P.formatNestings=V;P.pureFormatPipeline=Ee;var E=D(),U=H();function K(r,i){r=r.replace(/\r\n|\n|\r/g,`\r -`);let l=r.split(""),e="",s=0,u=1,C=0,T=!1,w=!1;for(let n=0;n<=l.length-1;n++)if(C++,s>0)s--;else{if(s=0,w&&l[n]==='"'?w=!1:!T&&l[n]==='"'&&(w=!0),l[n]===` -`){if(w)return r;u++,C=0}if(!T&&l[n]==="}")return r;if(l[n]==="{"?T=!0:T&&l[n]==="}"&&(T=!1),!w&&!(s>0)&&(!T||i.KeywordUppercaseAlsoInComment)){for(let d of E.KEYWORDS){let h=r.substr(n,d.length),L=r[n-1],S=r[n+d.length];if(h.toLowerCase()===d.toLowerCase()&&j(L)&&j(S)){e+=d.toUpperCase(),s=d.length-1;break}}if(!(s>0)){for(let d of E.DOUBLE_OPERATORS)if(r.substr(n,d.length)===d){r[n-1]!==" "&&(e+=" "),e+=d,r[n+d.length]!==" "&&(e+=" "),s=d.length-1;break}}if(!(s>0)){let d=S=>/[A-Za-z0-9_$]/.test(S||""),h=S=>/[A-Za-z]/.test(S||""),L=S=>/[A-Za-z0-9$-]/.test(S||"");for(let S of E.SINGLE_OPERATORS){if(l[n]!==S)continue;if(S==="-"){let o=r[n-1],m=r[n+1];if(L(o)&&L(m)){let R=n-1;for(;R>=0&&L(r[R]);)R--;R++;let b=n+1;for(;b=0&&/[ \t]/.test(e[o]);)o--;let m=o>=0?e[o]:void 0,R=r[n+1];(m===void 0||/[=+\-*/,(;{}]/.test(m)||m===` -`||m==="\r")&&/[0-9]/.test(R)&&(f=!0)}let t=!(S==="-"&&f);if(t&&e.length>0&&!/[ \t\r\n]/.test(e[e.length-1])&&(e+=" "),e+=S,t){let o=r[n+1];o&&!/[ \t\r\n]/.test(o)&&(e+=" ")}s=-1;break}}}s===0&&(e+=l[n])}e=e.replace(/\r\r\n/g,E.CRLF).replace(/\r(?!\n)/g,"");let B=e.split(E.CRLF).map(n=>n.replace(/\s+$/g,"")),F=[],$=0;for(let n of B)if(n===""){$++,$===1&&F.push("");continue}else $=0,F.push(n);let c=F.join(E.CRLF);return c=(()=>{let n="",d=!1,h=!1,L=0,S=f=>/[A-Za-z]/.test(f);for(let f=0;f0){for(;n.length>0&&n[n.length-1]===" ";)n=n.slice(0,-1);L=0}n+=")";let o=f+1;for(;o=0&&/[A-Za-z0-9$-]/.test(n[o]);)o--;let m=f+3;for(;m0&&n[n.length-1]===" ";)n=n.slice(0,-1);n+=",";let o=c[f+1];o&&o!==" "&&o!==")"&&o!=="\r"&&o!==` -`&&(n+=" ");continue}}n+=t}return n.replace(/= {2,}>/g,"= >")})(),c=c.split(E.CRLF).map(n=>{if(/^\s*\{[^{}]*\}\s*$/.test(n))return n;let d=n.indexOf("{"),h=n,L="";return d!==-1&&(h=n.slice(0,d),L=n.slice(d)),h.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).map(f=>f.startsWith('"')&&f.endsWith('"')?f:f.replace(/(\S)\s+;/g,"$1;")).join("")+L}).join(E.CRLF),c}function V(r,i){let l="",e=[],s="",u=0,C=0,T=!1,w=!1,B=!1,F=0,$=`^${i.BlockCodeBegin}`,c=`^${i.BlockCodeExclude}`,n=`^${i.BlockCodeEnd}`,d=`^${i.RegionBlockCodeBegin}`,h=`^${i.RegionBlockCodeExclude}`,L=`^${i.RegionBlockCodeEnd}`,S=r.endsWith(E.CRLF);e=r.split(E.CRLF);for(let t=0;t{s=`((?![^{]*})(${A}))`,e[t].search(new RegExp(s,"i"))!==-1&&(W=!0)}),B)_&&(u++,w=!0,B=!1);else if(!z)if(ee)B=!0,F=C;else for(let A of U.NESTINGS){if(W||(s=`((?![^{]*})(\\b${A.keyword})\\b)`,e[t].search(new RegExp(s,"i"))!==-1&&u++),A.multiline!==""&&(s=`((?![^{]*})(\\b${A.multiline})\\b)`,e[t].search(new RegExp(s,"i"))),A.middle!==""&&(s=`((?![^{]*})(\\b${A.middle})\\b)`,e[t].search(new RegExp(s,"i"))!==-1)){w=!0;break}if(s=`((?![^{]*})(\\b${A.end})\\b)`,e[t].search(new RegExp(s,"i"))!==-1){u--,u<0&&(u=0),w=!0;break}}}if(!m){let O=o&&e[t].includes("}");if(T||O||o){e[t]=b,B=!1,C!==u&&(C=u);continue}let p=C;B?/\bIF\b/i.test(e[t])&&!/\bTHEN\b/i.test(e[t])||(p=F+2):w&&/\bTHEN\b/i.test(e[t])&&(p=F+2,w=!1);let _=ue(p,w,i);e[t]=_+e[t],C!==u&&(C=u),w=!1}}e=e.map(t=>t.replace(/[ \t]+$/g,""));for(let t=0;t{if(t.trim()==="")return t;let o=t.match(/\{[^{}\r\n]*\}/g)||[],m=[],R=t;o.forEach((p,_)=>{let x=`@@C${_}@@`;m.push(p),R=R.replace(p,x)});let b=R.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).filter(p=>p!==""),O="";return b.forEach(p=>{if(p.startsWith('"')&&p.endsWith('"'))O+=p;else{let _=p.match(/^(\s*)(.*)$/);if(_){let x=_[1],z=_[2].replace(/ {2,}/g," ");O+=x+z}else O+=p.replace(/ {2,}/g," ")}}),m.forEach((p,_)=>{O=O.replace(`@@C${_}@@`,p)}),O}).join(E.CRLF)}function ue(r,i,l){let e="";if(r!==0){let s=l.ReplaceTabToSpaces!==!1,u=typeof l.IndentSize=="number"&&l.IndentSize>=1&&l.IndentSize<=10?l.IndentSize:4,C=s?" ".repeat(u):" ";for(let T=0;Tr===i)}function Ee(r,i){let l=K(r,i);l=V(l,i);let e=(i.allowedNumberOfEmptyLines||1)+1;if(i.RemoveEmptyLines){let C;i.EmptyLinesAlsoInComment?C=new RegExp(`(?![^{]*})(^[ ]*$\r? -){${e},}`,"gm"):C=new RegExp(`(^[ ]*$\r? -){${e},}`,"gm"),l=l.replace(C,E.CRLF)}let s=i.ReplaceTabToSpaces!==!1,u=typeof i.IndentSize=="number"&&i.IndentSize>=1&&i.IndentSize<=10?i.IndentSize:4;if(s){let C=/^\t+/gm;l=l.replace(C,T=>" ".repeat(T.length*u))}return l}});var Z=y(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.preFormat=pe;M.formatNestings=me;M.fullFormatPipeline=de;var G=X();function pe(r,i){return(0,G.preFormat)(r,i)}function me(r,i){return(0,G.formatNestings)(r,i)}function de(r,i){return(0,G.pureFormatPipeline)(r,i)}});var Y=y(a=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.info=a.config=void 0;a.formatTE=Ce;a.getConfig=Q;a.log=he;a.cloneArray=Se;var v=require("vscode"),I=require("vscode"),q=Z(),Re=D();a.config={};function Ce(r){a.config=Q();let i=I.window.activeTextEditor.document,l=we(r,i,a.config);return[v.TextEdit.replace(r,l)]}function we(r,i,l){let e,s=i.getText(r);s=(0,q.preFormat)(s,l),s=(0,q.formatNestings)(s,l);let u=(l.allowedNumberOfEmptyLines||1)+1;return l.RemoveEmptyLines&&(l.EmptyLinesAlsoInComment?e=new RegExp(`(?![^{]*})(^[ ]*$\r? -){${u},}`,"gm"):e=new RegExp(`(^[ ]*$\r? -){${u},}`,"gm"),s=s.replace(e,Re.CRLF)),s}function Q(){return a.config.debug=!1,a.config.debugToChannel=!0,a.config.allowedNumberOfEmptyLines=I.workspace.getConfiguration().get("VBI.formatter.EmptyLine.allowedNumberOfEmptyLines"),(a.config.allowedNumberOfEmptyLines<0||a.config.allowedNumberOfEmptyLines>50)&&(a.config.allowedNumberOfEmptyLines=1),a.config.RemoveEmptyLines=I.workspace.getConfiguration().get("VBI.formatter.EmptyLine.RemoveEmptyLines"),a.config.EmptyLinesAlsoInComment=I.workspace.getConfiguration().get("VBI.formatter.EmptyLine.EmptyLinesAlsoInComment"),a.config.BlockCodeBegin=I.workspace.getConfiguration().get("VBI.formatter.BC.BlockCodeBegin"),a.config.BlockCodeEnd=I.workspace.getConfiguration().get("VBI.formatter.BC.BlockCodeEnd"),a.config.BlockCodeExclude=I.workspace.getConfiguration().get("VBI.formatter.BC.BlockCodeExclude"),a.config.RegionBlockCodeBegin=I.workspace.getConfiguration().get("VBI.formatter.Region.BlockCodeBegin"),a.config.RegionBlockCodeEnd=I.workspace.getConfiguration().get("VBI.formatter.Region.BlockCodeEnd"),a.config.RegionBlockCodeExclude=I.workspace.getConfiguration().get("VBI.formatter.Region.BlockCodeExclude"),a.config.ReplaceTabToSpaces=I.workspace.getConfiguration().get("VBI.formatter.Misc.ReplaceTabToSpaces"),a.config.IndentSize=I.workspace.getConfiguration().get("VBI.formatter.Misc.IndentSize"),(typeof a.config.IndentSize!="number"||a.config.IndentSize<1||a.config.IndentSize>10)&&(a.config.IndentSize=4),typeof a.config.ReplaceTabToSpaces!="boolean"&&(a.config.ReplaceTabToSpaces=!0),console.log("getConfig():",a.config),a.config}a.info=v.window.createOutputChannel("VBI-Info");function he(r,...i){function l(e){switch(typeof e){case"undefined":return"undefined";case"object":let s="";for(let[u,C]of Object.entries(e))s+=`${u}: ${C} -`;return s;default:return e}}if(a.config.debug)if(a.config.debugToChannel)switch(r.toLowerCase()){case"info":i.map(s=>{a.info.appendLine("INFO:"+l(s))}),a.info.show();return;case"warn":i.map(s=>{a.info.appendLine("WARN:"+l(s))}),a.info.show();return;case"error":let e="";i.map(s=>{e+=l(s)}),a.info.appendLine(e),v.window.showErrorMessage(e),a.info.show();return;default:i.map(s=>{a.info.appendLine("INFO-Other:"+l(s))}),a.info.show();return}else switch(r.toLowerCase()){case"info":console.log("INFO:",i);return;case"warn":console.log("WARNING:",i);return;case"error":console.error("ERROR:",i);return;default:console.log("log:",r,i);return}else if(r.toLowerCase()==="error"){let e="";i.map(s=>{e+=l(s)}),console.error("ERROR:",i),v.window.showErrorMessage(e);return}}function Se(r){return[...r]}});Object.defineProperty(exports,"__esModule",{value:!0});exports.activate=_e;exports.deactivate=Te;var N=require("vscode"),J=Y();function _e(r){N.commands.registerCommand("vbi-format",()=>{let{activeTextEditor:i}=N.window;if(i){let{document:l}=i,e=new N.Position(0,0),s=new N.Position(l.lineCount-1,l.lineAt(l.lineCount-1).text.length),u=new N.Range(e,s);return(0,J.formatTE)(u)}}),N.languages.registerDocumentFormattingEditProvider({scheme:"file",language:"intouch"},{provideDocumentFormattingEdits(i){let{activeTextEditor:l}=N.window,e=new N.Position(0,0),s=new N.Position(i.lineCount-1,i.lineAt(i.lineCount-1).text.length),u=new N.Range(e,s);return(0,J.formatTE)(u)}})}function Te(){} +"use strict";var Ea=Object.defineProperty;var pb=Object.getOwnPropertyDescriptor;var gb=Object.getOwnPropertyNames;var mb=Object.prototype.hasOwnProperty;var jh=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var P=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Fh=(n,e)=>{for(var t in e)Ea(n,t,{get:e[t],enumerable:!0})},_b=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gb(e))!mb.call(n,i)&&i!==t&&Ea(n,i,{get:()=>e[i],enumerable:!(r=pb(e,i))||r.enumerable});return n};var Hs=n=>_b(Ea({},"__esModule",{value:!0}),n);var Ft=P(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.boolean=yb;jt.string=Lh;jt.number=vb;jt.error=bb;jt.func=Ah;jt.array=kh;jt.stringArray=Cb;jt.typedArray=wb;jt.thenable=$h;jt.asPromise=Db;function yb(n){return n===!0||n===!1}function Lh(n){return typeof n=="string"||n instanceof String}function vb(n){return typeof n=="number"||n instanceof Number}function bb(n){return n instanceof Error}function Ah(n){return typeof n=="function"}function kh(n){return Array.isArray(n)}function Cb(n){return kh(n)&&n.every(e=>Lh(e))}function wb(n,e){return Array.isArray(n)&&n.every(e)}function $h(n){return n&&Ah(n.then)}function Db(n){return n instanceof Promise?n:$h(n)?new Promise((e,t)=>{n.then(r=>e(r),r=>t(r))}):Promise.resolve(n)}});var oi=P(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.boolean=Sb;In.string=Hh;In.number=Pb;In.error=Rb;In.func=Tb;In.array=Uh;In.stringArray=Ob;function Sb(n){return n===!0||n===!1}function Hh(n){return typeof n=="string"||n instanceof String}function Pb(n){return typeof n=="number"||n instanceof Number}function Rb(n){return n instanceof Error}function Tb(n){return typeof n=="function"}function Uh(n){return Array.isArray(n)}function Ob(n){return Uh(n)&&n.every(e=>Hh(e))}});var ec=P(W=>{"use strict";var Eb=W&&W.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),qb=W&&W.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Mb=W&&W.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.LRUCache=hr.LinkedMap=hr.Touch=void 0;var it;(function(n){n.None=0,n.First=1,n.AsOld=n.First,n.Last=2,n.AsNew=n.Last})(it||(hr.Touch=it={}));var Us=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){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}before(e){let t=this._map.get(e);return t?t.previous?.value:void 0}after(e){let t=this._map.get(e);return t?t.next?.value:void 0}has(e){return this._map.has(e)}get(e,t=it.None){let r=this._map.get(e);if(r)return t!==it.None&&this.touch(r,t),r.value}set(e,t,r=it.None){let i=this._map.get(e);if(i)i.value=t,r!==it.None&&this.touch(i,r);else{switch(i={key:e,value:t,next:void 0,previous:void 0},r){case it.None:this.addItemLast(i);break;case it.First:this.addItemFirst(i);break;case it.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let r=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,t=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.key,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return r}values(){let e=this._state,t=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.value,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return r}entries(){let e=this._state,t=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:[t.key,t.value],done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return r}[Symbol.iterator](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,r=this.size;for(;t&&r>e;)this._map.delete(t.key),t=t.next,r--;this._head=t,this._size=r,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,r=e.previous;if(!t||!r)throw new Error("Invalid list");t.previous=r,r.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==it.First&&t!==it.Last)){if(t===it.First){if(e===this._head)return;let r=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===it.Last){if(e===this._tail)return;let r=e.next,i=e.previous;e===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e}fromJSON(e){this.clear();for(let[t,r]of e)this.set(t,r)}};hr.LinkedMap=Us;var tc=class extends Us{_limit;_ratio;constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=it.AsNew){return super.get(e,t)}peek(e){return super.get(e,it.None)}set(e,t){return super.set(e,t,it.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};hr.LRUCache=tc});var Kh=P(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Disposable=void 0;var zh;(function(n){function e(t){return{dispose:t}}n.create=e})(zh||(Ws.Disposable=zh={}))});var pr=P(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var rc;function ic(){if(rc===void 0)throw new Error("No runtime abstraction layer installed");return rc}(function(n){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");rc=t}n.install=e})(ic||(ic={}));sc.default=ic});var ai=P(gr=>{"use strict";var xb=gr&&gr.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(gr,"__esModule",{value:!0});gr.Emitter=gr.Event=void 0;var Ib=xb(pr()),Bh;(function(n){let e={dispose(){}};n.None=function(){return e}})(Bh||(gr.Event=Bh={}));var oc=class{_callbacks;_contexts;add(e,t=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i{this._callbacks||(this._callbacks=new oc),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),i.dispose=n._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};gr.Emitter=ac});var Bs=P(_t=>{"use strict";var Nb=_t&&_t.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),jb=_t&&_t.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Fb=_t&&_t.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.SharedArrayReceiverStrategy=ci.SharedArraySenderStrategy=void 0;var Hb=Bs(),Bi;(function(n){n.Continue=0,n.Cancelled=1})(Bi||(Bi={}));var lc=class{buffers;constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),r=new Int32Array(t,0,1);r[0]=Bi.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let r=this.buffers.get(t);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,Bi.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};ci.SharedArraySenderStrategy=lc;var dc=class{data;constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Bi.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},fc=class{token;constructor(e){this.token=new dc(e)}cancel(){}dispose(){}},hc=class{kind="request";createCancellationTokenSource(e){let t=e.$cancellationData;return t===void 0?new Hb.CancellationTokenSource:new fc(t)}};ci.SharedArrayReceiverStrategy=hc});var gc=P(ui=>{"use strict";var Ub=ui&&ui.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ui,"__esModule",{value:!0});ui.Semaphore=void 0;var Wb=Ub(pr()),pc=class{_capacity;_active;_waiting;constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,r)=>{this._waiting.push({thunk:e,resolve:t,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,Wb.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};ui.Semaphore=pc});var Xh=P(st=>{"use strict";var zb=st&&st.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Kb=st&&st.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Bb=st&&st.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property. +${JSON.stringify(Object.fromEntries(r))}`));return}let s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(t):t,i=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(i)}).catch(r=>{this.fireError(r)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,_c.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};st.ReadableStreamMessageReader=vc});var ep=P(ot=>{"use strict";var Xb=ot&&ot.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Jb=ot&&ot.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Qb=ot&&ot.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;ithis.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{let i=[];return i.push(eC,r.byteLength.toString(),Yh),i.push(Yh),this.doWrite(e,i,r)},r=>{throw this.fireError(r),r}))}async doWrite(e,t,r){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(r)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};ot.WriteableStreamMessageWriter=Cc});var tp=P(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.AbstractMessageBuffer=void 0;var tC=13,nC=10,rC=`\r +`,wc=class{_encoding;_chunks;_totalLength;constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let t=0,r=0,i=0,s=0;e:for(;rthis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){let s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}let t=this.allocNative(e),r=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);t.set(o,r),r+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else t.set(s,r),r+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return t}};Xs.AbstractMessageBuffer=wc});var sp=P(K=>{"use strict";var iC=K&&K.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),sC=K&&K.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),oC=K&&K.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{},warn:()=>{},info:()=>{},log:()=>{}});var ue;(function(n){n[n.Off=0]="Off",n[n.Messages=1]="Messages",n[n.Compact=2]="Compact",n[n.Verbose=3]="Verbose"})(ue||(K.Trace=ue={}));var Tc;(function(n){n.Off="off",n.Messages="messages",n.Compact="compact",n.Verbose="verbose"})(Tc||(K.TraceValue=Tc={}));K.TraceValues=Tc;(function(n){function e(r){if(!Me.string(r))return n.Off;switch(r=r.toLowerCase(),r){case"off":return n.Off;case"messages":return n.Messages;case"compact":return n.Compact;case"verbose":return n.Verbose;default:return n.Off}}n.fromString=e;function t(r){switch(r){case n.Off:return"off";case n.Messages:return"messages";case n.Compact:return"compact";case n.Verbose:return"verbose";default:return"off"}}n.toString=t})(ue||(K.Trace=ue={}));var St;(function(n){n.Text="text",n.JSON="json"})(St||(K.TraceFormat=St={}));(function(n){function e(t){return Me.string(t)?(t=t.toLowerCase(),t==="json"?n.JSON:n.Text):n.Text}n.fromString=e})(St||(K.TraceFormat=St={}));var Oc;(function(n){n.type=new X.NotificationType("$/setTrace")})(Oc||(K.SetTraceNotification=Oc={}));var Js;(function(n){n.type=new X.NotificationType("$/logTrace")})(Js||(K.LogTraceNotification=Js={}));var Ji;(function(n){n[n.Closed=1]="Closed",n[n.Disposed=2]="Disposed",n[n.AlreadyListening=3]="AlreadyListening"})(Ji||(K.ConnectionErrors=Ji={}));var di=class n extends Error{code;constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,n.prototype)}};K.ConnectionError=di;var Ec;(function(n){function e(t){let r=t;return r&&Me.func(r.cancelUndispatched)}n.is=e})(Ec||(K.ConnectionStrategy=Ec={}));var Qs;(function(n){function e(t){let r=t;return r&&(r.kind===void 0||r.kind==="id")&&Me.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Me.func(r.dispose))}n.is=e})(Qs||(K.IdCancellationReceiverStrategy=Qs={}));var qc;(function(n){function e(t){let r=t;return r&&r.kind==="request"&&Me.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Me.func(r.dispose))}n.is=e})(qc||(K.RequestCancellationReceiverStrategy=qc={}));var Ys;(function(n){n.Message=Object.freeze({createCancellationTokenSource(t){return new Dc.CancellationTokenSource}});function e(t){return Qs.is(t)||qc.is(t)}n.is=e})(Ys||(K.CancellationReceiverStrategy=Ys={}));var Zs;(function(n){n.Message=Object.freeze({sendCancellation(t,r){return t.sendNotification(Qi.type,{id:r})},cleanup(t){}});function e(t){let r=t;return r&&Me.func(r.sendCancellation)&&Me.func(r.cleanup)}n.is=e})(Zs||(K.CancellationSenderStrategy=Zs={}));var eo;(function(n){n.Message=Object.freeze({receiver:Ys.Message,sender:Zs.Message});function e(t){let r=t;return r&&Ys.is(r.receiver)&&Zs.is(r.sender)}n.is=e})(eo||(K.CancellationStrategy=eo={}));var to;(function(n){function e(t){let r=t;return r&&Me.func(r.handleMessage)}n.is=e})(to||(K.MessageStrategy=to={}));var ip;(function(n){function e(t){let r=t;return r&&(eo.is(r.cancellationStrategy)||Ec.is(r.connectionStrategy)||to.is(r.messageStrategy)||Me.number(r.maxParallelism))}n.is=e})(ip||(K.ConnectionOptions=ip={}));var Wt;(function(n){n[n.New=1]="New",n[n.Listening=2]="Listening",n[n.Closed=3]="Closed",n[n.Disposed=4]="Disposed"})(Wt||(Wt={}));function cC(n,e,t,r){let i=t!==void 0?t:K.NullLogger,s=0,o=0,a=0,u="2.0",l=r?.maxParallelism??-1,f=0,p,h=new Map,g,_=new Map,v=new Map,R,q=new rp.LinkedMap,w=new Map,M=new Set,j=new Map,F=ue.Off,oe=St.Text,te,Te=Wt.New,Pn=new Vi.Emitter,Qr=new Vi.Emitter,rr=new Vi.Emitter,Yr=new Vi.Emitter,Zr=new Vi.Emitter,Mt=r&&r.cancellationStrategy?r.cancellationStrategy:eo.Message;function Rn(y){}function xt(){return Te===Wt.Listening}function Tn(){return Te===Wt.Closed}function Ht(){return Te===Wt.Disposed}function Oe(){(Te===Wt.New||Te===Wt.Listening)&&(Te=Wt.Closed,Qr.fire(void 0))}function Ui(y){Pn.fire([y,void 0,void 0])}function Zt(y){Pn.fire(y)}n.onClose(Oe),n.onError(Ui),e.onClose(Oe),e.onError(Zt);function ir(y){if(y===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+y.toString()}function ei(y){return y===null?"res-unknown-"+(++a).toString():"res-"+y.toString()}function Mr(){return"not-"+(++o).toString()}function en(y,E){X.Message.isRequest(E)?y.set(ir(E.id),E):X.Message.isResponse(E)?l===-1?y.set(ei(E.id),E):ar(E):y.set(Mr(),E)}function xr(){R||q.size===0||l!==-1&&f>=l||(R=(0,np.default)().timer.setImmediate(async()=>{if(R=void 0,q.size===0||l!==-1&&f>=l)return;let y=q.shift(),E;try{f++;let I=r?.messageStrategy;to.is(I)?E=I.handleMessage(y,ti):E=ti(y)}catch(I){i.error(`Processing message queue failed: ${I.toString()}`)}finally{E instanceof Promise?E.then(()=>{f--,xr()}).catch(I=>{i.error(`Processing message queue failed: ${I.toString()}`)}):f--,xr()}}))}async function ti(y){return X.Message.isRequest(y)?or(y):X.Message.isNotification(y)?Wi(y):X.Message.isResponse(y)?ar(y):ni(y)}let sr=y=>{try{if(X.Message.isNotification(y)&&y.method===Qi.type.method){let E=y.params.id,I=ir(E),H=q.get(I);if(X.Message.isRequest(H)){let ae=r?.connectionStrategy,ie=ae&&ae.cancelUndispatched?ae.cancelUndispatched(H,Rn):void 0;if(ie&&(ie.error!==void 0||ie.result!==void 0)){q.delete(I),j.delete(E),ie.id=H.id,cr(ie,y.method,Date.now()),e.write(ie).catch(()=>i.error("Sending response for canceled message failed."));return}}let Z=j.get(E);if(Z!==void 0){Z.cancel(),On(y);return}else M.add(E)}en(q,y)}finally{xr()}};async function or(y){if(Ht())return Promise.resolve();function E(Ee,ke,pe){let ye={jsonrpc:u,id:y.id};return Ee instanceof X.ResponseError?ye.error=Ee.toJson():ye.result=Ee===void 0?null:Ee,cr(ye,ke,pe),e.write(ye)}function I(Ee,ke,pe){let ye={jsonrpc:u,id:y.id,error:Ee.toJson()};return cr(ye,ke,pe),e.write(ye)}ur(y);let H=h.get(y.method),Z,ae;H&&(Z=H.type,ae=H.handler);let ie=Date.now();if(ae||p){let Ee=y.id??String(Date.now()),ke=Qs.is(Mt.receiver)?Mt.receiver.createCancellationTokenSource(Ee):Mt.receiver.createCancellationTokenSource(y);y.id!==null&&M.has(y.id)&&ke.cancel(),y.id!==null&&j.set(Ee,ke);try{let pe;if(ae)if(y.params===void 0){if(Z!==void 0&&Z.numberOfParams!==0)return I(new X.ResponseError(X.ErrorCodes.InvalidParams,`Request ${y.method} defines ${Z.numberOfParams} params but received none.`),y.method,ie);pe=ae(ke.token)}else if(Array.isArray(y.params)){if(Z!==void 0&&Z.parameterStructures===X.ParameterStructures.byName)return I(new X.ResponseError(X.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by name but received parameters by position`),y.method,ie);pe=ae(...y.params,ke.token)}else{if(Z!==void 0&&Z.parameterStructures===X.ParameterStructures.byPosition)return I(new X.ResponseError(X.ErrorCodes.InvalidParams,`Request ${y.method} defines parameters by position but received parameters by name`),y.method,ie);pe=ae(y.params,ke.token)}else p&&(pe=p(y.method,y.params,ke.token));let ye=await pe;await E(ye,y.method,ie)}catch(pe){pe instanceof X.ResponseError?await E(pe,y.method,ie):pe&&Me.string(pe.message)?await I(new X.ResponseError(X.ErrorCodes.InternalError,`Request ${y.method} failed with message: ${pe.message}`),y.method,ie):await I(new X.ResponseError(X.ErrorCodes.InternalError,`Request ${y.method} failed unexpectedly without providing any details.`),y.method,ie)}finally{j.delete(Ee)}}else await I(new X.ResponseError(X.ErrorCodes.MethodNotFound,`Unhandled method ${y.method}`),y.method,ie)}function ar(y){if(!Ht())if(y.id===null)y.error?i.error(`Received response message without id: Error is: +${JSON.stringify(y.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let E=y.id,I=w.get(E);if(ri(y,I),I!==void 0){w.delete(E);try{if(y.error){let H=y.error;I.reject(new X.ResponseError(H.code,H.message,H.data))}else if(y.result!==void 0)I.resolve(y.result);else throw new Error("Should never happen.")}catch(H){H.message?i.error(`Response handler '${I.method}' failed with message: ${H.message}`):i.error(`Response handler '${I.method}' failed unexpectedly.`)}}}}async function Wi(y){if(Ht())return;let E,I;if(y.method===Qi.type.method){let H=y.params.id;M.delete(H),On(y);return}else{let H=_.get(y.method);H&&(I=H.handler,E=H.type)}if(I||g)try{if(On(y),I)if(y.params===void 0)E!==void 0&&E.numberOfParams!==0&&E.parameterStructures!==X.ParameterStructures.byName&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received none.`),await I();else if(Array.isArray(y.params)){let H=y.params;y.method===Xi.type.method&&H.length===2&&Sc.is(H[0])?await I({token:H[0],value:H[1]}):(E!==void 0&&(E.parameterStructures===X.ParameterStructures.byName&&i.error(`Notification ${y.method} defines parameters by name but received parameters by position`),E.numberOfParams!==y.params.length&&i.error(`Notification ${y.method} defines ${E.numberOfParams} params but received ${H.length} arguments`)),await I(...H))}else E!==void 0&&E.parameterStructures===X.ParameterStructures.byPosition&&i.error(`Notification ${y.method} defines parameters by position but received parameters by name`),await I(y.params);else g&&await g(y.method,y.params)}catch(H){H.message?i.error(`Notification handler '${y.method}' failed with message: ${H.message}`):i.error(`Notification handler '${y.method}' failed unexpectedly.`)}else rr.fire(y)}function ni(y){if(!y){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(y,null,4)}`);let E=y;if(Me.string(E.id)||Me.number(E.id)){let I=E.id,H=w.get(I);H&&H.reject(new Error("The received response has neither a result nor an error property."))}}function wt(y){if(y!=null)switch(F){case ue.Verbose:return JSON.stringify(y,null,4);case ue.Compact:return JSON.stringify(y);default:return}}function zi(y){if(!(F===ue.Off||!te))if(oe===St.Text){let E;(F===ue.Verbose||F===ue.Compact)&&y.params&&(E=`Params: ${wt(y.params)}`),te.log(`Sending request '${y.method} - (${y.id})'.`,E)}else tt("send-request",y)}function tn(y){if(!(F===ue.Off||!te))if(oe===St.Text){let E;(F===ue.Verbose||F===ue.Compact)&&(y.params?E=`Params: ${wt(y.params)}`:E="No parameters provided."),te.log(`Sending notification '${y.method}'.`,E)}else tt("send-notification",y)}function cr(y,E,I){if(!(F===ue.Off||!te))if(oe===St.Text){let H;(F===ue.Verbose||F===ue.Compact)&&(y.error&&y.error.data?H=`Error data: ${wt(y.error.data)}`:y.result?H=`Result: ${wt(y.result)}`:y.error===void 0&&(H="No result returned.")),te.log(`Sending response '${E} - (${y.id})'. Processing request took ${Date.now()-I}ms`,H)}else tt("send-response",y)}function ur(y){if(!(F===ue.Off||!te))if(oe===St.Text){let E;(F===ue.Verbose||F===ue.Compact)&&y.params&&(E=`Params: ${wt(y.params)}`),te.log(`Received request '${y.method} - (${y.id})'.`,E)}else tt("receive-request",y)}function On(y){if(!(F===ue.Off||!te||y.method===Js.type.method))if(oe===St.Text){let E;(F===ue.Verbose||F===ue.Compact)&&(y.params?E=`Params: ${wt(y.params)}`:E="No parameters provided."),te.log(`Received notification '${y.method}'.`,E)}else tt("receive-notification",y)}function ri(y,E){if(!(F===ue.Off||!te))if(oe===St.Text){let I;if((F===ue.Verbose||F===ue.Compact)&&(y.error&&y.error.data?I=`Error data: ${wt(y.error.data)}`:y.result?I=`Result: ${wt(y.result)}`:y.error===void 0&&(I="No result returned.")),E){let H=y.error?` Request failed: ${y.error.message} (${y.error.code}).`:"";te.log(`Received response '${E.method} - (${y.id})' in ${Date.now()-E.timerStart}ms.${H}`,I)}else te.log(`Received response ${y.id} without active response promise.`,I)}else tt("receive-response",y)}function tt(y,E){if(!te||F===ue.Off)return;let I={isLSPMessage:!0,type:y,message:E,timestamp:Date.now()};te.log(I)}function Ut(){if(Tn())throw new di(Ji.Closed,"Connection is closed.");if(Ht())throw new di(Ji.Disposed,"Connection is disposed.")}function nt(){if(xt())throw new di(Ji.AlreadyListening,"Connection is already listening")}function Ki(){if(!xt())throw new Error("Call listen() first.")}function Ye(y){return y===void 0?null:y}function En(y){if(y!==null)return y}function ii(y){return y!=null&&!Array.isArray(y)&&typeof y=="object"}function Ir(y,E){switch(y){case X.ParameterStructures.auto:return ii(E)?En(E):[Ye(E)];case X.ParameterStructures.byName:if(!ii(E))throw new Error("Received parameters by name but param is not an object literal.");return En(E);case X.ParameterStructures.byPosition:return[Ye(E)];default:throw new Error(`Unknown parameter structure ${y.toString()}`)}}function lr(y,E){let I,H=y.numberOfParams;switch(H){case 0:I=void 0;break;case 1:I=Ir(y.parameterStructures,E[0]);break;default:I=[];for(let Z=0;Z{Ut();let I,H;if(Me.string(y)){I=y;let ae=E[0],ie=0,Ee=X.ParameterStructures.auto;X.ParameterStructures.is(ae)&&(ie=1,Ee=ae);let ke=E.length,pe=ke-ie;switch(pe){case 0:H=void 0;break;case 1:H=Ir(Ee,E[ie]);break;default:if(Ee===X.ParameterStructures.byName)throw new Error(`Received ${pe} parameters for 'by Name' notification parameter structure.`);H=E.slice(ie,ke).map(ye=>Ye(ye));break}}else{let ae=E;I=y.method,H=lr(y,ae)}let Z={jsonrpc:u,method:I,params:H};return tn(Z),e.write(Z).catch(ae=>{throw i.error("Sending notification failed."),ae})},onNotification:(y,E)=>{Ut();let I;return Me.func(y)?g=y:E&&(Me.string(y)?(I=y,_.set(y,{type:void 0,handler:E})):(I=y.method,_.set(y.method,{type:y,handler:E}))),{dispose:()=>{I!==void 0?_.get(I)?.handler===E&&_.delete(I):g===y&&(g=void 0)}}},onProgress:(y,E,I)=>{if(v.has(E))throw new Error(`Progress handler for token ${E} already registered`);return v.set(E,I),{dispose:()=>{v.get(E)===I&&v.delete(E)}}},sendProgress:(y,E,I)=>It.sendNotification(Xi.type,{token:E,value:I}),onUnhandledProgress:Yr.event,sendRequest:(y,...E)=>{Ut(),Ki();function I(ye,rt){let pt=Mt.sender.sendCancellation(ye,rt);pt===void 0?i.log(`Received no promise from cancellation strategy when cancelling id ${rt}`):pt.catch(()=>{i.log(`Sending cancellation messages for id ${rt} failed.`)})}let H,Z,ae;if(Me.string(y)){H=y;let ye=E[0],rt=E[E.length-1],pt=0,qn=X.ParameterStructures.auto;X.ParameterStructures.is(ye)&&(pt=1,qn=ye);let Dt=E.length;Dc.CancellationToken.is(rt)&&(Dt=Dt-1,ae=rt);let gt=Dt-pt;switch(gt){case 0:Z=void 0;break;case 1:Z=Ir(qn,E[pt]);break;default:if(qn===X.ParameterStructures.byName)throw new Error(`Received ${gt} parameters for 'by Name' request parameter structure.`);Z=E.slice(pt,Dt).map(si=>Ye(si));break}}else{let ye=E;H=y.method,Z=lr(y,ye);let rt=y.numberOfParams;ae=Dc.CancellationToken.is(ye[rt])?ye[rt]:void 0}let ie=s++,Ee,ke=!1;ae!==void 0&&(ae.isCancellationRequested?ke=!0:Ee=ae.onCancellationRequested(()=>{I(It,ie)}));let pe={jsonrpc:u,id:ie,method:H,params:Z};return zi(pe),typeof Mt.sender.enableCancellation=="function"&&Mt.sender.enableCancellation(pe),new Promise(async(ye,rt)=>{let pt=gt=>{ye(gt),Mt.sender.cleanup(ie),Ee?.dispose()},qn=gt=>{rt(gt),Mt.sender.cleanup(ie),Ee?.dispose()},Dt={method:H,timerStart:Date.now(),resolve:pt,reject:qn};try{w.set(ie,Dt),await e.write(pe),ke&&I(It,ie)}catch(gt){throw w.delete(ie),Dt.reject(new X.ResponseError(X.ErrorCodes.MessageWriteError,gt.message?gt.message:"Unknown reason")),i.error("Sending request failed."),gt}})},onRequest:(y,E)=>{Ut();let I=null;return Rc.is(y)?(I=void 0,p=y):Me.string(y)?(I=null,E!==void 0&&(I=y,h.set(y,{handler:E,type:void 0}))):E!==void 0&&(I=y.method,h.set(y.method,{type:y,handler:E})),{dispose:()=>{I!==null&&(I!==void 0?h.get(I)?.handler===E&&h.delete(I):p===y&&(p=void 0))}}},hasPendingResponse:()=>w.size>0,trace:async(y,E,I)=>{let H=!1,Z=St.Text;I!==void 0&&(Me.boolean(I)?H=I:(H=I.sendNotification||!1,Z=I.traceFormat||St.Text)),F=y,oe=Z,F===ue.Off?te=void 0:te=E,H&&!Tn()&&!Ht()&&await It.sendNotification(Oc.type,{value:ue.toString(y)})},onError:Pn.event,onClose:Qr.event,onUnhandledNotification:rr.event,onDispose:Zr.event,end:()=>{e.end()},dispose:()=>{if(Ht())return;Te=Wt.Disposed,Zr.fire(void 0);let y=new X.ResponseError(X.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let E of w.values())E.reject(y);w=new Map,j=new Map,M=new Set,q=new rp.LinkedMap,Me.func(e.dispose)&&e.dispose(),Me.func(n.dispose)&&n.dispose()},listen:()=>{Ut(),nt(),Te=Wt.Listening,n.listen(sr)},inspect:()=>{(0,np.default)().console.log("inspect")}};return It.onNotification(Js.type,y=>{if(F===ue.Off||!te)return;let E=F===ue.Verbose||F===ue.Compact;te.log(y.message,E?y.verbose:void 0)}),It.onNotification(Xi.type,async y=>{let E=v.get(y.token);E?await E(y.value):Yr.fire(y)}),It}});var Nn=P(S=>{"use strict";var uC=S&&S.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(S,"__esModule",{value:!0});S.ProgressType=S.ProgressToken=S.createMessageConnection=S.NullLogger=S.ConnectionOptions=S.ConnectionStrategy=S.AbstractMessageBuffer=S.WriteableStreamMessageWriter=S.AbstractMessageWriter=S.MessageWriter=S.ReadableStreamMessageReader=S.AbstractMessageReader=S.MessageReader=S.SharedArrayReceiverStrategy=S.SharedArraySenderStrategy=S.CancellationToken=S.CancellationTokenSource=S.Emitter=S.Event=S.Disposable=S.LRUCache=S.Touch=S.LinkedMap=S.ParameterStructures=S.NotificationType9=S.NotificationType8=S.NotificationType7=S.NotificationType6=S.NotificationType5=S.NotificationType4=S.NotificationType3=S.NotificationType2=S.NotificationType1=S.NotificationType0=S.NotificationType=S.ErrorCodes=S.ResponseError=S.RequestType9=S.RequestType8=S.RequestType7=S.RequestType6=S.RequestType5=S.RequestType4=S.RequestType3=S.RequestType2=S.RequestType1=S.RequestType0=S.RequestType=S.Message=S.RAL=void 0;S.MessageStrategy=S.CancellationStrategy=S.CancellationSenderStrategy=S.RequestCancellationReceiverStrategy=S.IdCancellationReceiverStrategy=S.CancellationReceiverStrategy=S.ConnectionError=S.ConnectionErrors=S.LogTraceNotification=S.SetTraceNotification=S.TraceFormat=S.TraceValues=S.TraceValue=S.Trace=void 0;var ve=ec();Object.defineProperty(S,"Message",{enumerable:!0,get:function(){return ve.Message}});Object.defineProperty(S,"RequestType",{enumerable:!0,get:function(){return ve.RequestType}});Object.defineProperty(S,"RequestType0",{enumerable:!0,get:function(){return ve.RequestType0}});Object.defineProperty(S,"RequestType1",{enumerable:!0,get:function(){return ve.RequestType1}});Object.defineProperty(S,"RequestType2",{enumerable:!0,get:function(){return ve.RequestType2}});Object.defineProperty(S,"RequestType3",{enumerable:!0,get:function(){return ve.RequestType3}});Object.defineProperty(S,"RequestType4",{enumerable:!0,get:function(){return ve.RequestType4}});Object.defineProperty(S,"RequestType5",{enumerable:!0,get:function(){return ve.RequestType5}});Object.defineProperty(S,"RequestType6",{enumerable:!0,get:function(){return ve.RequestType6}});Object.defineProperty(S,"RequestType7",{enumerable:!0,get:function(){return ve.RequestType7}});Object.defineProperty(S,"RequestType8",{enumerable:!0,get:function(){return ve.RequestType8}});Object.defineProperty(S,"RequestType9",{enumerable:!0,get:function(){return ve.RequestType9}});Object.defineProperty(S,"ResponseError",{enumerable:!0,get:function(){return ve.ResponseError}});Object.defineProperty(S,"ErrorCodes",{enumerable:!0,get:function(){return ve.ErrorCodes}});Object.defineProperty(S,"NotificationType",{enumerable:!0,get:function(){return ve.NotificationType}});Object.defineProperty(S,"NotificationType0",{enumerable:!0,get:function(){return ve.NotificationType0}});Object.defineProperty(S,"NotificationType1",{enumerable:!0,get:function(){return ve.NotificationType1}});Object.defineProperty(S,"NotificationType2",{enumerable:!0,get:function(){return ve.NotificationType2}});Object.defineProperty(S,"NotificationType3",{enumerable:!0,get:function(){return ve.NotificationType3}});Object.defineProperty(S,"NotificationType4",{enumerable:!0,get:function(){return ve.NotificationType4}});Object.defineProperty(S,"NotificationType5",{enumerable:!0,get:function(){return ve.NotificationType5}});Object.defineProperty(S,"NotificationType6",{enumerable:!0,get:function(){return ve.NotificationType6}});Object.defineProperty(S,"NotificationType7",{enumerable:!0,get:function(){return ve.NotificationType7}});Object.defineProperty(S,"NotificationType8",{enumerable:!0,get:function(){return ve.NotificationType8}});Object.defineProperty(S,"NotificationType9",{enumerable:!0,get:function(){return ve.NotificationType9}});Object.defineProperty(S,"ParameterStructures",{enumerable:!0,get:function(){return ve.ParameterStructures}});var Mc=nc();Object.defineProperty(S,"LinkedMap",{enumerable:!0,get:function(){return Mc.LinkedMap}});Object.defineProperty(S,"LRUCache",{enumerable:!0,get:function(){return Mc.LRUCache}});Object.defineProperty(S,"Touch",{enumerable:!0,get:function(){return Mc.Touch}});var lC=Kh();Object.defineProperty(S,"Disposable",{enumerable:!0,get:function(){return lC.Disposable}});var op=ai();Object.defineProperty(S,"Event",{enumerable:!0,get:function(){return op.Event}});Object.defineProperty(S,"Emitter",{enumerable:!0,get:function(){return op.Emitter}});var ap=Bs();Object.defineProperty(S,"CancellationTokenSource",{enumerable:!0,get:function(){return ap.CancellationTokenSource}});Object.defineProperty(S,"CancellationToken",{enumerable:!0,get:function(){return ap.CancellationToken}});var cp=Gh();Object.defineProperty(S,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return cp.SharedArraySenderStrategy}});Object.defineProperty(S,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return cp.SharedArrayReceiverStrategy}});var xc=Xh();Object.defineProperty(S,"MessageReader",{enumerable:!0,get:function(){return xc.MessageReader}});Object.defineProperty(S,"AbstractMessageReader",{enumerable:!0,get:function(){return xc.AbstractMessageReader}});Object.defineProperty(S,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return xc.ReadableStreamMessageReader}});var Ic=ep();Object.defineProperty(S,"MessageWriter",{enumerable:!0,get:function(){return Ic.MessageWriter}});Object.defineProperty(S,"AbstractMessageWriter",{enumerable:!0,get:function(){return Ic.AbstractMessageWriter}});Object.defineProperty(S,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Ic.WriteableStreamMessageWriter}});var dC=tp();Object.defineProperty(S,"AbstractMessageBuffer",{enumerable:!0,get:function(){return dC.AbstractMessageBuffer}});var He=sp();Object.defineProperty(S,"ConnectionStrategy",{enumerable:!0,get:function(){return He.ConnectionStrategy}});Object.defineProperty(S,"ConnectionOptions",{enumerable:!0,get:function(){return He.ConnectionOptions}});Object.defineProperty(S,"NullLogger",{enumerable:!0,get:function(){return He.NullLogger}});Object.defineProperty(S,"createMessageConnection",{enumerable:!0,get:function(){return He.createMessageConnection}});Object.defineProperty(S,"ProgressToken",{enumerable:!0,get:function(){return He.ProgressToken}});Object.defineProperty(S,"ProgressType",{enumerable:!0,get:function(){return He.ProgressType}});Object.defineProperty(S,"Trace",{enumerable:!0,get:function(){return He.Trace}});Object.defineProperty(S,"TraceValue",{enumerable:!0,get:function(){return He.TraceValue}});Object.defineProperty(S,"TraceFormat",{enumerable:!0,get:function(){return He.TraceFormat}});Object.defineProperty(S,"SetTraceNotification",{enumerable:!0,get:function(){return He.SetTraceNotification}});Object.defineProperty(S,"LogTraceNotification",{enumerable:!0,get:function(){return He.LogTraceNotification}});Object.defineProperty(S,"ConnectionErrors",{enumerable:!0,get:function(){return He.ConnectionErrors}});Object.defineProperty(S,"ConnectionError",{enumerable:!0,get:function(){return He.ConnectionError}});Object.defineProperty(S,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return He.CancellationReceiverStrategy}});Object.defineProperty(S,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return He.IdCancellationReceiverStrategy}});Object.defineProperty(S,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return He.RequestCancellationReceiverStrategy}});Object.defineProperty(S,"CancellationSenderStrategy",{enumerable:!0,get:function(){return He.CancellationSenderStrategy}});Object.defineProperty(S,"CancellationStrategy",{enumerable:!0,get:function(){return He.CancellationStrategy}});Object.defineProperty(S,"MessageStrategy",{enumerable:!0,get:function(){return He.MessageStrategy}});Object.defineProperty(S,"TraceValues",{enumerable:!0,get:function(){return He.TraceValues}});var fC=uC(pr());S.RAL=fC.default});var ho={};Fh(ho,{AnnotatedTextEdit:()=>jn,ApplyKind:()=>tu,ChangeAnnotation:()=>mr,ChangeAnnotationIdentifier:()=>Be,CodeAction:()=>_u,CodeActionContext:()=>mu,CodeActionKind:()=>gu,CodeActionTag:()=>co,CodeActionTriggerKind:()=>is,CodeDescription:()=>Wc,CodeLens:()=>yu,Color:()=>ro,ColorInformation:()=>Lc,ColorPresentation:()=>Ac,Command:()=>jr,CompletionItem:()=>ru,CompletionItemKind:()=>Jc,CompletionItemLabelDetails:()=>nu,CompletionItemTag:()=>Yc,CompletionList:()=>iu,CreateFile:()=>hi,DeleteFile:()=>gi,Diagnostic:()=>es,DiagnosticRelatedInformation:()=>io,DiagnosticSeverity:()=>Hc,DiagnosticTag:()=>Uc,DocumentHighlight:()=>uu,DocumentHighlightKind:()=>cu,DocumentLink:()=>bu,DocumentSymbol:()=>pu,DocumentUri:()=>Nc,EOL:()=>hC,FoldingRange:()=>$c,FoldingRangeKind:()=>kc,FormattingOptions:()=>vu,Hover:()=>su,InlayHint:()=>Eu,InlayHintKind:()=>uo,InlayHintLabelPart:()=>lo,InlineCompletionContext:()=>Nu,InlineCompletionItem:()=>qu,InlineCompletionList:()=>Mu,InlineCompletionTriggerKind:()=>xu,InlineValueContext:()=>Ou,InlineValueEvaluatableExpression:()=>Tu,InlineValueText:()=>Pu,InlineValueVariableLookup:()=>Ru,InsertReplaceEdit:()=>Zc,InsertTextFormat:()=>Qc,InsertTextMode:()=>eu,LanguageKind:()=>Vc,Location:()=>Zi,LocationLink:()=>Fc,MarkedString:()=>rs,MarkupContent:()=>_r,MarkupKind:()=>ao,OptionalVersionedTextDocumentIdentifier:()=>ns,ParameterInformation:()=>ou,Position:()=>Lt,Range:()=>xe,RenameFile:()=>pi,SelectedCompletionInfo:()=>Iu,SelectionRange:()=>Cu,SemanticTokenModifiers:()=>Du,SemanticTokenTypes:()=>wu,SemanticTokens:()=>Su,SignatureInformation:()=>au,SnippetTextEdit:()=>zc,StringValue:()=>fo,SymbolInformation:()=>fu,SymbolKind:()=>lu,SymbolTag:()=>du,TextDocument:()=>Fu,TextDocumentEdit:()=>ts,TextDocumentIdentifier:()=>Bc,TextDocumentItem:()=>Xc,TextEdit:()=>nn,URI:()=>no,VersionedTextDocumentIdentifier:()=>Gc,WorkspaceChange:()=>Kc,WorkspaceEdit:()=>so,WorkspaceFolder:()=>ju,WorkspaceSymbol:()=>hu,integer:()=>jc,uinteger:()=>Yi});var Nc,no,jc,Yi,Lt,xe,Zi,Fc,ro,Lc,Ac,kc,$c,io,Hc,Uc,Wc,es,jr,nn,mr,Be,jn,ts,hi,pi,gi,so,fi,zc,oo,Kc,Bc,Gc,ns,Vc,Xc,ao,_r,Jc,Qc,Yc,Zc,eu,tu,nu,ru,iu,rs,su,ou,au,cu,uu,lu,du,fu,hu,pu,gu,is,mu,co,_u,yu,vu,bu,Cu,wu,Du,Su,Pu,Ru,Tu,Ou,uo,lo,Eu,fo,qu,Mu,xu,Iu,Nu,ju,hC,Fu,Lu,C,po=jh(()=>{"use strict";(function(n){function e(t){return typeof t=="string"}n.is=e})(Nc||(Nc={}));(function(n){function e(t){return typeof t=="string"}n.is=e})(no||(no={}));(function(n){n.MIN_VALUE=-2147483648,n.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&n.MIN_VALUE<=t&&t<=n.MAX_VALUE}n.is=e})(jc||(jc={}));(function(n){n.MIN_VALUE=0,n.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&n.MIN_VALUE<=t&&t<=n.MAX_VALUE}n.is=e})(Yi||(Yi={}));(function(n){function e(r,i){return r===Number.MAX_VALUE&&(r=Yi.MAX_VALUE),i===Number.MAX_VALUE&&(i=Yi.MAX_VALUE),{line:r,character:i}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&C.uinteger(i.line)&&C.uinteger(i.character)}n.is=t})(Lt||(Lt={}));(function(n){function e(r,i,s,o){if(C.uinteger(r)&&C.uinteger(i)&&C.uinteger(s)&&C.uinteger(o))return{start:Lt.create(r,i),end:Lt.create(s,o)};if(Lt.is(r)&&Lt.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${o}]`)}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&Lt.is(i.start)&&Lt.is(i.end)}n.is=t})(xe||(xe={}));(function(n){function e(r,i){return{uri:r,range:i}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&xe.is(i.range)&&(C.string(i.uri)||C.undefined(i.uri))}n.is=t})(Zi||(Zi={}));(function(n){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&xe.is(i.targetRange)&&C.string(i.targetUri)&&xe.is(i.targetSelectionRange)&&(xe.is(i.originSelectionRange)||C.undefined(i.originSelectionRange))}n.is=t})(Fc||(Fc={}));(function(n){function e(r,i,s,o){return{red:r,green:i,blue:s,alpha:o}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&C.numberRange(i.red,0,1)&&C.numberRange(i.green,0,1)&&C.numberRange(i.blue,0,1)&&C.numberRange(i.alpha,0,1)}n.is=t})(ro||(ro={}));(function(n){function e(r,i){return{range:r,color:i}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&xe.is(i.range)&&ro.is(i.color)}n.is=t})(Lc||(Lc={}));(function(n){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&C.string(i.label)&&(C.undefined(i.textEdit)||nn.is(i))&&(C.undefined(i.additionalTextEdits)||C.typedArray(i.additionalTextEdits,nn.is))}n.is=t})(Ac||(Ac={}));(function(n){n.Comment="comment",n.Imports="imports",n.Region="region"})(kc||(kc={}));(function(n){function e(r,i,s,o,a,u){let l={startLine:r,endLine:i};return C.defined(s)&&(l.startCharacter=s),C.defined(o)&&(l.endCharacter=o),C.defined(a)&&(l.kind=a),C.defined(u)&&(l.collapsedText=u),l}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&C.uinteger(i.startLine)&&C.uinteger(i.startLine)&&(C.undefined(i.startCharacter)||C.uinteger(i.startCharacter))&&(C.undefined(i.endCharacter)||C.uinteger(i.endCharacter))&&(C.undefined(i.kind)||C.string(i.kind))}n.is=t})($c||($c={}));(function(n){function e(r,i){return{location:r,message:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&Zi.is(i.location)&&C.string(i.message)}n.is=t})(io||(io={}));(function(n){n.Error=1,n.Warning=2,n.Information=3,n.Hint=4})(Hc||(Hc={}));(function(n){n.Unnecessary=1,n.Deprecated=2})(Uc||(Uc={}));(function(n){function e(t){let r=t;return C.objectLiteral(r)&&C.string(r.href)}n.is=e})(Wc||(Wc={}));(function(n){function e(s,o,a,u,l,f){let p={range:s,message:o};return C.defined(a)&&(p.severity=a),C.defined(u)&&(p.code=u),C.defined(l)&&(p.source=l),C.defined(f)&&(p.relatedInformation=f),p}n.create=e;function t(s){var o;let a=s;return C.defined(a)&&xe.is(a.range)&&(C.string(a.message)||_r.is(a.message))&&(C.number(a.severity)||C.undefined(a.severity))&&(C.integer(a.code)||C.string(a.code)||C.undefined(a.code))&&(C.undefined(a.codeDescription)||C.string((o=a.codeDescription)===null||o===void 0?void 0:o.href))&&(C.string(a.source)||C.undefined(a.source))&&(C.undefined(a.relatedInformation)||C.typedArray(a.relatedInformation,io.is))}n.is=t;function r(s){return C.string(s.message)}n.is3_17=r;function i(s){if(C.string(s.message))return s.message;if(_r.is(s.message))return s.message.value;throw new Error(`Unknown message type ${typeof s.message}`)}n.getMessageString=i})(es||(es={}));(function(n){function e(r,i,...s){let o={title:r,command:i};return C.defined(s)&&s.length>0&&(o.arguments=s),o}n.create=e;function t(r){let i=r;return C.defined(i)&&C.string(i.title)&&(i.tooltip===void 0||C.string(i.tooltip))&&C.string(i.command)}n.is=t})(jr||(jr={}));(function(n){function e(s,o){return{range:s,newText:o}}n.replace=e;function t(s,o){return{range:{start:s,end:s},newText:o}}n.insert=t;function r(s){return{range:s,newText:""}}n.del=r;function i(s){let o=s;return C.objectLiteral(o)&&C.string(o.newText)&&xe.is(o.range)}n.is=i})(nn||(nn={}));(function(n){function e(r,i,s){let o={label:r};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&C.string(i.label)&&(C.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(C.string(i.description)||i.description===void 0)}n.is=t})(mr||(mr={}));(function(n){function e(t){let r=t;return C.string(r)}n.is=e})(Be||(Be={}));(function(n){function e(s,o,a){return{range:s,newText:o,annotationId:a}}n.replace=e;function t(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}n.insert=t;function r(s,o){return{range:s,newText:"",annotationId:o}}n.del=r;function i(s){let o=s;return nn.is(o)&&(mr.is(o.annotationId)||Be.is(o.annotationId))}n.is=i})(jn||(jn={}));(function(n){function e(r,i){return{textDocument:r,edits:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&ns.is(i.textDocument)&&Array.isArray(i.edits)}n.is=t})(ts||(ts={}));(function(n){function e(r,i,s){let o={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}n.create=e;function t(r){let i=r;return i&&i.kind==="create"&&C.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||C.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||C.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Be.is(i.annotationId))}n.is=t})(hi||(hi={}));(function(n){function e(r,i,s,o){let a={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}n.create=e;function t(r){let i=r;return i&&i.kind==="rename"&&C.string(i.oldUri)&&C.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||C.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||C.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Be.is(i.annotationId))}n.is=t})(pi||(pi={}));(function(n){function e(r,i,s){let o={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}n.create=e;function t(r){let i=r;return i&&i.kind==="delete"&&C.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||C.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||C.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Be.is(i.annotationId))}n.is=t})(gi||(gi={}));(function(n){function e(t){let r=t;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>C.string(i.kind)?hi.is(i)||pi.is(i)||gi.is(i):ts.is(i)))}n.is=e})(so||(so={}));fi=class{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let i,s;if(r===void 0?i=nn.insert(e,t):Be.is(r)?(s=r,i=jn.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),i=jn.insert(e,t,s)),this.edits.push(i),s!==void 0)return s}replace(e,t,r){let i,s;if(r===void 0?i=nn.replace(e,t):Be.is(r)?(s=r,i=jn.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(r),i=jn.replace(e,t,s)),this.edits.push(i),s!==void 0)return s}delete(e,t){let r,i;if(t===void 0?r=nn.del(e):Be.is(t)?(i=t,r=jn.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),r=jn.del(e,i)),this.edits.push(r),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(n){function e(t){let r=t;return C.objectLiteral(r)&&xe.is(r.range)&&fo.isSnippet(r.snippet)&&(r.annotationId===void 0||mr.is(r.annotationId)||Be.is(r.annotationId))}n.is=e})(zc||(zc={}));oo=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(Be.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Kc=class{constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new oo(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(ts.is(t)){let r=new fi(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{let r=new fi(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(ns.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let t={uri:e.uri,version:e.version},r=this._textEditChanges[t.uri];if(!r){let i=[],s={textDocument:t,edits:i};this._workspaceEdit.documentChanges.push(s),r=new fi(i,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new fi(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new oo,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;mr.is(t)||Be.is(t)?i=t:r=t;let s,o;if(i===void 0?s=hi.create(e,r):(o=Be.is(i)?i:this._changeAnnotations.manage(i),s=hi.create(e,r,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}renameFile(e,t,r,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let s;mr.is(r)||Be.is(r)?s=r:i=r;let o,a;if(s===void 0?o=pi.create(e,t,i):(a=Be.is(s)?s:this._changeAnnotations.manage(s),o=pi.create(e,t,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;mr.is(t)||Be.is(t)?i=t:r=t;let s,o;if(i===void 0?s=gi.create(e,r):(o=Be.is(i)?i:this._changeAnnotations.manage(i),s=gi.create(e,r,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}};(function(n){function e(r){return{uri:r}}n.create=e;function t(r){let i=r;return C.defined(i)&&C.string(i.uri)}n.is=t})(Bc||(Bc={}));(function(n){function e(r,i){return{uri:r,version:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&C.string(i.uri)&&C.integer(i.version)}n.is=t})(Gc||(Gc={}));(function(n){function e(r,i){return{uri:r,version:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&C.string(i.uri)&&(i.version===null||C.integer(i.version))}n.is=t})(ns||(ns={}));(function(n){n.ABAP="abap",n.WindowsBat="bat",n.BibTeX="bibtex",n.Clojure="clojure",n.Coffeescript="coffeescript",n.C="c",n.CPP="cpp",n.CSharp="csharp",n.CSS="css",n.D="d",n.Delphi="pascal",n.Diff="diff",n.Dart="dart",n.Dockerfile="dockerfile",n.Elixir="elixir",n.Erlang="erlang",n.FSharp="fsharp",n.GitCommit="git-commit",n.GitRebase="git-rebase",n.Go="go",n.Groovy="groovy",n.Handlebars="handlebars",n.Haskell="haskell",n.HTML="html",n.Ini="ini",n.Java="java",n.JavaScript="javascript",n.JavaScriptReact="javascriptreact",n.JSON="json",n.LaTeX="latex",n.Less="less",n.Lua="lua",n.Makefile="makefile",n.Markdown="markdown",n.ObjectiveC="objective-c",n.ObjectiveCPP="objective-cpp",n.Pascal="pascal",n.Perl="perl",n.Perl6="perl6",n.PHP="php",n.Plaintext="plaintext",n.Powershell="powershell",n.Pug="jade",n.Python="python",n.R="r",n.Razor="razor",n.Ruby="ruby",n.Rust="rust",n.SCSS="scss",n.SASS="sass",n.Scala="scala",n.ShaderLab="shaderlab",n.ShellScript="shellscript",n.SQL="sql",n.Swift="swift",n.TypeScript="typescript",n.TypeScriptReact="typescriptreact",n.TeX="tex",n.VisualBasic="vb",n.XML="xml",n.XSL="xsl",n.YAML="yaml"})(Vc||(Vc={}));(function(n){function e(r,i,s,o){return{uri:r,languageId:i,version:s,text:o}}n.create=e;function t(r){let i=r;return C.defined(i)&&C.string(i.uri)&&C.string(i.languageId)&&C.integer(i.version)&&C.string(i.text)}n.is=t})(Xc||(Xc={}));(function(n){n.PlainText="plaintext",n.Markdown="markdown";function e(t){let r=t;return r===n.PlainText||r===n.Markdown}n.is=e})(ao||(ao={}));(function(n){function e(t){let r=t;return C.objectLiteral(t)&&ao.is(r.kind)&&C.string(r.value)}n.is=e})(_r||(_r={}));(function(n){n.Text=1,n.Method=2,n.Function=3,n.Constructor=4,n.Field=5,n.Variable=6,n.Class=7,n.Interface=8,n.Module=9,n.Property=10,n.Unit=11,n.Value=12,n.Enum=13,n.Keyword=14,n.Snippet=15,n.Color=16,n.File=17,n.Reference=18,n.Folder=19,n.EnumMember=20,n.Constant=21,n.Struct=22,n.Event=23,n.Operator=24,n.TypeParameter=25})(Jc||(Jc={}));(function(n){n.PlainText=1,n.Snippet=2})(Qc||(Qc={}));(function(n){n.Deprecated=1})(Yc||(Yc={}));(function(n){function e(r,i,s){return{newText:r,insert:i,replace:s}}n.create=e;function t(r){let i=r;return i&&C.string(i.newText)&&xe.is(i.insert)&&xe.is(i.replace)}n.is=t})(Zc||(Zc={}));(function(n){n.asIs=1,n.adjustIndentation=2})(eu||(eu={}));(function(n){n.Replace=1,n.Merge=2})(tu||(tu={}));(function(n){function e(t){let r=t;return r&&(C.string(r.detail)||r.detail===void 0)&&(C.string(r.description)||r.description===void 0)}n.is=e})(nu||(nu={}));(function(n){function e(t){return{label:t}}n.create=e})(ru||(ru={}));(function(n){function e(t,r){return{items:t||[],isIncomplete:!!r}}n.create=e})(iu||(iu={}));(function(n){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}n.fromPlainText=e;function t(r){let i=r;return C.string(i)||C.objectLiteral(i)&&C.string(i.language)&&C.string(i.value)}n.is=t})(rs||(rs={}));(function(n){function e(t){let r=t;return!!r&&C.objectLiteral(r)&&(_r.is(r.contents)||rs.is(r.contents)||C.typedArray(r.contents,rs.is))&&(t.range===void 0||xe.is(t.range))}n.is=e})(su||(su={}));(function(n){function e(t,r){return r?{label:t,documentation:r}:{label:t}}n.create=e})(ou||(ou={}));(function(n){function e(t,r,...i){let s={label:t};return C.defined(r)&&(s.documentation=r),C.defined(i)?s.parameters=i:s.parameters=[],s}n.create=e})(au||(au={}));(function(n){n.Text=1,n.Read=2,n.Write=3})(cu||(cu={}));(function(n){function e(t,r){let i={range:t};return C.number(r)&&(i.kind=r),i}n.create=e})(uu||(uu={}));(function(n){n.File=1,n.Module=2,n.Namespace=3,n.Package=4,n.Class=5,n.Method=6,n.Property=7,n.Field=8,n.Constructor=9,n.Enum=10,n.Interface=11,n.Function=12,n.Variable=13,n.Constant=14,n.String=15,n.Number=16,n.Boolean=17,n.Array=18,n.Object=19,n.Key=20,n.Null=21,n.EnumMember=22,n.Struct=23,n.Event=24,n.Operator=25,n.TypeParameter=26})(lu||(lu={}));(function(n){n.Deprecated=1})(du||(du={}));(function(n){function e(t,r,i,s,o){let a={name:t,kind:r,location:{uri:s,range:i}};return o&&(a.containerName=o),a}n.create=e})(fu||(fu={}));(function(n){function e(t,r,i,s){return s!==void 0?{name:t,kind:r,location:{uri:i,range:s}}:{name:t,kind:r,location:{uri:i}}}n.create=e})(hu||(hu={}));(function(n){function e(r,i,s,o,a,u){let l={name:r,detail:i,kind:s,range:o,selectionRange:a};return u!==void 0&&(l.children=u),l}n.create=e;function t(r){let i=r;return i&&C.string(i.name)&&C.number(i.kind)&&xe.is(i.range)&&xe.is(i.selectionRange)&&(i.detail===void 0||C.string(i.detail))&&(i.deprecated===void 0||C.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}n.is=t})(pu||(pu={}));(function(n){n.Empty="",n.QuickFix="quickfix",n.Refactor="refactor",n.RefactorExtract="refactor.extract",n.RefactorInline="refactor.inline",n.RefactorMove="refactor.move",n.RefactorRewrite="refactor.rewrite",n.Source="source",n.SourceOrganizeImports="source.organizeImports",n.SourceFixAll="source.fixAll",n.Notebook="notebook"})(gu||(gu={}));(function(n){n.Invoked=1,n.Automatic=2})(is||(is={}));(function(n){function e(r,i,s){let o={diagnostics:r};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}n.create=e;function t(r){let i=r;return C.defined(i)&&C.typedArray(i.diagnostics,es.is)&&(i.only===void 0||C.typedArray(i.only,C.string))&&(i.triggerKind===void 0||i.triggerKind===is.Invoked||i.triggerKind===is.Automatic)}n.is=t})(mu||(mu={}));(function(n){n.LLMGenerated=1;function e(t){return C.defined(t)&&t===n.LLMGenerated}n.is=e})(co||(co={}));(function(n){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):jr.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}n.create=e;function t(r){let i=r;return i&&C.string(i.title)&&(i.diagnostics===void 0||C.typedArray(i.diagnostics,es.is))&&(i.kind===void 0||C.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||jr.is(i.command))&&(i.isPreferred===void 0||C.boolean(i.isPreferred))&&(i.edit===void 0||so.is(i.edit))&&(i.tags===void 0||C.typedArray(i.tags,co.is))}n.is=t})(_u||(_u={}));(function(n){function e(r,i){let s={range:r};return C.defined(i)&&(s.data=i),s}n.create=e;function t(r){let i=r;return C.defined(i)&&xe.is(i.range)&&(C.undefined(i.command)||jr.is(i.command))}n.is=t})(yu||(yu={}));(function(n){function e(r,i){return{tabSize:r,insertSpaces:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&C.uinteger(i.tabSize)&&C.boolean(i.insertSpaces)}n.is=t})(vu||(vu={}));(function(n){function e(r,i,s){return{range:r,target:i,data:s}}n.create=e;function t(r){let i=r;return C.defined(i)&&xe.is(i.range)&&(C.undefined(i.target)||C.string(i.target))}n.is=t})(bu||(bu={}));(function(n){function e(r,i){return{range:r,parent:i}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&xe.is(i.range)&&(i.parent===void 0||n.is(i.parent))}n.is=t})(Cu||(Cu={}));(function(n){n.namespace="namespace",n.type="type",n.class="class",n.enum="enum",n.interface="interface",n.struct="struct",n.typeParameter="typeParameter",n.parameter="parameter",n.variable="variable",n.property="property",n.enumMember="enumMember",n.event="event",n.function="function",n.method="method",n.macro="macro",n.keyword="keyword",n.modifier="modifier",n.comment="comment",n.string="string",n.number="number",n.regexp="regexp",n.operator="operator",n.decorator="decorator",n.label="label"})(wu||(wu={}));(function(n){n.declaration="declaration",n.definition="definition",n.readonly="readonly",n.static="static",n.deprecated="deprecated",n.abstract="abstract",n.async="async",n.modification="modification",n.documentation="documentation",n.defaultLibrary="defaultLibrary"})(Du||(Du={}));(function(n){function e(t){let r=t;return C.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}n.is=e})(Su||(Su={}));(function(n){function e(r,i){return{range:r,text:i}}n.create=e;function t(r){let i=r;return i!=null&&xe.is(i.range)&&C.string(i.text)}n.is=t})(Pu||(Pu={}));(function(n){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}n.create=e;function t(r){let i=r;return i!=null&&xe.is(i.range)&&C.boolean(i.caseSensitiveLookup)&&(C.string(i.variableName)||i.variableName===void 0)}n.is=t})(Ru||(Ru={}));(function(n){function e(r,i){return{range:r,expression:i}}n.create=e;function t(r){let i=r;return i!=null&&xe.is(i.range)&&(C.string(i.expression)||i.expression===void 0)}n.is=t})(Tu||(Tu={}));(function(n){function e(r,i){return{frameId:r,stoppedLocation:i}}n.create=e;function t(r){let i=r;return C.defined(i)&&xe.is(r.stoppedLocation)}n.is=t})(Ou||(Ou={}));(function(n){n.Type=1,n.Parameter=2;function e(t){return t===1||t===2}n.is=e})(uo||(uo={}));(function(n){function e(r){return{value:r}}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&(i.tooltip===void 0||C.string(i.tooltip)||_r.is(i.tooltip))&&(i.location===void 0||Zi.is(i.location))&&(i.command===void 0||jr.is(i.command))}n.is=t})(lo||(lo={}));(function(n){function e(r,i,s){let o={position:r,label:i};return s!==void 0&&(o.kind=s),o}n.create=e;function t(r){let i=r;return C.objectLiteral(i)&&Lt.is(i.position)&&(C.string(i.label)||C.typedArray(i.label,lo.is))&&(i.kind===void 0||uo.is(i.kind))&&i.textEdits===void 0||C.typedArray(i.textEdits,nn.is)&&(i.tooltip===void 0||C.string(i.tooltip)||_r.is(i.tooltip))&&(i.paddingLeft===void 0||C.boolean(i.paddingLeft))&&(i.paddingRight===void 0||C.boolean(i.paddingRight))}n.is=t})(Eu||(Eu={}));(function(n){function e(r){return{kind:"snippet",value:r}}n.createSnippet=e;function t(r){let i=r;return C.objectLiteral(i)&&i.kind==="snippet"&&C.string(i.value)}n.isSnippet=t})(fo||(fo={}));(function(n){function e(t,r,i,s){return{insertText:t,filterText:r,range:i,command:s}}n.create=e})(qu||(qu={}));(function(n){function e(t){return{items:t}}n.create=e})(Mu||(Mu={}));(function(n){n.Invoked=1,n.Automatic=2})(xu||(xu={}));(function(n){function e(t,r){return{range:t,text:r}}n.create=e})(Iu||(Iu={}));(function(n){function e(t,r){return{triggerKind:t,selectedCompletionInfo:r}}n.create=e})(Nu||(Nu={}));(function(n){function e(t){let r=t;return C.objectLiteral(r)&&no.is(r.uri)&&C.string(r.name)}n.is=e})(ju||(ju={}));hC=[` +`,`\r +`,"\r"];(function(n){function e(s,o,a,u){return new Lu(s,o,a,u)}n.create=e;function t(s){let o=s;return!!(C.defined(o)&&C.string(o.uri)&&(C.undefined(o.languageId)||C.string(o.languageId))&&C.uinteger(o.lineCount)&&C.func(o.getText)&&C.func(o.positionAt)&&C.func(o.offsetAt))}n.is=t;function r(s,o){let a=s.getText(),u=i(o,(f,p)=>{let h=f.range.start.line-p.range.start.line;return h===0?f.range.start.character-p.range.start.character:h}),l=a.length;for(let f=u.length-1;f>=0;f--){let p=u[f],h=s.offsetAt(p.range.start),g=s.offsetAt(p.range.end);if(g<=l)a=a.substring(0,h)+p.newText+a.substring(g,a.length);else throw new Error("Overlapping edit");l=h}return a}n.applyEdits=r;function i(s,o){if(s.length<=1)return s;let a=s.length/2|0,u=s.slice(0,a),l=s.slice(a);i(u,o),i(l,o);let f=0,p=0,h=0;for(;f0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,i=t.length;if(i===0)return Lt.create(0,e);for(;re?i=o:r=o+1}let s=r-1;return Lt.create(s,e-t[s])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],i=e.line+1"u"}n.undefined=r;function i(g){return g===!0||g===!1}n.boolean=i;function s(g){return e.call(g)==="[object String]"}n.string=s;function o(g){return e.call(g)==="[object Number]"}n.number=o;function a(g,_,v){return e.call(g)==="[object Number]"&&_<=g&&g<=v}n.numberRange=a;function u(g){return e.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}n.integer=u;function l(g){return e.call(g)==="[object Number]"&&0<=g&&g<=2147483647}n.uinteger=l;function f(g){return e.call(g)==="[object Function]"}n.func=f;function p(g){return g!==null&&typeof g=="object"}n.objectLiteral=p;function h(g,_){return Array.isArray(g)&&g.every(_)}n.typedArray=h})(C||(C={}))});var Ce=P(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.CM=at.ProtocolNotificationType=at.ProtocolNotificationType0=at.ProtocolRequestType=at.ProtocolRequestType0=at.RegistrationType=at.MessageDirection=void 0;var mi=Nn(),up;(function(n){n.clientToServer="clientToServer",n.serverToClient="serverToClient",n.both="both"})(up||(at.MessageDirection=up={}));var Au=class{____;method;constructor(e){this.method=e}};at.RegistrationType=Au;var ku=class extends mi.RequestType0{__;___;____;_pr;constructor(e){super(e)}};at.ProtocolRequestType0=ku;var $u=class extends mi.RequestType{__;___;____;_pr;constructor(e){super(e,mi.ParameterStructures.byName)}};at.ProtocolRequestType=$u;var Hu=class extends mi.NotificationType0{___;____;constructor(e){super(e)}};at.ProtocolNotificationType0=Hu;var Uu=class extends mi.NotificationType{___;____;constructor(e){super(e,mi.ParameterStructures.byName)}};at.ProtocolNotificationType=Uu;var lp;(function(n){function e(t,r){return{client:t,server:r}}n.create=e})(lp||(at.CM=lp={}))});var go=P(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.boolean=pC;zt.string=dp;zt.number=gC;zt.error=mC;zt.func=_C;zt.array=fp;zt.stringArray=yC;zt.typedArray=vC;zt.objectLiteral=bC;function pC(n){return n===!0||n===!1}function dp(n){return typeof n=="string"||n instanceof String}function gC(n){return typeof n=="number"||n instanceof Number}function mC(n){return n instanceof Error}function _C(n){return typeof n=="function"}function fp(n){return Array.isArray(n)}function yC(n){return fp(n)&&n.every(e=>dp(e))}function vC(n,e){return Array.isArray(n)&&n.every(e)}function bC(n){return n!==null&&typeof n=="object"}});var pp=P(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.ImplementationRequest=void 0;var Wu=Ce(),hp;(function(n){n.method="textDocument/implementation",n.messageDirection=Wu.MessageDirection.clientToServer,n.type=new Wu.ProtocolRequestType(n.method),n.capabilities=Wu.CM.create("textDocument.implementation","implementationProvider")})(hp||(mo.ImplementationRequest=hp={}))});var mp=P(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.TypeDefinitionRequest=void 0;var zu=Ce(),gp;(function(n){n.method="textDocument/typeDefinition",n.messageDirection=zu.MessageDirection.clientToServer,n.type=new zu.ProtocolRequestType(n.method),n.capabilities=zu.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(gp||(_o.TypeDefinitionRequest=gp={}))});var vp=P(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.DidChangeWorkspaceFoldersNotification=yi.WorkspaceFoldersRequest=void 0;var _i=Ce(),_p;(function(n){n.method="workspace/workspaceFolders",n.messageDirection=_i.MessageDirection.serverToClient,n.type=new _i.ProtocolRequestType0(n.method),n.capabilities=_i.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(_p||(yi.WorkspaceFoldersRequest=_p={}));var yp;(function(n){n.method="workspace/didChangeWorkspaceFolders",n.messageDirection=_i.MessageDirection.clientToServer,n.type=new _i.ProtocolNotificationType(n.method),n.capabilities=_i.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(yp||(yi.DidChangeWorkspaceFoldersNotification=yp={}))});var Cp=P(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.ConfigurationRequest=void 0;var Ku=Ce(),bp;(function(n){n.method="workspace/configuration",n.messageDirection=Ku.MessageDirection.serverToClient,n.type=new Ku.ProtocolRequestType(n.method),n.capabilities=Ku.CM.create("workspace.configuration",void 0)})(bp||(yo.ConfigurationRequest=bp={}))});var Sp=P(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.ColorPresentationRequest=bi.DocumentColorRequest=void 0;var vi=Ce(),wp;(function(n){n.method="textDocument/documentColor",n.messageDirection=vi.MessageDirection.clientToServer,n.type=new vi.ProtocolRequestType(n.method),n.capabilities=vi.CM.create("textDocument.colorProvider","colorProvider")})(wp||(bi.DocumentColorRequest=wp={}));var Dp;(function(n){n.method="textDocument/colorPresentation",n.messageDirection=vi.MessageDirection.clientToServer,n.type=new vi.ProtocolRequestType(n.method),n.capabilities=vi.CM.create("textDocument.colorProvider","colorProvider")})(Dp||(bi.ColorPresentationRequest=Dp={}))});var Tp=P(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.FoldingRangeRefreshRequest=wi.FoldingRangeRequest=void 0;var Ci=Ce(),Pp;(function(n){n.method="textDocument/foldingRange",n.messageDirection=Ci.MessageDirection.clientToServer,n.type=new Ci.ProtocolRequestType(n.method),n.capabilities=Ci.CM.create("textDocument.foldingRange","foldingRangeProvider")})(Pp||(wi.FoldingRangeRequest=Pp={}));var Rp;(function(n){n.method="workspace/foldingRange/refresh",n.messageDirection=Ci.MessageDirection.serverToClient,n.type=new Ci.ProtocolRequestType0(n.method),n.capabilities=Ci.CM.create("workspace.foldingRange.refreshSupport",void 0)})(Rp||(wi.FoldingRangeRefreshRequest=Rp={}))});var Ep=P(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.DeclarationRequest=void 0;var Bu=Ce(),Op;(function(n){n.method="textDocument/declaration",n.messageDirection=Bu.MessageDirection.clientToServer,n.type=new Bu.ProtocolRequestType(n.method),n.capabilities=Bu.CM.create("textDocument.declaration","declarationProvider")})(Op||(vo.DeclarationRequest=Op={}))});var Mp=P(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.SelectionRangeRequest=void 0;var Gu=Ce(),qp;(function(n){n.method="textDocument/selectionRange",n.messageDirection=Gu.MessageDirection.clientToServer,n.type=new Gu.ProtocolRequestType(n.method),n.capabilities=Gu.CM.create("textDocument.selectionRange","selectionRangeProvider")})(qp||(bo.SelectionRangeRequest=qp={}))});var jp=P(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.WorkDoneProgressCancelNotification=yr.WorkDoneProgressCreateRequest=yr.WorkDoneProgress=void 0;var CC=Nn(),ss=Ce(),xp;(function(n){n.type=new CC.ProgressType;function e(t){return t===n.type}n.is=e})(xp||(yr.WorkDoneProgress=xp={}));var Ip;(function(n){n.method="window/workDoneProgress/create",n.messageDirection=ss.MessageDirection.serverToClient,n.type=new ss.ProtocolRequestType(n.method),n.capabilities=ss.CM.create("window.workDoneProgress",void 0)})(Ip||(yr.WorkDoneProgressCreateRequest=Ip={}));var Np;(function(n){n.method="window/workDoneProgress/cancel",n.messageDirection=ss.MessageDirection.clientToServer,n.type=new ss.ProtocolNotificationType(n.method)})(Np||(yr.WorkDoneProgressCancelNotification=Np={}))});var kp=P(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.CallHierarchyOutgoingCallsRequest=vr.CallHierarchyIncomingCallsRequest=vr.CallHierarchyPrepareRequest=void 0;var Fn=Ce(),Fp;(function(n){n.method="textDocument/prepareCallHierarchy",n.messageDirection=Fn.MessageDirection.clientToServer,n.type=new Fn.ProtocolRequestType(n.method),n.capabilities=Fn.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Fp||(vr.CallHierarchyPrepareRequest=Fp={}));var Lp;(function(n){n.method="callHierarchy/incomingCalls",n.messageDirection=Fn.MessageDirection.clientToServer,n.type=new Fn.ProtocolRequestType(n.method),n.capabilities=Fn.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Lp||(vr.CallHierarchyIncomingCallsRequest=Lp={}));var Ap;(function(n){n.method="callHierarchy/outgoingCalls",n.messageDirection=Fn.MessageDirection.clientToServer,n.type=new Fn.ProtocolRequestType(n.method),n.capabilities=Fn.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Ap||(vr.CallHierarchyOutgoingCallsRequest=Ap={}))});var Kp=P(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.SemanticTokensRefreshRequest=yt.SemanticTokensRangeRequest=yt.SemanticTokensDeltaRequest=yt.SemanticTokensRequest=yt.SemanticTokensRegistrationType=yt.TokenFormat=void 0;var Pt=Ce(),$p;(function(n){n.Relative="relative"})($p||(yt.TokenFormat=$p={}));var os;(function(n){n.method="textDocument/semanticTokens",n.type=new Pt.RegistrationType(n.method)})(os||(yt.SemanticTokensRegistrationType=os={}));var Hp;(function(n){n.method="textDocument/semanticTokens/full",n.messageDirection=Pt.MessageDirection.clientToServer,n.type=new Pt.ProtocolRequestType(n.method),n.registrationMethod=os.method,n.capabilities=Pt.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(Hp||(yt.SemanticTokensRequest=Hp={}));var Up;(function(n){n.method="textDocument/semanticTokens/full/delta",n.messageDirection=Pt.MessageDirection.clientToServer,n.type=new Pt.ProtocolRequestType(n.method),n.registrationMethod=os.method,n.capabilities=Pt.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(Up||(yt.SemanticTokensDeltaRequest=Up={}));var Wp;(function(n){n.method="textDocument/semanticTokens/range",n.messageDirection=Pt.MessageDirection.clientToServer,n.type=new Pt.ProtocolRequestType(n.method),n.registrationMethod=os.method,n.capabilities=Pt.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(Wp||(yt.SemanticTokensRangeRequest=Wp={}));var zp;(function(n){n.method="workspace/semanticTokens/refresh",n.messageDirection=Pt.MessageDirection.serverToClient,n.type=new Pt.ProtocolRequestType0(n.method),n.capabilities=Pt.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(zp||(yt.SemanticTokensRefreshRequest=zp={}))});var Gp=P(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.ShowDocumentRequest=void 0;var Vu=Ce(),Bp;(function(n){n.method="window/showDocument",n.messageDirection=Vu.MessageDirection.serverToClient,n.type=new Vu.ProtocolRequestType(n.method),n.capabilities=Vu.CM.create("window.showDocument.support",void 0)})(Bp||(Co.ShowDocumentRequest=Bp={}))});var Xp=P(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.LinkedEditingRangeRequest=void 0;var Xu=Ce(),Vp;(function(n){n.method="textDocument/linkedEditingRange",n.messageDirection=Xu.MessageDirection.clientToServer,n.type=new Xu.ProtocolRequestType(n.method),n.capabilities=Xu.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(Vp||(wo.LinkedEditingRangeRequest=Vp={}))});var rg=P(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.WillDeleteFilesRequest=ct.DidDeleteFilesNotification=ct.DidRenameFilesNotification=ct.WillRenameFilesRequest=ct.DidCreateFilesNotification=ct.WillCreateFilesRequest=ct.FileOperationPatternKind=void 0;var Ge=Ce(),Jp;(function(n){n.file="file",n.folder="folder"})(Jp||(ct.FileOperationPatternKind=Jp={}));var Qp;(function(n){n.method="workspace/willCreateFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolRequestType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(Qp||(ct.WillCreateFilesRequest=Qp={}));var Yp;(function(n){n.method="workspace/didCreateFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolNotificationType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(Yp||(ct.DidCreateFilesNotification=Yp={}));var Zp;(function(n){n.method="workspace/willRenameFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolRequestType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(Zp||(ct.WillRenameFilesRequest=Zp={}));var eg;(function(n){n.method="workspace/didRenameFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolNotificationType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(eg||(ct.DidRenameFilesNotification=eg={}));var tg;(function(n){n.method="workspace/didDeleteFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolNotificationType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(tg||(ct.DidDeleteFilesNotification=tg={}));var ng;(function(n){n.method="workspace/willDeleteFiles",n.messageDirection=Ge.MessageDirection.clientToServer,n.type=new Ge.ProtocolRequestType(n.method),n.capabilities=Ge.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(ng||(ct.WillDeleteFilesRequest=ng={}))});var ag=P(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.MonikerRequest=br.MonikerKind=br.UniquenessLevel=void 0;var Ju=Ce(),ig;(function(n){n.document="document",n.project="project",n.group="group",n.scheme="scheme",n.global="global"})(ig||(br.UniquenessLevel=ig={}));var sg;(function(n){n.$import="import",n.$export="export",n.local="local"})(sg||(br.MonikerKind=sg={}));var og;(function(n){n.method="textDocument/moniker",n.messageDirection=Ju.MessageDirection.clientToServer,n.type=new Ju.ProtocolRequestType(n.method),n.capabilities=Ju.CM.create("textDocument.moniker","monikerProvider")})(og||(br.MonikerRequest=og={}))});var dg=P(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.TypeHierarchySubtypesRequest=Cr.TypeHierarchySupertypesRequest=Cr.TypeHierarchyPrepareRequest=void 0;var Fr=Ce(),cg;(function(n){n.method="textDocument/prepareTypeHierarchy",n.messageDirection=Fr.MessageDirection.clientToServer,n.type=new Fr.ProtocolRequestType(n.method),n.capabilities=Fr.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(cg||(Cr.TypeHierarchyPrepareRequest=cg={}));var ug;(function(n){n.method="typeHierarchy/supertypes",n.messageDirection=Fr.MessageDirection.clientToServer,n.type=new Fr.ProtocolRequestType(n.method)})(ug||(Cr.TypeHierarchySupertypesRequest=ug={}));var lg;(function(n){n.method="typeHierarchy/subtypes",n.messageDirection=Fr.MessageDirection.clientToServer,n.type=new Fr.ProtocolRequestType(n.method)})(lg||(Cr.TypeHierarchySubtypesRequest=lg={}))});var pg=P(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.InlineValueRefreshRequest=Si.InlineValueRequest=void 0;var Di=Ce(),fg;(function(n){n.method="textDocument/inlineValue",n.messageDirection=Di.MessageDirection.clientToServer,n.type=new Di.ProtocolRequestType(n.method),n.capabilities=Di.CM.create("textDocument.inlineValue","inlineValueProvider")})(fg||(Si.InlineValueRequest=fg={}));var hg;(function(n){n.method="workspace/inlineValue/refresh",n.messageDirection=Di.MessageDirection.serverToClient,n.type=new Di.ProtocolRequestType0(n.method),n.capabilities=Di.CM.create("workspace.inlineValue.refreshSupport",void 0)})(hg||(Si.InlineValueRefreshRequest=hg={}))});var yg=P(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.InlayHintRefreshRequest=wr.InlayHintResolveRequest=wr.InlayHintRequest=void 0;var Ln=Ce(),gg;(function(n){n.method="textDocument/inlayHint",n.messageDirection=Ln.MessageDirection.clientToServer,n.type=new Ln.ProtocolRequestType(n.method),n.capabilities=Ln.CM.create("textDocument.inlayHint","inlayHintProvider")})(gg||(wr.InlayHintRequest=gg={}));var mg;(function(n){n.method="inlayHint/resolve",n.messageDirection=Ln.MessageDirection.clientToServer,n.type=new Ln.ProtocolRequestType(n.method),n.capabilities=Ln.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(mg||(wr.InlayHintResolveRequest=mg={}));var _g;(function(n){n.method="workspace/inlayHint/refresh",n.messageDirection=Ln.MessageDirection.serverToClient,n.type=new Ln.ProtocolRequestType0(n.method),n.capabilities=Ln.CM.create("workspace.inlayHint.refreshSupport",void 0)})(_g||(wr.InlayHintRefreshRequest=_g={}))});var Pg=P(Ve=>{"use strict";var wC=Ve&&Ve.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),DC=Ve&&Ve.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),SC=Ve&&Ve.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var RC=de&&de.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),TC=de&&de.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),OC=de&&de.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.InlineCompletionRequest=void 0;var Zu=Ce(),Ig;(function(n){n.method="textDocument/inlineCompletion",n.messageDirection=Zu.MessageDirection.clientToServer,n.type=new Zu.ProtocolRequestType(n.method),n.capabilities=Zu.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(Ig||(So.InlineCompletionRequest=Ig={}))});var Lg=P(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.TextDocumentContentRefreshRequest=Ri.TextDocumentContentRequest=void 0;var cs=Ce(),jg;(function(n){n.method="workspace/textDocumentContent",n.messageDirection=cs.MessageDirection.clientToServer,n.type=new cs.ProtocolRequestType(n.method),n.capabilities=cs.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(jg||(Ri.TextDocumentContentRequest=jg={}));var Fg;(function(n){n.method="workspace/textDocumentContent/refresh",n.messageDirection=cs.MessageDirection.serverToClient,n.type=new cs.ProtocolRequestType(n.method)})(Fg||(Ri.TextDocumentContentRefreshRequest=Fg={}))});var Qm=P(m=>{"use strict";var EC=m&&m.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),qC=m&&m.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),MC=m&&m.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0}n.hasId=e})(Kg||(m.StaticRegistrationOptions=Kg={}));var Bg;(function(n){function e(t){let r=t;return r&&(r.documentSelector===null||rl.is(r.documentSelector))}n.is=e})(Bg||(m.TextDocumentRegistrationOptions=Bg={}));var Gg;(function(n){function e(r){let i=r;return Xe.objectLiteral(i)&&(i.workDoneProgress===void 0||Xe.boolean(i.workDoneProgress))}n.is=e;function t(r){let i=r;return i&&Xe.boolean(i.workDoneProgress)}n.hasWorkDoneProgress=t})(Gg||(m.WorkDoneProgressOptions=Gg={}));var Vg;(function(n){n.method="initialize",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method)})(Vg||(m.InitializeRequest=Vg={}));var Xg;(function(n){n.unknownProtocolVersion=1})(Xg||(m.InitializeErrorCodes=Xg={}));var Jg;(function(n){n.method="initialized",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method)})(Jg||(m.InitializedNotification=Jg={}));var Qg;(function(n){n.method="shutdown",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType0(n.method)})(Qg||(m.ShutdownRequest=Qg={}));var Yg;(function(n){n.method="exit",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType0(n.method)})(Yg||(m.ExitNotification=Yg={}));var Zg;(function(n){n.method="workspace/didChangeConfiguration",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("workspace.didChangeConfiguration",void 0)})(Zg||(m.DidChangeConfigurationNotification=Zg={}));var em;(function(n){n.Error=1,n.Warning=2,n.Info=3,n.Log=4,n.Debug=5})(em||(m.MessageType=em={}));var tm;(function(n){n.method="window/showMessage",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("window.showMessage",void 0)})(tm||(m.ShowMessageNotification=tm={}));var nm;(function(n){n.method="window/showMessageRequest",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("window.showMessage",void 0)})(nm||(m.ShowMessageRequest=nm={}));var rm;(function(n){n.method="window/logMessage",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolNotificationType(n.method)})(rm||(m.LogMessageNotification=rm={}));var im;(function(n){n.method="telemetry/event",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolNotificationType(n.method)})(im||(m.TelemetryEventNotification=im={}));var sm;(function(n){n.None=0,n.Full=1,n.Incremental=2})(sm||(m.TextDocumentSyncKind=sm={}));var om;(function(n){n.method="textDocument/didOpen",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(om||(m.DidOpenTextDocumentNotification=om={}));var am;(function(n){function e(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}n.isIncremental=e;function t(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}n.isFull=t})(am||(m.TextDocumentContentChangeEvent=am={}));var cm;(function(n){n.method="textDocument/didChange",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.synchronization","textDocumentSync")})(cm||(m.DidChangeTextDocumentNotification=cm={}));var um;(function(n){n.method="textDocument/didClose",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(um||(m.DidCloseTextDocumentNotification=um={}));var lm;(function(n){n.method="textDocument/didSave",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(lm||(m.DidSaveTextDocumentNotification=lm={}));var dm;(function(n){n.Manual=1,n.AfterDelay=2,n.FocusOut=3})(dm||(m.TextDocumentSaveReason=dm={}));var fm;(function(n){n.method="textDocument/willSave",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(fm||(m.WillSaveTextDocumentNotification=fm={}));var hm;(function(n){n.method="textDocument/willSaveWaitUntil",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(hm||(m.WillSaveTextDocumentWaitUntilRequest=hm={}));var pm;(function(n){n.method="workspace/didChangeWatchedFiles",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("workspace.didChangeWatchedFiles",void 0)})(pm||(m.DidChangeWatchedFilesNotification=pm={}));var gm;(function(n){n.Created=1,n.Changed=2,n.Deleted=3})(gm||(m.FileChangeType=gm={}));var il;(function(n){function e(t){let r=t;return Xe.objectLiteral(r)&&(Ag.URI.is(r.baseUri)||Ag.WorkspaceFolder.is(r.baseUri))&&Xe.string(r.pattern)}n.is=e})(il||(m.RelativePattern=il={}));var sl;(function(n){function e(t){let r=t;return Xe.string(r)||il.is(r)}n.is=e})(sl||(m.GlobPattern=sl={}));var mm;(function(n){n.Create=1,n.Change=2,n.Delete=4})(mm||(m.WatchKind=mm={}));var _m;(function(n){n.method="textDocument/publishDiagnostics",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolNotificationType(n.method),n.capabilities=O.CM.create("textDocument.publishDiagnostics",void 0)})(_m||(m.PublishDiagnosticsNotification=_m={}));var ym;(function(n){n.Invoked=1,n.TriggerCharacter=2,n.TriggerForIncompleteCompletions=3})(ym||(m.CompletionTriggerKind=ym={}));var vm;(function(n){n.method="textDocument/completion",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.completion","completionProvider")})(vm||(m.CompletionRequest=vm={}));var bm;(function(n){n.method="completionItem/resolve",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(bm||(m.CompletionResolveRequest=bm={}));var Cm;(function(n){n.method="textDocument/hover",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.hover","hoverProvider")})(Cm||(m.HoverRequest=Cm={}));var wm;(function(n){n.Invoked=1,n.TriggerCharacter=2,n.ContentChange=3})(wm||(m.SignatureHelpTriggerKind=wm={}));var Dm;(function(n){n.method="textDocument/signatureHelp",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(Dm||(m.SignatureHelpRequest=Dm={}));var Sm;(function(n){n.method="textDocument/definition",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.definition","definitionProvider")})(Sm||(m.DefinitionRequest=Sm={}));var Pm;(function(n){n.method="textDocument/references",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.references","referencesProvider")})(Pm||(m.ReferencesRequest=Pm={}));var Rm;(function(n){n.method="textDocument/documentHighlight",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(Rm||(m.DocumentHighlightRequest=Rm={}));var Tm;(function(n){n.method="textDocument/documentSymbol",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(Tm||(m.DocumentSymbolRequest=Tm={}));var Om;(function(n){n.method="textDocument/codeAction",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.codeAction","codeActionProvider")})(Om||(m.CodeActionRequest=Om={}));var Em;(function(n){n.method="codeAction/resolve",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})(Em||(m.CodeActionResolveRequest=Em={}));var qm;(function(n){n.method="workspace/symbol",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("workspace.symbol","workspaceSymbolProvider")})(qm||(m.WorkspaceSymbolRequest=qm={}));var Mm;(function(n){n.method="workspaceSymbol/resolve",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})(Mm||(m.WorkspaceSymbolResolveRequest=Mm={}));var xm;(function(n){n.method="textDocument/codeLens",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.codeLens","codeLensProvider")})(xm||(m.CodeLensRequest=xm={}));var Im;(function(n){n.method="codeLens/resolve",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(Im||(m.CodeLensResolveRequest=Im={}));var Nm;(function(n){n.method="workspace/codeLens/refresh",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolRequestType0(n.method),n.capabilities=O.CM.create("workspace.codeLens",void 0)})(Nm||(m.CodeLensRefreshRequest=Nm={}));var jm;(function(n){n.method="textDocument/documentLink",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.documentLink","documentLinkProvider")})(jm||(m.DocumentLinkRequest=jm={}));var Fm;(function(n){n.method="documentLink/resolve",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})(Fm||(m.DocumentLinkResolveRequest=Fm={}));var Lm;(function(n){n.method="textDocument/formatting",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.formatting","documentFormattingProvider")})(Lm||(m.DocumentFormattingRequest=Lm={}));var Am;(function(n){n.method="textDocument/rangeFormatting",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(Am||(m.DocumentRangeFormattingRequest=Am={}));var km;(function(n){n.method="textDocument/rangesFormatting",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(km||(m.DocumentRangesFormattingRequest=km={}));var $m;(function(n){n.method="textDocument/onTypeFormatting",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})($m||(m.DocumentOnTypeFormattingRequest=$m={}));var Hm;(function(n){n.Identifier=1})(Hm||(m.PrepareSupportDefaultBehavior=Hm={}));var Um;(function(n){n.method="textDocument/rename",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.rename","renameProvider")})(Um||(m.RenameRequest=Um={}));var Wm;(function(n){n.method="textDocument/prepareRename",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(Wm||(m.PrepareRenameRequest=Wm={}));var zm;(function(n){n.method="workspace/executeCommand",n.messageDirection=O.MessageDirection.clientToServer,n.type=new O.ProtocolRequestType(n.method),n.capabilities=O.CM.create("workspace.executeCommand","executeCommandProvider")})(zm||(m.ExecuteCommandRequest=zm={}));var Km;(function(n){n.method="workspace/applyEdit",n.messageDirection=O.MessageDirection.serverToClient,n.type=new O.ProtocolRequestType("workspace/applyEdit"),n.capabilities=O.CM.create("workspace.applyEdit",void 0)})(Km||(m.ApplyWorkspaceEditRequest=Km={}))});var Zm=P(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.createProtocolConnection=$C;var Ym=Nn();function $C(n,e,t,r){return Ym.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Ym.createMessageConnection)(n,e,t,r)}});var V=P(vt=>{"use strict";var HC=vt&&vt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Po=vt&&vt.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&HC(e,n,t)};Object.defineProperty(vt,"__esModule",{value:!0});vt.LSPErrorCodes=vt.createProtocolConnection=void 0;Po(Nn(),vt);Po((po(),Hs(ho)),vt);Po(Ce(),vt);Po(Qm(),vt);var UC=Zm();Object.defineProperty(vt,"createProtocolConnection",{enumerable:!0,get:function(){return UC.createProtocolConnection}});var e_;(function(n){n.lspReservedErrorRangeStart=-32899,n.RequestFailed=-32803,n.ServerCancelled=-32802,n.ContentModified=-32801,n.RequestCancelled=-32800,n.lspReservedErrorRangeEnd=-32800})(e_||(vt.LSPErrorCodes=e_={}))});var Ro=P(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Semaphore=Bt.Delayer=void 0;Bt.setTestMode=WC;Bt.clearTestMode=zC;Bt.map=KC;Bt.mapAsync=BC;Bt.forEach=GC;var ds=V(),fl=class{defaultDelay;timeout;completionPromise;onSuccess;task;constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(r=>{this.onSuccess=r}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;let r=this.task();return this.task=void 0,r})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ds.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}cancelTimeout(){this.timeout!==void 0&&(this.timeout.dispose(),this.timeout=void 0)}};Bt.Delayer=fl;var hl=class{_capacity;_active;_waiting;constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,r)=>{this._waiting.push({thunk:e,resolve:t,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,ds.RAL)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Bt.Semaphore=hl;var pl=!1;function WC(){pl=!0}function zC(){pl=!1}var t_=15,ls=class{yieldAfter;startTime;counter;total;counterInterval;constructor(e=t_){this.yieldAfter=pl===!0?Math.max(e,2):Math.max(e,t_),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.counter=0,this.total=0,this.counterInterval=1,this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){let e=Date.now()-this.startTime,t=Math.max(0,this.yieldAfter-e);if(this.total+=this.counter,this.counter=0,e>=this.yieldAfter||t<=1)return this.counterInterval=1,this.total=0,!0;switch(e){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}};async function KC(n,e,t,r){if(n.length===0)return[];let i=new Array(n.length),s=new ls(r?.yieldAfter);function o(u){s.start();for(let l=u;l{(0,ds.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function BC(n,e,t,r){if(n.length===0)return[];let i=new Array(n.length),s=new ls(r?.yieldAfter);async function o(u){s.start();for(let l=u;l{(0,ds.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function GC(n,e,t,r){if(n.length===0)return;let i=new ls(r?.yieldAfter);function s(a){i.start();for(let u=a;u{(0,ds.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?a(-1):a(s(o))})})}});var ml=P(kn=>{"use strict";var VC=kn&&kn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),XC=kn&&kn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),JC=kn&&kn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var YC=$n&&$n.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ZC=$n&&$n.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ew=$n&&$n.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var nw=Hn&&Hn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),rw=Hn&&Hn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),iw=Hn&&Hn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var ow=Un&&Un.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),aw=Un&&Un.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),cw=Un&&Un.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var lw=At&&At.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),dw=At&&At.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),r_=At&&At.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var hw=Wn&&Wn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),pw=Wn&&Wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),gw=Wn&&Wn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var _w=zn&&zn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),yw=zn&&zn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),vw=zn&&zn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var Cw=Kn&&Kn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ww=Kn&&Kn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Dw=Kn&&Kn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var Sw=Bn&&Bn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Pw=Bn&&Bn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Rw=Bn&&Bn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";var Ow=Gt&&Gt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Ew=Gt&&Gt.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Oo=Gt&&Gt.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;id.toString());function r(d){return t(d)}function i(d){return{uri:t(d.uri)}}function s(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function o(d){return{uri:t(d.uri),version:d.version}}function a(d){return{textDocument:s(d)}}function u(d){let D=d;return!!D.document&&!!D.contentChanges}function l(d){let D=d;return!!D.uri&&!!D.version}function f(d,D,$){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let ge=D,ce=$;return{textDocument:{uri:t(ge),version:ce},contentChanges:d.contentChanges.map(mt=>{let Mn=mt.range;return{range:{start:{line:Mn.start.line,character:Mn.start.character},end:{line:Mn.end.line,character:Mn.end.character}},rangeLength:mt.rangeLength,text:mt.text}})}}else throw Error("Unsupported text document change parameter")}function p(d){return{textDocument:i(d)}}function h(d,D=!1){let $={textDocument:i(d)};return D&&($.text=d.getText()),$}function g(d){switch(d){case Fe.TextDocumentSaveReason.Manual:return B.TextDocumentSaveReason.Manual;case Fe.TextDocumentSaveReason.AfterDelay:return B.TextDocumentSaveReason.AfterDelay;case Fe.TextDocumentSaveReason.FocusOut:return B.TextDocumentSaveReason.FocusOut}return B.TextDocumentSaveReason.Manual}function _(d){return{textDocument:i(d.document),reason:g(d.reason)}}function v(d){return{files:d.files.map(D=>({uri:t(D)}))}}function R(d){return{files:d.files.map(D=>({oldUri:t(D.oldUri),newUri:t(D.newUri)}))}}function q(d){return{files:d.files.map(D=>({uri:t(D)}))}}function w(d){return{files:d.files.map(D=>({uri:t(D)}))}}function M(d){return{files:d.files.map(D=>({oldUri:t(D.oldUri),newUri:t(D.newUri)}))}}function j(d){return{files:d.files.map(D=>({uri:t(D)}))}}function F(d,D){return{textDocument:i(d),position:Rn(D)}}function oe(d){switch(d){case Fe.CompletionTriggerKind.TriggerCharacter:return B.CompletionTriggerKind.TriggerCharacter;case Fe.CompletionTriggerKind.TriggerForIncompleteCompletions:return B.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return B.CompletionTriggerKind.Invoked}}function te(d,D,$){return{textDocument:i(d),position:Rn(D),context:{triggerKind:oe($.triggerKind),triggerCharacter:$.triggerCharacter}}}function Te(d){switch(d){case Fe.SignatureHelpTriggerKind.Invoke:return B.SignatureHelpTriggerKind.Invoked;case Fe.SignatureHelpTriggerKind.TriggerCharacter:return B.SignatureHelpTriggerKind.TriggerCharacter;case Fe.SignatureHelpTriggerKind.ContentChange:return B.SignatureHelpTriggerKind.ContentChange}}function Pn(d){return{label:d.label}}function Qr(d){return d.map(Pn)}function rr(d){return{label:d.label,parameters:Qr(d.parameters)}}function Yr(d){return d.map(rr)}function Zr(d){return d===void 0?d:{signatures:Yr(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function Mt(d,D,$){return{textDocument:i(d),position:Rn(D),context:{isRetrigger:$.isRetrigger,triggerCharacter:$.triggerCharacter,triggerKind:Te($.triggerKind),activeSignatureHelp:Zr($.activeSignatureHelp)}}}function Rn(d){return{line:d.line,character:d.character}}function xt(d){return d==null?d:{line:d.line>B.uinteger.MAX_VALUE?B.uinteger.MAX_VALUE:d.line,character:d.character>B.uinteger.MAX_VALUE?B.uinteger.MAX_VALUE:d.character}}function Tn(d,D){return i_.map(d,xt,D)}function Ht(d){return d.map(xt)}function Oe(d){return d==null?d:{start:xt(d.start),end:xt(d.end)}}function Ui(d){return d.map(Oe)}function Zt(d){return d==null?d:B.Location.create(r(d.uri),Oe(d.range))}function ir(d){switch(d){case Fe.DiagnosticSeverity.Error:return B.DiagnosticSeverity.Error;case Fe.DiagnosticSeverity.Warning:return B.DiagnosticSeverity.Warning;case Fe.DiagnosticSeverity.Information:return B.DiagnosticSeverity.Information;case Fe.DiagnosticSeverity.Hint:return B.DiagnosticSeverity.Hint}}function ei(d){if(!d)return;let D=[];for(let $ of d){let ge=Mr($);ge!==void 0&&D.push(ge)}return D.length>0?D:void 0}function Mr(d){switch(d){case Fe.DiagnosticTag.Unnecessary:return B.DiagnosticTag.Unnecessary;case Fe.DiagnosticTag.Deprecated:return B.DiagnosticTag.Deprecated;default:return}}function en(d){return{message:d.message,location:Zt(d.location)}}function xr(d){return d.map(en)}function ti(d){if(d!=null)return Ar.number(d)||Ar.string(d)?d:{value:d.value,target:r(d.target)}}function sr(d){let D=B.Diagnostic.create(Oe(d.range),d.message),$=d instanceof o_.ProtocolDiagnostic?d:void 0;$!==void 0&&$.data!==void 0&&(D.data=$.data);let ge=ti(d.code);return o_.DiagnosticCode.is(ge)?$!==void 0&&$.hasDiagnosticCode?D.code=ge:(D.code=ge.value,D.codeDescription={href:ge.target}):D.code=ge,Ar.number(d.severity)&&(D.severity=ir(d.severity)),Array.isArray(d.tags)&&(D.tags=ei(d.tags)),d.relatedInformation&&(D.relatedInformation=xr(d.relatedInformation)),d.source&&(D.source=d.source),D}function or(d,D){return d==null?d:i_.map(d,sr,D)}function ar(d){return d==null?d:d.map(sr)}function Wi(d,D){switch(d){case"$string":return D;case B.MarkupKind.PlainText:return{kind:d,value:D};case B.MarkupKind.Markdown:return{kind:d,value:D.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function ni(d){if(d===Fe.CompletionItemTag.Deprecated)return B.CompletionItemTag.Deprecated}function wt(d){if(d===void 0)return d;let D=[];for(let $ of d){let ge=ni($);ge!==void 0&&D.push(ge)}return D}function zi(d,D){return D!==void 0?D:d+1}function tn(d,D=!1){let $,ge;Ar.string(d.label)?$=d.label:($=d.label.label,D&&(d.label.detail!==void 0||d.label.description!==void 0)&&(ge={detail:d.label.detail,description:d.label.description}));let ce={label:$};ge!==void 0&&(ce.labelDetails=ge);let Ze=d instanceof qw.default?d:void 0;d.detail&&(ce.detail=d.detail),d.documentation&&(!Ze||Ze.documentationFormat==="$string"?ce.documentation=d.documentation:ce.documentation=Wi(Ze.documentationFormat,d.documentation)),d.filterText&&(ce.filterText=d.filterText),cr(ce,d),Ar.number(d.kind)&&(ce.kind=zi(d.kind,Ze&&Ze.originalItemKind)),d.sortText&&(ce.sortText=d.sortText),d.additionalTextEdits&&(ce.additionalTextEdits=ri(d.additionalTextEdits)),d.commitCharacters&&(ce.commitCharacters=d.commitCharacters.slice()),d.command&&(ce.command=ae(d.command)),(d.preselect===!0||d.preselect===!1)&&(ce.preselect=d.preselect);let mt=wt(d.tags);if(Ze){if(Ze.data!==void 0&&(ce.data=Ze.data),Ze.deprecated===!0||Ze.deprecated===!1){if(Ze.deprecated===!0&&mt!==void 0&&mt.length>0){let Mn=mt.indexOf(Fe.CompletionItemTag.Deprecated);Mn!==-1&&mt.splice(Mn,1)}ce.deprecated=Ze.deprecated}Ze.insertTextMode!==void 0&&(ce.insertTextMode=Ze.insertTextMode)}return mt!==void 0&&mt.length>0&&(ce.tags=mt),ce.insertTextMode===void 0&&d.keepWhitespace===!0&&(ce.insertTextMode=B.InsertTextMode.adjustIndentation),ce}function cr(d,D){let $=B.InsertTextFormat.PlainText,ge,ce;D.textEdit?(ge=D.textEdit.newText,ce=D.textEdit.range):D.insertText instanceof Fe.SnippetString?($=B.InsertTextFormat.Snippet,ge=D.insertText.value):ge=D.insertText,D.range&&(ce=D.range),d.insertTextFormat=$,D.fromEdit&&ge!==void 0&&ce!==void 0?d.textEdit=ur(ge,ce):d.insertText=ge}function ur(d,D){return Nl.is(D)?B.InsertReplaceEdit.create(d,Oe(D.inserting),Oe(D.replacing)):{newText:d,range:Oe(D)}}function On(d){return{range:Oe(d.range),newText:d.newText}}function ri(d){return d==null?d:d.map(On)}function tt(d){return d<=Fe.SymbolKind.TypeParameter?d+1:B.SymbolKind.Property}function Ut(d){return d}function nt(d){return d.map(Ut)}function Ki(d,D,$){return{textDocument:i(d),position:Rn(D),context:{includeDeclaration:$.includeDeclaration}}}async function Ye(d,D){let $=B.CodeAction.create(d.title);if(d instanceof s_.default&&d.data!==void 0&&($.data=d.data),d.kind!==void 0&&($.kind=It(d.kind)),d.diagnostics!==void 0&&($.diagnostics=await or(d.diagnostics,D)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&($.command=ae(d.command)),d.isPreferred!==void 0&&($.isPreferred=d.isPreferred),d.disabled!==void 0&&($.disabled={reason:d.disabled.reason}),d.isAI&&($.tags??=[],$.tags.push(B.CodeActionTag.LLMGenerated)),$}function En(d){let D=B.CodeAction.create(d.title);if(d instanceof s_.default&&d.data!==void 0&&(D.data=d.data),d.kind!==void 0&&(D.kind=It(d.kind)),d.diagnostics!==void 0&&(D.diagnostics=ar(d.diagnostics)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(D.command=ae(d.command)),d.isPreferred!==void 0&&(D.isPreferred=d.isPreferred),d.disabled!==void 0&&(D.disabled={reason:d.disabled.reason}),d.isAI&&(D.tags??=[],D.tags.push(B.CodeActionTag.LLMGenerated)),D}async function ii(d,D){if(d==null)return d;let $;return d.only&&Ar.string(d.only.value)&&($=[d.only.value]),B.CodeActionContext.create(await or(d.diagnostics,D),$,lr(d.triggerKind))}function Ir(d){if(d==null)return d;let D;return d.only&&Ar.string(d.only.value)&&(D=[d.only.value]),B.CodeActionContext.create(ar(d.diagnostics),D,lr(d.triggerKind))}function lr(d){switch(d){case Fe.CodeActionTriggerKind.Invoke:return B.CodeActionTriggerKind.Invoked;case Fe.CodeActionTriggerKind.Automatic:return B.CodeActionTriggerKind.Automatic;default:return}}function It(d){if(d!=null)return d.value}function y(d){return B.InlineValueContext.create(d.frameId,Oe(d.stoppedLocation))}function E(d,D,$){return{textDocument:i(d),position:xt(D),context:I($)}}function I(d){return{triggerKind:H(d.triggerKind),selectedCompletionInfo:Z(d.selectedCompletionInfo)}}function H(d){switch(d){case Fe.InlineCompletionTriggerKind.Invoke:return B.InlineCompletionTriggerKind.Invoked;case Fe.InlineCompletionTriggerKind.Automatic:return B.InlineCompletionTriggerKind.Automatic}}function Z(d){if(d!=null)return{range:Oe(d.range),text:d.text}}function ae(d){let D=B.Command.create(d.title,d.command);return d.tooltip&&(D.tooltip=d.tooltip),d.arguments&&(D.arguments=d.arguments),D}function ie(d){let D=B.CodeLens.create(Oe(d.range));return d.command&&(D.command=ae(d.command)),d instanceof Mw.default&&d.data&&(D.data=d.data),D}function Ee(d,D){let $={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return D.trimTrailingWhitespace&&($.trimTrailingWhitespace=!0),D.trimFinalNewlines&&($.trimFinalNewlines=!0),D.insertFinalNewline&&($.insertFinalNewline=!0),$}function ke(d){return{textDocument:i(d)}}function pe(d){return{textDocument:i(d)}}function ye(d){let D=B.DocumentLink.create(Oe(d.range));d.target&&(D.target=r(d.target)),d.tooltip!==void 0&&(D.tooltip=d.tooltip);let $=d instanceof xw.default?d:void 0;return $&&$.data&&(D.data=$.data),D}function rt(d){return{textDocument:i(d)}}function pt(d){let D={name:d.name,kind:tt(d.kind),uri:r(d.uri),range:Oe(d.range),selectionRange:Oe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(D.detail=d.detail),d.tags!==void 0&&(D.tags=nt(d.tags)),d instanceof Iw.default&&d.data!==void 0&&(D.data=d.data),D}function qn(d){let D={name:d.name,kind:tt(d.kind),uri:r(d.uri),range:Oe(d.range),selectionRange:Oe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(D.detail=d.detail),d.tags!==void 0&&(D.tags=nt(d.tags)),d instanceof Nw.default&&d.data!==void 0&&(D.data=d.data),D}function Dt(d){let D=d instanceof jw.default?{name:d.name,kind:tt(d.kind),location:d.hasRange?Zt(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:tt(d.kind),location:Zt(d.location)};return d.tags!==void 0&&(D.tags=nt(d.tags)),d.containerName!==""&&(D.containerName=d.containerName),D}function gt(d){let D=typeof d.label=="string"?d.label:d.label.map(si),$=B.InlayHint.create(xt(d.position),D);return d.kind!==void 0&&($.kind=d.kind),d.textEdits!==void 0&&($.textEdits=ri(d.textEdits)),d.tooltip!==void 0&&($.tooltip=ks(d.tooltip)),d.paddingLeft!==void 0&&($.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&($.paddingRight=d.paddingRight),d instanceof Fw.default&&d.data!==void 0&&($.data=d.data),$}function si(d){let D=B.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(D.location=Zt(d.location)),d.command!==void 0&&(D.command=ae(d.command)),d.tooltip!==void 0&&(D.tooltip=ks(d.tooltip)),D}function ks(d){return typeof d=="string"?d:{kind:B.MarkupKind.Markdown,value:d.value}}return{asUri:r,asTextDocumentIdentifier:i,asTextDocumentItem:s,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:a,asChangeTextDocumentParams:f,asCloseTextDocumentParams:p,asSaveTextDocumentParams:h,asWillSaveTextDocumentParams:_,asDidCreateFilesParams:v,asDidRenameFilesParams:R,asDidDeleteFilesParams:q,asWillCreateFilesParams:w,asWillRenameFilesParams:M,asWillDeleteFilesParams:j,asTextDocumentPositionParams:F,asCompletionParams:te,asSignatureHelpParams:Mt,asWorkerPosition:Rn,asRange:Oe,asRanges:Ui,asPosition:xt,asPositions:Tn,asPositionsSync:Ht,asLocation:Zt,asDiagnosticSeverity:ir,asDiagnosticTag:Mr,asDiagnostic:sr,asDiagnostics:or,asDiagnosticsSync:ar,asCompletionItem:tn,asTextEdit:On,asSymbolKind:tt,asSymbolTag:Ut,asSymbolTags:nt,asReferenceParams:Ki,asCodeAction:Ye,asCodeActionSync:En,asCodeActionContext:ii,asCodeActionContextSync:Ir,asInlineValueContext:y,asCommand:ae,asCodeLens:ie,asFormattingOptions:Ee,asDocumentSymbolParams:ke,asCodeLensParams:pe,asDocumentLink:ye,asDocumentLinkParams:rt,asCallHierarchyItem:pt,asTypeHierarchyItem:qn,asInlayHint:gt,asWorkspaceSymbol:Dt,asInlineCompletionParams:E,asInlineCompletionContext:I}}});var l_=P(Vt=>{"use strict";var Aw=Vt&&Vt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),kw=Vt&&Vt.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),qo=Vt&&Vt.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;iN.Uri.parse(c));function o(c){return s(c)}function a(c){let b=[];for(let T of c)if(typeof T=="string")b.push(T);else if(u_.NotebookCellTextDocumentFilter.is(T))if(typeof T.notebook=="string")b.push({notebookType:T.notebook,language:T.language});else{let L=T.notebook.notebookType??"*";b.push({notebookType:L,scheme:T.notebook.scheme,pattern:Ra(T.notebook.pattern),language:T.language})}else u_.TextDocumentFilter.is(T)&&b.push({language:T.language,scheme:T.scheme,pattern:Ra(T.pattern)});return b}async function u(c,b){return se.map(c,f,b)}function l(c){let b=new Array(c.length);for(let T=0;T0?b:void 0}function g(c){switch(c){case z.DiagnosticTag.Unnecessary:return N.DiagnosticTag.Unnecessary;case z.DiagnosticTag.Deprecated:return N.DiagnosticTag.Deprecated;default:return}}function _(c){return c?new N.Position(c.line,c.character):void 0}function v(c){return c?new N.Range(c.start.line,c.start.character,c.end.line,c.end.character):void 0}async function R(c,b){return se.map(c,T=>new N.Range(T.start.line,T.start.character,T.end.line,T.end.character),b)}function q(c){if(c==null)return N.DiagnosticSeverity.Error;switch(c){case z.DiagnosticSeverity.Error:return N.DiagnosticSeverity.Error;case z.DiagnosticSeverity.Warning:return N.DiagnosticSeverity.Warning;case z.DiagnosticSeverity.Information:return N.DiagnosticSeverity.Information;case z.DiagnosticSeverity.Hint:return N.DiagnosticSeverity.Hint}return N.DiagnosticSeverity.Error}function w(c){if(Rt.string(c))return j(c);if(Eo.is(c))return j().appendCodeblock(c.value,c.language);if(Array.isArray(c)){let b=[];for(let T of c){let L=j();Eo.is(T)?L.appendCodeblock(T.value,T.language):L.appendMarkdown(T),b.push(L)}return b}else return j(c)}function M(c){if(Rt.string(c))return c;switch(c.kind){case z.MarkupKind.Markdown:return j(c.value);case z.MarkupKind.PlainText:return c.value;default:return`Unsupported Markup content received. Kind is: ${c.kind}`}}function j(c){let b;if(c===void 0||typeof c=="string")b=new N.MarkdownString(c);else switch(c.kind){case z.MarkupKind.Markdown:b=new N.MarkdownString(c.value);break;case z.MarkupKind.PlainText:b=new N.MarkdownString,b.appendText(c.value);break;default:b=new N.MarkdownString,b.appendText(`Unsupported Markup content received. Kind is: ${c.kind}`);break}return b.isTrusted=e,b.supportHtml=t,b.supportThemeIcons=r,b}function F(c){if(c)return new N.Hover(w(c.contents),v(c.range))}async function oe(c,b,T){if(!c)return;if(Array.isArray(c))return se.map(c,xn=>rr(xn,b),T);let L=c,{defaultRange:qe,commitCharacters:Le}=te(L,b),me=await se.map(L.items,xn=>rr(xn,Le,L.applyKind?.commitCharacters,qe,L.itemDefaults?.insertTextMode,L.itemDefaults?.insertTextFormat,L.itemDefaults?.data,L.applyKind?.data),T);return new N.CompletionList(me,L.isIncomplete)}function te(c,b){let T=c.itemDefaults?.editRange,L=c.itemDefaults?.commitCharacters??b;return z.Range.is(T)?{defaultRange:v(T),commitCharacters:L}:T!==void 0?{defaultRange:{inserting:v(T.insert),replacing:v(T.replace)},commitCharacters:L}:{defaultRange:void 0,commitCharacters:L}}function Te(c){return z.CompletionItemKind.Text<=c&&c<=z.CompletionItemKind.TypeParameter?[c-1,void 0]:[N.CompletionItemKind.Text,c]}function Pn(c){if(c===z.CompletionItemTag.Deprecated)return N.CompletionItemTag.Deprecated}function Qr(c){if(c==null)return[];let b=[];for(let T of c){let L=Pn(T);L!==void 0&&b.push(L)}return b}function rr(c,b,T,L,qe,Le,me,xn){let dr=Qr(c.tags),Nt=Mt(c),$e=new $w.default(Nt);c.detail&&($e.detail=c.detail),c.documentation&&($e.documentation=M(c.documentation),$e.documentationFormat=Rt.string(c.documentation)?"$string":c.documentation.kind),c.filterText&&($e.filterText=c.filterText);let $s=Rn(c,L,Le);if($s&&($e.insertText=$s.text,$e.range=$s.range,$e.fromEdit=$s.fromEdit),Rt.number(c.kind)){let[hb,Nh]=Te(c.kind);$e.kind=hb,Nh&&($e.originalItemKind=Nh)}c.sortText&&($e.sortText=c.sortText),c.additionalTextEdits&&($e.additionalTextEdits=Oe(c.additionalTextEdits));let xh=Yr(c,b,T);xh&&($e.commitCharacters=xh.slice()),c.command&&($e.command=nt(c.command)),(c.deprecated===!0||c.deprecated===!1)&&($e.deprecated=c.deprecated,c.deprecated===!0&&dr.push(N.CompletionItemTag.Deprecated)),(c.preselect===!0||c.preselect===!1)&&($e.preselect=c.preselect);let Ih=Zr(c,me,xn);Ih!==void 0&&($e.data=Ih),dr.length>0&&($e.tags=dr);let Oa=c.insertTextMode??qe;return Oa!==void 0&&($e.insertTextMode=Oa,Oa===z.InsertTextMode.asIs&&($e.keepWhitespace=!0)),$e}function Yr(c,b,T){if(T===z.ApplyKind.Merge){if(!b&&!c.commitCharacters)return;let L=new Set;if(b)for(let qe of b)L.add(qe);if(Rt.stringArray(c.commitCharacters))for(let qe of c.commitCharacters)L.add(qe);return Array.from(L)}return c.commitCharacters!==void 0?Rt.stringArray(c.commitCharacters)?c.commitCharacters:void 0:b}function Zr(c,b,T){if(T===z.ApplyKind.Merge){let L={...b};return c.data&&Object.entries(c.data).forEach(([qe,Le])=>{Le!=null&&(L[qe]=Le)}),L}return c.data??b}function Mt(c){return z.CompletionItemLabelDetails.is(c.labelDetails)?{label:c.label,detail:c.labelDetails.detail,description:c.labelDetails.description}:c.label}function Rn(c,b,T){let L=c.insertTextFormat??T;if(c.textEdit!==void 0||b!==void 0){let[qe,Le]=c.textEdit!==void 0?xt(c.textEdit):[b,c.textEditText??c.label];return L===z.InsertTextFormat.Snippet?{text:new N.SnippetString(Le),range:qe,fromEdit:!0}:{text:Le,range:qe,fromEdit:!0}}else return c.insertText?L===z.InsertTextFormat.Snippet?{text:new N.SnippetString(c.insertText),fromEdit:!1}:{text:c.insertText,fromEdit:!1}:void 0}function xt(c){return z.InsertReplaceEdit.is(c)?[{inserting:v(c.insert),replacing:v(c.replace)},c.newText]:[v(c.range),c.newText]}function Tn(c){if(c)return new N.TextEdit(v(c.range),c.newText)}async function Ht(c,b){if(c)return se.map(c,Tn,b)}function Oe(c){if(!c)return;let b=new Array(c.length);for(let T=0;T0){let T=[];for(let L of c.children)T.push(tt(L));b.children=T}return b}function Ut(c,b){c.tags=ur(b.tags),b.deprecated&&(c.tags?c.tags.includes(N.SymbolTag.Deprecated)||(c.tags=c.tags.concat(N.SymbolTag.Deprecated)):c.tags=[N.SymbolTag.Deprecated])}function nt(c){let b={title:c.title,command:c.command};return c.tooltip&&(b.tooltip=c.tooltip),c.arguments&&(b.arguments=c.arguments),b}async function Ki(c,b){if(c)return se.map(c,nt,b)}let Ye=new Map;Ye.set(z.CodeActionKind.Empty,N.CodeActionKind.Empty),Ye.set(z.CodeActionKind.QuickFix,N.CodeActionKind.QuickFix),Ye.set(z.CodeActionKind.Refactor,N.CodeActionKind.Refactor),Ye.set(z.CodeActionKind.RefactorExtract,N.CodeActionKind.RefactorExtract),Ye.set(z.CodeActionKind.RefactorInline,N.CodeActionKind.RefactorInline),Ye.set(z.CodeActionKind.RefactorRewrite,N.CodeActionKind.RefactorRewrite),Ye.set(z.CodeActionKind.Source,N.CodeActionKind.Source),Ye.set(z.CodeActionKind.SourceOrganizeImports,N.CodeActionKind.SourceOrganizeImports);function En(c){if(c==null)return;let b=Ye.get(c);if(b)return b;let T=c.split(".");b=N.CodeActionKind.Empty;for(let L of T)b=b.append(L);return b}function ii(c){if(c!=null)return c.map(b=>En(b))}function Ir(c){if(c!=null)return c.map(b=>({kind:En(b.kind),command:nt(b.command)}))}async function lr(c,b){if(c==null)return;let T=new Ww.default(c.title,c.data);return c.kind!==void 0&&(T.kind=En(c.kind)),c.diagnostics!==void 0&&(T.diagnostics=l(c.diagnostics)),c.edit!==void 0&&(T.edit=await I(c.edit,b)),c.command!==void 0&&(T.command=nt(c.command)),c.isPreferred!==void 0&&(T.isPreferred=c.isPreferred),c.disabled!==void 0&&(T.disabled={reason:c.disabled.reason}),c.tags?.includes(z.CodeActionTag.LLMGenerated)&&(T.isAI=!0),T}function It(c,b){return se.mapAsync(c,async T=>z.Command.is(T)?nt(T):lr(T,b),b)}function y(c){if(!c)return;let b=new Hw.default(v(c.range));return c.command&&(b.command=nt(c.command)),c.data!==void 0&&c.data!==null&&(b.data=c.data),b}async function E(c,b){if(c)return se.map(c,y,b)}async function I(c,b){if(!c)return;let T=new Map;if(c.changeAnnotations!==void 0){let Le=c.changeAnnotations;await se.forEach(Object.keys(Le),me=>{let xn=H(Le[me]);T.set(me,xn)},b)}let L=Le=>{if(Le!==void 0)return T.get(Le)},qe=new N.WorkspaceEdit;if(c.documentChanges){let Le=c.documentChanges;await se.forEach(Le,me=>{if(z.CreateFile.is(me))qe.createFile(s(me.uri),me.options,L(me.annotationId));else if(z.RenameFile.is(me))qe.renameFile(s(me.oldUri),s(me.newUri),me.options,L(me.annotationId));else if(z.DeleteFile.is(me))qe.deleteFile(s(me.uri),me.options,L(me.annotationId));else if(z.TextDocumentEdit.is(me)){let xn=s(me.textDocument.uri),dr=[];for(let Nt of me.edits)z.AnnotatedTextEdit.is(Nt)?dr.push([new N.TextEdit(v(Nt.range),Nt.newText),L(Nt.annotationId)]):z.SnippetTextEdit.is(Nt)?dr.push([new N.SnippetTextEdit(v(Nt.range),new N.SnippetString(Nt.snippet.value)),L(Nt.annotationId)]):dr.push([new N.TextEdit(v(Nt.range),Nt.newText),void 0]);qe.set(xn,dr)}else throw new Error(`Unknown workspace edit change received: +${JSON.stringify(me,void 0,4)}`)},b)}else if(c.changes){let Le=c.changes;await se.forEach(Object.keys(Le),me=>{qe.set(s(me),Oe(Le[me]))},b)}return qe}function H(c){if(c!==void 0)return{label:c.label,needsConfirmation:!!c.needsConfirmation,description:c.description}}function Z(c){let b=v(c.range),T=c.target?o(c.target):void 0,L=new Uw.default(b,T);return c.tooltip!==void 0&&(L.tooltip=c.tooltip),c.data!==void 0&&c.data!==null&&(L.data=c.data),L}async function ae(c,b){if(c)return se.map(c,Z,b)}function ie(c){return new N.Color(c.red,c.green,c.blue,c.alpha)}function Ee(c){return new N.ColorInformation(v(c.range),ie(c.color))}async function ke(c,b){if(c)return se.map(c,Ee,b)}function pe(c){let b=new N.ColorPresentation(c.label);return b.additionalTextEdits=Oe(c.additionalTextEdits),c.textEdit&&(b.textEdit=Tn(c.textEdit)),b}async function ye(c,b){if(c)return se.map(c,pe,b)}function rt(c){if(c)switch(c){case z.FoldingRangeKind.Comment:return N.FoldingRangeKind.Comment;case z.FoldingRangeKind.Imports:return N.FoldingRangeKind.Imports;case z.FoldingRangeKind.Region:return N.FoldingRangeKind.Region}}function pt(c){return new N.FoldingRange(c.startLine,c.endLine,rt(c.kind))}async function qn(c,b){if(c)return se.map(c,pt,b)}function Dt(c){return new N.SelectionRange(v(c.range),c.parent?Dt(c.parent):void 0)}async function gt(c,b){return Array.isArray(c)?se.map(c,Dt,b):[]}function si(c){return z.InlineValueText.is(c)?new N.InlineValueText(v(c.range),c.text):z.InlineValueVariableLookup.is(c)?new N.InlineValueVariableLookup(v(c.range),c.variableName,c.caseSensitiveLookup):new N.InlineValueEvaluatableExpression(v(c.range),c.expression)}async function ks(c,b){return Array.isArray(c)?se.map(c,si,b):[]}async function d(c,b){let T=typeof c.label=="string"?c.label:await se.map(c.label,D,b),L=new Gw.default(_(c.position),T);return c.kind!==void 0&&(L.kind=c.kind),c.textEdits!==void 0&&(L.textEdits=await Ht(c.textEdits,b)),c.tooltip!==void 0&&(L.tooltip=$(c.tooltip)),c.paddingLeft!==void 0&&(L.paddingLeft=c.paddingLeft),c.paddingRight!==void 0&&(L.paddingRight=c.paddingRight),c.data!==void 0&&(L.data=c.data),L}function D(c){let b=new N.InlayHintLabelPart(c.value);return c.location!==void 0&&(b.location=en(c.location)),c.tooltip!==void 0&&(b.tooltip=$(c.tooltip)),c.command!==void 0&&(b.command=nt(c.command)),b}function $(c){return typeof c=="string"?c:j(c)}async function ge(c,b){if(Array.isArray(c))return se.mapAsync(c,d,b)}function ce(c){if(c===null)return;let b=new zw.default(tn(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(b.tags=ur(c.tags)),b}async function Ze(c,b){if(c!==null)return se.map(c,ce,b)}async function mt(c,b){return new N.CallHierarchyIncomingCall(ce(c.from),await R(c.fromRanges,b))}async function Mn(c,b){if(c!==null)return se.mapAsync(c,mt,b)}async function Eh(c,b){return new N.CallHierarchyOutgoingCall(ce(c.to),await R(c.fromRanges,b))}async function sb(c,b){if(c!==null)return se.mapAsync(c,Eh,b)}async function ob(c,b){if(c!=null)return new N.SemanticTokens(new Uint32Array(c.data),c.resultId)}function qh(c){return new N.SemanticTokensEdit(c.start,c.deleteCount,c.data!==void 0?new Uint32Array(c.data):void 0)}async function ab(c,b){if(c!=null)return new N.SemanticTokensEdits(c.edits.map(qh),c.resultId)}function cb(c){return c}async function ub(c,b){if(c!=null)return new N.LinkedEditingRanges(await R(c.ranges,b),lb(c.wordPattern))}function lb(c){if(c!=null)return new RegExp(c)}function Mh(c){if(c===null)return;let b=new Kw.default(tn(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(b.tags=ur(c.tags)),b}async function db(c,b){if(c!==null)return se.map(c,Mh,b)}function Ra(c){if(Rt.string(c))return c;if(z.RelativePattern.is(c)){if(z.URI.is(c.baseUri))return new N.RelativePattern(o(c.baseUri),c.pattern);if(z.WorkspaceFolder.is(c.baseUri)){let b=N.workspace.getWorkspaceFolder(o(c.baseUri.uri));return b!==void 0?new N.RelativePattern(b,c.pattern):void 0}}}async function fb(c,b){if(!c)return;if(Array.isArray(c))return se.map(c,qe=>Ta(qe),b);let T=c,L=await se.map(T.items,qe=>Ta(qe),b);return new N.InlineCompletionList(L)}function Ta(c){let b;typeof c.insertText=="string"?b=c.insertText:b=new N.SnippetString(c.insertText.value);let T;c.command&&(T=nt(c.command));let L=new N.InlineCompletionItem(b,v(c.range),T);return c.filterText&&(L.filterText=c.filterText),L}return{asUri:o,asDocumentSelector:a,asDiagnostics:u,asDiagnostic:f,asRange:v,asRanges:R,asPosition:_,asDiagnosticSeverity:q,asDiagnosticTag:g,asHover:F,asCompletionResult:oe,asCompletionItem:rr,asTextEdit:Tn,asTextEdits:Ht,asSignatureHelp:Ui,asSignatureInformations:Zt,asSignatureInformation:ir,asParameterInformations:ei,asParameterInformation:Mr,asDeclarationResult:xr,asDefinitionResult:ti,asLocation:en,asReferences:ar,asDocumentHighlights:Wi,asDocumentHighlight:ni,asDocumentHighlightKind:wt,asSymbolKind:tn,asSymbolTag:cr,asSymbolTags:ur,asSymbolInformations:zi,asSymbolInformation:On,asDocumentSymbols:ri,asDocumentSymbol:tt,asCommand:nt,asCommands:Ki,asCodeAction:lr,asCodeActionKind:En,asCodeActionKinds:ii,asCodeActionDocumentations:Ir,asCodeActionResult:It,asCodeLens:y,asCodeLenses:E,asWorkspaceEdit:I,asDocumentLink:Z,asDocumentLinks:ae,asFoldingRangeKind:rt,asFoldingRange:pt,asFoldingRanges:qn,asColor:ie,asColorInformation:Ee,asColorInformations:ke,asColorPresentation:pe,asColorPresentations:ye,asSelectionRange:Dt,asSelectionRanges:gt,asInlineValue:si,asInlineValues:ks,asInlayHint:d,asInlayHints:ge,asSemanticTokensLegend:cb,asSemanticTokens:ob,asSemanticTokensEdit:qh,asSemanticTokensEdits:ab,asCallHierarchyItem:ce,asCallHierarchyItems:Ze,asCallHierarchyIncomingCall:mt,asCallHierarchyIncomingCalls:Mn,asCallHierarchyOutgoingCall:Eh,asCallHierarchyOutgoingCalls:sb,asLinkedEditingRanges:ub,asTypeHierarchyItem:Mh,asTypeHierarchyItems:db,asGlobPattern:Ra,asInlineCompletionResult:fb,asInlineCompletionItem:Ta}}});var we=P(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.empty=void 0;Pr.v4=d_;Pr.isUUID=f_;Pr.parse=Jw;Pr.generateUuid=Qw;var fs=class{_value;constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},jl=class n extends fs{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return n._oneOf(n._chars)}constructor(){super([n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),"-",n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),"-","4",n._randomHex(),n._randomHex(),n._randomHex(),"-",n._oneOf(n._timeHighBits),n._randomHex(),n._randomHex(),n._randomHex(),"-",n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex(),n._randomHex()].join(""))}};Pr.empty=new fs("00000000-0000-0000-0000-000000000000");function d_(){return new jl}var Xw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function f_(n){return Xw.test(n)}function Jw(n){if(!f_(n))throw new Error("invalid uuid");return new fs(n)}function Qw(){return d_().asHex()}});var Ll=P(on=>{"use strict";var Yw=on&&on.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Zw=on&&on.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),eD=on&&on.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),r&&r(this);break}})}begin(e){this._infinite=e.percentage===void 0,this._lspProgressDisposable!==void 0&&h_.window.withProgress({location:h_.ProgressLocation.Window,cancellable:e.cancellable,title:e.title},async(t,r)=>{if(this._lspProgressDisposable!==void 0)return this._progress=t,this._cancellationToken=r,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(p_.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,s)=>{this._resolve=i,this._reject=s})})}report(e){if(this._infinite&&g_.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(g_.number(e.percentage)){let t=Math.max(0,Math.min(e.percentage,100)),r=Math.max(0,t-this._reported);this._reported+=r,this._progress!==void 0&&this._progress.report({message:e.message,increment:r})}}cancel(){this.cleanup(),this._reject!==void 0&&(this._reject(),this._resolve=void 0,this._reject=void 0)}done(){this.cleanup(),this._resolve!==void 0&&(this._resolve(),this._resolve=void 0,this._reject=void 0)}cleanup(){this._lspProgressDisposable!==void 0&&(this._lspProgressDisposable.dispose(),this._lspProgressDisposable=void 0),this._tokenDisposable!==void 0&&(this._tokenDisposable.dispose(),this._tokenDisposable=void 0),this._progress=void 0,this._cancellationToken=void 0}};on.ProgressPart=Fl});var ne=P(_e=>{"use strict";var tD=_e&&_e.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),nD=_e&&_e.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),b_=_e&&_e.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}let r=t>0;return{kind:"document",id:this.registrationType.method,registrations:r,matches:!1}}};_e.DynamicDocumentFeature=hs;var $l=class extends hs{_event;_type;_middleware;_createParams;_textDocument;_selectorFilter;_listener;_selectors;_onAboutToSendNotification;_onNotificationSent;static textDocumentFilter(e,t){for(let r of e)if(Xt.languages.match(r,t)>0)return!0;return!1}constructor(e,t,r,i,s,o,a){super(e),this._event=t,this._type=r,this._middleware=i,this._createParams=s,this._textDocument=o,this._selectorFilter=a,this._selectors=new Map,this._onAboutToSendNotification=new Xt.EventEmitter,this._onNotificationSent=new Xt.EventEmitter}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=this._event(t=>{this.callback(t).catch(r=>{this._client.error(`Sending document notification ${this._type.method} failed.`,r)})})),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}async callback(e){let t=async r=>{let i=this.getTextDocument(r),s=this._createParams(r);this.aboutToSendNotification(i,this._type,s),await this._client.sendNotification(this._type,s),this.notificationSent(i,this._type,s)};if(this.matches(e)){let r=this._middleware();return r?r(e,i=>t(i)):t(e)}}matches(e){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(e))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),e)}get onAboutToSendNotification(){return this._onAboutToSendNotification.event}aboutToSendNotification(e,t,r){this._onAboutToSendNotification.fire({textDocument:e,type:t,params:r})}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(e,t,r){this._onNotificationSent.fire({textDocument:e,type:t,params:r})}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._onNotificationSent.dispose(),this._onNotificationSent=new Xt.EventEmitter,this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Xt.languages.match(t,e)>0)return{send:r=>this.callback(r)}}};_e.TextDocumentEventFeature=$l;var Hl=class extends hs{_registrationType;_registrations;constructor(e,t){super(e),this._registrationType=t,this._registrations=new Map}*getDocumentSelectors(){for(let e of this._registrations.values()){let t=e.data.registerOptions.documentSelector;t!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(t))}}get registrationType(){return this._registrationType}register(e){if(!e.registerOptions.documentSelector)return;let t=this.registerLanguageProvider(e.registerOptions,e.id);this._registrations.set(e.id,{disposable:t[0],data:e,provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(Al.TextDocumentRegistrationOptions.is(t)){let r=Al.StaticRegistrationOptions.hasId(t)?t.id:m_.generateUuid(),i=t.documentSelector??e;if(i)return[r,Object.assign({},t,{documentSelector:i})]}else if(ft.boolean(t)&&t===!0||Al.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let r=ft.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[m_.generateUuid(),r]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return ft.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e})}getProvider(e){for(let t of this._registrations.values()){let r=t.data.registerOptions.documentSelector;if(r!==null&&Xt.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(r),e)>0)return t.provider}}getAllProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};_e.TextDocumentLanguageFeature=Hl;var Ul=class{_client;_registrationType;_registrations;constructor(e,t){this._client=e,this._registrationType=t,this._registrations=new Map}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:e}}get registrationType(){return this._registrationType}register(e){let t=this.registerLanguageProvider(e.registerOptions);this._registrations.set(e.id,{disposable:t[0],provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};_e.WorkspaceFeature=Ul;var v_;(function(n){n.push="push",n.pull="pull"})(v_||(_e.DiagnosticCollectionSource=v_={}));var Wl=class{create(e,t){return e!==void 0?Xt.languages.createDiagnosticCollection(e):Xt.languages.createDiagnosticCollection()}dispose(e,t){e.dispose()}};_e.DefaultDiagnosticCollectionProvider=Wl});var w_=P(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.range=kr.balanced=void 0;var iD=(n,e,t)=>{let r=n instanceof RegExp?C_(n,t):n,i=e instanceof RegExp?C_(e,t):e,s=r!==null&&i!=null&&(0,kr.range)(r,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+r.length,s[1]),post:t.slice(s[1]+i.length)}};kr.balanced=iD;var C_=(n,e)=>{let t=e.match(n);return t?t[0]:null},sD=(n,e,t)=>{let r,i,s,o,a,u=t.indexOf(n),l=t.indexOf(e,u+1),f=u;if(u>=0&&l>0){if(n===e)return[u,l];for(r=[],s=t.length;f>=0&&!a;){if(f===u)r.push(f),u=t.indexOf(n,f+1);else if(r.length===1){let p=r.pop();p!==void 0&&(a=[p,l])}else i=r.pop(),i!==void 0&&i=0?u:l}r.length&&o!==void 0&&(a=[s,o])}return a};kr.range=sD});var E_=P(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.EXPANSION_MAX_LENGTH=Gn.EXPANSION_MAX=void 0;Gn.expand=yD;var D_=w_(),S_="\0SLASH"+Math.random()+"\0",P_="\0OPEN"+Math.random()+"\0",Bl="\0CLOSE"+Math.random()+"\0",R_="\0COMMA"+Math.random()+"\0",T_="\0PERIOD"+Math.random()+"\0",oD=new RegExp(S_,"g"),aD=new RegExp(P_,"g"),cD=new RegExp(Bl,"g"),uD=new RegExp(R_,"g"),lD=new RegExp(T_,"g"),dD=/\\\\/g,fD=/\\{/g,hD=/\\}/g,pD=/\\,/g,gD=/\\\./g;Gn.EXPANSION_MAX=1e5;Gn.EXPANSION_MAX_LENGTH=4e6;function zl(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function mD(n){return n.replace(dD,S_).replace(fD,P_).replace(hD,Bl).replace(pD,R_).replace(gD,T_)}function _D(n){return n.replace(oD,"\\").replace(aD,"{").replace(cD,"}").replace(uD,",").replace(lD,".")}function O_(n){if(!n)return[""];let e=[],t=(0,D_.balanced)("{","}",n);if(!t)return n.split(",");let{pre:r,body:i,post:s}=t,o=r.split(",");o[o.length-1]+="{"+i+"}";let a=O_(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function yD(n,e={}){if(!n)return[];let{max:t=Gn.EXPANSION_MAX,maxLength:r=Gn.EXPANSION_MAX_LENGTH}=e;return n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),Kl(mD(n),t,r,!0).map(_D)}function vD(n){return"{"+n+"}"}function bD(n){return/^-?0\d/.test(n)}function CD(n,e){return n<=e}function wD(n,e){return n>=e}function ps(n,e,t,r,i,s){let o=[],a=0;for(let u=0;u=r)return o;let f=n[u]+e+t[l];if(!(s&&!f)){if(a+f.length>i)return o;o.push(f),a+=f.length}}return o}function DD(n,e,t,r){let i=n.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=zl(i[0]),a=zl(i[1]),u=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(zl(i[2])),1):1,f=CD;a0){let q=new Array(R+1).join("0");_<0?v="-"+q+v.slice(1):v=q+v}}if(g+v.length>r)break;s.push(v),g+=v.length}return s}function Kl(n,e,t,r){let i=[""],s=!1,o=!0;for(;;){let a=(0,D_.balanced)("{","}",n);if(!a)return ps(i,n,[""],e,t,s);let u=a.pre;if(/\$$/.test(u)){if(i=ps(i,u+"{"+a.body+"}",[""],e,t,s&&!a.post.length),o=!1,!a.post.length)break;n=a.post;continue}let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),p=l||f,h=a.body.indexOf(",")>=0;if(!p&&!h){if(a.post.match(/,(?!,).*\}/)){n=a.pre+"{"+a.body+Bl+a.post,r=!0;continue}return ps(i,u+"{"+a.body+"}"+a.post,[""],e,t,s)}o&&(s=r&&!p,o=!1);let g;if(p)g=DD(a.body,f,e,t);else{let _=O_(a.body);if(_.length===1&&_[0]!==void 0&&(_=Kl(_[0],e,t,!1).map(vD),_.length===1)){if(i=ps(i,u+_[0],[""],e,t,s&&!a.post.length),!a.post.length)break;n=a.post;continue}let v=s&&!a.post.length&&!u;for(let q=0;v&&q=e||R+j.length>t)break e;g.push(j),R+=j.length}}}}if(i=ps(i,u,g,e,t,s&&!a.post.length),!a.post.length)break;n=a.post}return i}});var q_=P(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.assertValidPattern=void 0;var SD=1024*64,PD=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>SD)throw new TypeError("pattern is too long")};Mo.assertValidPattern=PD});var x_=P(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.parseClass=void 0;var RD={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},gs=n=>n.replace(/[[\]\\-]/g,"\\$&"),TD=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),M_=n=>n.join(""),OD=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,o=!1,a=!1,u=!1,l=!1,f=t,p="";e:for(;sp?r.push(gs(p)+"-"+gs(v)):v===p&&r.push(gs(v)),p="",s++;continue}if(n.startsWith("-]",s+1)){r.push(gs(v+"-")),s+=2;continue}if(n.startsWith("-",s+1)){p=v,s+=2;continue}r.push(gs(v)),s++}if(f{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.unescape=void 0;var ED=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?n.replace(/\[([^/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?n.replace(/\[([^/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");Io.unescape=ED});var Xl=P(Ao=>{"use strict";var bt;Object.defineProperty(Ao,"__esModule",{value:!0});Ao.AST=void 0;var qD=x_(),jo=No(),MD=new Set(["!","?","+","*","@"]),Gl=n=>MD.has(n),I_=n=>Gl(n.type),xD=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),ID=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),ND=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),N_=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),jD="(?!(?:^|/)\\.\\.?(?:$|/))",Fo="(?!\\.)",FD=new Set(["[","."]),LD=new Set(["..","."]),AD=new Set("().*{}+?[]^$\\!"),kD=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vl="[^/]",j_=Vl+"*?",F_=Vl+"+?",$D=0,Lo=class{type;#n;#r;#i=!1;#e=[];#t;#a;#u;#c=!1;#s;#o;#l=!1;id=++$D;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,r={}){this.type=e,e&&(this.#r=!0),this.#t=t,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#_(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,r=t.#t;for(;r;){for(let i=t.#a+1;!r.type&&itypeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let t=0;ttypeof g!="string"),l=this.#e.map(g=>{let[_,v,R,q]=typeof g=="string"?bt.#D(g,this.#r,u):g.toRegExpSource(e);return this.#r=this.#r||R,this.#i=this.#i||q,_}).join(""),f="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&LD.has(this.#e[0]))){let _=FD,v=t&&_.has(l.charAt(0))||l.startsWith("\\.")&&_.has(l.charAt(2))||l.startsWith("\\.\\.")&&_.has(l.charAt(4)),R=!t&&!e&&_.has(l.charAt(0));f=v?jD:R?Fo:""}let p="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(p="(?:$|\\/)"),[f+l+p,(0,jo.unescape)(l),this.#r=!!this.#r,this.#i]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#m(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let u=this.toString(),l=this;return l.#e=[u],l.type=null,l.#r=void 0,[u,(0,jo.unescape)(this.toString()),!1,!1]}let o=!r||e||t||!Fo?"":this.#m(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?Fo:"")+F_;else{let u=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Fo:"")+j_+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+u}return[a,(0,jo.unescape)(s),this.#r=!!this.#r,this.#i]}#h(){if(I_(this)){let e=0,t=!1;do{t=!0;for(let r=0;r{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=t.toRegExpSource(e);return this.#i=this.#i||o,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#D(e,t,r=!1){let i=!1,s="",o=!1,a=!1;for(let u=0;u{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.escape=void 0;var HD=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");ko.escape=HD});var Ql=P(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.unescape=U.escape=U.AST=U.Minimatch=U.match=U.makeRe=U.braceExpand=U.defaults=U.filter=U.GLOBSTAR=U.sep=U.minimatch=void 0;var UD=E_(),$o=q_(),k_=Xl(),WD=Jl(),zD=No(),KD=(n,e,t={})=>((0,$o.assertValidPattern)(e),!t.nocomment&&e.charAt(0)==="#"?!1:new $r(e,t).match(n));U.minimatch=KD;var BD=/^\*+([^+@!?*[(]*)$/,GD=n=>e=>!e.startsWith(".")&&e.endsWith(n),VD=n=>e=>e.endsWith(n),XD=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),JD=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),QD=/^\*+\.\*+$/,YD=n=>!n.startsWith(".")&&n.includes("."),ZD=n=>n!=="."&&n!==".."&&n.includes("."),eS=/^\.\*+$/,tS=n=>n!=="."&&n!==".."&&n.startsWith("."),nS=/^\*+$/,rS=n=>n.length!==0&&!n.startsWith("."),iS=n=>n.length!==0&&n!=="."&&n!=="..",sS=/^\?+([^+@!?*[(]*)?$/,oS=([n,e=""])=>{let t=$_([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},aS=([n,e=""])=>{let t=H_([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},cS=([n,e=""])=>{let t=H_([n]);return e?r=>t(r)&&r.endsWith(e):t},uS=([n,e=""])=>{let t=$_([n]);return e?r=>t(r)&&r.endsWith(e):t},$_=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},H_=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},U_=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",L_={win32:{sep:"\\"},posix:{sep:"/"}};U.sep=U_==="win32"?L_.win32.sep:L_.posix.sep;U.minimatch.sep=U.sep;U.GLOBSTAR=Symbol("globstar **");U.minimatch.GLOBSTAR=U.GLOBSTAR;var lS="[^/]",dS=lS+"*?",fS="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",hS="(?:(?!(?:\\/|^)\\.).)*?",pS=(n,e={})=>t=>(0,U.minimatch)(t,n,e);U.filter=pS;U.minimatch.filter=U.filter;var kt=(n,e={})=>Object.assign({},n,e),gS=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return U.minimatch;let e=U.minimatch;return Object.assign((r,i,s={})=>e(r,i,kt(n,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,kt(n,s))}static defaults(i){return e.defaults(kt(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,kt(n,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,kt(n,s))}},unescape:(r,i={})=>e.unescape(r,kt(n,i)),escape:(r,i={})=>e.escape(r,kt(n,i)),filter:(r,i={})=>e.filter(r,kt(n,i)),defaults:r=>e.defaults(kt(n,r)),makeRe:(r,i={})=>e.makeRe(r,kt(n,i)),braceExpand:(r,i={})=>e.braceExpand(r,kt(n,i)),match:(r,i,s={})=>e.match(r,i,kt(n,s)),sep:e.sep,GLOBSTAR:U.GLOBSTAR})};U.defaults=gS;U.minimatch.defaults=U.defaults;var mS=(n,e={})=>((0,$o.assertValidPattern)(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,UD.expand)(n,{max:e.braceExpandMax}));U.braceExpand=mS;U.minimatch.braceExpand=U.braceExpand;var _S=(n,e={})=>new $r(n,e).makeRe();U.makeRe=_S;U.minimatch.makeRe=U.makeRe;var yS=(n,e,t={})=>{let r=new $r(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n};U.match=yS;U.minimatch.match=U.match;var A_=/[?*]|[+@!]\(.*?\)|\[|\]/,vS=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$r=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){(0,$o.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||U_,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=s[0]===""&&s[1]===""&&(s[2]==="?"||!A_.test(s[2]))&&!A_.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(u)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(l)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(u=>this.parse(u))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;ii&&r.splice(i+1,o-i);let a=r[i+1],u=r[i+2],l=r[i+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let o=1;ot.length)}partsMatch(e,t,r=!1){let i=0,s=0,o=[],a="";for(;i=2&&(e=this.levelTwoFileOptimize(e)),t.includes(U.GLOBSTAR)?this.#n(e,t,r,i,s):this.#i(e,t,r,i,s)}#n(e,t,r,i,s){let o=t.indexOf(U.GLOBSTAR,s),a=t.lastIndexOf(U.GLOBSTAR),[u,l,f]=r?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,a),t.slice(a+1)];if(u.length){let w=e.slice(i,i+u.length);if(!this.#i(w,u,r,0,0))return!1;i+=u.length,s+=u.length}let p=0;if(f.length){if(f.length+i>e.length)return!1;let w=e.length-f.length;if(this.#i(e,f,r,w,0))p=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(w--,!this.#i(e,f,r,w,0)))return!1;p=f.length+1}}if(!l.length){let w=!!p;for(let M=i;M{let l=u.map(p=>{if(p instanceof RegExp)for(let h of p.flags.split(""))i.add(h);return typeof p=="string"?vS(p):p===U.GLOBSTAR?U.GLOBSTAR:p._src});l.forEach((p,h)=>{let g=l[h+1],_=l[h-1];p!==U.GLOBSTAR||_===U.GLOBSTAR||(_===void 0?g!==void 0&&g!==U.GLOBSTAR?l[h+1]="(?:\\/|"+r+"\\/)?"+g:l[h]=r:g===void 0?l[h-1]=_+"(?:\\/|\\/"+r+")?":g!==U.GLOBSTAR&&(l[h-1]=_+"(?:\\/|\\/"+r+"\\/)"+g,l[h+1]=U.GLOBSTAR))});let f=l.filter(p=>p!==U.GLOBSTAR);if(this.partial&&f.length>=1){let p=[];for(let h=1;h<=f.length;h++)p.push(f.slice(0,h).join("/"));return"(?:"+p.join("|")+")"}return f.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let u=i;if(r.matchBase&&a.length===1&&(u=[o]),this.matchOne(u,a,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return U.minimatch.defaults(e).Minimatch}};U.Minimatch=$r;var bS=Xl();Object.defineProperty(U,"AST",{enumerable:!0,get:function(){return bS.AST}});var CS=Jl();Object.defineProperty(U,"escape",{enumerable:!0,get:function(){return CS.escape}});var wS=No();Object.defineProperty(U,"unescape",{enumerable:!0,get:function(){return wS.unescape}});U.minimatch.AST=k_.AST;U.minimatch.Minimatch=$r;U.minimatch.escape=WD.escape;U.minimatch.unescape=zD.unescape});var Yl=P(Vn=>{"use strict";var DS=Vn&&Vn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),SS=Vn&&Vn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),PS=Vn&&Vn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.DiagnosticFeature=Rr.DiagnosticPullMode=Rr.vsdiag=void 0;var De=require("vscode"),Se=V(),ES=we(),qS=Yl(),ms=ne();function Ho(n,e){return n[e]===void 0&&(n[e]={}),n[e]}var Tt;(function(n){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=n.DocumentDiagnosticReportKind||(n.DocumentDiagnosticReportKind={}))})(Tt||(Rr.vsdiag=Tt={}));var _s;(function(n){n.onType="onType",n.onSave="onSave",n.onFocus="onFocus"})(_s||(Rr.DiagnosticPullMode=_s={}));var Je;(function(n){n.active="open",n.reschedule="reschedule",n.outDated="drop"})(Je||(Je={}));var Ue;(function(n){n[n.document=1]="document",n[n.workspace=2]="workspace"})(Ue||(Ue={}));var Xn;(function(n){function e(t){return t instanceof De.Uri?t.toString():t.uri.toString()}n.asKey=e})(Xn||(Xn={}));var Zl=class{documentPullStates;workspacePullStates;constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,r){let i=e===Ue.document?this.documentPullStates:this.workspacePullStates,[s,o,a]=t instanceof De.Uri?[t.toString(),t,r]:[t.uri.toString(),t.uri,t.version],u=i.get(s);return u===void 0&&(u={document:o,pulledVersion:a,resultId:void 0},i.set(s,u)),u}update(e,t,r,i){let s=e===Ue.document?this.documentPullStates:this.workspacePullStates,[o,a,u,l]=t instanceof De.Uri?[t.toString(),t,r,i]:[t.uri.toString(),t.uri,t.version,r],f=s.get(o);f===void 0?(f={document:a,pulledVersion:u,resultId:l},s.set(o,f)):(f.pulledVersion=u,f.resultId=l)}unTrack(e,t){let r=Xn.asKey(t);(e===Ue.document?this.documentPullStates:this.workspacePullStates).delete(r)}tracks(e,t){let r=Xn.asKey(t);return(e===Ue.document?this.documentPullStates:this.workspacePullStates).has(r)}tracksSameVersion(e,t){let r=t.uri.toString(),s=(e===Ue.document?this.documentPullStates:this.workspacePullStates).get(r);return s!==void 0&&s.pulledVersion===t.version}getResultId(e,t){let r=Xn.asKey(t);return(e===Ue.document?this.documentPullStates:this.workspacePullStates).get(r)?.resultId}getAllResultIds(){let e=[];for(let[t,r]of this.workspacePullStates)this.documentPullStates.has(t)&&(r=this.documentPullStates.get(t)),r.resultId!==void 0&&e.push({uri:t,value:r.resultId});return e}},ed=class{isDisposed;client;visibleDocuments;options;onDidChangeDiagnosticsEmitter;provider;diagnostics;openRequests;documentStates;workspaceErrorCounter;workspaceCancellation;workspaceTimeout;constructor(e,t,r){this.client=e,this.visibleDocuments=t,this.options=r,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new De.EventEmitter,this.provider=this.createProvider(),this.diagnostics=this.createDiagnosticCollection(),this.openRequests=new Map,this.documentStates=new Zl,this.workspaceErrorCounter=0}createDiagnosticCollection(){return this.client.clientOptions.diagnosticCollectionProvider===void 0?De.languages.createDiagnosticCollection(this.options.identifier):this.client.clientOptions.diagnosticCollectionProvider.create(this.options.identifier,ms.DiagnosticCollectionSource.pull)}knows(e,t){let r=t instanceof De.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(r.toString())}knowsSameVersion(e,t){let r=this.openRequests.get(t.uri.toString());return r===void 0?this.documentStates.tracksSameVersion(e,t):r.state===Je.reschedule?!0:r.state===Je.outDated?!1:r.version===t.version}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let r=e instanceof De.Uri?e:e.uri;this.pullAsync(e).then(()=>{t&&t()},i=>{this.client.error(`Document pull failed for text document ${r.toString()}`,i,!1)})}async pullAsync(e,t){if(this.isDisposed)return;let r=e instanceof De.Uri,i=r?e:e.uri,s=i.toString();t=r?t:e.version;let o=this.openRequests.get(s),a=r?this.documentStates.track(Ue.document,e,t):this.documentStates.track(Ue.document,e);if(o===void 0){let u=new De.CancellationTokenSource;this.openRequests.set(s,{state:Je.active,document:e,version:t,tokenSource:u});let l,f;try{l=await this.provider.provideDiagnostics(e,a.resultId,u.token)??{kind:Tt.DocumentDiagnosticReportKind.full,items:[]}}catch(p){if(p instanceof ms.LSPCancellationError&&Se.DiagnosticServerCancellationData.is(p.data)&&p.data.retriggerRequest===!1&&(f={state:Je.outDated,document:e}),f===void 0&&p instanceof De.CancellationError)f={state:Je.reschedule,document:e};else throw p}if(f=f??this.openRequests.get(s),f===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${s}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(s),!this.visibleDocuments.isVisible(e)){this.documentStates.unTrack(Ue.document,e);return}if(f.state===Je.outDated)return;l!==void 0&&(l.kind===Tt.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),a.pulledVersion=t,a.resultId=l.resultId),f.state===Je.reschedule&&this.pull(e)}else o.state===Je.active?(o.tokenSource.cancel(),this.openRequests.set(s,{state:Je.reschedule,document:o.document})):o.state===Je.outDated&&this.openRequests.set(s,{state:Je.reschedule,document:o.document})}forgetDocument(e){if(this.isDisposed)return;let t=e instanceof De.Uri?e:e.uri,r=t.toString(),i=this.openRequests.get(r);this.options.workspaceDiagnostics&&t.scheme!=="untitled"?(i!==void 0?this.openRequests.set(r,{state:Je.reschedule,document:e}):this.pull(e,()=>{this.forget(Ue.document,e)}),this.forget(Ue.workspace,e)):(i!==void 0&&(i.state===Je.active&&i.tokenSource.cancel(),this.openRequests.set(r,{state:Je.outDated,document:e})),this.diagnostics.delete(t),this.forget(Ue.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,Se.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof ms.LSPCancellationError)&&!Se.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,Se.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new De.CancellationTokenSource;let e=this.documentStates.getAllResultIds().map(t=>({uri:this.client.protocol2CodeConverter.asUri(t.uri),value:t.value}));await this.provider.provideWorkspaceDiagnostics(e,this.workspaceCancellation.token,t=>{if(!(!t||this.isDisposed))for(let r of t.items)r.kind===Tt.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(Ue.document,r.uri)||this.diagnostics.set(r.uri,r.items)),this.documentStates.update(Ue.workspace,r.uri,r.version??void 0,r.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,r,i)=>{let s=(a,u,l)=>{let f={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(a instanceof De.Uri?a:a.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Tt.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(Se.DocumentDiagnosticRequest.type,f,l).then(async p=>{if(this.isDisposed)return{kind:Tt.DocumentDiagnosticReportKind.full,items:[]};if(l.isCancellationRequested)throw new De.CancellationError;return p==null?{kind:Tt.DocumentDiagnosticReportKind.full,items:[]}:p.kind===Se.DocumentDiagnosticReportKind.Full?{kind:Tt.DocumentDiagnosticReportKind.full,resultId:p.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(p.items,l)}:{kind:Tt.DocumentDiagnosticReportKind.unChanged,resultId:p.resultId}},p=>this.client.handleFailedRequest(Se.DocumentDiagnosticRequest.type,l,p,{kind:Tt.DocumentDiagnosticReportKind.full,items:[]},!0,!0))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,r,i,s):s(t,r,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,r,i)=>{let s=async l=>l.kind===Se.DocumentDiagnosticReportKind.Full?{kind:Tt.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version,items:await this.client.protocol2CodeConverter.asDiagnostics(l.items,r)}:{kind:Tt.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let f=[];for(let p of l)f.push({uri:this.client.code2ProtocolConverter.asUri(p.uri),value:p.value});return f},a=(l,f,p)=>{let h=(0,ES.generateUuid)(),g=this.client.onProgress(Se.WorkspaceDiagnosticRequest.partialResult,h,async v=>{if(v==null){p(null);return}let R={items:[]};for(let q of v.items)try{R.items.push(await s(q))}catch(w){this.client.error("Converting workspace diagnostics failed.",w)}p(R)}),_={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:h};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(Se.WorkspaceDiagnosticRequest.type,_,f).then(async v=>{if(f.isCancellationRequested)return{items:[]};let R={items:[]};for(let q of v.items)R.items.push(await s(q));return g.dispose(),p(R),{items:[]}},v=>(g.dispose(),this.client.handleFailedRequest(Se.DocumentDiagnosticRequest.type,f,v,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,r,i,a):a(t,r,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===Je.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:Je.outDated,document:t.document});this.client.clientOptions.diagnosticCollectionProvider!==void 0?this.client.clientOptions.diagnosticCollectionProvider.dispose(this.diagnostics,ms.DiagnosticCollectionSource.pull):this.diagnostics.dispose()}},td=class{client;diagnosticRequestor;lastDocumentToPull;documents;timeoutHandle;isDisposed;constructor(e,t){this.client=e,this.diagnosticRequestor=t,this.documents=new Se.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=Xn.asKey(e);this.documents.has(t)||(this.documents.set(t,e,Se.Touch.Last),this.lastDocumentToPull=e)}remove(e){let t=Xn.asKey(e);if(this.documents.delete(t),this.documents.size===0){this.stop();return}else if(t===this.lastDocumentToPullKey()){let r=this.documents.before(t);r===void 0?this.stop():this.lastDocumentToPull=r}}trigger(){this.lastDocumentToPull=this.documents.last,this.runLoop()}runLoop(){if(this.isDisposed!==!0){if(this.documents.size===0){this.stop();return}this.lastDocumentToPull!==void 0&&this.timeoutHandle===void 0&&(this.timeoutHandle=(0,Se.RAL)().timer.setTimeout(()=>{let e=this.documents.first;if(e===void 0)return;let t=Xn.asKey(e);this.diagnosticRequestor.pullAsync(e).catch(r=>{this.client.error(`Document pull failed for text document ${t}`,r,!1)}).finally(()=>{this.timeoutHandle=void 0,this.documents.set(t,e,Se.Touch.Last),t!==this.lastDocumentToPullKey()&&this.runLoop()})},500))}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear(),this.lastDocumentToPull=void 0}stop(){this.timeoutHandle?.dispose(),this.timeoutHandle=void 0,this.lastDocumentToPull=void 0}lastDocumentToPullKey(){return this.lastDocumentToPull!==void 0?Xn.asKey(this.lastDocumentToPull):void 0}},nd=class{disposable;diagnosticRequestor;activeTextDocument;backgroundScheduler;constructor(e,t,r){let i=Object.assign({onChange:!1,onSave:!1,onFocus:!1},e.clientOptions.diagnosticPullOptions),s=e.protocol2CodeConverter.asDocumentSelector(r.documentSelector),o=[],a=(w,M)=>!(typeof w=="string"||w.language!==void 0&&w.language!=="*"||w.scheme!==void 0&&w.scheme!=="*"&&w.scheme!==M.scheme||w.pattern!==void 0&&!(0,qS.matchGlobPattern)(w.pattern,M)),u=w=>{let M=r.documentSelector;if(i.match!==void 0)return i.match(M,w);for(let j of M)if(Se.TextDocumentFilter.is(j)&&a(j,w))return!0;return!1},l=w=>w instanceof De.Uri?u(w):De.languages.match(s,w)>0&&t.isVisible(w),f=w=>De.languages.match(s,w.document)>0&&t.isVisible(w.notebook.uri),p=w=>w instanceof De.Uri?this.activeTextDocument?.uri.toString()===w.toString():this.activeTextDocument===w;this.diagnosticRequestor=new ed(e,t,r),this.backgroundScheduler=new td(e,this.diagnosticRequestor);let h=w=>{!l(w)||!r.interFileDependencies||p(w)||i.onChange===!1||this.backgroundScheduler.add(w)},g=(w,M)=>(i.filter===void 0||!i.filter(w,M))&&this.diagnosticRequestor.knows(Ue.document,w);this.activeTextDocument=De.window.activeTextEditor?.document,o.push(De.window.onDidChangeActiveTextEditor(w=>{let M=this.activeTextDocument;this.activeTextDocument=w?.document,M!==void 0&&h(M),this.activeTextDocument!==void 0&&(this.backgroundScheduler.remove(this.activeTextDocument),i.onFocus===!0&&l(this.activeTextDocument)&&g(this.activeTextDocument,_s.onFocus)&&this.diagnosticRequestor.pull(this.activeTextDocument))}));let _=e.getFeature(Se.DidOpenTextDocumentNotification.method);o.push(_.onNotificationSent(w=>{let M=w.textDocument;this.diagnosticRequestor.knowsSameVersion(Ue.document,M)||l(M)&&this.diagnosticRequestor.pull(M,()=>{h(M)})}));let v=e.getFeature(Se.NotebookDocumentSyncRegistrationType.method);o.push(v.onOpenNotificationSent(w=>{for(let M of w.getCells())f(M)&&this.diagnosticRequestor.pull(M.document,()=>{h(M.document)})})),o.push(t.onOpen(w=>{for(let M of w){if(this.diagnosticRequestor.knows(Ue.document,M))continue;let j=M.toString(),F;for(let oe of De.workspace.textDocuments)if(j===oe.uri.toString()){F=oe;break}F!==void 0&&l(F)&&this.diagnosticRequestor.pull(F,()=>{h(F)})}}));let R=new Set;for(let w of De.workspace.textDocuments)l(w)&&(this.diagnosticRequestor.pull(w,()=>{h(w)}),R.add(w.uri.toString()));for(let w of De.workspace.notebookDocuments)for(let M of w.getCells())f(M)&&(this.diagnosticRequestor.pull(M.document,()=>{h(M.document)}),R.add(M.document.uri.toString()));if(i.onTabs===!0)for(let w of t.getResources())!R.has(w.toString())&&l(w)&&this.diagnosticRequestor.pull(w,()=>{h(w)});if(i.onChange===!0){let w=e.getFeature(Se.DidChangeTextDocumentNotification.method);o.push(w.onNotificationSent(async M=>{let j=M.textDocument;g(j,_s.onType)&&this.diagnosticRequestor.pull(j,()=>{this.backgroundScheduler.trigger()})})),o.push(v.onChangeNotificationSent(async M=>{let F=(M.cells?.textContent||[]).map(Te=>M.notebook.getCells().find(Pn=>Pn.document.uri.toString()===Te.document.uri.toString()));for(let Te of F)Te&&f(Te)&&this.diagnosticRequestor.pull(Te.document,()=>{this.backgroundScheduler.trigger()});let oe=M.cells?.structure?.didClose||[];for(let Te of oe)this.diagnosticRequestor.forgetDocument(Te.document);let te=M.cells?.structure?.didOpen||[];for(let Te of te)f(Te)&&this.diagnosticRequestor.pull(Te.document,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let w=e.getFeature(Se.DidSaveTextDocumentNotification.method);o.push(w.onNotificationSent(M=>{let j=M.textDocument;g(j,_s.onSave)&&this.diagnosticRequestor.pull(M.textDocument)})),o.push(v.onSaveNotificationSent(M=>{for(let j of M.getCells())f(j)&&this.diagnosticRequestor.pull(j.document)}))}let q=e.getFeature(Se.DidCloseTextDocumentNotification.method);o.push(q.onAboutToSendNotification(w=>{this.cleanUpDocument(w.textDocument)})),o.push(v.onCloseNotificationSent(w=>{for(let M of w.getCells())this.cleanUpDocument(M.document)})),o.push(t.onClose(w=>{for(let M of w)this.cleanUpDocument(M)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let w of De.workspace.textDocuments)l(w)&&this.diagnosticRequestor.pull(w)}),r.workspaceDiagnostics===!0&&r.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=De.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}forget(e){this.cleanUpDocument(e)}cleanUpDocument(e){this.backgroundScheduler.remove(e),this.diagnosticRequestor.knows(Ue.document,e)&&this.diagnosticRequestor.forgetDocument(e)}},rd=class extends ms.TextDocumentLanguageFeature{constructor(e){super(e,Se.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=Ho(Ho(e,"textDocument"),"diagnostic");t.relatedInformation=!0,t.tagSupport={valueSet:[Se.DiagnosticTag.Unnecessary,Se.DiagnosticTag.Deprecated]},t.codeDescriptionSupport=!0,t.dataSupport=!0,t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,t.markupMessageSupport=!1,Ho(Ho(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(Se.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,s]=this.getRegistration(t,e.diagnosticProvider);!i||!s||this.register({id:i,registerOptions:s})}clear(){super.clear()}refresh(){for(let e of this.getAllProviders())e.onDidChangeDiagnosticsEmitter.fire()}registerLanguageProvider(e){let t=new nd(this._client,this._client.visibleDocuments,e);return[t.disposable,t]}};Rr.DiagnosticFeature=rd});var K_=P(an=>{"use strict";var MS=an&&an.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),xS=an&&an.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Ko=an&&an.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0&&(v.metadata=o(h.metadata)),v}t.asNotebookDocument=i;function s(h,g){return h.map(_=>a(_,g))}t.asNotebookCells=s;function o(h){return l(new Set,h)}t.asMetadata=o;function a(h,g){let _=Jn.NotebookCell.create(u(h.kind),g.asUri(h.document.uri));return Object.keys(h.metadata).length>0&&(_.metadata=o(h.metadata)),h.executionSummary!==void 0&&W_.number(h.executionSummary.executionOrder)&&W_.boolean(h.executionSummary.success)&&(_.executionSummary={executionOrder:h.executionSummary.executionOrder,success:h.executionSummary.success}),_}t.asNotebookCell=a;function u(h){switch(h){case Re.NotebookCellKind.Markup:return Jn.NotebookCellKind.Markup;case Re.NotebookCellKind.Code:return Jn.NotebookCellKind.Code}}function l(h,g){if(h.has(g))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(g)){let _=[];for(let v of g)if(v!==null&&typeof v=="object"||Array.isArray(v))_.push(l(h,v));else{if(v instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");_.push(v)}return _}else{let _=Object.keys(g),v=Object.create(null);for(let R of _){let q=g[R];if(q!==null&&typeof q=="object"||Array.isArray(q))v[R]=l(h,q);else{if(q instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");v[R]=q}}return v}}function f(h,g){let _=g.asChangeTextDocumentParams(h,h.document.uri,h.document.version);return{document:_.textDocument,changes:_.contentChanges}}t.asTextContentChange=f;function p(h,g){let _=Object.create(null);if(h.metadata&&(_.metadata=n.c2p.asMetadata(h.metadata)),h.cells!==void 0){let v=Object.create(null),R=h.cells;R.structure&&(v.structure={array:{start:R.structure.array.start,deleteCount:R.structure.array.deleteCount,cells:R.structure.array.cells!==void 0?R.structure.array.cells.map(q=>n.c2p.asNotebookCell(q,g)):void 0},didOpen:R.structure.didOpen!==void 0?R.structure.didOpen.map(q=>g.asOpenTextDocumentParams(q.document).textDocument):void 0,didClose:R.structure.didClose!==void 0?R.structure.didClose.map(q=>g.asCloseTextDocumentParams(q.document).textDocument):void 0}),R.data!==void 0&&(v.data=R.data.map(q=>n.c2p.asNotebookCell(q,g))),R.textContent!==void 0&&(v.textContent=R.textContent.map(q=>n.c2p.asTextContentChange(q,g))),Object.keys(v).length>0&&(_.cells=v)}return _}t.asNotebookDocumentChangeEvent=p})(e=n.c2p||(n.c2p={}))})(Oi||(Oi={}));var sd;(function(n){function e(a,u,l){let f=a.length,p=u.length,h=0;for(;h=0&&_>=0&&t(a[g],u[_],l);)g--,_--;let v=g+1-h,R=h===_+1?void 0:u.slice(h,_+1);return R!==void 0?{start:h,deleteCount:v,cells:R}:{start:h,deleteCount:v}}else return hr.document.uri.toString()))}}n.create=e})(zo||(zo={}));var Ei=class{client;options;notebookSyncInfo;notebookDidOpen;disposables;selector;onChangeNotificationSent;onOpenNotificationSent;onCloseNotificationSent;onSaveNotificationSent;constructor(e,t,r,i,s,o){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(Wo.asDocumentSelector(t)),this.onChangeNotificationSent=r,this.onOpenNotificationSent=i,this.onCloseNotificationSent=s,this.onSaveNotificationSent=o,Re.workspace.onDidOpenNotebookDocument(a=>{this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a)},void 0,this.disposables);for(let a of Re.workspace.notebookDocuments)this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a);Re.workspace.onDidChangeNotebookDocument(a=>this.didChangeNotebookDocument(a),void 0,this.disposables),this.options.save===!0&&Re.workspace.onDidSaveNotebookDocument(a=>this.didSave(a),void 0,this.disposables),Re.workspace.onDidCloseNotebookDocument(a=>{this.didClose(a),this.notebookDidOpen.delete(a.uri.toString())},void 0,this.disposables)}getState(){for(let e of Re.workspace.notebookDocuments)if(this.getMatchingCellsConsideringSyncInfo(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){if(Re.languages.match(this.selector,e)>0)return!0;let t=e.uri.toString();for(let r of this.notebookSyncInfo.values())if(r.uris.has(t))return!0;return!1}didOpenNotebookCellTextDocument(e,t){if(Re.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let r=this.getSyncInfo(e),i=this.cellMatches(e,t);if(r!==void 0){let s=r.uris.has(t.document.uri.toString());if(i&&s||!i&&!s)return;if(i){let o=this.mergeCells(e,r,[t]);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,r,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t,r){if(Re.languages.match(this.selector,r.document)===0)return;let i=this.getSyncInfo(e);i===void 0||!i.uris.has(t.document.uri.toString())||this.doSendChange({notebook:e,cells:{textContent:[r]}},i.cells).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let r=this.getSyncInfo(e);if(r===void 0)return;let i=t.document.uri,s=r.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(s!==-1)if(s===0&&r.cells.length===1)this.doSendClose(e,r.cells).catch(()=>{});else{let o=r.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t,r=this.getSyncInfo(e)){if(r!==void 0)if(t===void 0&&(t=r.cells.slice()),t!==void 0){let i=this.asNotebookDocumentChangeEvent(e,void 0,r,t);i!==void 0&&this.doSendChange(i,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t=this.getMatchingCells(e),t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,r=this.getSyncInfo(t);if(r===void 0){if(e.contentChanges.length===0)return;let i=this.getMatchingCells(t);if(i===void 0)return;this.didOpen(t,i,r)}else{let i=this.getMatchingCellsFromEvent(t,r,e);if(i===void 0){this.didClose(t,r);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,r,i);s!==void 0&&this.doSendChange(s,i).catch(()=>{})}}didSave(e){this.getSyncInfo(e)!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.getSyncInfo(e)){if(t===void 0)return;let r=e.getCells().filter(i=>t.uris.has(i.document.uri.toString()));this.doSendClose(e,r).catch(()=>{})}async sendDidOpenNotebookDocument(e){if(this.getSyncInfo(e)!==void 0)throw new Error(`Notebook document ${e.uri.toString()} is already open`);let r=this.getMatchingCells(e);if(r!==void 0)return this.doSendOpen(e,r)}async doSendOpen(e,t){let r=async(s,o)=>{let a=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(Jn.DidOpenNotebookDocumentNotification.type,{notebookDocument:Oi.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),cellTextDocuments:a}),this.onOpenNotificationSent.fire(s)}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),zo.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,r):r(e,t)}async sendDidChangeNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e.notebook);if(t===void 0)throw new Error(`Received changed event for un-synced notebook ${e.notebook.uri.toString()}`);return this.doSendChange(e,t)}async doSendChange(e,t){let r=async s=>{try{await this.client.sendNotification(Jn.DidChangeNotebookDocumentNotification.type,{notebookDocument:Oi.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:Oi.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)}),this.onChangeNotificationSent.fire(s)}catch(o){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",o),o}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),zo.create(t)),i?.didChange!==void 0?i?.didChange(e,r):r(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async i=>{try{await this.client.sendNotification(Jn.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}}),this.onSaveNotificationSent.fire(i)}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},r=this.client.middleware?.notebooks;return r?.didSave!==void 0?r.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e);if(t===void 0)throw new Error(`Received close event for un-synced notebook ${e.uri.toString()}`);return this.doSendClose(e,t)}async doSendClose(e,t){let r=async(s,o)=>{try{await this.client.sendNotification(Jn.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))}),this.onCloseNotificationSent.fire(s)}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,r):r(e,t)}getSynchronizedCells(e){return this.getSyncInfo(e)?.cells}asNotebookDocumentChangeEvent(e,t,r,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=Oi.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)o.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&a.push(u.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&r!==void 0&&i!==void 0){let a=r.cells,u=i,l=sd.computeDiff(a,u,!1),f,p;if(l!==void 0){f=l.cells===void 0?new Map:new Map(l.cells.map(_=>[_.document.uri.toString(),_])),p=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(_=>[_.document.uri.toString(),_]));for(let _ of Array.from(p.keys()))f.has(_)&&(p.delete(_),f.delete(_));s.cells=s.cells??{};let h=[],g=[];if(f.size>0||p.size>0){for(let _ of f.values())h.push(_);for(let _ of p.values())g.push(_)}s.cells.structure={array:l,didOpen:h,didClose:g}}}return Object.keys(s).length>1?s:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let r of this.options.notebookSelector)if(r.notebook===void 0||Uo.matchNotebook(r.notebook,e)){let i=this.filterCells(e,t,r.cells);return i.length===0?void 0:i}}}getMatchingCellsFromEvent(e,t,r){if(this.options.notebookSelector===void 0)return;let i;for(let u of this.options.notebookSelector)if(u.notebook===void 0||Uo.matchNotebook(u.notebook,e)){i=u;break}if(i===void 0)return;if((r.cellChanges===void 0||r.cellChanges.length===0)&&(r.contentChanges===void 0||r.contentChanges.length===0))return t.cells;let s;if(r.cellChanges!==void 0&&r.cellChanges.length>0){let u=r.cellChanges.map(f=>f.cell),l=this.filterCells(e,u,i.cells);if(l.length!==u.length){s=new Set(t.uris);for(let f of u)s.delete(f.document.uri.toString());for(let f of l)s.add(f.document.uri.toString())}}if(r.contentChanges!==void 0&&r.contentChanges.length>0){s===void 0&&(s=new Set(t.uris));for(let u of r.contentChanges){for(let f of u.removedCells)s.delete(f.document.uri.toString());let l=this.filterCells(e,new Array(...u.addedCells),i.cells);for(let f of l)s.add(f.document.uri.toString())}}if(s===void 0)return t.cells;let o=[],a=e.getCells();for(let u of a)s.has(u.document.uri.toString())&&o.push(u);return o}getMatchingCellsFromSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:void 0}getMatchingCellsConsideringSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:this.getMatchingCells(e)}mergeCells(e,t,r){let i=[],s=new Set(t.uris);for(let o of r)s.add(o.document.uri.toString());for(let o of e.getCells())s.has(o.document.uri.toString())&&i.push(o);return i}cellMatches(e,t){let r=this.getMatchingCells(e,[t]);return r!==void 0&&r[0]===t}filterCells(e,t,r){let i=r!==void 0?t.filter(s=>{let o=s.document.languageId;return r.some((a=>a.language==="*"||o===a.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}getSyncInfo(e){return this.notebookSyncInfo.get(e.uri.toString())}},od=class n{static CellScheme="vscode-notebook-cell";client;registrations;dedicatedChannel;_onChangeNotificationSent;_onOpenNotificationSent;_onCloseNotificationSent;_onSaveNotificationSent;constructor(e){this.client=e,this.registrations=new Map,this.registrationType=Jn.NotebookDocumentSyncRegistrationType.type,this._onChangeNotificationSent=new Re.EventEmitter,this._onOpenNotificationSent=new Re.EventEmitter,this._onCloseNotificationSent=new Re.EventEmitter,this._onSaveNotificationSent=new Re.EventEmitter,Re.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==n.CellScheme)return;let[r,i]=this.findNotebookDocumentAndCell(t);if(!(r===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Ei&&s.didOpenNotebookCellTextDocument(r,i)}),Re.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let r=t.document;if(r.uri.scheme!==n.CellScheme)return;let[i,s]=this.findNotebookDocumentAndCell(r);if(!(i===void 0||s===void 0))for(let o of this.registrations.values())o instanceof Ei&&o.didChangeNotebookCellTextDocument(i,s,t)}),Re.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==n.CellScheme)return;let[r,i]=this.findNotebookDocumentAndCell(t);if(!(r===void 0||i===void 0))for(let s of this.registrations.values())s instanceof Ei&&s.didCloseNotebookCellTextDocument(r,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}registrationType;get onOpenNotificationSent(){return this._onOpenNotificationSent.event}get onChangeNotificationSent(){return this._onChangeNotificationSent.event}get onCloseNotificationSent(){return this._onCloseNotificationSent.event}get onSaveNotificationSent(){return this._onSaveNotificationSent.event}fillClientCapabilities(e){let t=z_(z_(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(Wo.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let r=t.id??IS.generateUuid();this.register({id:r,registerOptions:t})}register(e){let t=new Ei(this.client,e.registerOptions,this._onChangeNotificationSent,this._onOpenNotificationSent,this._onCloseNotificationSent,this._onSaveNotificationSent);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t!==void 0&&(this.registrations.delete(e),t.dispose())}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear(),this._onChangeNotificationSent.dispose(),this._onChangeNotificationSent=new Re.EventEmitter,this._onOpenNotificationSent.dispose(),this._onOpenNotificationSent=new Re.EventEmitter,this._onCloseNotificationSent.dispose(),this._onCloseNotificationSent=new Re.EventEmitter,this._onSaveNotificationSent.dispose(),this._onSaveNotificationSent=new Re.EventEmitter}handles(e){if(e.uri.scheme!==n.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&Re.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let r of Re.workspace.notebookDocuments)for(let i of r.getCells())if(i.document.uri.toString()===t)return[r,i];return[void 0,void 0]}};an.NotebookDocumentSyncFeature=od});var V_=P(Ot=>{"use strict";var jS=Ot&&Ot.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),FS=Ot&&Ot.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),G_=Ot&&Ot.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let i=o=>{let a=[];for(let u of o.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;a.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,r,i):i(t,r)})}getConfiguration(e,t){let r=null;if(t){let i=t.lastIndexOf(".");if(i===-1)r=Hr(qi.workspace.getConfiguration(void 0,e).get(t));else{let s=qi.workspace.getConfiguration(t.substr(0,i),e);s&&(r=Hr(s.get(t.substr(i+1))))}}else{let i=qi.workspace.getConfiguration(void 0,e);r={};for(let s of Object.keys(i))i.has(s)&&(r[s]=Hr(i.get(s)))}return r===void 0&&(r=null),r}clear(){}};Ot.ConfigurationFeature=ad;function Hr(n){if(n){if(Array.isArray(n))return n.map(Hr);if(typeof n=="object"){let e=Object.create(null);for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=Hr(n[t]));return e}}return n}var cd=class{_client;isCleared;_listeners;constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return ys.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,B_.ensure)((0,B_.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:AS.generateUuid(),registerOptions:{section:e}})}register(e){let t=qi.workspace.onDidChangeConfiguration(r=>{this.onDidChangeConfiguration(e.registerOptions.section,r)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let r;if(LS.string(e)?r=[e]:r=e,r!==void 0&&t!==void 0&&!r.some(a=>t.affectsConfiguration(a)))return;let i=async o=>o===void 0?this._client.sendNotification(ys.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(ys.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(r,i):i(r)).catch(o=>{this._client.error(`Sending notification ${ys.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let u=0;u=0?u=qi.workspace.getConfiguration(o.substr(0,a),r).get(o.substr(a+1)):u=qi.workspace.getConfiguration(void 0,r).get(o),u){let l=e[s].split(".");t(i,l)[l[l.length-1]]=Hr(u)}}return i}};Ot.SyncConfigurationFeature=cd});var Y_={};Fh(Y_,{TextDocument:()=>ud});function ld(n,e){if(n.length<=1)return n;let t=n.length/2|0,r=n.slice(0,t),i=n.slice(t);ld(r,e),ld(i,e);let s=0,o=0,a=0;for(;st.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:n}function kS(n){let e=Q_(n.range);return e!==n.range?{newText:n.newText,range:e}:n}var Bo,ud,Z_=jh(()=>{"use strict";Bo=class n{constructor(e,t,r,i){this._uri=e,this._languageId=t,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){for(let r of e)if(n.isIncremental(r)){let i=Q_(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),u=Math.max(i.end.line,0),l=this._lineOffsets,f=X_(r.text,!1,s);if(u-a===f.length)for(let h=0,g=f.length;he?i=o:r=o+1}let s=r-1;return e=this.ensureBeforeEOL(e,t[s]),{line:s,character:e-t[s]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line];if(e.character<=0)return r;let i=e.line+1=t.length){let o=t.length-1;return{start:{line:o,character:0},end:{line:o,character:this._content.length-t[o]}}}else if(e<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=t[e],i=e+1=t.length)return"";if(e<0)return"";let r=e+1t&&J_(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")}static isFull(e){let t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0}};(function(n){function e(i,s,o,a){return new Bo(i,s,o,a)}n.create=e;function t(i,s,o){if(i instanceof Bo)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}n.update=t;function r(i,s){let o=i.getText(),a=ld(s.map(kS),(f,p)=>{let h=f.range.start.line-p.range.start.line;return h===0?f.range.start.character-p.range.start.character:h}),u=0,l=[];for(let f of a){let p=i.offsetAt(f.range.start);if(pu&&l.push(o.substring(u,p)),f.newText.length&&l.push(f.newText),u=i.offsetAt(f.range.end)}return l.push(o.substr(u)),l.join("")}n.applyEdits=r})(ud||(ud={}))});var ey=P(We=>{"use strict";var $S=We&&We.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),HS=We&&We.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),US=We&&We.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;ie.middleware.didOpen,r=>e.code2ProtocolConverter.asOpenTextDocumentParams(r),r=>r,Ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingOpenNotifications=new Map,this._delayOpen=e.clientOptions.textSynchronization?.delayOpenNotifications??!1}async callback(e){if(this._delayOpen){if(!this.matches(e))return;if(this._client.visibleDocuments.isVisible(e))return super.callback(e);{let r=new _d(e);this._pendingOpenNotifications.set(r.uri.toString(),r)}}else return super.callback(e)}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;t&&r&&r.openClose&&this.register({id:Mi.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return fe.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);if(Ae.workspace.textDocuments.forEach(r=>{let i=r.uri.toString();if(!this._syncedDocuments.has(i)&&Ae.languages.match(t,r)>0&&!this._client.hasDedicatedTextSynchronizationFeature(r))if(this._client.visibleDocuments.isVisible(r)){let o=this._client.middleware,a=u=>this._client.sendNotification(this._type,this._createParams(u));(o.didOpen?o.didOpen(r,a):a(r)).catch(u=>{this._client.error(`Sending document notification ${this._type.method} failed`,u)}),this._syncedDocuments.set(i,r)}else this._pendingOpenNotifications.set(i,r)}),this._delayOpen&&this._pendingOpenListeners===void 0){this._pendingOpenListeners=[];let r=this._client.visibleDocuments;this._pendingOpenListeners.push(r.onClose(i=>{for(let s of i)this._pendingOpenNotifications.delete(s.toString())})),this._pendingOpenListeners.push(r.onOpen(i=>{for(let s of i){let o=this._pendingOpenNotifications.get(s.toString());o!==void 0&&(super.callback(o).catch((a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})),this._pendingOpenNotifications.delete(s.toString()))}})),this._pendingOpenListeners.push(Ae.workspace.onDidCloseTextDocument(i=>{this._pendingOpenNotifications.delete(i.uri.toString())}))}}async sendPendingOpenNotifications(e){let t=Array.from(this._pendingOpenNotifications.values());this._pendingOpenNotifications.clear();let r=!1;for(let i of t){if(e!==void 0&&i.uri.toString()===e){r=!0;continue}await super.callback(i)}return r}getTextDocument(e){return e}notificationSent(e,t,r){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,r)}clear(){if(this._pendingOpenNotifications.clear(),this._pendingOpenListeners!==void 0){for(let e of this._pendingOpenListeners)e.dispose();this._pendingOpenListeners=void 0}super.clear()}};We.DidOpenTextDocumentFeature=dd;var fd=class extends Ie.TextDocumentEventFeature{_syncedDocuments;_pendingTextDocumentChanges;constructor(e,t,r){super(e,Ae.workspace.onDidCloseTextDocument,fe.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,Ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=r}get registrationType(){return fe.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;t&&r&&r.openClose&&this.register({id:Mi.generateUuid(),registerOptions:{documentSelector:t}})}async callback(e){await super.callback(e),this._pendingTextDocumentChanges.delete(e.uri.toString())}getTextDocument(e){return e}notificationSent(e,t,r){this._syncedDocuments.delete(e.uri.toString()),super.notificationSent(e,t,r)}unregister(e){let t=this._selectors.get(e);if(t===void 0)return;super.unregister(e);let r=this._selectors.values();this._syncedDocuments.forEach(i=>{if(Ae.languages.match(t,i)>0&&!this._selectorFilter(r,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let s=this._client.middleware,o=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(s.didClose?s.didClose(i,o):o(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}};We.DidCloseTextDocumentFeature=fd;var hd=class extends Ie.DynamicDocumentFeature{_listener;_changeData;_onAboutToSendNotification;_onNotificationSent;_onPendingChangeAdded;_pendingTextDocumentChanges;_syncKind;constructor(e,t){super(e),this._changeData=new Map,this._onAboutToSendNotification=new Ae.EventEmitter,this._onNotificationSent=new Ae.EventEmitter,this._onPendingChangeAdded=new Ae.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=fe.TextDocumentSyncKind.None}get onAboutToSendNotification(){return this._onAboutToSendNotification.event}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return fe.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;t&&r&&r.change!==void 0&&r.change!==fe.TextDocumentSyncKind.None&&this.register({id:Mi.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:r.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Ae.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(e.id,{syncKind:e.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)}),this.updateSyncKind(e.registerOptions.syncKind))}*getDocumentSelectors(){for(let e of this._changeData.values())yield e.documentSelector}async callback(e){if(e.contentChanges.length===0)return;let t=e.document.uri,r=e.document.version,i=[];for(let s of this._changeData.values())if(Ae.languages.match(s.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(s.syncKind===fe.TextDocumentSyncKind.Incremental){let a=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,r);this.aboutToSendNotification(u.document,fe.DidChangeTextDocumentNotification.type,l),await this._client.sendNotification(fe.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,fe.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}else if(s.syncKind===fe.TextDocumentSyncKind.Full){let a=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}}return Promise.all(i).then(void 0,s=>{throw this._client.error(`Sending document notification ${fe.DidChangeTextDocumentNotification.type.method} failed`,s),s})}aboutToSendNotification(e,t,r){this._onAboutToSendNotification.fire({textDocument:e,type:t,params:r})}notificationSent(e,t,r){this._onNotificationSent.fire({textDocument:e,type:t,params:r})}unregister(e){if(this._changeData.delete(e),this._changeData.size===0)this._listener&&(this._listener.dispose(),this._listener=void 0),this._syncKind=fe.TextDocumentSyncKind.None;else{this._syncKind=fe.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===fe.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=fe.TextDocumentSyncKind.None,this._listener&&(this._listener.dispose(),this._listener=void 0)}getPendingDocumentChanges(e){if(this._pendingTextDocumentChanges.size===0)return[];let t;if(e.size===0)t=Array.from(this._pendingTextDocumentChanges.values()),this._pendingTextDocumentChanges.clear();else{t=[];for(let r of this._pendingTextDocumentChanges)e.has(r[0])||(t.push(r[1]),this._pendingTextDocumentChanges.delete(r[0]))}return t}getProvider(e){for(let t of this._changeData.values())if(Ae.languages.match(t.documentSelector,e)>0)return{send:r=>this.callback(r)}}updateSyncKind(e){if(this._syncKind!==fe.TextDocumentSyncKind.Full)switch(e){case fe.TextDocumentSyncKind.Full:this._syncKind=e;break;case fe.TextDocumentSyncKind.Incremental:this._syncKind===fe.TextDocumentSyncKind.None&&(this._syncKind=fe.TextDocumentSyncKind.Incremental);break}}};We.DidChangeTextDocumentFeature=hd;var pd=class extends Ie.TextDocumentEventFeature{constructor(e){super(e,Ae.workspace.onWillSaveTextDocument,fe.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,r)=>Ie.TextDocumentEventFeature.textDocumentFilter(t,r.document))}get registrationType(){return fe.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;t&&r&&r.willSave&&this.register({id:Mi.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};We.WillSaveFeature=pd;var gd=class extends Ie.DynamicDocumentFeature{_listener;_selectors;constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return fe.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;t&&r&&r.willSaveWaitUntil&&this.register({id:Mi.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Ae.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(Ie.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,r=i=>this._client.sendRequest(fe.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async s=>{let o=await this._client.protocol2CodeConverter.asTextEdits(s);return o===void 0?[]:o});e.waitUntil(t.willSaveWaitUntil?t.willSaveWaitUntil(e,r):r(e))}}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}};We.WillSaveWaitUntilFeature=gd;var md=class extends Ie.TextDocumentEventFeature{_includeText;constructor(e){super(e,Ae.workspace.onDidSaveTextDocument,fe.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,Ie.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return fe.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,Ie.ensure)((0,Ie.ensure)(e,"textDocument"),"synchronization").didSave=!0}initialize(e,t){let r=e.resolvedTextDocumentSync;if(t&&r&&r.save){let i=typeof r.save=="boolean"?{includeText:!1}:{includeText:!!r.save.includeText};this.register({id:Mi.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};We.DidSaveTextDocumentFeature=md;var zS="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function KS(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of zS)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var BS=KS(),_d=class n{_extTextDocument;_capturedTextDocument;_content;_uri;_fileName;_languageId;_version;_eol;_isUntitled;_encoding;_isDirty;_isClosed;constructor(e){this._extTextDocument=e,this._content=e.getText(),this._uri=e.uri,this._fileName=e.fileName,this._languageId=e.languageId,this._version=e.version,this._eol=e.eol,this._isUntitled=e.isUntitled,this._encoding=e.encoding,this._isDirty=e.isDirty,this._isClosed=e.isClosed,this._capturedTextDocument=WS.TextDocument.create(this._uri.toString(),this._languageId,this._version,this._content)}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}get eol(){return this._eol}get isUntitled(){return this._isUntitled}get encoding(){return this._encoding}get fileName(){return this._fileName}get isDirty(){return this._isDirty}get isClosed(){return this._isClosed}save(){return this.version===this._extTextDocument.version?this._extTextDocument.save():Promise.resolve(!1)}get lineCount(){return this._capturedTextDocument.lineCount}offsetAt(e){return this._capturedTextDocument.offsetAt(e)}positionAt(e){let t=this._capturedTextDocument.positionAt(e);return new Ae.Position(t.line,t.character)}getText(e){return this._capturedTextDocument.getText(e)}lineAt(e){let t=typeof e=="number"?e:this.validatePosition(e).line;if(t<0||t>=this.lineCount)throw new RangeError(`Illegal value for line: ${t}`);let r=this._capturedTextDocument.getLineRange(t),i=this._capturedTextDocument.getText(r),s=i.search(/\S/),o=new Ae.Range(r.start.line,r.start.character,r.end.line,r.end.character),a=t+1=e.character)return new Ae.Range(r,o.index,r,s.lastIndex)}validateRange(e){let t=this.validatePosition(e.start),r=this.validatePosition(e.end);return t===e.start&&r===e.end?e:new Ae.Range(t.line,t.character,r.line,r.character)}validatePosition(e){let t=Math.min(Math.max(e.line,0),this.lineCount-1),r=this._capturedTextDocument.getLineRange(t),i=Math.min(Math.max(e.character,0),r.end.character);return t===e.line&&i===e.character?e:new Ae.Position(t,i)}static getWordRegExp(e){let t=e??BS;if(t.flags.includes("g"))return t;let r=`${t.flags}g`;return new RegExp(t.source,r)}}});var ty=P(cn=>{"use strict";var GS=cn&&cn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),VS=cn&&cn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),XS=cn&&cn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let p=this._client,h=this._client.middleware,g=(_,v,R,q)=>p.sendRequest(ee.CompletionRequest.type,p.code2ProtocolConverter.asCompletionParams(_,v,R),q).then(w=>q.isCancellationRequested?null:p.protocol2CodeConverter.asCompletionResult(w,i,q),w=>p.handleFailedRequest(ee.CompletionRequest.type,q,w,null));return h.provideCompletionItem?h.provideCompletionItem(a,u,f,l,g):g(a,u,f,l)},resolveCompletionItem:e.resolveProvider?(a,u)=>{let l=this._client,f=this._client.middleware,p=(h,g)=>l.sendRequest(ee.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(h,!!this.labelDetailsSupport.get(t)),g).then(_=>g.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(_),_=>l.handleFailedRequest(ee.CompletionResolveRequest.type,g,_,h));return f.resolveCompletionItem?f.resolveCompletionItem(a,u,p):p(a,u)}:void 0};return[JS.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(s),o,...r),o]}};cn.CompletionItemFeature=vd});var ny=P(un=>{"use strict";var ZS=un&&un.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),eP=un&&un.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),tP=un&&un.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h)=>a.sendRequest(vs.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asHover(g),g=>a.handleFailedRequest(vs.HoverRequest.type,h,g,null)),l=a.middleware;return l.provideHover?l.provideHover(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return nP.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};un.HoverFeature=Cd});var ry=P(ln=>{"use strict";var iP=ln&&ln.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),sP=ln&&ln.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),oP=ln&&ln.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h)=>a.sendRequest(wd.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(g,h),g=>a.handleFailedRequest(wd.DefinitionRequest.type,h,g,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return aP.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ln.DefinitionFeature=Sd});var sy=P(dn=>{"use strict";var uP=dn&&dn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),lP=dn&&dn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),dP=dn&&dn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h,g)=>a.sendRequest(bs.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(f,p,h),g).then(_=>g.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(_,g),_=>a.handleFailedRequest(bs.SignatureHelpRequest.type,g,_,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(r,i,o,s,u):u(r,i,o,s)}};return[this.registerProvider(e,t),t]}registerProvider(e,t){let r=this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector);if(e.retriggerCharacters===void 0){let i=e.triggerCharacters||[];return iy.languages.registerSignatureHelpProvider(r,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return iy.languages.registerSignatureHelpProvider(r,t,i)}}};dn.SignatureHelpFeature=Rd});var oy=P(fn=>{"use strict";var hP=fn&&fn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),pP=fn&&fn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),gP=fn&&fn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h)=>a.sendRequest(Td.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(g,h),g=>a.handleFailedRequest(Td.DocumentHighlightRequest.type,h,g,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,s,o,u):u(i,s,o)}};return[mP.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};fn.DocumentHighlightFeature=Ed});var xd=P(ut=>{"use strict";var yP=ut&&ut.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),vP=ut&&ut.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),bP=ut&&ut.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=async(f,p)=>{try{let h=await a.sendRequest(le.DocumentSymbolRequest.type,a.code2ProtocolConverter.asDocumentSymbolParams(f),p);if(p.isCancellationRequested||h===void 0||h===null)return null;if(h.length===0)return[];{let g=h[0];return le.DocumentSymbol.is(g)?await a.protocol2CodeConverter.asDocumentSymbols(h,p):await a.protocol2CodeConverter.asSymbolInformations(h,p)}}catch(h){return a.handleFailedRequest(le.DocumentSymbolRequest.type,p,h,null)}},l=a.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(s,o,u):u(s,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[CP.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r,i),r]}};ut.DocumentSymbolFeature=Md});var cy=P(hn=>{"use strict";var DP=hn&&hn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),SP=hn&&hn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),PP=hn&&hn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let s=this._client,o=(u,l)=>s.sendRequest(Cs.WorkspaceSymbolRequest.type,{query:u},l).then(f=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformations(f,l),f=>s.handleFailedRequest(Cs.WorkspaceSymbolRequest.type,l,f,null)),a=s.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(r,i,o):o(r,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(r,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(Cs.WorkspaceSymbolResolveRequest.type,s.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(f=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformation(f),f=>s.handleFailedRequest(Cs.WorkspaceSymbolResolveRequest.type,l,f,null)),a=s.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(r,i,o):o(r,i)}:void 0};return[RP.languages.registerWorkspaceSymbolProvider(t),t]}};hn.WorkspaceSymbolFeature=Nd});var uy=P(pn=>{"use strict";var OP=pn&&pn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),EP=pn&&pn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),qP=pn&&pn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let u=this._client,l=(p,h,g,_)=>u.sendRequest(jd.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(p,h,g),_).then(v=>_.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(v,_),v=>u.handleFailedRequest(jd.ReferencesRequest.type,_,v,null)),f=u.middleware;return f.provideReferences?f.provideReferences(i,s,o,a,l):l(i,s,o,a)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return MP.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};pn.ReferencesFeature=Ld});var ly=P(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.TypeDefinitionFeature=void 0;var IP=require("vscode"),Ad=V(),ws=ne(),kd=class extends ws.TextDocumentLanguageFeature{constructor(e){super(e,Ad.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,ws.ensure)((0,ws.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,ws.ensure)((0,ws.ensure)(e,"textDocument"),"typeDefinition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.typeDefinitionProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r={provideTypeDefinition:(i,s,o)=>{let a=this._client,u=(f,p,h)=>a.sendRequest(Ad.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(g,h),g=>a.handleFailedRequest(Ad.TypeDefinitionRequest.type,h,g,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return IP.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Go.TypeDefinitionFeature=kd});var dy=P(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.ImplementationFeature=void 0;var NP=require("vscode"),$d=V(),Hd=ne(),Ud=class extends Hd.TextDocumentLanguageFeature{constructor(e){super(e,$d.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,Hd.ensure)((0,Hd.ensure)(e,"textDocument"),"implementation");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.implementationProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r={provideImplementation:(i,s,o)=>{let a=this._client,u=(f,p,h)=>a.sendRequest($d.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(g,h),g=>a.handleFailedRequest($d.ImplementationRequest.type,h,g,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return NP.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Vo.ImplementationFeature=Ud});var fy=P(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.ColorProviderFeature=void 0;var jP=require("vscode"),Ds=V(),Wd=ne(),zd=class extends Wd.TextDocumentLanguageFeature{constructor(e){super(e,Ds.DocumentColorRequest.type)}fillClientCapabilities(e){(0,Wd.ensure)((0,Wd.ensure)(e,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.colorProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r={provideColorPresentations:(i,s,o)=>{let a=this._client,u=(f,p,h)=>{let g={color:f,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p.document),range:a.code2ProtocolConverter.asRange(p.range)};return a.sendRequest(Ds.ColorPresentationRequest.type,g,h).then(_=>h.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(_,h),_=>a.handleFailedRequest(Ds.ColorPresentationRequest.type,h,_,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,s,o,u):u(i,s,o)},provideDocumentColors:(i,s)=>{let o=this._client,a=(l,f)=>{let p={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(Ds.DocumentColorRequest.type,p,f).then(h=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(h,f),h=>o.handleFailedRequest(Ds.DocumentColorRequest.type,f,h,null))},u=o.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,s,a):a(i,s)}};return[jP.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};Xo.ColorProviderFeature=zd});var hy=P(gn=>{"use strict";var FP=gn&&gn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),LP=gn&&gn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),AP=gn&&gn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let u=this._client,l=async(p,h,g,_)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(h),context:u.code2ProtocolConverter.asCodeActionContextSync(g)};return u.sendRequest(lt.CodeActionRequest.type,v,_).then(R=>_.isCancellationRequested||R===null||R===void 0?null:u.protocol2CodeConverter.asCodeActionResult(R,_),R=>u.handleFailedRequest(lt.CodeActionRequest.type,_,R,null))},f=u.middleware;return f.provideCodeActions?f.provideCodeActions(i,s,o,a,l):l(i,s,o,a)},resolveCodeAction:e.resolveProvider?(i,s)=>{let o=this._client,a=this._client.middleware,u=async(l,f)=>o.sendRequest(lt.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),f).then(p=>f.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(p,f),p=>o.handleFailedRequest(lt.CodeActionResolveRequest.type,f,p,l));return a.resolveCodeAction?a.resolveCodeAction(i,s,u):u(i,s)}:void 0};return[kP.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r,this.getMetadata(e)),r]}getMetadata(e){if(!(e.codeActionKinds===void 0&&e.documentation===void 0))return{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds),documentation:this._client.protocol2CodeConverter.asCodeActionDocumentations(e.documentation)}}};gn.CodeActionFeature=Bd});var gy=P(mn=>{"use strict";var HP=mn&&mn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),UP=mn&&mn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),WP=mn&&mn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{for(let s of this.getAllProviders())s.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:zP.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r=new py.EventEmitter,i={onDidChangeCodeLenses:r.event,provideCodeLenses:(s,o)=>{let a=this._client,u=(f,p)=>a.sendRequest(xi.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(f),p).then(h=>p.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(h,p),h=>a.handleFailedRequest(xi.CodeLensRequest.type,p,h,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(s,o,u):u(s,o)},resolveCodeLens:e.resolveProvider?(s,o)=>{let a=this._client,u=(f,p)=>a.sendRequest(xi.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(f),p).then(h=>p.isCancellationRequested?f:a.protocol2CodeConverter.asCodeLens(h),h=>a.handleFailedRequest(xi.CodeLensResolveRequest.type,p,h,f)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(s,o,u):u(s,o)}:void 0};return[py.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:r}]}};mn.CodeLensFeature=Gd});var my=P(Ct=>{"use strict";var KP=Ct&&Ct.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),BP=Ct&&Ct.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),GP=Ct&&Ct.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h)=>{let g={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(f),options:a.code2ProtocolConverter.asFormattingOptions(p,Ii.fromConfiguration(f))};return a.sendRequest(Jt.DocumentFormattingRequest.type,g,h).then(_=>h.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(_,h),_=>a.handleFailedRequest(Jt.DocumentFormattingRequest.type,h,_,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,s,o,u):u(i,s,o)}};return[Jo.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};Ct.DocumentFormattingFeature=Vd;var Xd=class extends Qn.TextDocumentLanguageFeature{constructor(e){super(e,Jt.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,Qn.ensure)((0,Qn.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let r=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);r&&this.register({id:Qd.generateUuid(),registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,r={provideDocumentRangeFormattingEdits:(i,s,o,a)=>{let u=this._client,l=(p,h,g,_)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(h),options:u.code2ProtocolConverter.asFormattingOptions(g,Ii.fromConfiguration(p))};return u.sendRequest(Jt.DocumentRangeFormattingRequest.type,v,_).then(R=>_.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(R,_),R=>u.handleFailedRequest(Jt.DocumentRangeFormattingRequest.type,_,R,null))},f=u.middleware;return f.provideDocumentRangeFormattingEdits?f.provideDocumentRangeFormattingEdits(i,s,o,a,l):l(i,s,o,a)}};return e.rangesSupport&&(r.provideDocumentRangesFormattingEdits=(i,s,o,a)=>{let u=this._client,l=(p,h,g,_)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),ranges:u.code2ProtocolConverter.asRanges(h),options:u.code2ProtocolConverter.asFormattingOptions(g,Ii.fromConfiguration(p))};return u.sendRequest(Jt.DocumentRangesFormattingRequest.type,v,_).then(R=>_.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(R,_),R=>u.handleFailedRequest(Jt.DocumentRangesFormattingRequest.type,_,R,null))},f=u.middleware;return f.provideDocumentRangesFormattingEdits?f.provideDocumentRangesFormattingEdits(i,s,o,a,l):l(i,s,o,a)}),[Jo.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};Ct.DocumentRangeFormattingFeature=Xd;var Jd=class extends Qn.TextDocumentLanguageFeature{constructor(e){super(e,Jt.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,Qn.ensure)((0,Qn.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let r=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);r&&this.register({id:Qd.generateUuid(),registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,r={provideOnTypeFormattingEdits:(s,o,a,u,l)=>{let f=this._client,p=(g,_,v,R,q)=>{let w={textDocument:f.code2ProtocolConverter.asTextDocumentIdentifier(g),position:f.code2ProtocolConverter.asPosition(_),ch:v,options:f.code2ProtocolConverter.asFormattingOptions(R,Ii.fromConfiguration(g))};return f.sendRequest(Jt.DocumentOnTypeFormattingRequest.type,w,q).then(M=>q.isCancellationRequested?null:f.protocol2CodeConverter.asTextEdits(M,q),M=>f.handleFailedRequest(Jt.DocumentOnTypeFormattingRequest.type,q,M,null))},h=f.middleware;return h.provideOnTypeFormattingEdits?h.provideOnTypeFormattingEdits(s,o,a,u,l,p):p(s,o,a,u,l)}},i=e.moreTriggerCharacter||[];return[Jo.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r,e.firstTriggerCharacter,...i),r]}};Ct.DocumentOnTypeFormattingFeature=Jd});var vy=P(_n=>{"use strict";var VP=_n&&_n.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),XP=_n&&_n.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),yy=_n&&_n.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let u=this._client,l=async(p,h,g,_)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),position:u.code2ProtocolConverter.asPosition(h),newName:g},R=null;try{R=await u.sendRequest(Ur.RenameRequest.type,v,_)}catch(w){return u.handleFailedRequest(Ur.RenameRequest.type,_,w,null,!1)}if(_.isCancellationRequested||R===null)return null;let q=await u.protocol2CodeConverter.asWorkspaceEdit(R,_);if(_.isCancellationRequested)return null;if(!u.validateWorkspaceEdit(R))throw new Error("The rename edit returned from the server is not valid anymore and cannot be applied.");return q},f=u.middleware;return f.provideRenameEdits?f.provideRenameEdits(i,s,o,a,l):l(i,s,o,a)},prepareRename:e.prepareProvider?(i,s,o)=>{let a=this._client,u=(f,p,h)=>{let g={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(f),position:a.code2ProtocolConverter.asPosition(p)};return a.sendRequest(Ur.PrepareRenameRequest.type,g,h).then(_=>h.isCancellationRequested?null:Ur.Range.is(_)?a.protocol2CodeConverter.asRange(_):this.isDefaultBehavior(_)?_.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):_&&Ur.Range.is(_.range)?{range:a.protocol2CodeConverter.asRange(_.range),placeholder:_.placeholder}:Promise.reject(new Error("The element can't be renamed.")),_=>{throw typeof _.message=="string"?new Error(_.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,s,o,u):u(i,s,o)}:void 0};return[this.registerProvider(t,r),r]}registerProvider(e,t){return JP.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&_y.boolean(t.defaultBehavior)}};_n.RenameFeature=Zd});var by=P(yn=>{"use strict";var YP=yn&&yn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),ZP=yn&&yn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),eR=yn&&yn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let o=this._client,a=(l,f)=>o.sendRequest(Ps.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),f).then(p=>f.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(p,f),p=>o.handleFailedRequest(Ps.DocumentLinkRequest.type,f,p,null)),u=o.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,s,a):a(i,s)},resolveDocumentLink:e.resolveProvider?(i,s)=>{let o=this._client,a=(l,f)=>o.sendRequest(Ps.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),f).then(p=>f.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(p),p=>o.handleFailedRequest(Ps.DocumentLinkResolveRequest.type,f,p,l)),u=o.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,s,a):a(i,s)}:void 0};return[tR.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};yn.DocumentLinkFeature=tf});var wy=P(vn=>{"use strict";var rR=vn&&vn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),iR=vn&&vn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),sR=vn&&vn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0}}get registrationType(){return nf.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Cy.ensure)((0,Cy.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:aR.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,r=t.middleware,i=(s,o)=>{let a={command:s,arguments:o};return t.sendRequest(nf.ExecuteCommandRequest.type,a).then(void 0,u=>t.handleFailedRequest(nf.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let s=[];for(let o of e.registerOptions.commands)s.push(oR.commands.registerCommand(o,(...a)=>r.executeCommand?r.executeCommand(o,a,i):i(o,a)));this._commands.set(e.id,s)}}unregister(e){let t=this._commands.get(e);t&&(this._commands.delete(e),t.forEach(r=>r.dispose()))}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};vn.ExecuteCommandFeature=rf});var Sy=P(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.FoldingRangeFeature=void 0;var Dy=require("vscode"),Wr=V(),Rs=ne(),sf=class extends Rs.TextDocumentLanguageFeature{constructor(e){super(e,Wr.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Rs.ensure)((0,Rs.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[Wr.FoldingRangeKind.Comment,Wr.FoldingRangeKind.Imports,Wr.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,Rs.ensure)((0,Rs.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(Wr.FoldingRangeRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeFoldingRange.fire()});let[r,i]=this.getRegistration(t,e.foldingRangeProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r=new Dy.EventEmitter,i={onDidChangeFoldingRanges:r.event,provideFoldingRanges:(s,o,a)=>{let u=this._client,l=(p,h,g)=>{let _={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p)};return u.sendRequest(Wr.FoldingRangeRequest.type,_,g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(v,g),v=>u.handleFailedRequest(Wr.FoldingRangeRequest.type,g,v,null))},f=u.middleware;return f.provideFoldingRanges?f.provideFoldingRanges(s,o,a,l):l(s,o,a)}};return[Dy.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:r}]}};Qo.FoldingRangeFeature=sf});var Py=P(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.DeclarationFeature=void 0;var cR=require("vscode"),of=V(),af=ne(),cf=class extends af.TextDocumentLanguageFeature{constructor(e){super(e,of.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,af.ensure)((0,af.ensure)(e,"textDocument"),"declaration");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.declarationProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r={provideDeclaration:(i,s,o)=>{let a=this._client,u=(f,p,h)=>a.sendRequest(of.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(g,h),g=>a.handleFailedRequest(of.DeclarationRequest.type,h,g,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return cR.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Yo.DeclarationFeature=cf});var Ry=P(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.SelectionRangeFeature=void 0;var uR=require("vscode"),uf=V(),lf=ne(),df=class extends lf.TextDocumentLanguageFeature{constructor(e){super(e,uf.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,lf.ensure)((0,lf.ensure)(e,"textDocument"),"selectionRange");t.dynamicRegistration=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.selectionRangeProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r={provideSelectionRanges:(i,s,o)=>{let a=this._client,u=async(f,p,h)=>{let g={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(f),positions:a.code2ProtocolConverter.asPositionsSync(p,h)};return a.sendRequest(uf.SelectionRangeRequest.type,g,h).then(_=>h.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(_,h),_=>a.handleFailedRequest(uf.SelectionRangeRequest.type,h,_,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return uR.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Zo.SelectionRangeFeature=df});var Ty=P(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.CallHierarchyFeature=void 0;var lR=require("vscode"),zr=V(),ff=ne(),hf=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,r){let i=this.client,s=this.middleware,o=(a,u,l)=>{let f=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(zr.CallHierarchyPrepareRequest.type,f,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(p,l),p=>i.handleFailedRequest(zr.CallHierarchyPrepareRequest.type,l,p,null))};return s.prepareCallHierarchy?s.prepareCallHierarchy(e,t,r,o):o(e,t,r)}provideCallHierarchyIncomingCalls(e,t){let r=this.client,i=this.middleware,s=(o,a)=>{let u={item:r.code2ProtocolConverter.asCallHierarchyItem(o)};return r.sendRequest(zr.CallHierarchyIncomingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>r.handleFailedRequest(zr.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,s):s(e,t)}provideCallHierarchyOutgoingCalls(e,t){let r=this.client,i=this.middleware,s=(o,a)=>{let u={item:r.code2ProtocolConverter.asCallHierarchyItem(o)};return r.sendRequest(zr.CallHierarchyOutgoingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>r.handleFailedRequest(zr.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,s):s(e,t)}},pf=class extends ff.TextDocumentLanguageFeature{constructor(e){super(e,zr.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,r=(0,ff.ensure)((0,ff.ensure)(t,"textDocument"),"callHierarchy");r.dynamicRegistration=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.callHierarchyProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=this._client,r=new hf(t);return[lR.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),r),r]}};ea.CallHierarchyFeature=pf});var Ey=P(bn=>{"use strict";var dR=bn&&bn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),fR=bn&&bn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Oy=bn&&bn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{for(let o of this.getAllProviders())o.onDidChangeSemanticTokensEmitter.fire()});let[i,s]=this.getRegistration(t,e.semanticTokensProvider);!i||!s||this.register({id:i,registerOptions:s})}registerLanguageProvider(e){let t=e.documentSelector,r=hR.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,s=new ta.EventEmitter,o=r?{onDidChangeSemanticTokens:s.event,provideDocumentSemanticTokens:(g,_)=>{let v=this._client,R=v.middleware,q=(w,M)=>{let j={textDocument:v.code2ProtocolConverter.asTextDocumentIdentifier(w)};return v.sendRequest(J.SemanticTokensRequest.type,j,M).then(F=>M.isCancellationRequested?null:v.protocol2CodeConverter.asSemanticTokens(F,M),F=>v.handleFailedRequest(J.SemanticTokensRequest.type,M,F,null))};return R.provideDocumentSemanticTokens?R.provideDocumentSemanticTokens(g,_,q):q(g,_)},provideDocumentSemanticTokensEdits:i?(g,_,v)=>{let R=this._client,q=R.middleware,w=(M,j,F)=>{let oe={textDocument:R.code2ProtocolConverter.asTextDocumentIdentifier(M),previousResultId:j};return R.sendRequest(J.SemanticTokensDeltaRequest.type,oe,F).then(async te=>F.isCancellationRequested?null:J.SemanticTokens.is(te)?await R.protocol2CodeConverter.asSemanticTokens(te,F):await R.protocol2CodeConverter.asSemanticTokensEdits(te,F),te=>R.handleFailedRequest(J.SemanticTokensDeltaRequest.type,F,te,null))};return q.provideDocumentSemanticTokensEdits?q.provideDocumentSemanticTokensEdits(g,_,v,w):w(g,_,v)}:void 0}:void 0,u=e.range===!0?{onDidChangeSemanticTokens:s.event,provideDocumentRangeSemanticTokens:(g,_,v)=>{let R=this._client,q=R.middleware,w=(M,j,F)=>{let oe={textDocument:R.code2ProtocolConverter.asTextDocumentIdentifier(M),range:R.code2ProtocolConverter.asRange(j)};return R.sendRequest(J.SemanticTokensRangeRequest.type,oe,F).then(te=>F.isCancellationRequested?null:R.protocol2CodeConverter.asSemanticTokens(te,F),te=>R.handleFailedRequest(J.SemanticTokensRangeRequest.type,F,te,null))};return q.provideDocumentRangeSemanticTokens?q.provideDocumentRangeSemanticTokens(g,_,v,w):w(g,_,v)}}:void 0,l=[],f=this._client,p=f.protocol2CodeConverter.asSemanticTokensLegend(e.legend),h=f.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(ta.languages.registerDocumentSemanticTokensProvider(h,o,p)),u!==void 0&&l.push(ta.languages.registerDocumentRangeSemanticTokensProvider(h,u,p)),[new ta.Disposable(()=>l.forEach(g=>g.dispose())),{range:u,full:o,onDidChangeSemanticTokensEmitter:s}]}};bn.SemanticTokensFeature=gf});var My=P(Cn=>{"use strict";var pR=Cn&&Cn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),gR=Cn&&Cn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),qy=Cn&&Cn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let a=this._client,u=(f,p,h)=>a.sendRequest(mf.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(f,p),h).then(g=>h.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(g,h),g=>a.handleFailedRequest(mf.LinkedEditingRangeRequest.type,h,g,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,r),r]}registerProvider(e,t){return mR.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Cn.LinkedEditingFeature=yf});var xy=P(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.TypeHierarchyFeature=void 0;var _R=require("vscode"),Kr=V(),vf=ne(),bf=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,r){let i=this.client,s=this.middleware,o=(a,u,l)=>{let f=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(Kr.TypeHierarchyPrepareRequest.type,f,l).then(p=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(p,l),p=>i.handleFailedRequest(Kr.TypeHierarchyPrepareRequest.type,l,p,null))};return s.prepareTypeHierarchy?s.prepareTypeHierarchy(e,t,r,o):o(e,t,r)}provideTypeHierarchySupertypes(e,t){let r=this.client,i=this.middleware,s=(o,a)=>{let u={item:r.code2ProtocolConverter.asTypeHierarchyItem(o)};return r.sendRequest(Kr.TypeHierarchySupertypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>r.handleFailedRequest(Kr.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,s):s(e,t)}provideTypeHierarchySubtypes(e,t){let r=this.client,i=this.middleware,s=(o,a)=>{let u={item:r.code2ProtocolConverter.asTypeHierarchyItem(o)};return r.sendRequest(Kr.TypeHierarchySubtypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:r.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>r.handleFailedRequest(Kr.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,s):s(e,t)}},Cf=class extends vf.TextDocumentLanguageFeature{constructor(e){super(e,Kr.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,vf.ensure)((0,vf.ensure)(e,"textDocument"),"typeHierarchy");t.dynamicRegistration=!0}initialize(e,t){let[r,i]=this.getRegistration(t,e.typeHierarchyProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=this._client,r=new bf(t);return[_R.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),r),r]}};na.TypeHierarchyFeature=Cf});var Ny=P(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.InlineValueFeature=void 0;var Iy=require("vscode"),ra=V(),Os=ne(),wf=class extends Os.TextDocumentLanguageFeature{constructor(e){super(e,ra.InlineValueRequest.type)}fillClientCapabilities(e){(0,Os.ensure)((0,Os.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,Os.ensure)((0,Os.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(ra.InlineValueRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeInlineValues.fire()});let[r,i]=this.getRegistration(t,e.inlineValueProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r=new Iy.EventEmitter,i={onDidChangeInlineValues:r.event,provideInlineValues:(s,o,a,u)=>{let l=this._client,f=(h,g,_,v)=>{let R={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(h),range:l.code2ProtocolConverter.asRange(g),context:l.code2ProtocolConverter.asInlineValueContext(_)};return l.sendRequest(ra.InlineValueRequest.type,R,v).then(q=>v.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(q,v),q=>l.handleFailedRequest(ra.InlineValueRequest.type,v,q,null))},p=l.middleware;return p.provideInlineValues?p.provideInlineValues(s,o,a,u,f):f(s,o,a,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:r}]}registerProvider(e,t){return Iy.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ia.InlineValueFeature=wf});var Fy=P(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.InlayHintsFeature=void 0;var jy=require("vscode"),Ni=V(),Es=ne(),Df=class extends Es.TextDocumentLanguageFeature{constructor(e){super(e,Ni.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,Es.ensure)((0,Es.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,Es.ensure)((0,Es.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(Ni.InlayHintRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeInlayHints.fire()});let[r,i]=this.getRegistration(t,e.inlayHintProvider);!r||!i||this.register({id:r,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,r=new jy.EventEmitter,i={onDidChangeInlayHints:r.event,provideInlayHints:(s,o,a)=>{let u=this._client,l=async(p,h,g)=>{let _={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(p),range:u.code2ProtocolConverter.asRange(h)};try{let v=await u.sendRequest(Ni.InlayHintRequest.type,_,g);return g.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(v,g)}catch(v){return u.handleFailedRequest(Ni.InlayHintRequest.type,g,v,null)}},f=u.middleware;return f.provideInlayHints?f.provideInlayHints(s,o,a,l):l(s,o,a)}};return i.resolveInlayHint=e.resolveProvider===!0?(s,o)=>{let a=this._client,u=async(f,p)=>{try{let h=await a.sendRequest(Ni.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(f),p);if(p.isCancellationRequested)return null;let g=a.protocol2CodeConverter.asInlayHint(h,p);return p.isCancellationRequested?null:g}catch(h){return a.handleFailedRequest(Ni.InlayHintResolveRequest.type,p,h,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(s,o,u):u(s,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:r}]}registerProvider(e,t){return jy.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};sa.InlayHintsFeature=Df});var Ly=P(Qt=>{"use strict";var yR=Qt&&Qt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),vR=Qt&&Qt.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),bR=Qt&&Qt.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;ie.indexOf(t)<0)}var Rf=class{_client;_listeners;_initialFolders;constructor(e){this._client=e,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return qs.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=oa.workspace.workspaceFolders;this.initializeWithFolders(t),t===void 0?e.workspaceFolders=null:e.workspaceFolders=t.map(r=>this.asProtocol(r))}initializeWithFolders(e){this._initialFolders=e}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.workspaceFolders=!0}initialize(e){let t=this._client;t.onRequest(qs.WorkspaceFoldersRequest.type,s=>{let o=()=>{let u=oa.workspace.workspaceFolders;return u===void 0?null:u.map(f=>this.asProtocol(f))},a=t.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(s,o):o(s)});let r=Sf(Sf(Sf(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof r=="string"?i=r:r===!0&&(i=CR.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let r=Pf(this._initialFolders,e),i=Pf(e,this._initialFolders);(i.length>0||r.length>0)&&(t=this.doSendEvent(i,r))}else this._initialFolders?t=this.doSendEvent([],this._initialFolders):e&&(t=this.doSendEvent(e,[]));t!==void 0&&t.catch(r=>{this._client.error(`Sending notification ${qs.DidChangeWorkspaceFoldersNotification.type.method} failed`,r)})}doSendEvent(e,t){let r={event:{added:e.map(i=>this.asProtocol(i)),removed:t.map(i=>this.asProtocol(i))}};return this._client.sendNotification(qs.DidChangeWorkspaceFoldersNotification.type,r)}register(e){let t=e.id,r=this._client,i=oa.workspace.onDidChangeWorkspaceFolders(s=>{let o=l=>this.doSendEvent(l.added,l.removed),a=r.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(s,o):o(s)).catch(l=>{this._client.error(`Sending notification ${qs.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(oa.workspace.workspaceFolders)}unregister(e){let t=this._listeners.get(e);t!==void 0&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear()}asProtocol(e){return e===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(e.uri),name:e.name}}};Qt.WorkspaceFoldersFeature=Rf});var $y=P(ze=>{"use strict";var wR=ze&&ze.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),DR=ze&&ze.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ua=ze&&ze.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0}}filterSize(){return this._filters.size}get registrationType(){return this._registrationType}fillClientCapabilities(e){let t=Ay(Ay(e,"workspace"),"fileOperations");ky(t,"dynamicRegistration",!0),ky(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,r=t!==void 0?RR(t,this._serverCapability):void 0;if(r?.filters!==void 0)try{this.register({id:PR.generateUuid(),registerOptions:{filters:r.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(e){this._listener||(this._listener=this._event(this.send,this));let t=e.registerOptions.filters.map(r=>{let i=new SR.Minimatch(r.pattern.glob,n.asMinimatchOptions(r.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${r.pattern.glob}!`);return{scheme:r.scheme,matcher:i,kind:r.pattern.matches}});this._filters.set(e.id,t)}unregister(e){this._filters.delete(e),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(e){return n.getFileType(e)}async filter(e,t){let r=await Promise.all(e.files.map(async s=>{let o=t(s),a=o.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;let f=await this.getFileType(o);if(f===void 0)return this._client.info(`Unable to determine file type for ${o.toString()}. Treating as a match.`),!0;if(f===$t.FileType.File&&l.kind===Yn.FileOperationPatternKind.file||f===$t.FileType.Directory&&l.kind===Yn.FileOperationPatternKind.folder)return!0}else if(l.kind===Yn.FileOperationPatternKind.folder&&await n.getFileType(o)===$t.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=e.files.filter((s,o)=>r[o]);return{...e,files:i}}static async getFileType(e){try{return(await $t.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},aa=class extends Ms{_notificationType;_accessUri;_createParams;constructor(e,t,r,i,s,o,a){super(e,t,r,i,s),this._notificationType=r,this._accessUri=o,this._createParams=a}async send(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let r=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(t,r)}}},ca=class extends aa{_willListener;_fsPathFileTypes=new Map;async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let r=await Ms.getFileType(e);return r&&this._fsPathFileTypes.set(t,r),r}async cacheFileTypes(e,t){await this.filter(e,t)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(e){super.unregister(e),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}clear(){super.clear(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}},Tf=class extends aa{constructor(e){super(e,$t.workspace.onDidCreateFiles,Yn.DidCreateFilesNotification.type,"didCreate","didCreate",t=>t,e.code2ProtocolConverter.asDidCreateFilesParams)}doSend(e,t){let r=this._client.middleware.workspace;return r?.didCreateFiles?r.didCreateFiles(e,t):t(e)}};ze.DidCreateFilesFeature=Tf;var Of=class extends ca{constructor(e){super(e,$t.workspace.onDidRenameFiles,Yn.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=$t.workspace.onWillRenameFiles(this.willRename,this)),super.register(e)}willRename(e){e.waitUntil(this.cacheFileTypes(e,t=>t.oldUri))}doSend(e,t){this.clearFileTypeCache();let r=this._client.middleware.workspace;return r?.didRenameFiles?r.didRenameFiles(e,t):t(e)}};ze.DidRenameFilesFeature=Of;var Ef=class extends ca{constructor(e){super(e,$t.workspace.onDidDeleteFiles,Yn.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=$t.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(e)}willDelete(e){e.waitUntil(this.cacheFileTypes(e,t=>t))}doSend(e,t){this.clearFileTypeCache();let r=this._client.middleware.workspace;return r?.didDeleteFiles?r.didDeleteFiles(e,t):t(e)}};ze.DidDeleteFilesFeature=Ef;var xs=class extends Ms{_requestType;_accessUri;_createParams;constructor(e,t,r,i,s,o,a){super(e,t,r,i,s),this._requestType=r,this._accessUri=o,this._createParams=a}async send(e){let t=this.waitUntil(e);e.waitUntil(t)}async waitUntil(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let r=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(t,r)}else return}},qf=class extends xs{constructor(e){super(e,$t.workspace.onWillCreateFiles,Yn.WillCreateFilesRequest.type,"willCreate","willCreate",t=>t,e.code2ProtocolConverter.asWillCreateFilesParams)}doSend(e,t){let r=this._client.middleware.workspace;return r?.willCreateFiles?r.willCreateFiles(e,t):t(e)}};ze.WillCreateFilesFeature=qf;var Mf=class extends xs{constructor(e){super(e,$t.workspace.onWillRenameFiles,Yn.WillRenameFilesRequest.type,"willRename","willRename",t=>t.oldUri,e.code2ProtocolConverter.asWillRenameFilesParams)}doSend(e,t){let r=this._client.middleware.workspace;return r?.willRenameFiles?r.willRenameFiles(e,t):t(e)}};ze.WillRenameFilesFeature=Mf;var xf=class extends xs{constructor(e){super(e,$t.workspace.onWillDeleteFiles,Yn.WillDeleteFilesRequest.type,"willDelete","willDelete",t=>t,e.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(e,t){let r=this._client.middleware.workspace;return r?.willDeleteFiles?r.willDeleteFiles(e,t):t(e)}};ze.WillDeleteFilesFeature=xf});var Hy=P(wn=>{"use strict";var TR=wn&&wn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),OR=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ER=wn&&wn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let u=this._client,l=this._client.middleware,f=(p,h,g,_)=>u.sendRequest(If.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(p,h,g),_).then(v=>_.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(v,_),v=>u.handleFailedRequest(If.InlineCompletionRequest.type,_,v,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,s,o,a,f):f(i,s,o,a)}};return[qR.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),r),r]}};wn.InlineCompletionItemFeature=jf});var zy=P(Dn=>{"use strict";var xR=Dn&&Dn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),IR=Dn&&Dn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),Wy=Dn&&Dn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0;return{kind:"workspace",id:ji.TextDocumentContentRequest.method,registrations:e}}get registrationType(){return ji.TextDocumentContentRequest.type}getProviders(){let e=[];for(let t of this._registrations.values())e.push(...t.providers);return e}fillClientCapabilities(e){let t=(0,Uy.ensure)((0,Uy.ensure)(e,"workspace"),"textDocumentContent");t.dynamicRegistration=!0}initialize(e){let t=this._client;if(t.onRequest(ji.TextDocumentContentRefreshRequest.type,async s=>{let o=t.protocol2CodeConverter.asUri(s.uri);for(let a of this._registrations.values())for(let u of a.providers)u.scheme===o.scheme&&u.onDidChangeEmitter.fire(o)}),!e?.workspace?.textDocumentContent)return;let r=e.workspace.textDocumentContent,i=ji.StaticRegistrationOptions.hasId(r)?r.id:NR.generateUuid();this.register({id:i,registerOptions:r})}register(e){let t=[],r=[];for(let i of e.registerOptions.schemes){let[s,o]=this.registerTextDocumentContentProvider(i);t.push(o),r.push(s)}this._registrations.set(e.id,{disposable:Ff.Disposable.from(...r),providers:t})}registerTextDocumentContentProvider(e){let t=new Ff.EventEmitter,r={onDidChange:t.event,provideTextDocumentContent:(i,s)=>{let o=this._client,a=(l,f)=>{let p={uri:o.code2ProtocolConverter.asUri(l)};return o.sendRequest(ji.TextDocumentContentRequest.type,p,f).then(h=>f.isCancellationRequested?null:h.text,h=>o.handleFailedRequest(ji.TextDocumentContentRequest.type,f,h,null))},u=o.middleware;return u.provideTextDocumentContent?u.provideTextDocumentContent(i,s,a):a(i,s)}};return[Ff.workspace.registerTextDocumentContentProvider(e,r),{scheme:e,onDidChangeEmitter:t,provider:r}]}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}};Dn.TextDocumentContentFeature=Lf});var Ky=P(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.FileSystemWatcherFeature=void 0;var jR=require("vscode"),Br=V(),la=ne(),Af=class{_client;_notifyFileEvent;_watchers;constructor(e,t){this._client=e,this._notifyFileEvent=t,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return Br.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,la.ensure)((0,la.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,la.ensure)((0,la.ensure)(e,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(e,t){}register(e){if(!Array.isArray(e.registerOptions.watchers))return;let t=[];for(let r of e.registerOptions.watchers){let i=this._client.protocol2CodeConverter.asGlobPattern(r.globPattern);if(i===void 0)continue;let s=!0,o=!0,a=!0;r.kind!==void 0&&r.kind!==null&&(s=(r.kind&Br.WatchKind.Create)!==0,o=(r.kind&Br.WatchKind.Change)!==0,a=(r.kind&Br.WatchKind.Delete)!==0);let u=jR.workspace.createFileSystemWatcher(i,!s,!o,!a);this.hookListeners(u,s,o,a,t),t.push(u)}this._watchers.set(e.id,t)}registerRaw(e,t){let r=[];for(let i of t)this.hookListeners(i,!0,!0,!0,r);this._watchers.set(e,r)}hookListeners(e,t,r,i,s){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Br.FileChangeType.Created}),null,s),r&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Br.FileChangeType.Changed}),null,s),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Br.FileChangeType.Deleted}),null,s)}unregister(e){let t=this._watchers.get(e);if(t){this._watchers.delete(e);for(let r of t)r.dispose()}}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};da.FileSystemWatcherFeature=Af});var Gy=P(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.ProgressFeature=void 0;var By=V(),FR=Ll();function LR(n,e){return n[e]===void 0&&(n[e]=Object.create(null)),n[e]}var kf=class{_client;activeParts;constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:By.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){LR(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},r=i=>{this.activeParts.add(new FR.ProgressPart(this._client,i.token,t))};e.onRequest(By.WorkDoneProgressCreateRequest.type,r)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};fa.ProgressFeature=kf});var Vf=P(he=>{"use strict";var AR=he&&he.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),kR=he&&he.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ga=he&&he.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{let t=this.open,r=new Set;n.fillVisibleResources(r);let i=new Set,s=new Set(r);for(let o of t.values())r.has(o)?s.delete(o):i.add(o);if(this.open=r,i.size>0){let o=new Set;for(let a of i)o.add(G.Uri.parse(a));this._onClose.fire(o)}if(s.size>0){let o=new Set;for(let a of s)o.add(G.Uri.parse(a));this._onOpen.fire(o)}};this.disposables.push(G.window.tabGroups.onDidChangeTabs(t=>{t.closed.length===0&&t.opened.length===0||e()})),this.disposables.push(G.window.onDidChangeVisibleTextEditors(t=>{e()}))}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposables.forEach(e=>e.dispose())}isActive(e){return e instanceof G.Uri?G.window.activeTextEditor?.document.uri===e:G.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof G.Uri?e:e.uri;return t.scheme===Hf.NotebookDocumentSyncFeature.CellScheme?G.workspace.notebookDocuments.some(r=>this.open.has(r.uri.toString())?r.getCells().find(s=>s.document.uri.toString()===t.toString())!==void 0:!1):this.open.has(t.toString())}getResources(){let e=new Set;return n.fillVisibleResources(new Set,e),e}static fillVisibleResources(e,t){let r=e??new Set;for(let i of G.window.tabGroups.all)for(let s of i.tabs){let o=s.input,a;o instanceof G.TabInputText?a=o.uri:o instanceof G.TabInputTextDiff?a=o.modified:(o instanceof G.TabInputCustom||o instanceof G.TabInputNotebook)&&(a=o.uri),a!==void 0&&!r.has(a.toString())&&(r.add(a.toString()),t!==void 0&&t.add(a))}for(let i of G.window.visibleTextEditors){let s=i.document.uri;r.has(s.toString())||(r.add(s.toString()),t!==void 0&&t.add(s))}}},pa=class n{_id;_name;_clientOptions;_state;_onStart;_onStop;_connection;_idleInterval;_ignoredRegistrations;_listeners;_disposed;_notificationHandlers;_notificationDisposables;_pendingNotificationHandlers;_requestHandlers;_requestDisposables;_pendingRequestHandlers;_progressHandlers;_pendingProgressHandlers;_progressDisposables;_initializeResult;_outputChannel;_disposeOutputChannel;_traceOutputChannel;_traceLogLevel;_capabilities;_diagnostics;_syncedDocuments;_didChangeTextDocumentFeature;_inFlightOpenNotifications;_pendingChangeSemaphore;_pendingChangeDelayer;_didOpenTextDocumentFeature;_fileEvents;_fileEventDelayer;_telemetryEmitter;_stateChangeEmitter;_trace;_traceFormat=x.TraceFormat.Text;_tracer;_c2p;_p2c;_visibleDocuments;constructor(e,t,r){this._id=e,this._name=t,r=r||{};let i={isTrusted:!1,supportHtml:!1,supportThemeIcons:!1};r.markdown!==void 0&&(i.isTrusted=Uf.sanitizeIsTrusted(r.markdown.isTrusted),i.supportHtml=r.markdown.supportHtml===!0,i.supportThemeIcons=r.markdown.supportThemeIcons===!0),this._clientOptions={documentSelector:r.documentSelector??[],synchronize:r.synchronize??{},diagnosticCollectionName:r.diagnosticCollectionName,outputChannelName:r.outputChannelName??this._name,revealOutputChannelOn:r.revealOutputChannelOn??Gr.Error,stdioEncoding:r.stdioEncoding??"utf8",initializationOptions:r.initializationOptions,initializationFailedHandler:r.initializationFailedHandler,progressOnInitialization:!!r.progressOnInitialization,errorHandler:r.errorHandler??this.createDefaultErrorHandler(r.connectionOptions?.maxRestartCount),middleware:r.middleware??{},uriConverters:r.uriConverters,workspaceFolder:r.workspaceFolder,connectionOptions:r.connectionOptions,markdown:i,diagnosticPullOptions:r.diagnosticPullOptions??{onChange:!0,onSave:!1},diagnosticCollectionProvider:r.diagnosticCollectionProvider??new dt.DefaultDiagnosticCollectionProvider,notebookDocumentOptions:r.notebookDocumentOptions??{},textSynchronization:this.createTextSynchronizationOptions(r.textSynchronization)},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=Y.Initial,this._ignoredRegistrations=new Set,this._listeners=[],this._notificationHandlers=new Map,this._pendingNotificationHandlers=new Map,this._notificationDisposables=new Map,this._requestHandlers=new Map,this._pendingRequestHandlers=new Map,this._requestDisposables=new Map,this._progressHandlers=new Map,this._pendingProgressHandlers=new Map,this._progressDisposables=new Map,this._connection=void 0,this._initializeResult=void 0,r.outputChannel?(this._outputChannel=r.outputChannel,this._disposeOutputChannel=!1,this._traceLogLevel=this._outputChannel.logLevel):(this._outputChannel=void 0,this._disposeOutputChannel=!0,this._traceLogLevel=G.LogLevel.Info),this._traceOutputChannel=r.traceOutputChannel,this._traceOutputChannel!==void 0&&(this._traceLogLevel=this._traceOutputChannel.logLevel),this._diagnostics=void 0,this._inFlightOpenNotifications=new Set,this._pendingChangeSemaphore=new ha.Semaphore(1),this._pendingChangeDelayer=new ha.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new ha.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new x.Emitter,this._stateChangeEmitter=new x.Emitter,this._trace=x.Trace.Off,this._tracer={log:(s,o)=>{Yt.string(s)?this.trace(s,o):this.traceObject(s)}},this._c2p=$R.createConverter(r.uriConverters?r.uriConverters.code2Protocol:void 0),this._p2c=HR.createConverter(r.uriConverters?r.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml,this._clientOptions.markdown.supportThemeIcons),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}createTextSynchronizationOptions(e){return e?typeof e.delayOpenNotifications=="boolean"?{delayOpenNotifications:e.delayOpenNotifications}:{delayOpenNotifications:!1}:{delayOpenNotifications:!1}}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get visibleDocuments(){return this._visibleDocuments===void 0&&(this._visibleDocuments=new zf),this._visibleDocuments}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=G.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name,{log:!0}),this._traceOutputChannel===void 0&&(this._traceLogLevel=this._outputChannel.logLevel)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){if(this._diagnostics!==null)return this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionProvider.create(this._clientOptions.diagnosticCollectionName??this._id,dt.DiagnosticCollectionSource.push)),this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(e){let t=this.getPublicState();this._state=e;let r=this.getPublicState();r!==t&&this._stateChangeEmitter.fire({oldState:t,newState:r})}getPublicState(){switch(this.$state){case Y.Starting:return Ai.Starting;case Y.Running:return Ai.Running;case Y.StartFailed:return Ai.StartFailed;default:return Ai.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===Y.StartFailed||this.$state===Y.Stopping||this.$state===Y.Stopped)return Promise.reject(new x.ResponseError(x.ErrorCodes.ConnectionInactive,"Client is not running"));let r=await this.$start();await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(),this._didChangeTextDocumentFeature.syncKind===x.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(r);let i,s;if(t.length===1?x.CancellationToken.is(t[0])?s=t[0]:i=t[0]:t.length===2&&(i=t[0],s=t[1]),s!==void 0&&s.isCancellationRequested)return Promise.reject(new x.ResponseError(x.LSPErrorCodes.RequestCancelled,"Request got cancelled"));let o=this._clientOptions.middleware?.sendRequest;return o!==void 0?o(e,i,s,(a,u,l)=>{let f=[];return u!==void 0&&f.push(u),l!==void 0&&f.push(l),r.sendRequest(a,...f)}):r.sendRequest(e,...t)}onRequest(e,t){let r=typeof e=="string"?e:e.method;this._requestHandlers.set(r,t);let i=this.activeConnection(),s;return i!==void 0?(this._requestDisposables.set(r,i.onRequest(e,t)),s={dispose:()=>{let o=this._requestDisposables.get(r);o!==void 0&&(o.dispose(),this._requestDisposables.delete(r))}}):(this._pendingRequestHandlers.set(r,t),s={dispose:()=>{this._pendingRequestHandlers.delete(r);let o=this._requestDisposables.get(r);o!==void 0&&(o.dispose(),this._requestDisposables.delete(r))}}),{dispose:()=>{this._requestHandlers.delete(r),s.dispose()}}}async sendNotification(e,t){if(this.$state===Y.StartFailed||this.$state===Y.Stopping||this.$state===Y.Stopped)return Promise.reject(new x.ResponseError(x.ErrorCodes.ConnectionInactive,"Client is not running"));let r=this._didChangeTextDocumentFeature.syncKind===x.TextDocumentSyncKind.Full,i;r&&typeof e!="string"&&e.method===x.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._inFlightOpenNotifications.add(i));let s;typeof e!="string"&&e.method===x.DidCloseTextDocumentNotification.method&&(s=t.textDocument.uri);let o=await this.$start();if(await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(s))return;r&&await this.sendPendingFullTextDocumentChanges(o),i!==void 0&&this._inFlightOpenNotifications.delete(i);let u=this._clientOptions.middleware?.sendNotification;return u?u(e,o.sendNotification.bind(o),t):o.sendNotification(e,t)}onNotification(e,t){let r=typeof e=="string"?e:e.method;this._notificationHandlers.set(r,t);let i=this.activeConnection(),s;return i!==void 0?(this._notificationDisposables.set(r,i.onNotification(e,t)),s={dispose:()=>{let o=this._notificationDisposables.get(r);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(r))}}):(this._pendingNotificationHandlers.set(r,t),s={dispose:()=>{this._pendingNotificationHandlers.delete(r);let o=this._notificationDisposables.get(r);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(r))}}),{dispose:()=>{this._notificationHandlers.delete(r),s.dispose()}}}async sendProgress(e,t,r){if(this.$state===Y.StartFailed||this.$state===Y.Stopping||this.$state===Y.Stopped)return Promise.reject(new x.ResponseError(x.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(e,t,r)}catch(i){throw this.error(`Sending progress for token ${t} failed.`,i),i}}onProgress(e,t,r){this._progressHandlers.set(t,{type:e,handler:r});let i=this.activeConnection(),s,o=this._clientOptions.middleware?.handleWorkDoneProgress,a=x.WorkDoneProgress.is(e)&&o!==void 0?u=>{o(t,u,()=>r(u))}:r;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,a)),s={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:r}),s={dispose:()=>{this._pendingProgressHandlers.delete(t);let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),s.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new Wf(this,e??4)}async setTrace(e){this._trace=e;let t=this.activeConnection();t!==void 0&&await t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(e){if(e instanceof x.ResponseError){let t=e;return` Message: ${t.message} + Code: ${t.code} ${t.data?` +`+t.data.toString():""}`}return e instanceof Error?Yt.string(e.stack)?e.stack:e.message:Yt.string(e)?e:e.toString()}shouldLogToOutputChannel(){return this.$state!==Y.Stopped?!0:this._outputChannel!==void 0}error(e,t,r=!0){this.shouldLogToOutputChannel()&&this.outputChannel.error(this.getLogMessage(e,t)),(r==="force"||r&&this._clientOptions.revealOutputChannelOn<=Gr.Error)&&this.showNotificationMessage(x.MessageType.Error,e,t)}warn(e,t,r=!0){this.shouldLogToOutputChannel()&&this.outputChannel.warn(this.getLogMessage(e,t)),r&&this._clientOptions.revealOutputChannelOn<=Gr.Warn&&this.showNotificationMessage(x.MessageType.Warning,e,t)}info(e,t,r=!0){this.shouldLogToOutputChannel()&&this.outputChannel.info(this.getLogMessage(e,t)),r&&this._clientOptions.revealOutputChannelOn<=Gr.Info&&this.showNotificationMessage(x.MessageType.Info,e,t)}debug(e,t,r=!0){this.shouldLogToOutputChannel()&&this.outputChannel.debug(this.getLogMessage(e,t)),r&&this._clientOptions.revealOutputChannelOn<=Gr.Debug&&this.showNotificationMessage(x.MessageType.Debug,e,t)}trace(e,t){this.traceOutputChannel.trace(this.getLogMessage(e,t))}traceObject(e){this.traceOutputChannel.trace(JSON.stringify(e))}showNotificationMessage(e,t,r){t=t??"A request has failed. See the output for more information.",r&&(t+=` +`+this.data2String(r)),(e===x.MessageType.Error?G.window.showErrorMessage:e===x.MessageType.Warning?G.window.showWarningMessage:G.window.showInformationMessage)(t,"Go to output").then(s=>{s!==void 0&&this.outputChannel.show(!0)})}getLogMessage(e,t){return t!=null?`${e} +${this.data2String(t)}`:e}needsStart(){return this.$state===Y.Initial||this.$state===Y.Stopping||this.$state===Y.Stopped}needsStop(){return this.$state===Y.Starting||this.$state===Y.Running}activeConnection(){return this.$state===Y.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===Y.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===Y.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;let[e,t,r]=this.createOnStartPromise();this._onStart=e,this._diagnostics=void 0;for(let[i,s]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,s);for(let[i,s]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,s);for(let[i,s]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,s);this.$state=Y.Starting;try{let i=await this.createConnection();i.onNotification(x.LogMessageNotification.type,s=>{switch(s.type){case x.MessageType.Error:this.error(s.message,void 0,!1);break;case x.MessageType.Warning:this.warn(s.message,void 0,!1);break;case x.MessageType.Info:this.info(s.message,void 0,!1);break;case x.MessageType.Debug:this.debug(s.message,void 0,!1);break;default:this.outputChannel.appendLine(s.message)}}),i.onNotification(x.ShowMessageNotification.type,s=>{switch(s.type){case x.MessageType.Error:G.window.showErrorMessage(s.message);break;case x.MessageType.Warning:G.window.showWarningMessage(s.message);break;case x.MessageType.Info:G.window.showInformationMessage(s.message);break;default:G.window.showInformationMessage(s.message)}}),i.onRequest(x.ShowMessageRequest.type,s=>{let o;switch(s.type){case x.MessageType.Error:o=G.window.showErrorMessage;break;case x.MessageType.Warning:o=G.window.showWarningMessage;break;case x.MessageType.Info:o=G.window.showInformationMessage;break;default:o=G.window.showInformationMessage}let a=s.actions||[];return o(s.message,...a)}),i.onNotification(x.TelemetryEventNotification.type,s=>{this._telemetryEmitter.fire(s)}),i.onRequest(x.ShowDocumentRequest.type,async(s,o)=>{let a=async l=>{let f=this.protocol2CodeConverter.asUri(l.uri);try{if(l.external===!0)return{success:await G.env.openExternal(f)};{let p={};return l.selection!==void 0&&(p.selection=this.protocol2CodeConverter.asRange(l.selection)),l.takeFocus===void 0||l.takeFocus===!1?p.preserveFocus=!0:l.takeFocus===!0&&(p.preserveFocus=!1),await G.window.showTextDocument(f,p),{success:!0}}}catch{return{success:!1}}},u=this._clientOptions.middleware.window?.showDocument;return u!==void 0?u(s,o,a):a(s)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=Y.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,i,"force"),r(i)}return this._onStart}createOnStartPromise(){let e,t;return[new Promise((i,s)=>{e=i,t=s}),e,t]}async initialize(e){this.refreshTrace(e,!1);let t=this._clientOptions.initializationOptions,[r,i]=this._clientOptions.workspaceFolder!==void 0?[this._clientOptions.workspaceFolder.uri.fsPath,[{uri:this._c2p.asUri(this._clientOptions.workspaceFolder.uri),name:this._clientOptions.workspaceFolder.name}]]:[this._clientGetRootPath(),null],s={processId:null,clientInfo:{name:G.env.appName,version:G.version},locale:this.getLocale(),rootPath:r||null,rootUri:r?this._c2p.asUri(G.Uri.file(r)):null,capabilities:this.computeClientCapabilities(),initializationOptions:Yt.func(t)?t():t,trace:x.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(s),this._clientOptions.progressOnInitialization){let o=Vy.generateUuid(),a=new UR.ProgressPart(e,o);s.workDoneToken=o;try{let u=await this.doInitialize(e,s);return a.done(),u}catch(u){throw a.cancel(),u}}else return this.doInitialize(e,s)}async doInitialize(e,t){try{let r=await e.initialize(t);if(r.capabilities.positionEncoding!==void 0&&r.capabilities.positionEncoding!==x.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${r.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=r,this.$state=Y.Running;let i;Yt.number(r.capabilities.textDocumentSync)?r.capabilities.textDocumentSync===x.TextDocumentSyncKind.None?i={openClose:!1,change:x.TextDocumentSyncKind.None,save:void 0}:i={openClose:!0,change:r.capabilities.textDocumentSync,save:{includeText:!1}}:r.capabilities.textDocumentSync!==void 0&&r.capabilities.textDocumentSync!==null&&(i=r.capabilities.textDocumentSync),this._capabilities=Object.assign({},r.capabilities,{resolvedTextDocumentSync:i}),e.onNotification(x.PublishDiagnosticsNotification.type,s=>this.handleDiagnostics(s)),e.onRequest(x.RegistrationRequest.type,s=>this.handleRegistrationRequest(s)),e.onRequest("client/registerFeature",s=>this.handleRegistrationRequest(s)),e.onRequest(x.UnregistrationRequest.type,s=>this.handleUnregistrationRequest(s)),e.onRequest("client/unregisterFeature",s=>this.handleUnregistrationRequest(s)),e.onRequest(x.ApplyWorkspaceEditRequest.type,s=>this.handleApplyWorkspaceEdit(s));for(let[s,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(s,e.onNotification(s,o));this._pendingNotificationHandlers.clear();for(let[s,o]of this._pendingRequestHandlers)this._requestDisposables.set(s,e.onRequest(s,o));this._pendingRequestHandlers.clear();for(let[s,o]of this._pendingProgressHandlers)this._progressDisposables.set(s,e.onProgress(o.type,s,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(x.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookLogLevelChanged(e),this.hookConfigurationChanged(e),this.initializeFeatures(e),r}catch(r){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(r)?this.initialize(e):this.stop():r instanceof x.ResponseError&&r.data&&r.data.retry?G.window.showErrorMessage(r.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(r&&r.message&&G.window.showErrorMessage(r.message),this.error("Server initialization failed.",r),this.stop()),r}}_clientGetRootPath(){let e=G.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}stop(e=2e3){return this.shutdown(Tr.Stop,e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t=2e3){if(this.$state===Y.Stopped||this.$state===Y.Initial)return;if(this.$state===Y.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}let r=this.activeConnection();if(r===void 0||this.$state!==Y.Running)throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);this._initializeResult=void 0,this.$state=Y.Stopping,this.cleanUp(e);let i=new Promise(o=>{(0,x.RAL)().timer.setTimeout(o,t)}),s=(async o=>(await o.shutdown(),await o.exit(),o))(r);return this._onStop=Promise.race([i,s]).then(o=>{if(o!==void 0)o.end(),o.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},o=>{throw this.error("Stopping server failed",o,!1),o}).finally(()=>{this.$state=Y.Stopped,e===Tr.Stop&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(e){this._fileEvents=[],this._fileEventDelayer.cancel();let t=this._listeners.splice(0,this._listeners.length);for(let r of t)r.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(let r of Array.from(this._features.entries()).map(i=>i[1]).reverse())r.clear();(e===Tr.Stop||e===Tr.Restart)&&(this._diagnostics===void 0&&(this._diagnostics=null),this._diagnostics!==null&&(this._clientOptions.diagnosticCollectionProvider.dispose(this._diagnostics,dt.DiagnosticCollectionSource.push),this._diagnostics=null)),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(e){let t=this;async function r(s){return t._fileEvents.push(s),t._fileEventDelayer.trigger(async()=>{let o=t._fileEvents;t._fileEvents=[];try{await t.sendNotification(x.DidChangeWatchedFilesNotification.type,{changes:o})}catch(a){throw t._fileEvents.push(...o),a}})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,r):r(e)).catch(s=>{t.error("Notifying file events failed.",s)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._inFlightOpenNotifications);if(t.length===0)return;for(let r of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(r);this._didChangeTextDocumentFeature.aboutToSendNotification(r,x.DidChangeTextDocumentNotification.type,i),await e.sendNotification(x.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(r,x.DidChangeTextDocumentNotification.type,i)}}catch(t){throw this.error("Sending pending changes failed",t,!1),t}})}triggerPendingChangeDelivery(){this._pendingChangeDelayer.trigger(async()=>{let e=this.activeConnection();if(e===void 0){this.triggerPendingChangeDelivery();return}await this.sendPendingFullTextDocumentChanges(e)}).catch(e=>this.error("Delivering pending changes failed",e,!1))}_diagnosticQueue=new Map;_diagnosticQueueState={state:"idle"};handleDiagnostics(e){if(this._diagnostics===null)return;let t=e.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===t&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(e.uri,e.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,x.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;let e=this._diagnosticQueue.entries().next();if(e.done===!0)return;let[t,r]=e.value;this._diagnosticQueue.delete(t);let i=new G.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(r,i.token).then(s=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),a=this.clientOptions.middleware;a.handleDiagnostics?a.handleDiagnostics(o,s,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(o,s)}}).catch(s=>{this.error("Processing diagnostic queue failed.",s)}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){if(this._diagnostics===null)return;let r=this.diagnostics;r!==void 0&&r.set(e,t)}getLocale(){return G.env.language}async $start(){if(this.$state===Y.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();let e=this.activeConnection();if(e===void 0)throw new Error("Starting server failed");return e}async createConnection(){let e=(i,s,o)=>{this.handleConnectionError(i,s,o).catch(a=>this.error("Handling connection error failed",a))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},r=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=bT(r.reader,r.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===Y.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:Or.DoNotRestart};if(this.$state!==Y.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===Or.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp(Tr.Stop),this.$state===Y.Starting?this.$state=Y.StartFailed:this.$state=Y.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===Or.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",void 0,!e.handled),this.cleanUp(Tr.Restart),this.$state=Y.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(t=>this.error("Restarting server failed",t,"force")))}async handleConnectionError(e,t,r){let i=await this._clientOptions.errorHandler.error(e,t,r);i.action===Is.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring. +${e.message} +Shutting down server.`,void 0,i.handled===!0?!1:"force"),this.stop().catch(s=>{this.error("Stopping server failed",s,!1)})):this.error(i.message??`Client ${this._name}: connection to server is erroring. +${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(G.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}hookLogLevelChanged(e){this._listeners.push(this.traceOutputChannel.onDidChangeLogLevel(t=>{this._traceLogLevel=t,this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let r=G.workspace.getConfiguration(this._id),i=this._traceLogLevel!==G.LogLevel.Trace?x.Trace.Off:x.Trace.Messages,s=x.TraceFormat.Text;if(r&&i!==x.Trace.Off){let o=r.get("trace.server","messages");typeof o=="string"?(i=x.Trace.fromString(o),i===x.Trace.Off&&(i=x.Trace.Messages)):(i=x.Trace.fromString(r.get("trace.server.verbosity","messages")),i===x.Trace.Off&&(i=x.Trace.Messages),s=x.TraceFormat.fromString(r.get("trace.server.format","text")))}this._trace=i,this._traceFormat=s,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(o=>{this.error("Updating trace failed with error",o,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let r;Yt.array(t)?r=t:r=[t],r&&this._dynamicFeatures.get(x.DidChangeWatchedFilesNotification.type.method).registerRaw(Vy.generateUuid(),r)}_features=[];_dynamicFeatures=new Map;registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),dt.DynamicFeature.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}hasDedicatedTextSynchronizationFeature(e){let t=this.getFeature(x.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof Hf.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new Xy.ConfigurationFeature(this)),this._didOpenTextDocumentFeature=new Fi.DidOpenTextDocumentFeature(this,this._syncedDocuments),this.registerFeature(this._didOpenTextDocumentFeature),this._didChangeTextDocumentFeature=new Fi.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new Fi.WillSaveFeature(this)),this.registerFeature(new Fi.WillSaveWaitUntilFeature(this)),this.registerFeature(new Fi.DidSaveTextDocumentFeature(this)),this.registerFeature(new Fi.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new yT.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new zR.CompletionItemFeature(this)),this.registerFeature(new KR.HoverFeature(this)),this.registerFeature(new GR.SignatureHelpFeature(this)),this.registerFeature(new BR.DefinitionFeature(this)),this.registerFeature(new QR.ReferencesFeature(this)),this.registerFeature(new VR.DocumentHighlightFeature(this)),this.registerFeature(new XR.DocumentSymbolFeature(this)),this.registerFeature(new JR.WorkspaceSymbolFeature(this)),this.registerFeature(new tT.CodeActionFeature(this)),this.registerFeature(new nT.CodeLensFeature(this)),this.registerFeature(new $f.DocumentFormattingFeature(this)),this.registerFeature(new $f.DocumentRangeFormattingFeature(this)),this.registerFeature(new $f.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new rT.RenameFeature(this)),this.registerFeature(new iT.DocumentLinkFeature(this)),this.registerFeature(new sT.ExecuteCommandFeature(this)),this.registerFeature(new Xy.SyncConfigurationFeature(this)),this.registerFeature(new YR.TypeDefinitionFeature(this)),this.registerFeature(new ZR.ImplementationFeature(this)),this.registerFeature(new eT.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new gT.WorkspaceFoldersFeature(this)),this.registerFeature(new oT.FoldingRangeFeature(this)),this.registerFeature(new aT.DeclarationFeature(this)),this.registerFeature(new cT.SelectionRangeFeature(this)),this.registerFeature(new vT.ProgressFeature(this)),this.registerFeature(new uT.CallHierarchyFeature(this)),this.registerFeature(new lT.SemanticTokensFeature(this)),this.registerFeature(new dT.LinkedEditingFeature(this)),this.registerFeature(new Li.DidCreateFilesFeature(this)),this.registerFeature(new Li.DidRenameFilesFeature(this)),this.registerFeature(new Li.DidDeleteFilesFeature(this)),this.registerFeature(new Li.WillCreateFilesFeature(this)),this.registerFeature(new Li.WillRenameFilesFeature(this)),this.registerFeature(new Li.WillDeleteFilesFeature(this)),this.registerFeature(new fT.TypeHierarchyFeature(this)),this.registerFeature(new hT.InlineValueFeature(this)),this.registerFeature(new pT.InlayHintsFeature(this)),this.registerFeature(new WR.DiagnosticFeature(this)),this.registerFeature(new Hf.NotebookDocumentSyncFeature(this)),this.registerFeature(new mT.InlineCompletionItemFeature(this)),this.registerFeature(new _T.TextDocumentContentFeature(this))}registerProposedFeatures(){this.registerFeatures(Gf.createAll(this))}fillInitializeParams(e){for(let t of this._features)Yt.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,dt.ensure)(e,"workspace").applyEdit=!0;let t=(0,dt.ensure)((0,dt.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[x.ResourceOperationKind.Create,x.ResourceOperationKind.Rename,x.ResourceOperationKind.Delete],t.failureHandling=x.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0},t.metadataSupport=!0,t.snippetEditSupport=!0;let r=(0,dt.ensure)((0,dt.ensure)(e,"textDocument"),"publishDiagnostics");r.relatedInformation=!0,r.versionSupport=!1,r.tagSupport={valueSet:[x.DiagnosticTag.Unnecessary,x.DiagnosticTag.Deprecated]},r.codeDescriptionSupport=!0,r.dataSupport=!0;let i=(0,dt.ensure)((0,dt.ensure)(e,"textDocument"),"filters");i.relativePatternSupport=!0;let s=(0,dt.ensure)(e,"window"),o=(0,dt.ensure)(s,"showMessage");o.messageActionItem={additionalPropertiesSupport:!0};let a=(0,dt.ensure)(s,"showDocument");a.support=!0;let u=(0,dt.ensure)(e,"general");u.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(n.RequestsToCancelOnContentModified)},u.regularExpressions={engine:"ECMAScript",version:"ES2020"},u.markdown={parser:"marked",version:"1.1.0"},u.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(u.markdown.allowedTags=["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]);for(let l of this._features)l.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let r of this._features)Yt.func(r.preInitialize)&&r.preInitialize(this._capabilities,t);for(let r of this._features)r.initialize(this._capabilities,t)}async handleRegistrationRequest(e){let t=this.clientOptions.middleware?.handleRegisterCapability;return t?t(e,r=>this.doRegisterCapability(r)):this.doRegisterCapability(e)}async doRegisterCapability(e){if(!this.isRunning()){for(let t of e.registrations)this._ignoredRegistrations.add(t.id);return}for(let t of e.registrations){let r=this._dynamicFeatures.get(t.method);if(r===void 0)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Registration failed.`));let i=t.registerOptions??{};i.documentSelector=i.documentSelector??this._clientOptions.documentSelector;let s={id:t.id,registerOptions:i};try{r.register(s)}catch(o){return Promise.reject(o)}}}async handleUnregistrationRequest(e){let t=this.clientOptions.middleware?.handleUnregisterCapability;return t?t(e,r=>this.doUnregisterCapability(r)):this.doUnregisterCapability(e)}async doUnregisterCapability(e){for(let t of e.unregisterations){if(this._ignoredRegistrations.has(t.id))continue;let r=this._dynamicFeatures.get(t.method);if(!r)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Unregistration failed.`));r.unregister(t.id)}}async handleApplyWorkspaceEdit(e){let t=this.clientOptions.middleware?.workspace?.handleApplyEdit;if(t){let r=await t(e,i=>this.doHandleApplyWorkspaceEdit(i));return r instanceof x.ResponseError?Promise.reject(r):r}else return this.doHandleApplyWorkspaceEdit(e)}workspaceEditLock=new ha.Semaphore(1);async doHandleApplyWorkspaceEdit(e){let t=e.edit,r=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t));return this.validateWorkspaceEdit(t)?Yt.asPromise(G.workspace.applyEdit(r,{isRefactoring:e.metadata?.isRefactoring}).then(s=>({applied:s}))):Promise.resolve({applied:!1})}validateWorkspaceEdit(e){let t=new Map;if(G.workspace.textDocuments.forEach(r=>t.set(r.uri.toString(),r)),e.documentChanges){for(let r of e.documentChanges)if(x.TextDocumentEdit.is(r)&&r.textDocument.version!==null&&r.textDocument.version>=0){let i=this._p2c.asUri(r.textDocument.uri).toString(),s=t.get(i);if(s&&s.version!==r.textDocument.version)return!1}}return!0}static RequestsToCancelOnContentModified=new Set([x.SemanticTokensRequest.method,x.SemanticTokensRangeRequest.method,x.SemanticTokensDeltaRequest.method]);static CancellableResolveCalls=new Set([x.CompletionResolveRequest.method,x.CodeLensResolveRequest.method,x.CodeActionResolveRequest.method,x.InlayHintResolveRequest.method,x.DocumentLinkResolveRequest.method,x.WorkspaceSymbolResolveRequest.method]);handleFailedRequest(e,t,r,i,s=!0,o=!1){if(r instanceof x.ResponseError){if(r.code===x.ErrorCodes.PendingResponseRejected||r.code===x.ErrorCodes.ConnectionInactive)return i;if(r.code===x.LSPErrorCodes.RequestCancelled||r.code===x.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested&&!o)return i;throw r.data!==void 0?new dt.LSPCancellationError(r.data):new G.CancellationError}else if(r.code===x.LSPErrorCodes.ContentModified){if(n.RequestsToCancelOnContentModified.has(e.method)||n.CancellableResolveCalls.has(e.method))throw new G.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,r,s),r}};he.BaseLanguageClient=pa;var Kf=class extends pa{serverOptions;constructor(e,t,r,i){super(e,t,i),this.serverOptions=r}async createMessageTransports(e){return this.serverOptions()}};he.LanguageClient=Kf;var Bf=class{error(e){(0,x.RAL)().console.error(e)}warn(e){(0,x.RAL)().console.warn(e)}info(e){(0,x.RAL)().console.info(e)}log(e){(0,x.RAL)().console.log(e)}};function bT(n,e,t,r,i){let s=new Bf,o=(0,x.createProtocolConnection)(n,e,s,i);return o.onError(u=>{t(u[0],u[1],u[2])}),o.onClose(r),{listen:()=>o.listen(),sendRequest:o.sendRequest,onRequest:o.onRequest,hasPendingResponse:o.hasPendingResponse,sendNotification:o.sendNotification,onNotification:o.onNotification,onProgress:o.onProgress,sendProgress:o.sendProgress,trace:(u,l,f)=>{let p={sendNotification:!1,traceFormat:x.TraceFormat.Text};return f===void 0?o.trace(u,l,p):(Yt.boolean(f),o.trace(u,l,f))},initialize:u=>o.sendRequest(x.InitializeRequest.type,u),shutdown:()=>o.sendRequest(x.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(x.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var Gf;(function(n){function e(t){return[]}n.createAll=e})(Gf||(he.ProposedFeatures=Gf={}))});var Zy=P(Zn=>{"use strict";var CT=Zn&&Zn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),wT=Zn&&Zn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),DT=Zn&&Zn.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i /dev/null 2>&1 +} + +terminateTree "${t}" +`;return!Yy.spawnSync("/bin/sh",[],{input:r,stdio:["pipe","inherit","inherit"]}).error}catch{return!1}else return n.kill("SIGKILL"),!0}});var nv=P(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var ev=require("util"),er=Nn(),Xf=class n extends er.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(e="utf-8"){super(e)}emptyBuffer(){return n.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new ev.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}},Jf=class{stream;constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),er.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),er.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),er.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),er.Disposable.create(()=>this.stream.off("data",e))}},Qf=class{stream;constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),er.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),er.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),er.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((r,i)=>{let s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,t,s):this.stream.write(e,s)})}end(){this.stream.end()}},tv=Object.freeze({messageBuffer:Object.freeze({create:n=>new Xf(n)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(n,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(n,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(n,e)=>{try{return n instanceof Buffer?Promise.resolve(JSON.parse(n.toString(e.charset))):Promise.resolve(JSON.parse(new ev.TextDecoder(e.charset).decode(n)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:n=>new Jf(n),asWritableStream:n=>new Qf(n)}),console,timer:Object.freeze({setTimeout(n,e,...t){let r=setTimeout(n,e,...t);return{dispose:()=>clearTimeout(r)}},setImmediate(n,...e){let t=setImmediate(n,...e);return{dispose:()=>clearImmediate(t)}},setInterval(n,e,...t){let r=setInterval(n,e,...t);return{dispose:()=>clearInterval(r)}}})});function Yf(){return tv}(function(n){function e(){er.RAL.install(tv)}n.install=e})(Yf||(Yf={}));Zf.default=Yf});var sh=P(re=>{"use strict";var iv=re&&re.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),OT=re&&re.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ih=re&&re.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;ithis.fireError(r)),t.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Et.Disposable.create(()=>this.process.off("message",e))}};re.IPCMessageReader=eh;var th=class extends Et.AbstractMessageWriter{process;errorCount;constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on("error",r=>this.fireError(r)),t.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};re.IPCMessageWriter=th;var nh=class extends Et.AbstractMessageReader{onData;constructor(e){super(),this.onData=new Et.Emitter,e.on("close",()=>this.fireClose),e.on("error",t=>this.fireError(t)),e.on("message",t=>{this.onData.fire(t)})}listen(e){return this.onData.event(e)}};re.PortMessageReader=nh;var rh=class extends Et.AbstractMessageWriter{port;errorCount;constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",t=>this.fireError(t))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};re.PortMessageWriter=rh;var Vr=class extends Et.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,Ns.default)().stream.asReadableStream(e),t)}};re.SocketMessageReader=Vr;var Xr=class extends Et.WriteableStreamMessageWriter{socket;constructor(e,t){super((0,Ns.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};re.SocketMessageWriter=Xr;var ma=class extends Et.ReadableStreamMessageReader{constructor(e,t){super((0,Ns.default)().stream.asReadableStream(e),t)}};re.StreamMessageReader=ma;var _a=class extends Et.WriteableStreamMessageWriter{constructor(e,t){super((0,Ns.default)().stream.asWritableStream(e),t)}};re.StreamMessageWriter=_a;var NT=process.env.XDG_RUNTIME_DIR,jT=new Map([["linux",107],["darwin",102]]);function FT(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,rv.randomBytes)(16).toString("hex")}-sock`;let n=32,e=10,t=IT.realpathSync(NT??xT.tmpdir()),r=jT.get(process.platform);if(r!==void 0&&(n=Math.min(r-t.length-e,n)),n<16)throw new Error(`Unable to generate a random pipe name with ${n} characters.`);let i=(0,rv.randomBytes)(Math.floor(n/2)).toString("hex");return MT.join(t,`lsp-${i}.sock`)}function LT(n,e="utf-8"){let t,r=new Promise((i,s)=>{t=i});return new Promise((i,s)=>{let o=(0,ya.createServer)(a=>{o.close(),t([new Vr(a,e),new Xr(a,e)])});o.on("error",s),o.listen(n,()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}function AT(n,e="utf-8"){let t=(0,ya.createConnection)(n);return[new Vr(t,e),new Xr(t,e)]}function kT(n,e="utf-8"){let t,r=new Promise((i,s)=>{t=i});return new Promise((i,s)=>{let o=(0,ya.createServer)(a=>{o.close(),t([new Vr(a,e),new Xr(a,e)])});o.on("error",s),o.listen(n,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>r})})})}function $T(n,e="utf-8"){let t=(0,ya.createConnection)(n,"127.0.0.1");return[new Vr(t,e),new Xr(t,e)]}function HT(n){let e=n;return e.read!==void 0&&e.addListener!==void 0}function UT(n){let e=n;return e.write!==void 0&&e.addListener!==void 0}function WT(n,e,t,r){t||(t=Et.NullLogger);let i=HT(n)?new ma(n):n,s=UT(e)?new _a(e):e;return Et.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,Et.createMessageConnection)(i,s,t,r)}});var oh=P(tr=>{"use strict";var zT=tr&&tr.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),sv=tr&&tr.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zT(e,n,t)};Object.defineProperty(tr,"__esModule",{value:!0});tr.createProtocolConnection=BT;var KT=sh();sv(sh(),tr);sv(V(),tr);function BT(n,e,t,r){return(0,KT.createMessageConnection)(n,e,t,r)}});var js=P((vq,ov)=>{"use strict";var GT=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};ov.exports=GT});var va=P((bq,av)=>{"use strict";var VT="2.0.0",XT=Number.MAX_SAFE_INTEGER||9007199254740991,JT=16,QT=250,YT=["major","premajor","minor","preminor","patch","prepatch","prerelease"];av.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:JT,MAX_SAFE_BUILD_LENGTH:QT,MAX_SAFE_INTEGER:XT,RELEASE_TYPES:YT,SEMVER_SPEC_VERSION:VT,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ba=P((Sn,cv)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ah,MAX_SAFE_BUILD_LENGTH:ZT,MAX_LENGTH:eO}=va(),tO=js();Sn=cv.exports={};var nO=Sn.re=[],rO=Sn.safeRe=[],A=Sn.src=[],iO=Sn.safeSrc=[],k=Sn.t={},sO=0,ch="[a-zA-Z0-9-]",oO=[["\\s",1],["\\d",eO],[ch,ZT]],aO=n=>{for(let[e,t]of oO)n=n.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return n},Q=(n,e,t)=>{let r=aO(e),i=sO++;tO(n,i,e),k[n]=i,A[i]=e,iO[i]=r,nO[i]=new RegExp(e,t?"g":void 0),rO[i]=new RegExp(r,t?"g":void 0)};Q("NUMERICIDENTIFIER","0|[1-9]\\d*");Q("NUMERICIDENTIFIERLOOSE","\\d+");Q("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ch}*`);Q("MAINVERSION",`(${A[k.NUMERICIDENTIFIER]})\\.(${A[k.NUMERICIDENTIFIER]})\\.(${A[k.NUMERICIDENTIFIER]})`);Q("MAINVERSIONLOOSE",`(${A[k.NUMERICIDENTIFIERLOOSE]})\\.(${A[k.NUMERICIDENTIFIERLOOSE]})\\.(${A[k.NUMERICIDENTIFIERLOOSE]})`);Q("PRERELEASEIDENTIFIER",`(?:${A[k.NONNUMERICIDENTIFIER]}|${A[k.NUMERICIDENTIFIER]})`);Q("PRERELEASEIDENTIFIERLOOSE",`(?:${A[k.NONNUMERICIDENTIFIER]}|${A[k.NUMERICIDENTIFIERLOOSE]})`);Q("PRERELEASE",`(?:-(${A[k.PRERELEASEIDENTIFIER]}(?:\\.${A[k.PRERELEASEIDENTIFIER]})*))`);Q("PRERELEASELOOSE",`(?:-?(${A[k.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${A[k.PRERELEASEIDENTIFIERLOOSE]})*))`);Q("BUILDIDENTIFIER",`${ch}+`);Q("BUILD",`(?:\\+(${A[k.BUILDIDENTIFIER]}(?:\\.${A[k.BUILDIDENTIFIER]})*))`);Q("FULLPLAIN",`v?${A[k.MAINVERSION]}${A[k.PRERELEASE]}?${A[k.BUILD]}?`);Q("FULL",`^${A[k.FULLPLAIN]}$`);Q("LOOSEPLAIN",`[v=\\s]*${A[k.MAINVERSIONLOOSE]}${A[k.PRERELEASELOOSE]}?${A[k.BUILD]}?`);Q("LOOSE",`^${A[k.LOOSEPLAIN]}$`);Q("GTLT","((?:<|>)?=?)");Q("XRANGEIDENTIFIERLOOSE",`${A[k.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Q("XRANGEIDENTIFIER",`${A[k.NUMERICIDENTIFIER]}|x|X|\\*`);Q("XRANGEPLAIN",`[v=\\s]*(${A[k.XRANGEIDENTIFIER]})(?:\\.(${A[k.XRANGEIDENTIFIER]})(?:\\.(${A[k.XRANGEIDENTIFIER]})(?:${A[k.PRERELEASE]})?${A[k.BUILD]}?)?)?`);Q("XRANGEPLAINLOOSE",`[v=\\s]*(${A[k.XRANGEIDENTIFIERLOOSE]})(?:\\.(${A[k.XRANGEIDENTIFIERLOOSE]})(?:\\.(${A[k.XRANGEIDENTIFIERLOOSE]})(?:${A[k.PRERELEASELOOSE]})?${A[k.BUILD]}?)?)?`);Q("XRANGE",`^${A[k.GTLT]}\\s*${A[k.XRANGEPLAIN]}$`);Q("XRANGELOOSE",`^${A[k.GTLT]}\\s*${A[k.XRANGEPLAINLOOSE]}$`);Q("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ah}})(?:\\.(\\d{1,${ah}}))?(?:\\.(\\d{1,${ah}}))?`);Q("COERCE",`${A[k.COERCEPLAIN]}(?:$|[^\\d])`);Q("COERCEFULL",A[k.COERCEPLAIN]+`(?:${A[k.PRERELEASE]})?(?:${A[k.BUILD]})?(?:$|[^\\d])`);Q("COERCERTL",A[k.COERCE],!0);Q("COERCERTLFULL",A[k.COERCEFULL],!0);Q("LONETILDE","(?:~>?)");Q("TILDETRIM",`(\\s*)${A[k.LONETILDE]}\\s+`,!0);Sn.tildeTrimReplace="$1~";Q("TILDE",`^${A[k.LONETILDE]}${A[k.XRANGEPLAIN]}$`);Q("TILDELOOSE",`^${A[k.LONETILDE]}${A[k.XRANGEPLAINLOOSE]}$`);Q("LONECARET","(?:\\^)");Q("CARETTRIM",`(\\s*)${A[k.LONECARET]}\\s+`,!0);Sn.caretTrimReplace="$1^";Q("CARET",`^${A[k.LONECARET]}${A[k.XRANGEPLAIN]}$`);Q("CARETLOOSE",`^${A[k.LONECARET]}${A[k.XRANGEPLAINLOOSE]}$`);Q("COMPARATORLOOSE",`^${A[k.GTLT]}\\s*(${A[k.LOOSEPLAIN]})$|^$`);Q("COMPARATOR",`^${A[k.GTLT]}\\s*(${A[k.FULLPLAIN]})$|^$`);Q("COMPARATORTRIM",`(\\s*)${A[k.GTLT]}\\s*(${A[k.LOOSEPLAIN]}|${A[k.XRANGEPLAIN]})`,!0);Sn.comparatorTrimReplace="$1$2$3";Q("HYPHENRANGE",`^\\s*(${A[k.XRANGEPLAIN]})\\s+-\\s+(${A[k.XRANGEPLAIN]})\\s*$`);Q("HYPHENRANGELOOSE",`^\\s*(${A[k.XRANGEPLAINLOOSE]})\\s+-\\s+(${A[k.XRANGEPLAINLOOSE]})\\s*$`);Q("STAR","(<|>)?=?\\s*\\*");Q("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Q("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ca=P((Cq,uv)=>{"use strict";var cO=Object.freeze({loose:!0}),uO=Object.freeze({}),lO=n=>n?typeof n!="object"?cO:n:uO;uv.exports=lO});var hv=P((wq,fv)=>{"use strict";var lv=/^[0-9]+$/,dv=(n,e)=>{if(typeof n=="number"&&typeof e=="number")return n===e?0:ndv(e,n);fv.exports={compareIdentifiers:dv,rcompareIdentifiers:dO}});var Fs=P((Dq,gv)=>{"use strict";var wa=js(),{MAX_LENGTH:pv,MAX_SAFE_INTEGER:Da}=va(),{safeRe:Sa,t:Pa}=ba(),fO=Ca(),{compareIdentifiers:uh}=hv(),hO=(n,e)=>{let t=e.split(".");if(t.length>n.length)return!1;for(let r=0;rpv)throw new TypeError(`version is longer than ${pv} characters`);wa("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Sa[Pa.LOOSE]:Sa[Pa.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Da||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Da||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Da||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&se.major?1:this.minore.minor?1:this.patche.patch?1:0}comparePre(e){if(e instanceof n||(e=new n(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],i=e.prerelease[t];if(wa("prerelease compare",t,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return uh(r,i)}while(++t)}compareBuild(e){e instanceof n||(e=new n(e,this.options));let t=0;do{let r=this.build[t],i=e.build[t];if(wa("build compare",t,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return uh(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let i=`-${t}`.match(this.options.loose?Sa[Pa.PRERELEASELOOSE]:Sa[Pa.PRERELEASE]);if(!i||i[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(t){let s=[t,i];if(r===!1&&(s=[t]),hO(this.prerelease,t)){let o=this.prerelease[t.split(".").length];isNaN(o)&&(this.prerelease=s)}else this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};gv.exports=lh});var yv=P((Sq,_v)=>{"use strict";var mv=Fs(),pO=(n,e,t=!1)=>{if(n instanceof mv)return n;try{return new mv(n,e)}catch(r){if(!t)return null;throw r}};_v.exports=pO});var bv=P((Pq,vv)=>{"use strict";var dh=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,t)}return this}};vv.exports=dh});var Jr=P((Rq,wv)=>{"use strict";var Cv=Fs(),gO=(n,e,t)=>new Cv(n,t).compare(new Cv(e,t));wv.exports=gO});var Sv=P((Tq,Dv)=>{"use strict";var mO=Jr(),_O=(n,e,t)=>mO(n,e,t)===0;Dv.exports=_O});var Rv=P((Oq,Pv)=>{"use strict";var yO=Jr(),vO=(n,e,t)=>yO(n,e,t)!==0;Pv.exports=vO});var Ov=P((Eq,Tv)=>{"use strict";var bO=Jr(),CO=(n,e,t)=>bO(n,e,t)>0;Tv.exports=CO});var qv=P((qq,Ev)=>{"use strict";var wO=Jr(),DO=(n,e,t)=>wO(n,e,t)>=0;Ev.exports=DO});var xv=P((Mq,Mv)=>{"use strict";var SO=Jr(),PO=(n,e,t)=>SO(n,e,t)<0;Mv.exports=PO});var Nv=P((xq,Iv)=>{"use strict";var RO=Jr(),TO=(n,e,t)=>RO(n,e,t)<=0;Iv.exports=TO});var Fv=P((Iq,jv)=>{"use strict";var OO=Sv(),EO=Rv(),qO=Ov(),MO=qv(),xO=xv(),IO=Nv(),NO=(n,e,t,r)=>{switch(e){case"===":return typeof n=="object"&&(n=n.version),typeof t=="object"&&(t=t.version),n===t;case"!==":return typeof n=="object"&&(n=n.version),typeof t=="object"&&(t=t.version),n!==t;case"":case"=":case"==":return OO(n,t,r);case"!=":return EO(n,t,r);case">":return qO(n,t,r);case">=":return MO(n,t,r);case"<":return xO(n,t,r);case"<=":return IO(n,t,r);default:throw new TypeError(`Invalid operator: ${e}`)}};jv.exports=NO});var Wv=P((Nq,Uv)=>{"use strict";var Ls=Symbol("SemVer ANY"),ph=class n{static get ANY(){return Ls}constructor(e,t){if(t=Lv(t),e instanceof n){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),hh("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ls?this.value="":this.value=this.operator+this.semver.version,hh("comp",this)}parse(e){let t=this.options.loose?Av[kv.COMPARATORLOOSE]:Av[kv.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new $v(r[2],this.options.loose):this.semver=Ls}toString(){return this.value}test(e){if(hh("Comparator.test",e,this.options.loose),this.semver===Ls||e===Ls)return!0;if(typeof e=="string")try{e=new $v(e,this.options)}catch{return!1}return fh(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Hv(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new Hv(this.value,t).test(e.semver):(t=Lv(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||fh(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||fh(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Uv.exports=ph;var Lv=Ca(),{safeRe:Av,t:kv}=ba(),fh=Fv(),hh=js(),$v=Fs(),Hv=gh()});var gh=P((jq,Gv)=>{"use strict";var jO=/\s+/g,mh=class n{constructor(e,t){if(t=LO(t),e instanceof n)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new n(e.raw,t);if(e instanceof _h)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(jO," "),this.set=this.raw.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(i=>!Kv(i[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&BO(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let t=this.set[e];for(let r=0;r0&&(this.formatted+=" "),this.formatted+=t[r].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(KO,"");let r=((this.options.includePrerelease&&WO)|(this.options.loose&&zO))+":"+e,i=zv.get(r);if(i)return i;let s=this.options.loose,o=s?ht[et.HYPHENRANGELOOSE]:ht[et.HYPHENRANGE];e=e.replace(o,rE(this.options.includePrerelease)),Pe("hyphen replace",e),e=e.replace(ht[et.COMPARATORTRIM],$O),Pe("comparator trim",e),e=e.replace(ht[et.TILDETRIM],HO),Pe("tilde trim",e),e=e.replace(ht[et.CARETTRIM],UO),Pe("caret trim",e);let a=e.split(" ").map(p=>GO(p,this.options)).join(" ").split(/\s+/).map(p=>nE(p,this.options));s&&(a=a.filter(p=>(Pe("loose invalid filter",p,this.options),!!p.match(ht[et.COMPARATORLOOSE])))),Pe("range list",a);let u=new Map,l=a.map(p=>new _h(p,this.options));for(let p of l){if(Kv(p))return[p];u.set(p.value,p)}u.size>1&&u.has("")&&u.delete("");let f=[...u.values()];return zv.set(r,f),f}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Range is required");return this.set.some(r=>Bv(r,t)&&e.set.some(i=>Bv(i,t)&&r.every(s=>i.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new AO(e,this.options)}catch{return!1}for(let t=0;tn.value==="<0.0.0-0",BO=n=>n.value==="",Bv=(n,e)=>{let t=!0,r=n.slice(),i=r.pop();for(;t&&r.length;)t=r.every(s=>i.intersects(s,e)),i=r.pop();return t},GO=(n,e)=>(n=n.replace(ht[et.BUILD],""),Pe("comp",n,e),n=QO(n,e),Pe("caret",n),n=XO(n,e),Pe("tildes",n),n=ZO(n,e),Pe("xrange",n),n=tE(n,e),Pe("stars",n),n),Ke=n=>!n||n.toLowerCase()==="x"||n==="*",VO=(n,e,t)=>Ke(n)&&!Ke(e)||Ke(e)&&t&&!Ke(t),XO=(n,e)=>n.trim().split(/\s+/).map(t=>JO(t,e)).join(" "),JO=(n,e)=>{let t=e.loose?ht[et.TILDELOOSE]:ht[et.TILDE],r=e.includePrerelease?"-0":"";return n.replace(t,(i,s,o,a,u)=>{Pe("tilde",n,i,s,o,a,u);let l;return Ke(s)?l="":Ke(o)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:Ke(a)?l=`>=${s}.${o}.0${r} <${s}.${+o+1}.0-0`:u?(Pe("replaceTilde pr",u),l=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`):l=`>=${s}.${o}.${a} <${s}.${+o+1}.0-0`,Pe("tilde return",l),l})},QO=(n,e)=>n.trim().split(/\s+/).map(t=>YO(t,e)).join(" "),YO=(n,e)=>{Pe("caret",n,e);let t=e.loose?ht[et.CARETLOOSE]:ht[et.CARET],r=e.includePrerelease?"-0":"";return n.replace(t,(i,s,o,a,u)=>{Pe("caret",n,i,s,o,a,u);let l;return Ke(s)?l="":Ke(o)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:Ke(a)?s==="0"?l=`>=${s}.${o}.0${r} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.0${r} <${+s+1}.0.0-0`:u?(Pe("replaceCaret pr",u),s==="0"?o==="0"?l=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:l=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(Pe("no pr"),s==="0"?o==="0"?l=`>=${s}.${o}.${a} <${s}.${o}.${+a+1}-0`:l=`>=${s}.${o}.${a} <${s}.${+o+1}.0-0`:l=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Pe("caret return",l),l})},ZO=(n,e)=>(Pe("replaceXRanges",n,e),n.split(/\s+/).map(t=>eE(t,e)).join(" ")),eE=(n,e)=>{n=n.trim();let t=e.loose?ht[et.XRANGELOOSE]:ht[et.XRANGE];return n.replace(t,(r,i,s,o,a,u)=>{if(Pe("xRange",n,r,i,s,o,a,u),VO(s,o,a))return n;let l=Ke(s),f=l||Ke(o),p=f||Ke(a),h=p;return i==="="&&h&&(i=""),u=e.includePrerelease?"-0":"",l?i===">"||i==="<"?r="<0.0.0-0":r="*":i&&h?(f&&(o=0),a=0,i===">"?(i=">=",f?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",f?s=+s+1:o=+o+1),i==="<"&&(u="-0"),r=`${i+s}.${o}.${a}${u}`):f?r=`>=${s}.0.0${u} <${+s+1}.0.0-0`:p&&(r=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),Pe("xRange return",r),r})},tE=(n,e)=>(Pe("replaceStars",n,e),n.trim().replace(ht[et.STAR],"")),nE=(n,e)=>(Pe("replaceGTE0",n,e),n.trim().replace(ht[e.includePrerelease?et.GTE0PRE:et.GTE0],"")),rE=n=>(e,t,r,i,s,o,a,u,l,f,p,h)=>(Ke(r)?t="":Ke(i)?t=`>=${r}.0.0${n?"-0":""}`:Ke(s)?t=`>=${r}.${i}.0${n?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${n?"-0":""}`,Ke(l)?u="":Ke(f)?u=`<${+l+1}.0.0-0`:Ke(p)?u=`<${l}.${+f+1}.0-0`:h?u=`<=${l}.${f}.${p}-${h}`:n?u=`<${l}.${f}.${+p+1}-0`:u=`<=${u}`,`${t} ${u}`.trim()),iE=(n,e,t)=>{for(let r=0;r0){let i=n[r].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Xv=P((Fq,Vv)=>{"use strict";var sE=gh(),oE=(n,e,t)=>{try{e=new sE(e,t)}catch{return!1}return e.test(n)};Vv.exports=oE});var Qv=P(qt=>{"use strict";var aE=qt&&qt.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),yh=qt&&qt.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&aE(e,n,t)};Object.defineProperty(qt,"__esModule",{value:!0});qt.DiagnosticPullMode=qt.vsdiag=void 0;yh(V(),qt);yh(ne(),qt);var Jv=id();Object.defineProperty(qt,"vsdiag",{enumerable:!0,get:function(){return Jv.vsdiag}});Object.defineProperty(qt,"DiagnosticPullMode",{enumerable:!0,get:function(){return Jv.DiagnosticPullMode}});yh(Vf(),qt)});var rb=P(Qe=>{"use strict";var tb=Qe&&Qe.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),cE=Qe&&Qe.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),As=Qe&&Qe.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i0&&(e.prerelease=[]),!dE(e,eb))throw new Error(`The language client requires VS Code version ${eb} but received version ${qr.version}`)}get isInDebugMode(){return this._isInDebugMode}get serverProcess(){return this._serverProcess}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}shutdown(e,t=2e3){return super.shutdown(e,t).finally(()=>{if(this._serverProcess){let r=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(r),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,uE.terminate)(e))}catch{}},2e3)}handleConnectionClosed(){return this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(e){super.fillInitializeParams(e),e.processId===null&&(e.processId=process.pid)}createMessageTransports(e){function t(h,g){if(!h&&!g)return;let _=Object.create(null);return Object.keys(process.env).forEach(v=>_[v]=process.env[v]),g&&(_.ELECTRON_RUN_AS_NODE="1",_.ELECTRON_NO_ASAR="1"),h&&Object.keys(h).forEach(v=>_[v]=h[v]),_}let r=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function s(){let h=process.execArgv;return h?h.some(g=>r.some(_=>g.startsWith(_))||i.some(_=>g===_)):!1}function o(h){if(h.stdin===null||h.stdout===null||h.stderr===null)throw new Error("Process created without stdio streams")}function a(h,g){Yv.createInterface({input:h,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",_=>g.info(_))}function u(h,g){Yv.createInterface({input:h,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",_=>g.error(_))}let l=this._serverOptions;if($i.func(l))return l().then(h=>{if(Zv.MessageTransports.is(h))return this._isDetached=!!h.detached,h;if(Dh.is(h))return this._isDetached=!!h.detached,{reader:new Ne.StreamMessageReader(h.reader),writer:new Ne.StreamMessageWriter(h.writer)};{let g;return Sh.is(h)?(g=h.process,this._isDetached=h.detached):(g=h,this._isDetached=!1),u(g.stderr,this.outputChannel),{reader:new Ne.StreamMessageReader(g.stdout),writer:new Ne.StreamMessageWriter(g.stdin)}}});let f,p=l;return p.run||p.debug?this._forceDebug||s()?(f=p.debug,this._isInDebugMode=!0):(f=p.run,this._isInDebugMode=!1):f=l,this._getServerWorkingDir(f.options).then(h=>{if(wh.is(f)&&f.module){let g=f,_=g.transport||je.stdio;if(g.runtime){let v=[],R=g.options??Object.create(null);R.execArgv&&R.execArgv.forEach(j=>v.push(j)),v.push(g.module),g.args&&g.args.forEach(j=>v.push(j));let q=Object.create(null);q.cwd=h,q.env=t(R.env,!1);let w=this._getRuntimePath(g.runtime,h),M;if(_===je.ipc?(q.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):_===je.stdio?v.push("--stdio"):_===je.pipe?(M=(0,Ne.generateRandomPipeName)(),v.push(`--pipe=${M}`)):Er.isSocket(_)&&v.push(`--socket=${_.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),_===je.ipc||_===je.stdio){let j=nr.spawn(w,v,q);return!j||!j.pid?ki(j,`Launching server using runtime ${w} failed.`):(this._serverProcess=j,u(j.stderr,this.outputChannel),_===je.ipc?(a(j.stdout,this.outputChannel),Promise.resolve({reader:new Ne.IPCMessageReader(j),writer:new Ne.IPCMessageWriter(j)})):Promise.resolve({reader:new Ne.StreamMessageReader(j.stdout),writer:new Ne.StreamMessageWriter(j.stdin)}))}else{if(_===je.pipe)return(0,Ne.createClientPipeTransport)(M).then(j=>{let F=nr.spawn(w,v,q);return!F||!F.pid?ki(F,`Launching server using runtime ${w} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),a(F.stdout,this.outputChannel),j.onConnected().then(oe=>({reader:oe[0],writer:oe[1]})))});if(Er.isSocket(_))return(0,Ne.createClientSocketTransport)(_.port).then(j=>{let F=nr.spawn(w,v,q);return!F||!F.pid?ki(F,`Launching server using runtime ${w} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),a(F.stdout,this.outputChannel),j.onConnected().then(oe=>({reader:oe[0],writer:oe[1]})))})}}else{let v;return new Promise((R,q)=>{let w=(g.args&&g.args.slice())??[];_===je.ipc?w.push("--node-ipc"):_===je.stdio?w.push("--stdio"):_===je.pipe?(v=(0,Ne.generateRandomPipeName)(),w.push(`--pipe=${v}`)):Er.isSocket(_)&&w.push(`--socket=${_.port}`),w.push(`--clientProcessId=${process.pid.toString()}`);let M=g.options?{...g.options}:Object.create(null);if(M.env=t(M.env,!0),M.execArgv=M.execArgv||[],M.cwd=h,M.silent=!0,_===je.ipc||_===je.stdio){let j=nr.fork(g.module,w||[],M);o(j),this._serverProcess=j,u(j.stderr,this.outputChannel),_===je.ipc?(a(j.stdout,this.outputChannel),R({reader:new Ne.IPCMessageReader(this._serverProcess),writer:new Ne.IPCMessageWriter(this._serverProcess)})):R({reader:new Ne.StreamMessageReader(j.stdout),writer:new Ne.StreamMessageWriter(j.stdin)})}else _===je.pipe?(0,Ne.createClientPipeTransport)(v).then(j=>{let F=nr.fork(g.module,w||[],M);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),a(F.stdout,this.outputChannel),j.onConnected().then(oe=>{R({reader:oe[0],writer:oe[1]})},q)},q):Er.isSocket(_)&&(0,Ne.createClientSocketTransport)(_.port).then(j=>{let F=nr.fork(g.module,w||[],M);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),a(F.stdout,this.outputChannel),j.onConnected().then(oe=>{R({reader:oe[0],writer:oe[1]})},q)},q)})}}else if(Ch.is(f)&&f.command){let g=f,_=f.args!==void 0?f.args.slice(0):[],v,R=f.transport;if(R===je.stdio)_.push("--stdio");else if(R===je.pipe)v=(0,Ne.generateRandomPipeName)(),_.push(`--pipe=${v}`);else if(Er.isSocket(R))_.push(`--socket=${R.port}`);else if(R===je.ipc)throw new Error("Transport kind ipc is not support for command executable");let q=Object.assign({},g.options);if(q.cwd=q.cwd||h,R===void 0||R===je.stdio){let w=nr.spawn(g.command,_,q);return!w||!w.pid?ki(w,`Launching server using command ${g.command} failed.`):(u(w.stderr,this.outputChannel),this._serverProcess=w,this._isDetached=!!q.detached,Promise.resolve({reader:new Ne.StreamMessageReader(w.stdout),writer:new Ne.StreamMessageWriter(w.stdin)}))}else{if(R===je.pipe)return(0,Ne.createClientPipeTransport)(v).then(w=>{let M=nr.spawn(g.command,_,q);return!M||!M.pid?ki(M,`Launching server using command ${g.command} failed.`):(this._serverProcess=M,this._isDetached=!!q.detached,u(M.stderr,this.outputChannel),a(M.stdout,this.outputChannel),w.onConnected().then(j=>({reader:j[0],writer:j[1]})))});if(Er.isSocket(R))return(0,Ne.createClientSocketTransport)(R.port).then(w=>{let M=nr.spawn(g.command,_,q);return!M||!M.pid?ki(M,`Launching server using command ${g.command} failed.`):(this._serverProcess=M,this._isDetached=!!q.detached,u(M.stderr,this.outputChannel),a(M.stdout,this.outputChannel),w.onConnected().then(j=>({reader:j[0],writer:j[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(l,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(h,g)=>{h===0?this.info("Server process exited successfully",void 0,!1):h!==null&&this.error(`Server process exited with code ${h}.`,void 0,!1),g!==null&&this.error(`Server process exited with signal ${g}.`,void 0,!1)})})}_getRuntimePath(e,t){if(bh.isAbsolute(e))return e;let r=this._mainGetRootPath();if(r!==void 0){let i=bh.join(r,e);if(vh.existsSync(i))return i}if(t!==void 0){let i=bh.join(t,e);if(vh.existsSync(i))return i}return e}_mainGetRootPath(){let e=qr.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}_getServerWorkingDir(e){let t=e&&e.cwd;return t||(t=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),t?new Promise(r=>{vh.lstat(t,(i,s)=>{r(!i&&s.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};Qe.LanguageClient=Ph;var Rh=class{_client;_setting;_listeners;constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return qr.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new qr.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,r=e>=0?this._setting.substr(e+1):void 0,i=r?qr.workspace.getConfiguration(t).get(r,!1):qr.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(s=>this._client.error("Start failed after configuration change",s,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(s=>this._client.error("Stop failed after configuration change",s,"force"))}};Qe.SettingMonitor=Rh;function ki(n,e){return n===null?Promise.reject(e):new Promise((t,r)=>{n.on("error",i=>{r(`${e} ${i}`)}),setImmediate(()=>r(e))})}});var fE=exports&&exports.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),hE=exports&&exports.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),ib=exports&&exports.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i{await Th.commands.executeCommand("editor.action.formatDocument")})),await Hi.start()}async function mE(){Hi!==void 0&&(await Hi.stop(),Hi=void 0)} //# sourceMappingURL=extension.js.map diff --git a/dist/server.js b/dist/server.js new file mode 100644 index 0000000..efe7071 --- /dev/null +++ b/dist/server.js @@ -0,0 +1,36 @@ +"use strict";var Li=Object.defineProperty;var yh=Object.getOwnPropertyDescriptor;var Th=Object.getOwnPropertyNames;var _h=Object.prototype.hasOwnProperty;var Ka=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var S=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Xa=(e,t)=>{for(var n in t)Li(e,n,{get:t[n],enumerable:!0})},vh=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Th(t))!_h.call(e,i)&&i!==n&&Li(e,i,{get:()=>t[i],enumerable:!(r=yh(t,i))||r.enumerable});return e};var ar=e=>vh(Li({},"__esModule",{value:!0}),e);var ur=S(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.boolean=bh;je.string=Ya;je.number=Ch;je.error=Ih;je.func=Ja;je.array=Za;je.stringArray=Sh;je.typedArray=Dh;je.thenable=wh;function bh(e){return e===!0||e===!1}function Ya(e){return typeof e=="string"||e instanceof String}function Ch(e){return typeof e=="number"||e instanceof Number}function Ih(e){return e instanceof Error}function Ja(e){return typeof e=="function"}function Za(e){return Array.isArray(e)}function Sh(e){return Za(e)&&e.every(t=>Ya(t))}function Dh(e,t){return Array.isArray(e)&&e.every(t)}function wh(e){return e&&Ja(e.then)}});var Xt=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.boolean=Ph;et.string=eu;et.number=kh;et.error=Rh;et.func=Oh;et.array=tu;et.stringArray=xh;function Ph(e){return e===!0||e===!1}function eu(e){return typeof e=="string"||e instanceof String}function kh(e){return typeof e=="number"||e instanceof Number}function Rh(e){return e instanceof Error}function Oh(e){return typeof e=="function"}function tu(e){return Array.isArray(e)}function xh(e){return tu(e)&&e.every(t=>eu(t))}});var fo=S(k=>{"use strict";var Mh=k&&k.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Eh=k&&k.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),qh=k&&k.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.LRUCache=ht.LinkedMap=ht.Touch=void 0;var de;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(de||(ht.Touch=de={}));var lr=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){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}before(t){let n=this._map.get(t);return n?n.previous?.value:void 0}after(t){let n=this._map.get(t);return n?n.next?.value:void 0}has(t){return this._map.has(t)}get(t,n=de.None){let r=this._map.get(t);if(r)return n!==de.None&&this.touch(r,n),r.value}set(t,n,r=de.None){let i=this._map.get(t);if(i)i.value=n,r!==de.None&&this.touch(i,r);else{switch(i={key:t,value:n,next:void 0,previous:void 0},r){case de.None:this.addItemLast(i);break;case de.First:this.addItemFirst(i);break;case de.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(t,i),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let n=this._map.get(t);if(n)return this._map.delete(t),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,n){let r=this._state,i=this._head;for(;i;){if(n?t.bind(n)(i.value,i.key,this):t(i.value,i.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.key,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}values(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:n.value,done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}entries(){let t=this._state,n=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let i={value:[n.key,n.value],done:!1};return n=n.next,i}else return{value:void 0,done:!0}}};return r}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let n=this._head,r=this.size;for(;n&&r>t;)this._map.delete(n.key),n=n.next,r--;this._head=n,this._size=r,n&&(n.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let n=t.next,r=t.previous;if(!n||!r)throw new Error("Invalid list");n.previous=r,r.next=n}t.next=void 0,t.previous=void 0,this._state++}touch(t,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(n!==de.First&&n!==de.Last)){if(n===de.First){if(t===this._head)return;let r=t.next,i=t.previous;t===this._tail?(i.next=void 0,this._tail=i):(r.previous=i,i.next=r),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(n===de.Last){if(t===this._tail)return;let r=t.next,i=t.previous;t===this._head?(r.previous=void 0,this._head=r):(r.previous=i,i.next=r),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((n,r)=>{t.push([r,n])}),t}fromJSON(t){this.clear();for(let[n,r]of t)this.set(n,r)}};ht.LinkedMap=lr;var mo=class extends lr{_limit;_ratio;constructor(t,n=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,n=de.AsNew){return super.get(t,n)}peek(t){return super.get(t,de.None)}set(t,n){return super.set(t,n,de.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};ht.LRUCache=mo});var iu=S(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.Disposable=void 0;var ru;(function(e){function t(n){return{dispose:n}}e.create=t})(ru||(dr.Disposable=ru={}))});var gt=S(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});var go;function po(){if(go===void 0)throw new Error("No runtime abstraction layer installed");return go}(function(e){function t(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");go=n}e.install=t})(po||(po={}));yo.default=po});var Yt=S(pt=>{"use strict";var Nh=pt&&pt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pt,"__esModule",{value:!0});pt.Emitter=pt.Event=void 0;var Ah=Nh(gt()),ou;(function(e){let t={dispose(){}};e.None=function(){return t}})(ou||(pt.Event=ou={}));var To=class{_callbacks;_contexts;add(t,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,o=this._callbacks.length;i{this._callbacks||(this._callbacks=new To),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),i.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};pt.Emitter=_o});var hr=S(Se=>{"use strict";var Gh=Se&&Se.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),jh=Se&&Se.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Fh=Se&&Se.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.SharedArrayReceiverStrategy=Jt.SharedArraySenderStrategy=void 0;var $h=hr(),Rn;(function(e){e.Continue=0,e.Cancelled=1})(Rn||(Rn={}));var Co=class{buffers;constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let n=new SharedArrayBuffer(4),r=new Int32Array(n,0,1);r[0]=Rn.Continue,this.buffers.set(t.id,n),t.$cancellationData=n}async sendCancellation(t,n){let r=this.buffers.get(n);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,Rn.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};Jt.SharedArraySenderStrategy=Co;var Io=class{data;constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Rn.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},So=class{token;constructor(t){this.token=new Io(t)}cancel(){}dispose(){}},Do=class{kind="request";createCancellationTokenSource(t){let n=t.$cancellationData;return n===void 0?new $h.CancellationTokenSource:new So(n)}};Jt.SharedArrayReceiverStrategy=Do});var Po=S(Zt=>{"use strict";var zh=Zt&&Zt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.Semaphore=void 0;var Bh=zh(gt()),wo=class{_capacity;_active;_waiting;constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((n,r)=>{this._waiting.push({thunk:t,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,Bh.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let n=t.thunk();n instanceof Promise?n.then(r=>{this._active--,t.resolve(r),this.runNext()},r=>{this._active--,t.reject(r),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}};Zt.Semaphore=wo});var au=S(fe=>{"use strict";var Qh=fe&&fe.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Vh=fe&&fe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Kh=fe&&fe.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{this.onData(r)});return this.readable.onError(r=>this.fireError(r)),this.readable.onClose(()=>this.fireClose()),n}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let r=this.buffer.tryReadHeaders(!0);if(!r)return;let i=r.get("content-length");if(!i){this.fireError(new Error(`Header must provide a Content-Length property. +${JSON.stringify(Object.fromEntries(r))}`));return}let o=parseInt(i);if(isNaN(o)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=o}let n=this.buffer.tryReadBody(this.nextMessageLength);if(n===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let r=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(n):n,i=await this.options.contentTypeDecoder.decode(r,this.options);this.callback(i)}).catch(r=>{this.fireError(r)})}}catch(n){this.fireError(n)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Ro.default)().timer.setTimeout((t,n)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};fe.ReadableStreamMessageReader=xo});var mu=S(me=>{"use strict";var Jh=me&&me.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Zh=me&&me.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),eg=me&&me.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;ithis.fireError(r)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(r=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(r):r).then(r=>{let i=[];return i.push(rg,r.byteLength.toString(),du),i.push(du),this.doWrite(t,i,r)},r=>{throw this.fireError(r),r}))}async doWrite(t,n,r){try{return await this.writable.write(n.join(""),"ascii"),this.writable.write(r)}catch(i){return this.handleError(i,t),Promise.reject(i)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){this.writable.end()}};me.WriteableStreamMessageWriter=Eo});var hu=S(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.AbstractMessageBuffer=void 0;var ig=13,og=10,sg=`\r +`,qo=class{_encoding;_chunks;_totalLength;constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let n=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let n=0,r=0,i=0,o=0;e:for(;rthis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(o)}if(this._chunks[0].byteLength>t){let o=this._chunks[0],s=this.asNative(o,t);return this._chunks[0]=o.slice(t),this._totalLength-=t,s}let n=this.allocNative(t),r=0,i=0;for(;t>0;){let o=this._chunks[i];if(o.byteLength>t){let s=o.slice(0,t);n.set(s,r),r+=t,this._chunks[i]=o.slice(t),this._totalLength-=t,t-=t}else n.set(o,r),r+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,t-=o.byteLength}return n}};yr.AbstractMessageBuffer=qo});var Tu=S(O=>{"use strict";var cg=O&&O.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),ag=O&&O.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ug=O&&O.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{},warn:()=>{},info:()=>{},log:()=>{}});var F;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(F||(O.Trace=F={}));var Fo;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(Fo||(O.TraceValue=Fo={}));O.TraceValues=Fo;(function(e){function t(r){if(!Y.string(r))return e.Off;switch(r=r.toLowerCase(),r){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function n(r){switch(r){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}e.toString=n})(F||(O.Trace=F={}));var Re;(function(e){e.Text="text",e.JSON="json"})(Re||(O.TraceFormat=Re={}));(function(e){function t(n){return Y.string(n)?(n=n.toLowerCase(),n==="json"?e.JSON:e.Text):e.Text}e.fromString=t})(Re||(O.TraceFormat=Re={}));var Lo;(function(e){e.type=new E.NotificationType("$/setTrace")})(Lo||(O.SetTraceNotification=Lo={}));var Tr;(function(e){e.type=new E.NotificationType("$/logTrace")})(Tr||(O.LogTraceNotification=Tr={}));var En;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(En||(O.ConnectionErrors=En={}));var tn=class e extends Error{code;constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};O.ConnectionError=tn;var Wo;(function(e){function t(n){let r=n;return r&&Y.func(r.cancelUndispatched)}e.is=t})(Wo||(O.ConnectionStrategy=Wo={}));var _r;(function(e){function t(n){let r=n;return r&&(r.kind===void 0||r.kind==="id")&&Y.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Y.func(r.dispose))}e.is=t})(_r||(O.IdCancellationReceiverStrategy=_r={}));var Uo;(function(e){function t(n){let r=n;return r&&r.kind==="request"&&Y.func(r.createCancellationTokenSource)&&(r.dispose===void 0||Y.func(r.dispose))}e.is=t})(Uo||(O.RequestCancellationReceiverStrategy=Uo={}));var vr;(function(e){e.Message=Object.freeze({createCancellationTokenSource(n){return new No.CancellationTokenSource}});function t(n){return _r.is(n)||Uo.is(n)}e.is=t})(vr||(O.CancellationReceiverStrategy=vr={}));var br;(function(e){e.Message=Object.freeze({sendCancellation(n,r){return n.sendNotification(qn.type,{id:r})},cleanup(n){}});function t(n){let r=n;return r&&Y.func(r.sendCancellation)&&Y.func(r.cleanup)}e.is=t})(br||(O.CancellationSenderStrategy=br={}));var Cr;(function(e){e.Message=Object.freeze({receiver:vr.Message,sender:br.Message});function t(n){let r=n;return r&&vr.is(r.receiver)&&br.is(r.sender)}e.is=t})(Cr||(O.CancellationStrategy=Cr={}));var Ir;(function(e){function t(n){let r=n;return r&&Y.func(r.handleMessage)}e.is=t})(Ir||(O.MessageStrategy=Ir={}));var yu;(function(e){function t(n){let r=n;return r&&(Cr.is(r.cancellationStrategy)||Wo.is(r.connectionStrategy)||Ir.is(r.messageStrategy)||Y.number(r.maxParallelism))}e.is=t})(yu||(O.ConnectionOptions=yu={}));var Fe;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(Fe||(Fe={}));function dg(e,t,n,r){let i=n!==void 0?n:O.NullLogger,o=0,s=0,c=0,g="2.0",d=r?.maxParallelism??-1,h=0,v,m=new Map,T,D=new Map,N=new Map,A,x=new pu.LinkedMap,p=new Map,l=new Set,C=new Map,P=F.Off,M=Re.Text,W,K=Fe.New,Je=new xn.Emitter,Aa=new xn.Emitter,Ga=new xn.Emitter,ja=new xn.Emitter,Fa=new xn.Emitter,dt=r&&r.cancellationStrategy?r.cancellationStrategy:Cr.Message;function eh(u){}function La(){return K===Fe.Listening}function Wa(){return K===Fe.Closed}function Vt(){return K===Fe.Disposed}function Ua(){(K===Fe.New||K===Fe.Listening)&&(K=Fe.Closed,Aa.fire(void 0))}function th(u){Je.fire([u,void 0,void 0])}function nh(u){Je.fire(u)}e.onClose(Ua),e.onError(th),t.onClose(Ua),t.onError(nh);function Ha(u){if(u===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+u.toString()}function rh(u){return u===null?"res-unknown-"+(++c).toString():"res-"+u.toString()}function ih(){return"not-"+(++s).toString()}function oh(u,b){E.Message.isRequest(b)?u.set(Ha(b.id),b):E.Message.isResponse(b)?d===-1?u.set(rh(b.id),b):za(b):u.set(ih(),b)}function Ai(){A||x.size===0||d!==-1&&h>=d||(A=(0,gu.default)().timer.setImmediate(async()=>{if(A=void 0,x.size===0||d!==-1&&h>=d)return;let u=x.shift(),b;try{h++;let I=r?.messageStrategy;Ir.is(I)?b=I.handleMessage(u,$a):b=$a(u)}catch(I){i.error(`Processing message queue failed: ${I.toString()}`)}finally{b instanceof Promise?b.then(()=>{h--,Ai()}).catch(I=>{i.error(`Processing message queue failed: ${I.toString()}`)}):h--,Ai()}}))}async function $a(u){return E.Message.isRequest(u)?ch(u):E.Message.isNotification(u)?ah(u):E.Message.isResponse(u)?za(u):uh(u)}let sh=u=>{try{if(E.Message.isNotification(u)&&u.method===qn.type.method){let b=u.params.id,I=Ha(b),R=x.get(I);if(E.Message.isRequest(R)){let X=r?.connectionStrategy,U=X&&X.cancelUndispatched?X.cancelUndispatched(R,eh):void 0;if(U&&(U.error!==void 0||U.result!==void 0)){x.delete(I),C.delete(b),U.id=R.id,Gi(U,u.method,Date.now()),t.write(U).catch(()=>i.error("Sending response for canceled message failed."));return}}let j=C.get(b);if(j!==void 0){j.cancel(),ji(u);return}else l.add(b)}oh(x,u)}finally{Ai()}};async function ch(u){if(Vt())return Promise.resolve();function b(ie,le,Z){let ee={jsonrpc:g,id:u.id};return ie instanceof E.ResponseError?ee.error=ie.toJson():ee.result=ie===void 0?null:ie,Gi(ee,le,Z),t.write(ee)}function I(ie,le,Z){let ee={jsonrpc:g,id:u.id,error:ie.toJson()};return Gi(ee,le,Z),t.write(ee)}fh(u);let R=m.get(u.method),j,X;R&&(j=R.type,X=R.handler);let U=Date.now();if(X||v){let ie=u.id??String(Date.now()),le=_r.is(dt.receiver)?dt.receiver.createCancellationTokenSource(ie):dt.receiver.createCancellationTokenSource(u);u.id!==null&&l.has(u.id)&&le.cancel(),u.id!==null&&C.set(ie,le);try{let Z;if(X)if(u.params===void 0){if(j!==void 0&&j.numberOfParams!==0)return I(new E.ResponseError(E.ErrorCodes.InvalidParams,`Request ${u.method} defines ${j.numberOfParams} params but received none.`),u.method,U);Z=X(le.token)}else if(Array.isArray(u.params)){if(j!==void 0&&j.parameterStructures===E.ParameterStructures.byName)return I(new E.ResponseError(E.ErrorCodes.InvalidParams,`Request ${u.method} defines parameters by name but received parameters by position`),u.method,U);Z=X(...u.params,le.token)}else{if(j!==void 0&&j.parameterStructures===E.ParameterStructures.byPosition)return I(new E.ResponseError(E.ErrorCodes.InvalidParams,`Request ${u.method} defines parameters by position but received parameters by name`),u.method,U);Z=X(u.params,le.token)}else v&&(Z=v(u.method,u.params,le.token));let ee=await Z;await b(ee,u.method,U)}catch(Z){Z instanceof E.ResponseError?await b(Z,u.method,U):Z&&Y.string(Z.message)?await I(new E.ResponseError(E.ErrorCodes.InternalError,`Request ${u.method} failed with message: ${Z.message}`),u.method,U):await I(new E.ResponseError(E.ErrorCodes.InternalError,`Request ${u.method} failed unexpectedly without providing any details.`),u.method,U)}finally{C.delete(ie)}}else await I(new E.ResponseError(E.ErrorCodes.MethodNotFound,`Unhandled method ${u.method}`),u.method,U)}function za(u){if(!Vt())if(u.id===null)u.error?i.error(`Received response message without id: Error is: +${JSON.stringify(u.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let b=u.id,I=p.get(b);if(mh(u,I),I!==void 0){p.delete(b);try{if(u.error){let R=u.error;I.reject(new E.ResponseError(R.code,R.message,R.data))}else if(u.result!==void 0)I.resolve(u.result);else throw new Error("Should never happen.")}catch(R){R.message?i.error(`Response handler '${I.method}' failed with message: ${R.message}`):i.error(`Response handler '${I.method}' failed unexpectedly.`)}}}}async function ah(u){if(Vt())return;let b,I;if(u.method===qn.type.method){let R=u.params.id;l.delete(R),ji(u);return}else{let R=D.get(u.method);R&&(I=R.handler,b=R.type)}if(I||T)try{if(ji(u),I)if(u.params===void 0)b!==void 0&&b.numberOfParams!==0&&b.parameterStructures!==E.ParameterStructures.byName&&i.error(`Notification ${u.method} defines ${b.numberOfParams} params but received none.`),await I();else if(Array.isArray(u.params)){let R=u.params;u.method===Mn.type.method&&R.length===2&&Ao.is(R[0])?await I({token:R[0],value:R[1]}):(b!==void 0&&(b.parameterStructures===E.ParameterStructures.byName&&i.error(`Notification ${u.method} defines parameters by name but received parameters by position`),b.numberOfParams!==u.params.length&&i.error(`Notification ${u.method} defines ${b.numberOfParams} params but received ${R.length} arguments`)),await I(...R))}else b!==void 0&&b.parameterStructures===E.ParameterStructures.byPosition&&i.error(`Notification ${u.method} defines parameters by position but received parameters by name`),await I(u.params);else T&&await T(u.method,u.params)}catch(R){R.message?i.error(`Notification handler '${u.method}' failed with message: ${R.message}`):i.error(`Notification handler '${u.method}' failed unexpectedly.`)}else Ga.fire(u)}function uh(u){if(!u){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(u,null,4)}`);let b=u;if(Y.string(b.id)||Y.number(b.id)){let I=b.id,R=p.get(I);R&&R.reject(new Error("The received response has neither a result nor an error property."))}}function ft(u){if(u!=null)switch(P){case F.Verbose:return JSON.stringify(u,null,4);case F.Compact:return JSON.stringify(u);default:return}}function lh(u){if(!(P===F.Off||!W))if(M===Re.Text){let b;(P===F.Verbose||P===F.Compact)&&u.params&&(b=`Params: ${ft(u.params)}`),W.log(`Sending request '${u.method} - (${u.id})'.`,b)}else Kt("send-request",u)}function dh(u){if(!(P===F.Off||!W))if(M===Re.Text){let b;(P===F.Verbose||P===F.Compact)&&(u.params?b=`Params: ${ft(u.params)}`:b="No parameters provided."),W.log(`Sending notification '${u.method}'.`,b)}else Kt("send-notification",u)}function Gi(u,b,I){if(!(P===F.Off||!W))if(M===Re.Text){let R;(P===F.Verbose||P===F.Compact)&&(u.error&&u.error.data?R=`Error data: ${ft(u.error.data)}`:u.result?R=`Result: ${ft(u.result)}`:u.error===void 0&&(R="No result returned.")),W.log(`Sending response '${b} - (${u.id})'. Processing request took ${Date.now()-I}ms`,R)}else Kt("send-response",u)}function fh(u){if(!(P===F.Off||!W))if(M===Re.Text){let b;(P===F.Verbose||P===F.Compact)&&u.params&&(b=`Params: ${ft(u.params)}`),W.log(`Received request '${u.method} - (${u.id})'.`,b)}else Kt("receive-request",u)}function ji(u){if(!(P===F.Off||!W||u.method===Tr.type.method))if(M===Re.Text){let b;(P===F.Verbose||P===F.Compact)&&(u.params?b=`Params: ${ft(u.params)}`:b="No parameters provided."),W.log(`Received notification '${u.method}'.`,b)}else Kt("receive-notification",u)}function mh(u,b){if(!(P===F.Off||!W))if(M===Re.Text){let I;if((P===F.Verbose||P===F.Compact)&&(u.error&&u.error.data?I=`Error data: ${ft(u.error.data)}`:u.result?I=`Result: ${ft(u.result)}`:u.error===void 0&&(I="No result returned.")),b){let R=u.error?` Request failed: ${u.error.message} (${u.error.code}).`:"";W.log(`Received response '${b.method} - (${u.id})' in ${Date.now()-b.timerStart}ms.${R}`,I)}else W.log(`Received response ${u.id} without active response promise.`,I)}else Kt("receive-response",u)}function Kt(u,b){if(!W||P===F.Off)return;let I={isLSPMessage:!0,type:u,message:b,timestamp:Date.now()};W.log(I)}function wn(){if(Wa())throw new tn(En.Closed,"Connection is closed.");if(Vt())throw new tn(En.Disposed,"Connection is disposed.")}function hh(){if(La())throw new tn(En.AlreadyListening,"Connection is already listening")}function gh(){if(!La())throw new Error("Call listen() first.")}function Pn(u){return u===void 0?null:u}function Ba(u){if(u!==null)return u}function Qa(u){return u!=null&&!Array.isArray(u)&&typeof u=="object"}function Fi(u,b){switch(u){case E.ParameterStructures.auto:return Qa(b)?Ba(b):[Pn(b)];case E.ParameterStructures.byName:if(!Qa(b))throw new Error("Received parameters by name but param is not an object literal.");return Ba(b);case E.ParameterStructures.byPosition:return[Pn(b)];default:throw new Error(`Unknown parameter structure ${u.toString()}`)}}function Va(u,b){let I,R=u.numberOfParams;switch(R){case 0:I=void 0;break;case 1:I=Fi(u.parameterStructures,b[0]);break;default:I=[];for(let j=0;j{wn();let I,R;if(Y.string(u)){I=u;let X=b[0],U=0,ie=E.ParameterStructures.auto;E.ParameterStructures.is(X)&&(U=1,ie=X);let le=b.length,Z=le-U;switch(Z){case 0:R=void 0;break;case 1:R=Fi(ie,b[U]);break;default:if(ie===E.ParameterStructures.byName)throw new Error(`Received ${Z} parameters for 'by Name' notification parameter structure.`);R=b.slice(U,le).map(ee=>Pn(ee));break}}else{let X=b;I=u.method,R=Va(u,X)}let j={jsonrpc:g,method:I,params:R};return dh(j),t.write(j).catch(X=>{throw i.error("Sending notification failed."),X})},onNotification:(u,b)=>{wn();let I;return Y.func(u)?T=u:b&&(Y.string(u)?(I=u,D.set(u,{type:void 0,handler:b})):(I=u.method,D.set(u.method,{type:u,handler:b}))),{dispose:()=>{I!==void 0?D.get(I)?.handler===b&&D.delete(I):T===u&&(T=void 0)}}},onProgress:(u,b,I)=>{if(N.has(b))throw new Error(`Progress handler for token ${b} already registered`);return N.set(b,I),{dispose:()=>{N.get(b)===I&&N.delete(b)}}},sendProgress:(u,b,I)=>xt.sendNotification(Mn.type,{token:b,value:I}),onUnhandledProgress:ja.event,sendRequest:(u,...b)=>{wn(),gh();function I(ee,Ge){let Ze=dt.sender.sendCancellation(ee,Ge);Ze===void 0?i.log(`Received no promise from cancellation strategy when cancelling id ${Ge}`):Ze.catch(()=>{i.log(`Sending cancellation messages for id ${Ge} failed.`)})}let R,j,X;if(Y.string(u)){R=u;let ee=b[0],Ge=b[b.length-1],Ze=0,kn=E.ParameterStructures.auto;E.ParameterStructures.is(ee)&&(Ze=1,kn=ee);let Mt=b.length;No.CancellationToken.is(Ge)&&(Mt=Mt-1,X=Ge);let Be=Mt-Ze;switch(Be){case 0:j=void 0;break;case 1:j=Fi(kn,b[Ze]);break;default:if(kn===E.ParameterStructures.byName)throw new Error(`Received ${Be} parameters for 'by Name' request parameter structure.`);j=b.slice(Ze,Mt).map(ph=>Pn(ph));break}}else{let ee=b;R=u.method,j=Va(u,ee);let Ge=u.numberOfParams;X=No.CancellationToken.is(ee[Ge])?ee[Ge]:void 0}let U=o++,ie,le=!1;X!==void 0&&(X.isCancellationRequested?le=!0:ie=X.onCancellationRequested(()=>{I(xt,U)}));let Z={jsonrpc:g,id:U,method:R,params:j};return lh(Z),typeof dt.sender.enableCancellation=="function"&&dt.sender.enableCancellation(Z),new Promise(async(ee,Ge)=>{let Ze=Be=>{ee(Be),dt.sender.cleanup(U),ie?.dispose()},kn=Be=>{Ge(Be),dt.sender.cleanup(U),ie?.dispose()},Mt={method:R,timerStart:Date.now(),resolve:Ze,reject:kn};try{p.set(U,Mt),await t.write(Z),le&&I(xt,U)}catch(Be){throw p.delete(U),Mt.reject(new E.ResponseError(E.ErrorCodes.MessageWriteError,Be.message?Be.message:"Unknown reason")),i.error("Sending request failed."),Be}})},onRequest:(u,b)=>{wn();let I=null;return jo.is(u)?(I=void 0,v=u):Y.string(u)?(I=null,b!==void 0&&(I=u,m.set(u,{handler:b,type:void 0}))):b!==void 0&&(I=u.method,m.set(u.method,{type:u,handler:b})),{dispose:()=>{I!==null&&(I!==void 0?m.get(I)?.handler===b&&m.delete(I):v===u&&(v=void 0))}}},hasPendingResponse:()=>p.size>0,trace:async(u,b,I)=>{let R=!1,j=Re.Text;I!==void 0&&(Y.boolean(I)?R=I:(R=I.sendNotification||!1,j=I.traceFormat||Re.Text)),P=u,M=j,P===F.Off?W=void 0:W=b,R&&!Wa()&&!Vt()&&await xt.sendNotification(Lo.type,{value:F.toString(u)})},onError:Je.event,onClose:Aa.event,onUnhandledNotification:Ga.event,onDispose:Fa.event,end:()=>{t.end()},dispose:()=>{if(Vt())return;K=Fe.Disposed,Fa.fire(void 0);let u=new E.ResponseError(E.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let b of p.values())b.reject(u);p=new Map,C=new Map,l=new Set,x=new pu.LinkedMap,Y.func(t.dispose)&&t.dispose(),Y.func(e.dispose)&&e.dispose()},listen:()=>{wn(),hh(),K=Fe.Listening,e.listen(sh)},inspect:()=>{(0,gu.default)().console.log("inspect")}};return xt.onNotification(Tr.type,u=>{if(P===F.Off||!W)return;let b=P===F.Verbose||P===F.Compact;W.log(u.message,b?u.verbose:void 0)}),xt.onNotification(Mn.type,async u=>{let b=N.get(u.token);b?await b(u.value):ja.fire(u)}),xt}});var tt=S(y=>{"use strict";var fg=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y,"__esModule",{value:!0});y.ProgressType=y.ProgressToken=y.createMessageConnection=y.NullLogger=y.ConnectionOptions=y.ConnectionStrategy=y.AbstractMessageBuffer=y.WriteableStreamMessageWriter=y.AbstractMessageWriter=y.MessageWriter=y.ReadableStreamMessageReader=y.AbstractMessageReader=y.MessageReader=y.SharedArrayReceiverStrategy=y.SharedArraySenderStrategy=y.CancellationToken=y.CancellationTokenSource=y.Emitter=y.Event=y.Disposable=y.LRUCache=y.Touch=y.LinkedMap=y.ParameterStructures=y.NotificationType9=y.NotificationType8=y.NotificationType7=y.NotificationType6=y.NotificationType5=y.NotificationType4=y.NotificationType3=y.NotificationType2=y.NotificationType1=y.NotificationType0=y.NotificationType=y.ErrorCodes=y.ResponseError=y.RequestType9=y.RequestType8=y.RequestType7=y.RequestType6=y.RequestType5=y.RequestType4=y.RequestType3=y.RequestType2=y.RequestType1=y.RequestType0=y.RequestType=y.Message=y.RAL=void 0;y.MessageStrategy=y.CancellationStrategy=y.CancellationSenderStrategy=y.RequestCancellationReceiverStrategy=y.IdCancellationReceiverStrategy=y.CancellationReceiverStrategy=y.ConnectionError=y.ConnectionErrors=y.LogTraceNotification=y.SetTraceNotification=y.TraceFormat=y.TraceValues=y.TraceValue=y.Trace=void 0;var B=fo();Object.defineProperty(y,"Message",{enumerable:!0,get:function(){return B.Message}});Object.defineProperty(y,"RequestType",{enumerable:!0,get:function(){return B.RequestType}});Object.defineProperty(y,"RequestType0",{enumerable:!0,get:function(){return B.RequestType0}});Object.defineProperty(y,"RequestType1",{enumerable:!0,get:function(){return B.RequestType1}});Object.defineProperty(y,"RequestType2",{enumerable:!0,get:function(){return B.RequestType2}});Object.defineProperty(y,"RequestType3",{enumerable:!0,get:function(){return B.RequestType3}});Object.defineProperty(y,"RequestType4",{enumerable:!0,get:function(){return B.RequestType4}});Object.defineProperty(y,"RequestType5",{enumerable:!0,get:function(){return B.RequestType5}});Object.defineProperty(y,"RequestType6",{enumerable:!0,get:function(){return B.RequestType6}});Object.defineProperty(y,"RequestType7",{enumerable:!0,get:function(){return B.RequestType7}});Object.defineProperty(y,"RequestType8",{enumerable:!0,get:function(){return B.RequestType8}});Object.defineProperty(y,"RequestType9",{enumerable:!0,get:function(){return B.RequestType9}});Object.defineProperty(y,"ResponseError",{enumerable:!0,get:function(){return B.ResponseError}});Object.defineProperty(y,"ErrorCodes",{enumerable:!0,get:function(){return B.ErrorCodes}});Object.defineProperty(y,"NotificationType",{enumerable:!0,get:function(){return B.NotificationType}});Object.defineProperty(y,"NotificationType0",{enumerable:!0,get:function(){return B.NotificationType0}});Object.defineProperty(y,"NotificationType1",{enumerable:!0,get:function(){return B.NotificationType1}});Object.defineProperty(y,"NotificationType2",{enumerable:!0,get:function(){return B.NotificationType2}});Object.defineProperty(y,"NotificationType3",{enumerable:!0,get:function(){return B.NotificationType3}});Object.defineProperty(y,"NotificationType4",{enumerable:!0,get:function(){return B.NotificationType4}});Object.defineProperty(y,"NotificationType5",{enumerable:!0,get:function(){return B.NotificationType5}});Object.defineProperty(y,"NotificationType6",{enumerable:!0,get:function(){return B.NotificationType6}});Object.defineProperty(y,"NotificationType7",{enumerable:!0,get:function(){return B.NotificationType7}});Object.defineProperty(y,"NotificationType8",{enumerable:!0,get:function(){return B.NotificationType8}});Object.defineProperty(y,"NotificationType9",{enumerable:!0,get:function(){return B.NotificationType9}});Object.defineProperty(y,"ParameterStructures",{enumerable:!0,get:function(){return B.ParameterStructures}});var Ho=ho();Object.defineProperty(y,"LinkedMap",{enumerable:!0,get:function(){return Ho.LinkedMap}});Object.defineProperty(y,"LRUCache",{enumerable:!0,get:function(){return Ho.LRUCache}});Object.defineProperty(y,"Touch",{enumerable:!0,get:function(){return Ho.Touch}});var mg=iu();Object.defineProperty(y,"Disposable",{enumerable:!0,get:function(){return mg.Disposable}});var _u=Yt();Object.defineProperty(y,"Event",{enumerable:!0,get:function(){return _u.Event}});Object.defineProperty(y,"Emitter",{enumerable:!0,get:function(){return _u.Emitter}});var vu=hr();Object.defineProperty(y,"CancellationTokenSource",{enumerable:!0,get:function(){return vu.CancellationTokenSource}});Object.defineProperty(y,"CancellationToken",{enumerable:!0,get:function(){return vu.CancellationToken}});var bu=su();Object.defineProperty(y,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return bu.SharedArraySenderStrategy}});Object.defineProperty(y,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return bu.SharedArrayReceiverStrategy}});var $o=au();Object.defineProperty(y,"MessageReader",{enumerable:!0,get:function(){return $o.MessageReader}});Object.defineProperty(y,"AbstractMessageReader",{enumerable:!0,get:function(){return $o.AbstractMessageReader}});Object.defineProperty(y,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return $o.ReadableStreamMessageReader}});var zo=mu();Object.defineProperty(y,"MessageWriter",{enumerable:!0,get:function(){return zo.MessageWriter}});Object.defineProperty(y,"AbstractMessageWriter",{enumerable:!0,get:function(){return zo.AbstractMessageWriter}});Object.defineProperty(y,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return zo.WriteableStreamMessageWriter}});var hg=hu();Object.defineProperty(y,"AbstractMessageBuffer",{enumerable:!0,get:function(){return hg.AbstractMessageBuffer}});var re=Tu();Object.defineProperty(y,"ConnectionStrategy",{enumerable:!0,get:function(){return re.ConnectionStrategy}});Object.defineProperty(y,"ConnectionOptions",{enumerable:!0,get:function(){return re.ConnectionOptions}});Object.defineProperty(y,"NullLogger",{enumerable:!0,get:function(){return re.NullLogger}});Object.defineProperty(y,"createMessageConnection",{enumerable:!0,get:function(){return re.createMessageConnection}});Object.defineProperty(y,"ProgressToken",{enumerable:!0,get:function(){return re.ProgressToken}});Object.defineProperty(y,"ProgressType",{enumerable:!0,get:function(){return re.ProgressType}});Object.defineProperty(y,"Trace",{enumerable:!0,get:function(){return re.Trace}});Object.defineProperty(y,"TraceValue",{enumerable:!0,get:function(){return re.TraceValue}});Object.defineProperty(y,"TraceFormat",{enumerable:!0,get:function(){return re.TraceFormat}});Object.defineProperty(y,"SetTraceNotification",{enumerable:!0,get:function(){return re.SetTraceNotification}});Object.defineProperty(y,"LogTraceNotification",{enumerable:!0,get:function(){return re.LogTraceNotification}});Object.defineProperty(y,"ConnectionErrors",{enumerable:!0,get:function(){return re.ConnectionErrors}});Object.defineProperty(y,"ConnectionError",{enumerable:!0,get:function(){return re.ConnectionError}});Object.defineProperty(y,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return re.CancellationReceiverStrategy}});Object.defineProperty(y,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return re.IdCancellationReceiverStrategy}});Object.defineProperty(y,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return re.RequestCancellationReceiverStrategy}});Object.defineProperty(y,"CancellationSenderStrategy",{enumerable:!0,get:function(){return re.CancellationSenderStrategy}});Object.defineProperty(y,"CancellationStrategy",{enumerable:!0,get:function(){return re.CancellationStrategy}});Object.defineProperty(y,"MessageStrategy",{enumerable:!0,get:function(){return re.MessageStrategy}});Object.defineProperty(y,"TraceValues",{enumerable:!0,get:function(){return re.TraceValues}});var gg=fg(gt());y.RAL=gg.default});var qr={};Xa(qr,{AnnotatedTextEdit:()=>nt,ApplyKind:()=>ms,ChangeAnnotation:()=>yt,ChangeAnnotationIdentifier:()=>oe,CodeAction:()=>Rs,CodeActionContext:()=>ks,CodeActionKind:()=>Ps,CodeActionTag:()=>Or,CodeActionTriggerKind:()=>Wn,CodeDescription:()=>ts,CodeLens:()=>Os,Color:()=>Dr,ColorInformation:()=>Ko,ColorPresentation:()=>Xo,Command:()=>qt,CompletionItem:()=>gs,CompletionItemKind:()=>as,CompletionItemLabelDetails:()=>hs,CompletionItemTag:()=>ls,CompletionList:()=>ps,CreateFile:()=>rn,DeleteFile:()=>sn,Diagnostic:()=>Gn,DiagnosticRelatedInformation:()=>wr,DiagnosticSeverity:()=>Zo,DiagnosticTag:()=>es,DocumentHighlight:()=>bs,DocumentHighlightKind:()=>vs,DocumentLink:()=>Ms,DocumentSymbol:()=>ws,DocumentUri:()=>Bo,EOL:()=>pg,FoldingRange:()=>Jo,FoldingRangeKind:()=>Yo,FormattingOptions:()=>xs,Hover:()=>ys,InlayHint:()=>Ws,InlayHintKind:()=>xr,InlayHintLabelPart:()=>Mr,InlineCompletionContext:()=>Bs,InlineCompletionItem:()=>Us,InlineCompletionList:()=>Hs,InlineCompletionTriggerKind:()=>$s,InlineValueContext:()=>Ls,InlineValueEvaluatableExpression:()=>Fs,InlineValueText:()=>Gs,InlineValueVariableLookup:()=>js,InsertReplaceEdit:()=>ds,InsertTextFormat:()=>us,InsertTextMode:()=>fs,LanguageKind:()=>ss,Location:()=>An,LocationLink:()=>Vo,MarkedString:()=>Ln,MarkupContent:()=>Tt,MarkupKind:()=>Rr,OptionalVersionedTextDocumentIdentifier:()=>Fn,ParameterInformation:()=>Ts,Position:()=>Me,Range:()=>J,RenameFile:()=>on,SelectedCompletionInfo:()=>zs,SelectionRange:()=>Es,SemanticTokenModifiers:()=>Ns,SemanticTokenTypes:()=>qs,SemanticTokens:()=>As,SignatureInformation:()=>_s,SnippetTextEdit:()=>ns,StringValue:()=>Er,SymbolInformation:()=>Ss,SymbolKind:()=>Cs,SymbolTag:()=>Is,TextDocument:()=>Vs,TextDocumentEdit:()=>jn,TextDocumentIdentifier:()=>is,TextDocumentItem:()=>cs,TextEdit:()=>Qe,URI:()=>Sr,VersionedTextDocumentIdentifier:()=>os,WorkspaceChange:()=>rs,WorkspaceEdit:()=>Pr,WorkspaceFolder:()=>Qs,WorkspaceSymbol:()=>Ds,integer:()=>Qo,uinteger:()=>Nn});var Bo,Sr,Qo,Nn,Me,J,An,Vo,Dr,Ko,Xo,Yo,Jo,wr,Zo,es,ts,Gn,qt,Qe,yt,oe,nt,jn,rn,on,sn,Pr,nn,ns,kr,rs,is,os,Fn,ss,cs,Rr,Tt,as,us,ls,ds,fs,ms,hs,gs,ps,Ln,ys,Ts,_s,vs,bs,Cs,Is,Ss,Ds,ws,Ps,Wn,ks,Or,Rs,Os,xs,Ms,Es,qs,Ns,As,Gs,js,Fs,Ls,xr,Mr,Ws,Er,Us,Hs,$s,zs,Bs,Qs,pg,Vs,Ks,f,Nr=Ka(()=>{"use strict";(function(e){function t(n){return typeof n=="string"}e.is=t})(Bo||(Bo={}));(function(e){function t(n){return typeof n=="string"}e.is=t})(Sr||(Sr={}));(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(Qo||(Qo={}));(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(n){return typeof n=="number"&&e.MIN_VALUE<=n&&n<=e.MAX_VALUE}e.is=t})(Nn||(Nn={}));(function(e){function t(r,i){return r===Number.MAX_VALUE&&(r=Nn.MAX_VALUE),i===Number.MAX_VALUE&&(i=Nn.MAX_VALUE),{line:r,character:i}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&f.uinteger(i.line)&&f.uinteger(i.character)}e.is=n})(Me||(Me={}));(function(e){function t(r,i,o,s){if(f.uinteger(r)&&f.uinteger(i)&&f.uinteger(o)&&f.uinteger(s))return{start:Me.create(r,i),end:Me.create(o,s)};if(Me.is(r)&&Me.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${o}, ${s}]`)}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&Me.is(i.start)&&Me.is(i.end)}e.is=n})(J||(J={}));(function(e){function t(r,i){return{uri:r,range:i}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&J.is(i.range)&&(f.string(i.uri)||f.undefined(i.uri))}e.is=n})(An||(An={}));(function(e){function t(r,i,o,s){return{targetUri:r,targetRange:i,targetSelectionRange:o,originSelectionRange:s}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&J.is(i.targetRange)&&f.string(i.targetUri)&&J.is(i.targetSelectionRange)&&(J.is(i.originSelectionRange)||f.undefined(i.originSelectionRange))}e.is=n})(Vo||(Vo={}));(function(e){function t(r,i,o,s){return{red:r,green:i,blue:o,alpha:s}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&f.numberRange(i.red,0,1)&&f.numberRange(i.green,0,1)&&f.numberRange(i.blue,0,1)&&f.numberRange(i.alpha,0,1)}e.is=n})(Dr||(Dr={}));(function(e){function t(r,i){return{range:r,color:i}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&J.is(i.range)&&Dr.is(i.color)}e.is=n})(Ko||(Ko={}));(function(e){function t(r,i,o){return{label:r,textEdit:i,additionalTextEdits:o}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&f.string(i.label)&&(f.undefined(i.textEdit)||Qe.is(i))&&(f.undefined(i.additionalTextEdits)||f.typedArray(i.additionalTextEdits,Qe.is))}e.is=n})(Xo||(Xo={}));(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Yo||(Yo={}));(function(e){function t(r,i,o,s,c,g){let d={startLine:r,endLine:i};return f.defined(o)&&(d.startCharacter=o),f.defined(s)&&(d.endCharacter=s),f.defined(c)&&(d.kind=c),f.defined(g)&&(d.collapsedText=g),d}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&f.uinteger(i.startLine)&&f.uinteger(i.startLine)&&(f.undefined(i.startCharacter)||f.uinteger(i.startCharacter))&&(f.undefined(i.endCharacter)||f.uinteger(i.endCharacter))&&(f.undefined(i.kind)||f.string(i.kind))}e.is=n})(Jo||(Jo={}));(function(e){function t(r,i){return{location:r,message:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&An.is(i.location)&&f.string(i.message)}e.is=n})(wr||(wr={}));(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(Zo||(Zo={}));(function(e){e.Unnecessary=1,e.Deprecated=2})(es||(es={}));(function(e){function t(n){let r=n;return f.objectLiteral(r)&&f.string(r.href)}e.is=t})(ts||(ts={}));(function(e){function t(o,s,c,g,d,h){let v={range:o,message:s};return f.defined(c)&&(v.severity=c),f.defined(g)&&(v.code=g),f.defined(d)&&(v.source=d),f.defined(h)&&(v.relatedInformation=h),v}e.create=t;function n(o){var s;let c=o;return f.defined(c)&&J.is(c.range)&&(f.string(c.message)||Tt.is(c.message))&&(f.number(c.severity)||f.undefined(c.severity))&&(f.integer(c.code)||f.string(c.code)||f.undefined(c.code))&&(f.undefined(c.codeDescription)||f.string((s=c.codeDescription)===null||s===void 0?void 0:s.href))&&(f.string(c.source)||f.undefined(c.source))&&(f.undefined(c.relatedInformation)||f.typedArray(c.relatedInformation,wr.is))}e.is=n;function r(o){return f.string(o.message)}e.is3_17=r;function i(o){if(f.string(o.message))return o.message;if(Tt.is(o.message))return o.message.value;throw new Error(`Unknown message type ${typeof o.message}`)}e.getMessageString=i})(Gn||(Gn={}));(function(e){function t(r,i,...o){let s={title:r,command:i};return f.defined(o)&&o.length>0&&(s.arguments=o),s}e.create=t;function n(r){let i=r;return f.defined(i)&&f.string(i.title)&&(i.tooltip===void 0||f.string(i.tooltip))&&f.string(i.command)}e.is=n})(qt||(qt={}));(function(e){function t(o,s){return{range:o,newText:s}}e.replace=t;function n(o,s){return{range:{start:o,end:o},newText:s}}e.insert=n;function r(o){return{range:o,newText:""}}e.del=r;function i(o){let s=o;return f.objectLiteral(s)&&f.string(s.newText)&&J.is(s.range)}e.is=i})(Qe||(Qe={}));(function(e){function t(r,i,o){let s={label:r};return i!==void 0&&(s.needsConfirmation=i),o!==void 0&&(s.description=o),s}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&f.string(i.label)&&(f.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(f.string(i.description)||i.description===void 0)}e.is=n})(yt||(yt={}));(function(e){function t(n){let r=n;return f.string(r)}e.is=t})(oe||(oe={}));(function(e){function t(o,s,c){return{range:o,newText:s,annotationId:c}}e.replace=t;function n(o,s,c){return{range:{start:o,end:o},newText:s,annotationId:c}}e.insert=n;function r(o,s){return{range:o,newText:"",annotationId:s}}e.del=r;function i(o){let s=o;return Qe.is(s)&&(yt.is(s.annotationId)||oe.is(s.annotationId))}e.is=i})(nt||(nt={}));(function(e){function t(r,i){return{textDocument:r,edits:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&Fn.is(i.textDocument)&&Array.isArray(i.edits)}e.is=n})(jn||(jn={}));(function(e){function t(r,i,o){let s={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="create"&&f.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||f.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||f.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oe.is(i.annotationId))}e.is=n})(rn||(rn={}));(function(e){function t(r,i,o,s){let c={kind:"rename",oldUri:r,newUri:i};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(c.options=o),s!==void 0&&(c.annotationId=s),c}e.create=t;function n(r){let i=r;return i&&i.kind==="rename"&&f.string(i.oldUri)&&f.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||f.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||f.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||oe.is(i.annotationId))}e.is=n})(on||(on={}));(function(e){function t(r,i,o){let s={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}e.create=t;function n(r){let i=r;return i&&i.kind==="delete"&&f.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||f.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||f.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||oe.is(i.annotationId))}e.is=n})(sn||(sn={}));(function(e){function t(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>f.string(i.kind)?rn.is(i)||on.is(i)||sn.is(i):jn.is(i)))}e.is=t})(Pr||(Pr={}));nn=class{constructor(t,n){this.edits=t,this.changeAnnotations=n}insert(t,n,r){let i,o;if(r===void 0?i=Qe.insert(t,n):oe.is(r)?(o=r,i=nt.insert(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),i=nt.insert(t,n,o)),this.edits.push(i),o!==void 0)return o}replace(t,n,r){let i,o;if(r===void 0?i=Qe.replace(t,n):oe.is(r)?(o=r,i=nt.replace(t,n,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),i=nt.replace(t,n,o)),this.edits.push(i),o!==void 0)return o}delete(t,n){let r,i;if(n===void 0?r=Qe.del(t):oe.is(n)?(i=n,r=nt.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=nt.del(t,i)),this.edits.push(r),i!==void 0)return i}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(e){function t(n){let r=n;return f.objectLiteral(r)&&J.is(r.range)&&Er.isSnippet(r.snippet)&&(r.annotationId===void 0||yt.is(r.annotationId)||oe.is(r.annotationId))}e.is=t})(ns||(ns={}));kr=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,n){let r;if(oe.is(t)?r=t:(r=this.nextId(),n=t),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(n===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=n,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},rs=class{constructor(t){this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new kr(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(n=>{if(jn.is(n)){let r=new nn(n.edits,this._changeAnnotations);this._textEditChanges[n.textDocument.uri]=r}})):t.changes&&Object.keys(t.changes).forEach(n=>{let r=new nn(t.changes[n]);this._textEditChanges[n]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(Fn.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n={uri:t.uri,version:t.version},r=this._textEditChanges[n.uri];if(!r){let i=[],o={textDocument:n,edits:i};this._workspaceEdit.documentChanges.push(o),r=new nn(i,this._changeAnnotations),this._textEditChanges[n.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let n=this._textEditChanges[t];if(!n){let r=[];this._workspaceEdit.changes[t]=r,n=new nn(r),this._textEditChanges[t]=n}return n}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new kr,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;yt.is(n)||oe.is(n)?i=n:r=n;let o,s;if(i===void 0?o=rn.create(t,r):(s=oe.is(i)?i:this._changeAnnotations.manage(i),o=rn.create(t,r,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}renameFile(t,n,r,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;yt.is(r)||oe.is(r)?o=r:i=r;let s,c;if(o===void 0?s=on.create(t,n,i):(c=oe.is(o)?o:this._changeAnnotations.manage(o),s=on.create(t,n,i,c)),this._workspaceEdit.documentChanges.push(s),c!==void 0)return c}deleteFile(t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;yt.is(n)||oe.is(n)?i=n:r=n;let o,s;if(i===void 0?o=sn.create(t,r):(s=oe.is(i)?i:this._changeAnnotations.manage(i),o=sn.create(t,r,s)),this._workspaceEdit.documentChanges.push(o),s!==void 0)return s}};(function(e){function t(r){return{uri:r}}e.create=t;function n(r){let i=r;return f.defined(i)&&f.string(i.uri)}e.is=n})(is||(is={}));(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&f.string(i.uri)&&f.integer(i.version)}e.is=n})(os||(os={}));(function(e){function t(r,i){return{uri:r,version:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&f.string(i.uri)&&(i.version===null||f.integer(i.version))}e.is=n})(Fn||(Fn={}));(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(ss||(ss={}));(function(e){function t(r,i,o,s){return{uri:r,languageId:i,version:o,text:s}}e.create=t;function n(r){let i=r;return f.defined(i)&&f.string(i.uri)&&f.string(i.languageId)&&f.integer(i.version)&&f.string(i.text)}e.is=n})(cs||(cs={}));(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(n){let r=n;return r===e.PlainText||r===e.Markdown}e.is=t})(Rr||(Rr={}));(function(e){function t(n){let r=n;return f.objectLiteral(n)&&Rr.is(r.kind)&&f.string(r.value)}e.is=t})(Tt||(Tt={}));(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(as||(as={}));(function(e){e.PlainText=1,e.Snippet=2})(us||(us={}));(function(e){e.Deprecated=1})(ls||(ls={}));(function(e){function t(r,i,o){return{newText:r,insert:i,replace:o}}e.create=t;function n(r){let i=r;return i&&f.string(i.newText)&&J.is(i.insert)&&J.is(i.replace)}e.is=n})(ds||(ds={}));(function(e){e.asIs=1,e.adjustIndentation=2})(fs||(fs={}));(function(e){e.Replace=1,e.Merge=2})(ms||(ms={}));(function(e){function t(n){let r=n;return r&&(f.string(r.detail)||r.detail===void 0)&&(f.string(r.description)||r.description===void 0)}e.is=t})(hs||(hs={}));(function(e){function t(n){return{label:n}}e.create=t})(gs||(gs={}));(function(e){function t(n,r){return{items:n||[],isIncomplete:!!r}}e.create=t})(ps||(ps={}));(function(e){function t(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function n(r){let i=r;return f.string(i)||f.objectLiteral(i)&&f.string(i.language)&&f.string(i.value)}e.is=n})(Ln||(Ln={}));(function(e){function t(n){let r=n;return!!r&&f.objectLiteral(r)&&(Tt.is(r.contents)||Ln.is(r.contents)||f.typedArray(r.contents,Ln.is))&&(n.range===void 0||J.is(n.range))}e.is=t})(ys||(ys={}));(function(e){function t(n,r){return r?{label:n,documentation:r}:{label:n}}e.create=t})(Ts||(Ts={}));(function(e){function t(n,r,...i){let o={label:n};return f.defined(r)&&(o.documentation=r),f.defined(i)?o.parameters=i:o.parameters=[],o}e.create=t})(_s||(_s={}));(function(e){e.Text=1,e.Read=2,e.Write=3})(vs||(vs={}));(function(e){function t(n,r){let i={range:n};return f.number(r)&&(i.kind=r),i}e.create=t})(bs||(bs={}));(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(Cs||(Cs={}));(function(e){e.Deprecated=1})(Is||(Is={}));(function(e){function t(n,r,i,o,s){let c={name:n,kind:r,location:{uri:o,range:i}};return s&&(c.containerName=s),c}e.create=t})(Ss||(Ss={}));(function(e){function t(n,r,i,o){return o!==void 0?{name:n,kind:r,location:{uri:i,range:o}}:{name:n,kind:r,location:{uri:i}}}e.create=t})(Ds||(Ds={}));(function(e){function t(r,i,o,s,c,g){let d={name:r,detail:i,kind:o,range:s,selectionRange:c};return g!==void 0&&(d.children=g),d}e.create=t;function n(r){let i=r;return i&&f.string(i.name)&&f.number(i.kind)&&J.is(i.range)&&J.is(i.selectionRange)&&(i.detail===void 0||f.string(i.detail))&&(i.deprecated===void 0||f.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}e.is=n})(ws||(ws={}));(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(Ps||(Ps={}));(function(e){e.Invoked=1,e.Automatic=2})(Wn||(Wn={}));(function(e){function t(r,i,o){let s={diagnostics:r};return i!=null&&(s.only=i),o!=null&&(s.triggerKind=o),s}e.create=t;function n(r){let i=r;return f.defined(i)&&f.typedArray(i.diagnostics,Gn.is)&&(i.only===void 0||f.typedArray(i.only,f.string))&&(i.triggerKind===void 0||i.triggerKind===Wn.Invoked||i.triggerKind===Wn.Automatic)}e.is=n})(ks||(ks={}));(function(e){e.LLMGenerated=1;function t(n){return f.defined(n)&&n===e.LLMGenerated}e.is=t})(Or||(Or={}));(function(e){function t(r,i,o){let s={title:r},c=!0;return typeof i=="string"?(c=!1,s.kind=i):qt.is(i)?s.command=i:s.edit=i,c&&o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return i&&f.string(i.title)&&(i.diagnostics===void 0||f.typedArray(i.diagnostics,Gn.is))&&(i.kind===void 0||f.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||qt.is(i.command))&&(i.isPreferred===void 0||f.boolean(i.isPreferred))&&(i.edit===void 0||Pr.is(i.edit))&&(i.tags===void 0||f.typedArray(i.tags,Or.is))}e.is=n})(Rs||(Rs={}));(function(e){function t(r,i){let o={range:r};return f.defined(i)&&(o.data=i),o}e.create=t;function n(r){let i=r;return f.defined(i)&&J.is(i.range)&&(f.undefined(i.command)||qt.is(i.command))}e.is=n})(Os||(Os={}));(function(e){function t(r,i){return{tabSize:r,insertSpaces:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&f.uinteger(i.tabSize)&&f.boolean(i.insertSpaces)}e.is=n})(xs||(xs={}));(function(e){function t(r,i,o){return{range:r,target:i,data:o}}e.create=t;function n(r){let i=r;return f.defined(i)&&J.is(i.range)&&(f.undefined(i.target)||f.string(i.target))}e.is=n})(Ms||(Ms={}));(function(e){function t(r,i){return{range:r,parent:i}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&J.is(i.range)&&(i.parent===void 0||e.is(i.parent))}e.is=n})(Es||(Es={}));(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(qs||(qs={}));(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(Ns||(Ns={}));(function(e){function t(n){let r=n;return f.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}e.is=t})(As||(As={}));(function(e){function t(r,i){return{range:r,text:i}}e.create=t;function n(r){let i=r;return i!=null&&J.is(i.range)&&f.string(i.text)}e.is=n})(Gs||(Gs={}));(function(e){function t(r,i,o){return{range:r,variableName:i,caseSensitiveLookup:o}}e.create=t;function n(r){let i=r;return i!=null&&J.is(i.range)&&f.boolean(i.caseSensitiveLookup)&&(f.string(i.variableName)||i.variableName===void 0)}e.is=n})(js||(js={}));(function(e){function t(r,i){return{range:r,expression:i}}e.create=t;function n(r){let i=r;return i!=null&&J.is(i.range)&&(f.string(i.expression)||i.expression===void 0)}e.is=n})(Fs||(Fs={}));(function(e){function t(r,i){return{frameId:r,stoppedLocation:i}}e.create=t;function n(r){let i=r;return f.defined(i)&&J.is(r.stoppedLocation)}e.is=n})(Ls||(Ls={}));(function(e){e.Type=1,e.Parameter=2;function t(n){return n===1||n===2}e.is=t})(xr||(xr={}));(function(e){function t(r){return{value:r}}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&(i.tooltip===void 0||f.string(i.tooltip)||Tt.is(i.tooltip))&&(i.location===void 0||An.is(i.location))&&(i.command===void 0||qt.is(i.command))}e.is=n})(Mr||(Mr={}));(function(e){function t(r,i,o){let s={position:r,label:i};return o!==void 0&&(s.kind=o),s}e.create=t;function n(r){let i=r;return f.objectLiteral(i)&&Me.is(i.position)&&(f.string(i.label)||f.typedArray(i.label,Mr.is))&&(i.kind===void 0||xr.is(i.kind))&&i.textEdits===void 0||f.typedArray(i.textEdits,Qe.is)&&(i.tooltip===void 0||f.string(i.tooltip)||Tt.is(i.tooltip))&&(i.paddingLeft===void 0||f.boolean(i.paddingLeft))&&(i.paddingRight===void 0||f.boolean(i.paddingRight))}e.is=n})(Ws||(Ws={}));(function(e){function t(r){return{kind:"snippet",value:r}}e.createSnippet=t;function n(r){let i=r;return f.objectLiteral(i)&&i.kind==="snippet"&&f.string(i.value)}e.isSnippet=n})(Er||(Er={}));(function(e){function t(n,r,i,o){return{insertText:n,filterText:r,range:i,command:o}}e.create=t})(Us||(Us={}));(function(e){function t(n){return{items:n}}e.create=t})(Hs||(Hs={}));(function(e){e.Invoked=1,e.Automatic=2})($s||($s={}));(function(e){function t(n,r){return{range:n,text:r}}e.create=t})(zs||(zs={}));(function(e){function t(n,r){return{triggerKind:n,selectedCompletionInfo:r}}e.create=t})(Bs||(Bs={}));(function(e){function t(n){let r=n;return f.objectLiteral(r)&&Sr.is(r.uri)&&f.string(r.name)}e.is=t})(Qs||(Qs={}));pg=[` +`,`\r +`,"\r"];(function(e){function t(o,s,c,g){return new Ks(o,s,c,g)}e.create=t;function n(o){let s=o;return!!(f.defined(s)&&f.string(s.uri)&&(f.undefined(s.languageId)||f.string(s.languageId))&&f.uinteger(s.lineCount)&&f.func(s.getText)&&f.func(s.positionAt)&&f.func(s.offsetAt))}e.is=n;function r(o,s){let c=o.getText(),g=i(s,(h,v)=>{let m=h.range.start.line-v.range.start.line;return m===0?h.range.start.character-v.range.start.character:m}),d=c.length;for(let h=g.length-1;h>=0;h--){let v=g[h],m=o.offsetAt(v.range.start),T=o.offsetAt(v.range.end);if(T<=d)c=c.substring(0,m)+v.newText+c.substring(T,c.length);else throw new Error("Overlapping edit");d=m}return c}e.applyEdits=r;function i(o,s){if(o.length<=1)return o;let c=o.length/2|0,g=o.slice(0,c),d=o.slice(c);i(g,s),i(d,s);let h=0,v=0,m=0;for(;h0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return Me.create(0,t);for(;rt?i=s:r=s+1}let o=r-1;return Me.create(o,t-n[o])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],i=t.line+1"u"}e.undefined=r;function i(T){return T===!0||T===!1}e.boolean=i;function o(T){return t.call(T)==="[object String]"}e.string=o;function s(T){return t.call(T)==="[object Number]"}e.number=s;function c(T,D,N){return t.call(T)==="[object Number]"&&D<=T&&T<=N}e.numberRange=c;function g(T){return t.call(T)==="[object Number]"&&-2147483648<=T&&T<=2147483647}e.integer=g;function d(T){return t.call(T)==="[object Number]"&&0<=T&&T<=2147483647}e.uinteger=d;function h(T){return t.call(T)==="[object Function]"}e.func=h;function v(T){return T!==null&&typeof T=="object"}e.objectLiteral=v;function m(T,D){return Array.isArray(T)&&T.every(D)}e.typedArray=m})(f||(f={}))});var V=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.CM=he.ProtocolNotificationType=he.ProtocolNotificationType0=he.ProtocolRequestType=he.ProtocolRequestType0=he.RegistrationType=he.MessageDirection=void 0;var cn=tt(),Cu;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(Cu||(he.MessageDirection=Cu={}));var Xs=class{____;method;constructor(t){this.method=t}};he.RegistrationType=Xs;var Ys=class extends cn.RequestType0{__;___;____;_pr;constructor(t){super(t)}};he.ProtocolRequestType0=Ys;var Js=class extends cn.RequestType{__;___;____;_pr;constructor(t){super(t,cn.ParameterStructures.byName)}};he.ProtocolRequestType=Js;var Zs=class extends cn.NotificationType0{___;____;constructor(t){super(t)}};he.ProtocolNotificationType0=Zs;var ec=class extends cn.NotificationType{___;____;constructor(t){super(t,cn.ParameterStructures.byName)}};he.ProtocolNotificationType=ec;var Iu;(function(e){function t(n,r){return{client:n,server:r}}e.create=t})(Iu||(he.CM=Iu={}))});var Ar=S(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.boolean=yg;Le.string=Su;Le.number=Tg;Le.error=_g;Le.func=vg;Le.array=Du;Le.stringArray=bg;Le.typedArray=Cg;Le.objectLiteral=Ig;function yg(e){return e===!0||e===!1}function Su(e){return typeof e=="string"||e instanceof String}function Tg(e){return typeof e=="number"||e instanceof Number}function _g(e){return e instanceof Error}function vg(e){return typeof e=="function"}function Du(e){return Array.isArray(e)}function bg(e){return Du(e)&&e.every(t=>Su(t))}function Cg(e,t){return Array.isArray(e)&&e.every(t)}function Ig(e){return e!==null&&typeof e=="object"}});var Pu=S(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ImplementationRequest=void 0;var tc=V(),wu;(function(e){e.method="textDocument/implementation",e.messageDirection=tc.MessageDirection.clientToServer,e.type=new tc.ProtocolRequestType(e.method),e.capabilities=tc.CM.create("textDocument.implementation","implementationProvider")})(wu||(Gr.ImplementationRequest=wu={}))});var Ru=S(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.TypeDefinitionRequest=void 0;var nc=V(),ku;(function(e){e.method="textDocument/typeDefinition",e.messageDirection=nc.MessageDirection.clientToServer,e.type=new nc.ProtocolRequestType(e.method),e.capabilities=nc.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(ku||(jr.TypeDefinitionRequest=ku={}))});var Mu=S(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.DidChangeWorkspaceFoldersNotification=un.WorkspaceFoldersRequest=void 0;var an=V(),Ou;(function(e){e.method="workspace/workspaceFolders",e.messageDirection=an.MessageDirection.serverToClient,e.type=new an.ProtocolRequestType0(e.method),e.capabilities=an.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(Ou||(un.WorkspaceFoldersRequest=Ou={}));var xu;(function(e){e.method="workspace/didChangeWorkspaceFolders",e.messageDirection=an.MessageDirection.clientToServer,e.type=new an.ProtocolNotificationType(e.method),e.capabilities=an.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(xu||(un.DidChangeWorkspaceFoldersNotification=xu={}))});var qu=S(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.ConfigurationRequest=void 0;var rc=V(),Eu;(function(e){e.method="workspace/configuration",e.messageDirection=rc.MessageDirection.serverToClient,e.type=new rc.ProtocolRequestType(e.method),e.capabilities=rc.CM.create("workspace.configuration",void 0)})(Eu||(Fr.ConfigurationRequest=Eu={}))});var Gu=S(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.ColorPresentationRequest=dn.DocumentColorRequest=void 0;var ln=V(),Nu;(function(e){e.method="textDocument/documentColor",e.messageDirection=ln.MessageDirection.clientToServer,e.type=new ln.ProtocolRequestType(e.method),e.capabilities=ln.CM.create("textDocument.colorProvider","colorProvider")})(Nu||(dn.DocumentColorRequest=Nu={}));var Au;(function(e){e.method="textDocument/colorPresentation",e.messageDirection=ln.MessageDirection.clientToServer,e.type=new ln.ProtocolRequestType(e.method),e.capabilities=ln.CM.create("textDocument.colorProvider","colorProvider")})(Au||(dn.ColorPresentationRequest=Au={}))});var Lu=S(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.FoldingRangeRefreshRequest=mn.FoldingRangeRequest=void 0;var fn=V(),ju;(function(e){e.method="textDocument/foldingRange",e.messageDirection=fn.MessageDirection.clientToServer,e.type=new fn.ProtocolRequestType(e.method),e.capabilities=fn.CM.create("textDocument.foldingRange","foldingRangeProvider")})(ju||(mn.FoldingRangeRequest=ju={}));var Fu;(function(e){e.method="workspace/foldingRange/refresh",e.messageDirection=fn.MessageDirection.serverToClient,e.type=new fn.ProtocolRequestType0(e.method),e.capabilities=fn.CM.create("workspace.foldingRange.refreshSupport",void 0)})(Fu||(mn.FoldingRangeRefreshRequest=Fu={}))});var Uu=S(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.DeclarationRequest=void 0;var ic=V(),Wu;(function(e){e.method="textDocument/declaration",e.messageDirection=ic.MessageDirection.clientToServer,e.type=new ic.ProtocolRequestType(e.method),e.capabilities=ic.CM.create("textDocument.declaration","declarationProvider")})(Wu||(Lr.DeclarationRequest=Wu={}))});var $u=S(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.SelectionRangeRequest=void 0;var oc=V(),Hu;(function(e){e.method="textDocument/selectionRange",e.messageDirection=oc.MessageDirection.clientToServer,e.type=new oc.ProtocolRequestType(e.method),e.capabilities=oc.CM.create("textDocument.selectionRange","selectionRangeProvider")})(Hu||(Wr.SelectionRangeRequest=Hu={}))});var Vu=S(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.WorkDoneProgressCancelNotification=_t.WorkDoneProgressCreateRequest=_t.WorkDoneProgress=void 0;var Sg=tt(),Un=V(),zu;(function(e){e.type=new Sg.ProgressType;function t(n){return n===e.type}e.is=t})(zu||(_t.WorkDoneProgress=zu={}));var Bu;(function(e){e.method="window/workDoneProgress/create",e.messageDirection=Un.MessageDirection.serverToClient,e.type=new Un.ProtocolRequestType(e.method),e.capabilities=Un.CM.create("window.workDoneProgress",void 0)})(Bu||(_t.WorkDoneProgressCreateRequest=Bu={}));var Qu;(function(e){e.method="window/workDoneProgress/cancel",e.messageDirection=Un.MessageDirection.clientToServer,e.type=new Un.ProtocolNotificationType(e.method)})(Qu||(_t.WorkDoneProgressCancelNotification=Qu={}))});var Ju=S(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.CallHierarchyOutgoingCallsRequest=vt.CallHierarchyIncomingCallsRequest=vt.CallHierarchyPrepareRequest=void 0;var rt=V(),Ku;(function(e){e.method="textDocument/prepareCallHierarchy",e.messageDirection=rt.MessageDirection.clientToServer,e.type=new rt.ProtocolRequestType(e.method),e.capabilities=rt.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Ku||(vt.CallHierarchyPrepareRequest=Ku={}));var Xu;(function(e){e.method="callHierarchy/incomingCalls",e.messageDirection=rt.MessageDirection.clientToServer,e.type=new rt.ProtocolRequestType(e.method),e.capabilities=rt.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Xu||(vt.CallHierarchyIncomingCallsRequest=Xu={}));var Yu;(function(e){e.method="callHierarchy/outgoingCalls",e.messageDirection=rt.MessageDirection.clientToServer,e.type=new rt.ProtocolRequestType(e.method),e.capabilities=rt.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(Yu||(vt.CallHierarchyOutgoingCallsRequest=Yu={}))});var il=S(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.SemanticTokensRefreshRequest=De.SemanticTokensRangeRequest=De.SemanticTokensDeltaRequest=De.SemanticTokensRequest=De.SemanticTokensRegistrationType=De.TokenFormat=void 0;var Oe=V(),Zu;(function(e){e.Relative="relative"})(Zu||(De.TokenFormat=Zu={}));var Hn;(function(e){e.method="textDocument/semanticTokens",e.type=new Oe.RegistrationType(e.method)})(Hn||(De.SemanticTokensRegistrationType=Hn={}));var el;(function(e){e.method="textDocument/semanticTokens/full",e.messageDirection=Oe.MessageDirection.clientToServer,e.type=new Oe.ProtocolRequestType(e.method),e.registrationMethod=Hn.method,e.capabilities=Oe.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(el||(De.SemanticTokensRequest=el={}));var tl;(function(e){e.method="textDocument/semanticTokens/full/delta",e.messageDirection=Oe.MessageDirection.clientToServer,e.type=new Oe.ProtocolRequestType(e.method),e.registrationMethod=Hn.method,e.capabilities=Oe.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(tl||(De.SemanticTokensDeltaRequest=tl={}));var nl;(function(e){e.method="textDocument/semanticTokens/range",e.messageDirection=Oe.MessageDirection.clientToServer,e.type=new Oe.ProtocolRequestType(e.method),e.registrationMethod=Hn.method,e.capabilities=Oe.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(nl||(De.SemanticTokensRangeRequest=nl={}));var rl;(function(e){e.method="workspace/semanticTokens/refresh",e.messageDirection=Oe.MessageDirection.serverToClient,e.type=new Oe.ProtocolRequestType0(e.method),e.capabilities=Oe.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(rl||(De.SemanticTokensRefreshRequest=rl={}))});var sl=S(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.ShowDocumentRequest=void 0;var sc=V(),ol;(function(e){e.method="window/showDocument",e.messageDirection=sc.MessageDirection.serverToClient,e.type=new sc.ProtocolRequestType(e.method),e.capabilities=sc.CM.create("window.showDocument.support",void 0)})(ol||(Ur.ShowDocumentRequest=ol={}))});var al=S(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LinkedEditingRangeRequest=void 0;var cc=V(),cl;(function(e){e.method="textDocument/linkedEditingRange",e.messageDirection=cc.MessageDirection.clientToServer,e.type=new cc.ProtocolRequestType(e.method),e.capabilities=cc.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(cl||(Hr.LinkedEditingRangeRequest=cl={}))});var pl=S(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.WillDeleteFilesRequest=ge.DidDeleteFilesNotification=ge.DidRenameFilesNotification=ge.WillRenameFilesRequest=ge.DidCreateFilesNotification=ge.WillCreateFilesRequest=ge.FileOperationPatternKind=void 0;var se=V(),ul;(function(e){e.file="file",e.folder="folder"})(ul||(ge.FileOperationPatternKind=ul={}));var ll;(function(e){e.method="workspace/willCreateFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolRequestType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(ll||(ge.WillCreateFilesRequest=ll={}));var dl;(function(e){e.method="workspace/didCreateFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolNotificationType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(dl||(ge.DidCreateFilesNotification=dl={}));var fl;(function(e){e.method="workspace/willRenameFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolRequestType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(fl||(ge.WillRenameFilesRequest=fl={}));var ml;(function(e){e.method="workspace/didRenameFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolNotificationType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(ml||(ge.DidRenameFilesNotification=ml={}));var hl;(function(e){e.method="workspace/didDeleteFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolNotificationType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(hl||(ge.DidDeleteFilesNotification=hl={}));var gl;(function(e){e.method="workspace/willDeleteFiles",e.messageDirection=se.MessageDirection.clientToServer,e.type=new se.ProtocolRequestType(e.method),e.capabilities=se.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(gl||(ge.WillDeleteFilesRequest=gl={}))});var vl=S(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.MonikerRequest=bt.MonikerKind=bt.UniquenessLevel=void 0;var ac=V(),yl;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(yl||(bt.UniquenessLevel=yl={}));var Tl;(function(e){e.$import="import",e.$export="export",e.local="local"})(Tl||(bt.MonikerKind=Tl={}));var _l;(function(e){e.method="textDocument/moniker",e.messageDirection=ac.MessageDirection.clientToServer,e.type=new ac.ProtocolRequestType(e.method),e.capabilities=ac.CM.create("textDocument.moniker","monikerProvider")})(_l||(bt.MonikerRequest=_l={}))});var Sl=S(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.TypeHierarchySubtypesRequest=Ct.TypeHierarchySupertypesRequest=Ct.TypeHierarchyPrepareRequest=void 0;var Nt=V(),bl;(function(e){e.method="textDocument/prepareTypeHierarchy",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.capabilities=Nt.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(bl||(Ct.TypeHierarchyPrepareRequest=bl={}));var Cl;(function(e){e.method="typeHierarchy/supertypes",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method)})(Cl||(Ct.TypeHierarchySupertypesRequest=Cl={}));var Il;(function(e){e.method="typeHierarchy/subtypes",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method)})(Il||(Ct.TypeHierarchySubtypesRequest=Il={}))});var Pl=S(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.InlineValueRefreshRequest=gn.InlineValueRequest=void 0;var hn=V(),Dl;(function(e){e.method="textDocument/inlineValue",e.messageDirection=hn.MessageDirection.clientToServer,e.type=new hn.ProtocolRequestType(e.method),e.capabilities=hn.CM.create("textDocument.inlineValue","inlineValueProvider")})(Dl||(gn.InlineValueRequest=Dl={}));var wl;(function(e){e.method="workspace/inlineValue/refresh",e.messageDirection=hn.MessageDirection.serverToClient,e.type=new hn.ProtocolRequestType0(e.method),e.capabilities=hn.CM.create("workspace.inlineValue.refreshSupport",void 0)})(wl||(gn.InlineValueRefreshRequest=wl={}))});var xl=S(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.InlayHintRefreshRequest=It.InlayHintResolveRequest=It.InlayHintRequest=void 0;var it=V(),kl;(function(e){e.method="textDocument/inlayHint",e.messageDirection=it.MessageDirection.clientToServer,e.type=new it.ProtocolRequestType(e.method),e.capabilities=it.CM.create("textDocument.inlayHint","inlayHintProvider")})(kl||(It.InlayHintRequest=kl={}));var Rl;(function(e){e.method="inlayHint/resolve",e.messageDirection=it.MessageDirection.clientToServer,e.type=new it.ProtocolRequestType(e.method),e.capabilities=it.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(Rl||(It.InlayHintResolveRequest=Rl={}));var Ol;(function(e){e.method="workspace/inlayHint/refresh",e.messageDirection=it.MessageDirection.serverToClient,e.type=new it.ProtocolRequestType0(e.method),e.capabilities=it.CM.create("workspace.inlayHint.refreshSupport",void 0)})(Ol||(It.InlayHintRefreshRequest=Ol={}))});var jl=S(ce=>{"use strict";var Dg=ce&&ce.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),wg=ce&&ce.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Pg=ce&&ce.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{"use strict";var Rg=H&&H.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Og=H&&H.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),xg=H&&H.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.InlineCompletionRequest=void 0;var dc=V(),Bl;(function(e){e.method="textDocument/inlineCompletion",e.messageDirection=dc.MessageDirection.clientToServer,e.type=new dc.ProtocolRequestType(e.method),e.capabilities=dc.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(Bl||(zr.InlineCompletionRequest=Bl={}))});var Xl=S(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.TextDocumentContentRefreshRequest=yn.TextDocumentContentRequest=void 0;var zn=V(),Vl;(function(e){e.method="workspace/textDocumentContent",e.messageDirection=zn.MessageDirection.clientToServer,e.type=new zn.ProtocolRequestType(e.method),e.capabilities=zn.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(Vl||(yn.TextDocumentContentRequest=Vl={}));var Kl;(function(e){e.method="workspace/textDocumentContent/refresh",e.messageDirection=zn.MessageDirection.serverToClient,e.type=new zn.ProtocolRequestType(e.method)})(Kl||(yn.TextDocumentContentRefreshRequest=Kl={}))});var df=S(a=>{"use strict";var Mg=a&&a.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Eg=a&&a.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),qg=a&&a.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i0}e.hasId=t})(id||(a.StaticRegistrationOptions=id={}));var od;(function(e){function t(n){let r=n;return r&&(r.documentSelector===null||gc.is(r.documentSelector))}e.is=t})(od||(a.TextDocumentRegistrationOptions=od={}));var sd;(function(e){function t(r){let i=r;return ae.objectLiteral(i)&&(i.workDoneProgress===void 0||ae.boolean(i.workDoneProgress))}e.is=t;function n(r){let i=r;return i&&ae.boolean(i.workDoneProgress)}e.hasWorkDoneProgress=n})(sd||(a.WorkDoneProgressOptions=sd={}));var cd;(function(e){e.method="initialize",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method)})(cd||(a.InitializeRequest=cd={}));var ad;(function(e){e.unknownProtocolVersion=1})(ad||(a.InitializeErrorCodes=ad={}));var ud;(function(e){e.method="initialized",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method)})(ud||(a.InitializedNotification=ud={}));var ld;(function(e){e.method="shutdown",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType0(e.method)})(ld||(a.ShutdownRequest=ld={}));var dd;(function(e){e.method="exit",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType0(e.method)})(dd||(a.ExitNotification=dd={}));var fd;(function(e){e.method="workspace/didChangeConfiguration",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("workspace.didChangeConfiguration",void 0)})(fd||(a.DidChangeConfigurationNotification=fd={}));var md;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(md||(a.MessageType=md={}));var hd;(function(e){e.method="window/showMessage",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("window.showMessage",void 0)})(hd||(a.ShowMessageNotification=hd={}));var gd;(function(e){e.method="window/showMessageRequest",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("window.showMessage",void 0)})(gd||(a.ShowMessageRequest=gd={}));var pd;(function(e){e.method="window/logMessage",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolNotificationType(e.method)})(pd||(a.LogMessageNotification=pd={}));var yd;(function(e){e.method="telemetry/event",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolNotificationType(e.method)})(yd||(a.TelemetryEventNotification=yd={}));var Td;(function(e){e.None=0,e.Full=1,e.Incremental=2})(Td||(a.TextDocumentSyncKind=Td={}));var _d;(function(e){e.method="textDocument/didOpen",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(_d||(a.DidOpenTextDocumentNotification=_d={}));var vd;(function(e){function t(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}e.isIncremental=t;function n(r){let i=r;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}e.isFull=n})(vd||(a.TextDocumentContentChangeEvent=vd={}));var bd;(function(e){e.method="textDocument/didChange",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.synchronization","textDocumentSync")})(bd||(a.DidChangeTextDocumentNotification=bd={}));var Cd;(function(e){e.method="textDocument/didClose",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(Cd||(a.DidCloseTextDocumentNotification=Cd={}));var Id;(function(e){e.method="textDocument/didSave",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(Id||(a.DidSaveTextDocumentNotification=Id={}));var Sd;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(Sd||(a.TextDocumentSaveReason=Sd={}));var Dd;(function(e){e.method="textDocument/willSave",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(Dd||(a.WillSaveTextDocumentNotification=Dd={}));var wd;(function(e){e.method="textDocument/willSaveWaitUntil",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(wd||(a.WillSaveTextDocumentWaitUntilRequest=wd={}));var Pd;(function(e){e.method="workspace/didChangeWatchedFiles",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("workspace.didChangeWatchedFiles",void 0)})(Pd||(a.DidChangeWatchedFilesNotification=Pd={}));var kd;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(kd||(a.FileChangeType=kd={}));var pc;(function(e){function t(n){let r=n;return ae.objectLiteral(r)&&(Yl.URI.is(r.baseUri)||Yl.WorkspaceFolder.is(r.baseUri))&&ae.string(r.pattern)}e.is=t})(pc||(a.RelativePattern=pc={}));var yc;(function(e){function t(n){let r=n;return ae.string(r)||pc.is(r)}e.is=t})(yc||(a.GlobPattern=yc={}));var Rd;(function(e){e.Create=1,e.Change=2,e.Delete=4})(Rd||(a.WatchKind=Rd={}));var Od;(function(e){e.method="textDocument/publishDiagnostics",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolNotificationType(e.method),e.capabilities=_.CM.create("textDocument.publishDiagnostics",void 0)})(Od||(a.PublishDiagnosticsNotification=Od={}));var xd;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(xd||(a.CompletionTriggerKind=xd={}));var Md;(function(e){e.method="textDocument/completion",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.completion","completionProvider")})(Md||(a.CompletionRequest=Md={}));var Ed;(function(e){e.method="completionItem/resolve",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(Ed||(a.CompletionResolveRequest=Ed={}));var qd;(function(e){e.method="textDocument/hover",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.hover","hoverProvider")})(qd||(a.HoverRequest=qd={}));var Nd;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(Nd||(a.SignatureHelpTriggerKind=Nd={}));var Ad;(function(e){e.method="textDocument/signatureHelp",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(Ad||(a.SignatureHelpRequest=Ad={}));var Gd;(function(e){e.method="textDocument/definition",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.definition","definitionProvider")})(Gd||(a.DefinitionRequest=Gd={}));var jd;(function(e){e.method="textDocument/references",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.references","referencesProvider")})(jd||(a.ReferencesRequest=jd={}));var Fd;(function(e){e.method="textDocument/documentHighlight",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(Fd||(a.DocumentHighlightRequest=Fd={}));var Ld;(function(e){e.method="textDocument/documentSymbol",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(Ld||(a.DocumentSymbolRequest=Ld={}));var Wd;(function(e){e.method="textDocument/codeAction",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.codeAction","codeActionProvider")})(Wd||(a.CodeActionRequest=Wd={}));var Ud;(function(e){e.method="codeAction/resolve",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})(Ud||(a.CodeActionResolveRequest=Ud={}));var Hd;(function(e){e.method="workspace/symbol",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("workspace.symbol","workspaceSymbolProvider")})(Hd||(a.WorkspaceSymbolRequest=Hd={}));var $d;(function(e){e.method="workspaceSymbol/resolve",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})($d||(a.WorkspaceSymbolResolveRequest=$d={}));var zd;(function(e){e.method="textDocument/codeLens",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.codeLens","codeLensProvider")})(zd||(a.CodeLensRequest=zd={}));var Bd;(function(e){e.method="codeLens/resolve",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(Bd||(a.CodeLensResolveRequest=Bd={}));var Qd;(function(e){e.method="workspace/codeLens/refresh",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolRequestType0(e.method),e.capabilities=_.CM.create("workspace.codeLens",void 0)})(Qd||(a.CodeLensRefreshRequest=Qd={}));var Vd;(function(e){e.method="textDocument/documentLink",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.documentLink","documentLinkProvider")})(Vd||(a.DocumentLinkRequest=Vd={}));var Kd;(function(e){e.method="documentLink/resolve",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})(Kd||(a.DocumentLinkResolveRequest=Kd={}));var Xd;(function(e){e.method="textDocument/formatting",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.formatting","documentFormattingProvider")})(Xd||(a.DocumentFormattingRequest=Xd={}));var Yd;(function(e){e.method="textDocument/rangeFormatting",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(Yd||(a.DocumentRangeFormattingRequest=Yd={}));var Jd;(function(e){e.method="textDocument/rangesFormatting",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(Jd||(a.DocumentRangesFormattingRequest=Jd={}));var Zd;(function(e){e.method="textDocument/onTypeFormatting",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})(Zd||(a.DocumentOnTypeFormattingRequest=Zd={}));var ef;(function(e){e.Identifier=1})(ef||(a.PrepareSupportDefaultBehavior=ef={}));var tf;(function(e){e.method="textDocument/rename",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.rename","renameProvider")})(tf||(a.RenameRequest=tf={}));var nf;(function(e){e.method="textDocument/prepareRename",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(nf||(a.PrepareRenameRequest=nf={}));var rf;(function(e){e.method="workspace/executeCommand",e.messageDirection=_.MessageDirection.clientToServer,e.type=new _.ProtocolRequestType(e.method),e.capabilities=_.CM.create("workspace.executeCommand","executeCommandProvider")})(rf||(a.ExecuteCommandRequest=rf={}));var of;(function(e){e.method="workspace/applyEdit",e.messageDirection=_.MessageDirection.serverToClient,e.type=new _.ProtocolRequestType("workspace/applyEdit"),e.capabilities=_.CM.create("workspace.applyEdit",void 0)})(of||(a.ApplyWorkspaceEditRequest=of={}))});var mf=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.createProtocolConnection=Hg;var ff=tt();function Hg(e,t,n,r){return ff.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,ff.createMessageConnection)(e,t,n,r)}});var te=S(we=>{"use strict";var $g=we&&we.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Br=we&&we.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&$g(t,e,n)};Object.defineProperty(we,"__esModule",{value:!0});we.LSPErrorCodes=we.createProtocolConnection=void 0;Br(tt(),we);Br((Nr(),ar(qr)),we);Br(V(),we);Br(df(),we);var zg=mf();Object.defineProperty(we,"createProtocolConnection",{enumerable:!0,get:function(){return zg.createProtocolConnection}});var hf;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(hf||(we.LSPErrorCodes=hf={}))});var Dc=S(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.empty=void 0;St.v4=gf;St.isUUID=pf;St.parse=Qg;St.generateUuid=Vg;var Qn=class{_value;constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}},Sc=class e extends Qn{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),"-","4",e._randomHex(),e._randomHex(),e._randomHex(),"-",e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),"-",e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(""))}};St.empty=new Qn("00000000-0000-0000-0000-000000000000");function gf(){return new Sc}var Bg=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pf(e){return Bg.test(e)}function Qg(e){if(!pf(e))throw new Error("invalid uuid");return new Qn(e)}function Vg(){return gf().asHex()}});var yf=S(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.ProgressFeature=void 0;vn.attachWorkDone=Xg;vn.attachPartialResult=Jg;var Dt=te(),Kg=Dc(),_n=class e{_connection;_token;static Instances=new Map;constructor(t,n){this._connection=t,this._token=n,e.Instances.set(this._token,this)}begin(t,n,r,i){let o={kind:"begin",title:t,message:r,cancellable:i};typeof n=="number"&&(o.percentage=Math.round(n)),this._connection.sendProgress(Dt.WorkDoneProgress.type,this._token,o)}report(t,n){let r={kind:"report"};typeof t=="number"?(r.percentage=Math.round(t),n!==void 0&&(r.message=n)):r.message=t,this._connection.sendProgress(Dt.WorkDoneProgress.type,this._token,r)}done(){e.Instances.delete(this._token),this._connection.sendProgress(Dt.WorkDoneProgress.type,this._token,{kind:"end"})}},Qr=class extends _n{_source;constructor(t,n){super(t,n),this._source=new Dt.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Vn=class{constructor(){}begin(){}report(){}done(){}},Vr=class extends Vn{_source;constructor(){super(),this._source=new Dt.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function Xg(e,t){if(t===void 0||t.workDoneToken===void 0)return new Vn;let n=t.workDoneToken;return delete t.workDoneToken,new _n(e,n)}var Yg=e=>class extends e{_progressSupported;constructor(){super(),this._progressSupported=!1}initialize(t){super.initialize(t),t?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(Dt.WorkDoneProgressCancelNotification.type,n=>{let r=_n.Instances.get(n.token);(r instanceof Qr||r instanceof Vr)&&r.cancel()}))}attachWorkDoneProgress(t){return t===void 0?new Vn:new _n(this.connection,t)}createWorkDoneProgress(){if(this._progressSupported){let t=(0,Kg.generateUuid)();return this.connection.sendRequest(Dt.WorkDoneProgressCreateRequest.type,{token:t}).then(()=>new Qr(this.connection,t))}else return Promise.resolve(new Vr)}};vn.ProgressFeature=Yg;var wc;(function(e){e.type=new Dt.ProgressType})(wc||(wc={}));var Pc=class{_connection;_token;constructor(t,n){this._connection=t,this._token=n}report(t){this._connection.sendProgress(wc.type,this._token,t)}};function Jg(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new Pc(e,n)}});var Tf=S(Xe=>{"use strict";var Zg=Xe&&Xe.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),ep=Xe&&Xe.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),tp=Xe&&Xe.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;iclass extends e{getConfiguration(t){return t?rp.string(t)?this._getConfiguration({section:t}):this._getConfiguration(t):this._getConfiguration({})}_getConfiguration(t){let n={items:Array.isArray(t)?t:[t]};return this.connection.sendRequest(np.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(t)?r:r[0]:Array.isArray(t)?[]:null)}};Xe.ConfigurationFeature=ip});var _f=S(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.WorkspaceFoldersFeature=void 0;var Kr=te(),op=e=>class extends e{_onDidChangeWorkspaceFolders;_unregistration;_notificationIsAutoRegistered;constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(t){super.initialize(t);let n=t.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Kr.Emitter,this.connection.onNotification(Kr.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(t){super.fillServerCapabilities(t);let n=t.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Kr.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Kr.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Xr.WorkspaceFoldersFeature=op});var vf=S(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.CallHierarchyFeature=void 0;var kc=te(),sp=e=>class extends e{get callHierarchy(){return{onPrepare:t=>this.connection.onRequest(kc.CallHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:t=>{let n=kc.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:t=>{let n=kc.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};Yr.CallHierarchyFeature=sp});var Oc=S(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.SemanticTokensBuilder=wt.SemanticTokensDiff=wt.SemanticTokensFeature=void 0;var Jr=te(),cp=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Jr.SemanticTokensRefreshRequest.type),on:t=>{let n=Jr.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:t=>{let n=Jr.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:t=>{let n=Jr.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};wt.SemanticTokensFeature=cp;var Zr=class{originalSequence;modifiedSequence;constructor(t,n){this.originalSequence=t,this.modifiedSequence=n}computeDiff(){let t=this.originalSequence.length,n=this.modifiedSequence.length,r=0;for(;r=r&&o>=r&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i0&&(s-=this._prevLine,s===0&&(c-=this._prevChar));let g=this._dataIsSortedAndDeltaEncoded?this._data:this._dataNonDelta;g[this._dataLen++]=s,g[this._dataLen++]=c,g[this._dataLen++]=r,g[this._dataLen++]=i,g[this._dataLen++]=o,this._prevLine=t,this._prevChar=n}get id(){return this._id.toString()}static _deltaDecode(t){let n=t.length/5|0,r=0,i=0,o=[];for(let s=0;s{let d=t[5*c],h=t[5*g];if(d===h){let v=t[5*c+1],m=t[5*g+1];return v-m}return d-h});let i=[],o=0,s=0;for(let c=0;c{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.ShowDocumentFeature=void 0;var ap=te(),up=e=>class extends e{showDocument(t){return this.connection.sendRequest(ap.ShowDocumentRequest.type,t)}};ei.ShowDocumentFeature=up});var Cf=S(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.FileOperationsFeature=void 0;var bn=te(),lp=e=>class extends e{onDidCreateFiles(t){return this.connection.onNotification(bn.DidCreateFilesNotification.type,n=>t(n))}onDidRenameFiles(t){return this.connection.onNotification(bn.DidRenameFilesNotification.type,n=>t(n))}onDidDeleteFiles(t){return this.connection.onNotification(bn.DidDeleteFilesNotification.type,n=>t(n))}onWillCreateFiles(t){return this.connection.onRequest(bn.WillCreateFilesRequest.type,(n,r)=>t(n,r))}onWillRenameFiles(t){return this.connection.onRequest(bn.WillRenameFilesRequest.type,(n,r)=>t(n,r))}onWillDeleteFiles(t){return this.connection.onRequest(bn.WillDeleteFilesRequest.type,(n,r)=>t(n,r))}};ti.FileOperationsFeature=lp});var If=S(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.LinkedEditingRangeFeature=void 0;var dp=te(),fp=e=>class extends e{onLinkedEditingRange(t){return this.connection.onRequest(dp.LinkedEditingRangeRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0))}};ni.LinkedEditingRangeFeature=fp});var Sf=S(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.TypeHierarchyFeature=void 0;var xc=te(),mp=e=>class extends e{get typeHierarchy(){return{onPrepare:t=>this.connection.onRequest(xc.TypeHierarchyPrepareRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:t=>{let n=xc.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:t=>{let n=xc.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ri.TypeHierarchyFeature=mp});var wf=S(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.InlineValueFeature=void 0;var Df=te(),hp=e=>class extends e{get inlineValue(){return{refresh:()=>this.connection.sendRequest(Df.InlineValueRefreshRequest.type),on:t=>this.connection.onRequest(Df.InlineValueRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};ii.InlineValueFeature=hp});var kf=S(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.FoldingRangeFeature=void 0;var Pf=te(),gp=e=>class extends e{get foldingRange(){return{refresh:()=>this.connection.sendRequest(Pf.FoldingRangeRefreshRequest.type),on:t=>{let n=Pf.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};oi.FoldingRangeFeature=gp});var Rf=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.InlayHintFeature=void 0;var Mc=te(),pp=e=>class extends e{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Mc.InlayHintRefreshRequest.type),on:t=>this.connection.onRequest(Mc.InlayHintRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n))),resolve:t=>this.connection.onRequest(Mc.InlayHintResolveRequest.type,(n,r)=>t(n,r))}}};si.InlayHintFeature=pp});var Of=S(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.DiagnosticFeature=void 0;var Kn=te(),yp=e=>class extends e{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Kn.DiagnosticRefreshRequest.type),on:t=>this.connection.onRequest(Kn.DocumentDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Kn.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:t=>this.connection.onRequest(Kn.WorkspaceDiagnosticRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(Kn.WorkspaceDiagnosticRequest.partialResult,n)))}}};ci.DiagnosticFeature=yp});var qc=S(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.TextDocuments=void 0;var Gt=te(),Ec=class{_configuration;_syncedDocuments;_onDidChangeContent;_onDidOpen;_onDidClose;_onDidSave;_onWillSave;_willSaveWaitUntil;constructor(t){this._configuration=t,this._syncedDocuments=new Map,this._onDidChangeContent=new Gt.Emitter,this._onDidOpen=new Gt.Emitter,this._onDidClose=new Gt.Emitter,this._onDidSave=new Gt.Emitter,this._onWillSave=new Gt.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._syncedDocuments.get(t)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(t){t.__textDocumentSync=Gt.TextDocumentSyncKind.Incremental;let n=[];return n.push(t.onDidOpenTextDocument(r=>{let i=r.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),n.push(t.onDidChangeTextDocument(r=>{let i=r.textDocument,o=r.contentChanges;if(o.length===0)return;let{version:s}=i;if(s==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let c=this._syncedDocuments.get(i.uri);c!==void 0&&(c=this._configuration.update(c,o,s),this._syncedDocuments.set(i.uri,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(t.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(t.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(t.onWillSaveTextDocumentWaitUntil((r,i)=>{let o=this._syncedDocuments.get(r.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:r.reason}),i):[]})),n.push(t.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Gt.Disposable.create(()=>{n.forEach(r=>r.dispose())})}};ai.TextDocuments=Ec});var Gc=S(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.NotebookDocuments=Cn.NotebookSyncFeature=void 0;var Ee=te(),xf=qc(),Tp=e=>class extends e{get synchronization(){return{onDidOpenNotebookDocument:t=>this.connection.onNotification(Ee.DidOpenNotebookDocumentNotification.type,n=>t(n)),onDidChangeNotebookDocument:t=>this.connection.onNotification(Ee.DidChangeNotebookDocumentNotification.type,n=>t(n)),onDidSaveNotebookDocument:t=>this.connection.onNotification(Ee.DidSaveNotebookDocumentNotification.type,n=>t(n)),onDidCloseNotebookDocument:t=>this.connection.onNotification(Ee.DidCloseNotebookDocumentNotification.type,n=>t(n))}}};Cn.NotebookSyncFeature=Tp;var Nc=class e{static NULL_DISPOSE=Object.freeze({dispose:()=>{}});openHandler;changeHandler;closeHandler;onDidOpenTextDocument(t){return this.openHandler=t,Ee.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(t){return this.openHandler&&this.openHandler(t)}onDidChangeTextDocument(t){return this.changeHandler=t,Ee.Disposable.create(()=>{this.changeHandler=t})}changeTextDocument(t){return this.changeHandler&&this.changeHandler(t)}onDidCloseTextDocument(t){return this.closeHandler=t,Ee.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(t){return this.closeHandler&&this.closeHandler(t)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}},Ac=class{notebookDocuments;notebookCellMap;_onDidOpen;_onDidSave;_onDidChange;_onDidClose;_cellTextDocuments;constructor(t){t instanceof xf.TextDocuments?this._cellTextDocuments=t:this._cellTextDocuments=new xf.TextDocuments(t),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Ee.Emitter,this._onDidChange=new Ee.Emitter,this._onDidSave=new Ee.Emitter,this._onDidClose=new Ee.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(t){return this._cellTextDocuments.get(t.document)}getNotebookDocument(t){return this.notebookDocuments.get(t)}getNotebookCell(t){let n=this.notebookCellMap.get(t);return n&&n[0]}findNotebookDocumentForCell(t){let n=typeof t=="string"?t:t.document,r=this.notebookCellMap.get(n);return r&&r[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(t){let n=new Nc,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(t.notebooks.synchronization.onDidOpenNotebookDocument(async i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)await n.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.push(t.notebooks.synchronization.onDidChangeNotebookDocument(async i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let s=o.metadata,c=!1,g=i.change;g.metadata!==void 0&&(c=!0,o.metadata=g.metadata);let d=[],h=[],v=[],m=[];if(g.cells!==void 0){let x=g.cells;if(x.structure!==void 0){let p=x.structure.array;if(o.cells.splice(p.start,p.deleteCount,...p.cells!==void 0?p.cells:[]),x.structure.didOpen!==void 0)for(let l of x.structure.didOpen)await n.openTextDocument({textDocument:l}),d.push(l.uri);if(x.structure.didClose)for(let l of x.structure.didClose)await n.closeTextDocument({textDocument:l}),h.push(l.uri)}if(x.data!==void 0){let p=new Map(x.data.map(l=>[l.document,l]));for(let l=0;l<=o.cells.length;l++){let C=p.get(o.cells[l].document);if(C!==void 0){let P=o.cells.splice(l,1,C);if(v.push({old:P[0],new:C}),p.delete(C.document),p.size===0)break}}}if(x.textContent!==void 0)for(let p of x.textContent)await n.changeTextDocument({textDocument:p.document,contentChanges:p.changes}),m.push(p.document.uri)}this.updateCellMap(o);let T={notebookDocument:o};c&&(T.metadata={old:s,new:o.metadata});let D=[];for(let x of d)D.push(this.getNotebookCell(x));let N=[];for(let x of h)N.push(this.getNotebookCell(x));let A=[];for(let x of m)A.push(this.getNotebookCell(x));(D.length>0||N.length>0||v.length>0||A.length>0)&&(T.cells={added:D,removed:N,changed:{data:v,textContent:A}}),(T.metadata!==void 0||T.cells!==void 0)&&this._onDidChange.fire(T)})),r.push(t.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),r.push(t.notebooks.synchronization.onDidCloseNotebookDocument(async i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let s of i.cellTextDocuments)await n.closeTextDocument({textDocument:s});this.notebookDocuments.delete(i.notebookDocument.uri);for(let s of o.cells)this.notebookCellMap.delete(s.document)}})),Ee.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(t){for(let n of t.cells)this.notebookCellMap.set(n.document,[n,t])}};Cn.NotebookDocuments=Ac});var Mf=S(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.MonikerFeature=void 0;var _p=te(),vp=e=>class extends e{get moniker(){return{on:t=>{let n=_p.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>t(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ui.MonikerFeature=vp});var Ef=S(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.InlineCompletionFeature=void 0;var bp=te(),Cp=e=>class extends e{get inlineCompletion(){return{on:t=>this.connection.onRequest(bp.InlineCompletionRequest.type,(n,r)=>t(n,r,this.attachWorkDoneProgress(n)))}}};li.InlineCompletionFeature=Cp});var Nf=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.TextDocumentContentFeature=void 0;var qf=te(),Ip=e=>class extends e{get textDocumentContent(){return{refresh:t=>this.connection.sendRequest(qf.TextDocumentContentRefreshRequest.type,{uri:t}),on:t=>this.connection.onRequest(qf.TextDocumentContentRequest.type,(n,r)=>t(n,r))}}};di.TextDocumentContentFeature=Ip});var Hc=S($=>{"use strict";var Sp=$&&$.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Dp=$&&$.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Uf=$&&$.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{t.window.showErrorMessage(n)})}};$.ErrorMessageTracker=Lc;var fi=class{_rawConnection;_connection;constructor(){}rawAttach(t){this._rawConnection=t}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(t){}initialize(t){}error(t){this.send(w.MessageType.Error,t)}warn(t){this.send(w.MessageType.Warning,t)}info(t){this.send(w.MessageType.Info,t)}log(t){this.send(w.MessageType.Log,t)}debug(t){this.send(w.MessageType.Debug,t)}send(t,n){this._rawConnection&&this._rawConnection.sendNotification(w.LogMessageNotification.type,{type:t,message:n}).catch(()=>{(0,w.RAL)().console.error("Sending log message failed")})}},Wc=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}showErrorMessage(t,...n){let r={type:w.MessageType.Error,message:t,actions:n};return this.connection.sendRequest(w.ShowMessageRequest.type,r).then(jc)}showWarningMessage(t,...n){let r={type:w.MessageType.Warning,message:t,actions:n};return this.connection.sendRequest(w.ShowMessageRequest.type,r).then(jc)}showInformationMessage(t,...n){let r={type:w.MessageType.Info,message:t,actions:n};return this.connection.sendRequest(w.ShowMessageRequest.type,r).then(jc)}},Af=(0,Op.ShowDocumentFeature)((0,q.ProgressFeature)(Wc)),Gf;(function(e){function t(){return new mi}e.create=t})(Gf||($.BulkRegistration=Gf={}));var mi=class{_registrations=[];_registered=new Set;add(t,n){let r=qe.string(t)?t:t.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);let i=Fc.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}},jf;(function(e){function t(){return new Xn(void 0,[])}e.create=t})(jf||($.BulkUnregistration=jf={}));var Xn=class{_connection;_unregistrations=new Map;constructor(t,n){this._connection=t,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(t){this._connection=t}add(t){this._unregistrations.set(t.method,t)}dispose(){let t=[];for(let r of this._unregistrations.values())t.push(r);let n={unregisterations:t};this._connection.sendRequest(w.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(t){let n=qe.string(t)?t:t.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(w.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},o=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}},hi=class{_connection;attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}register(t,n,r){return t instanceof mi?this.registerMany(t):t instanceof Xn?this.registerSingle1(t,n,r):this.registerSingle2(t,n)}registerSingle1(t,n,r){let i=qe.string(n)?n:n.method,o=Fc.generateUuid(),s={registrations:[{id:o,method:i,registerOptions:r||{}}]};return t.isAttached||t.attach(this.connection),this.connection.sendRequest(w.RegistrationRequest.type,s).then(c=>(t.add({id:o,method:i}),t),c=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(c)))}registerSingle2(t,n){let r=qe.string(t)?t:t.method,i=Fc.generateUuid(),o={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(w.RegistrationRequest.type,o).then(s=>w.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),s=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(s)))}unregisterSingle(t,n){let r={unregisterations:[{id:t,method:n}]};return this.connection.sendRequest(w.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${t} failed.`)})}registerMany(t){let n=t.asRegistrationParams();return this.connection.sendRequest(w.RegistrationRequest.type,n).then(()=>new Xn(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}},Uc=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}applyEdit(t){function n(i){return i&&!!i.edit}let r=n(t)?t:{edit:t};return this.connection.sendRequest(w.ApplyWorkspaceEditRequest.type,r)}},Ff=(0,Wp.TextDocumentContentFeature)((0,xp.FileOperationsFeature)((0,Pp.WorkspaceFoldersFeature)((0,wp.ConfigurationFeature)(Uc)))),gi=class{_trace;_connection;constructor(){this._trace=w.Trace.Off}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}set trace(t){this._trace=t}log(t,n){this._trace!==w.Trace.Off&&this.connection.sendNotification(w.LogTraceNotification.type,{message:t,verbose:this._trace===w.Trace.Verbose?n:void 0}).catch(()=>{})}},pi=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}logEvent(t){this.connection.sendNotification(w.TelemetryEventNotification.type,t).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},yi=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,q.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,q.attachPartialResult)(this.connection,n)}};$._LanguagesImpl=yi;var Lf=(0,Lp.InlineCompletionFeature)((0,Np.FoldingRangeFeature)((0,Fp.MonikerFeature)((0,Gp.DiagnosticFeature)((0,Ap.InlayHintFeature)((0,qp.InlineValueFeature)((0,Ep.TypeHierarchyFeature)((0,Mp.LinkedEditingRangeFeature)((0,Rp.SemanticTokensFeature)((0,kp.CallHierarchyFeature)(yi)))))))))),Ti=class{_connection;constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,q.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,q.attachPartialResult)(this.connection,n)}};$._NotebooksImpl=Ti;var Wf=(0,jp.NotebookSyncFeature)(Ti);function Hf(e,t){return function(n){return t(e(n))}}function $f(e,t){return function(n){return t(e(n))}}function zf(e,t){return function(n){return t(e(n))}}function Bf(e,t){return function(n){return t(e(n))}}function Qf(e,t){return function(n){return t(e(n))}}function Vf(e,t){return function(n){return t(e(n))}}function Kf(e,t){return function(n){return t(e(n))}}function Xf(e,t){return function(n){return t(e(n))}}function Up(e,t){function n(i,o,s){return i&&o?s(i,o):i||o}return{__brand:"features",console:n(e.console,t.console,Hf),tracer:n(e.tracer,t.tracer,zf),telemetry:n(e.telemetry,t.telemetry,$f),client:n(e.client,t.client,Bf),window:n(e.window,t.window,Qf),workspace:n(e.workspace,t.workspace,Vf),languages:n(e.languages,t.languages,Kf),notebooks:n(e.notebooks,t.notebooks,Xf)}}function Hp(e,t,n){let r=n&&n.console?new(n.console(fi)):new fi,i=e(r);r.rawAttach(i);let o=n&&n.tracer?new(n.tracer(gi)):new gi,s=n&&n.telemetry?new(n.telemetry(pi)):new pi,c=n&&n.client?new(n.client(hi)):new hi,g=n&&n.window?new(n.window(Af)):new Af,d=n&&n.workspace?new(n.workspace(Ff)):new Ff,h=n&&n.languages?new(n.languages(Lf)):new Lf,v=n&&n.notebooks?new(n.notebooks(Wf)):new Wf,m=[r,o,s,c,g,d,h,v];function T(p){return p instanceof Promise?p:qe.thenable(p)?new Promise((l,C)=>{p.then(P=>l(P),P=>C(P))}):Promise.resolve(p)}let D,N,A,x={listen:()=>i.listen(),sendRequest:(p,...l)=>i.sendRequest(qe.string(p)?p:p.method,...l),onRequest:(p,l)=>i.onRequest(p,l),sendNotification:(p,l)=>{let C=qe.string(p)?p:p.method;return i.sendNotification(C,l)},onNotification:(p,l)=>i.onNotification(p,l),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:p=>(N=p,{dispose:()=>{N=void 0}}),onInitialized:p=>i.onNotification(w.InitializedNotification.type,p),onShutdown:p=>(D=p,{dispose:()=>{D=void 0}}),onExit:p=>(A=p,{dispose:()=>{A=void 0}}),get console(){return r},get telemetry(){return s},get tracer(){return o},get client(){return c},get window(){return g},get workspace(){return d},get languages(){return h},get notebooks(){return v},onDidChangeConfiguration:p=>i.onNotification(w.DidChangeConfigurationNotification.type,p),onDidChangeWatchedFiles:p=>i.onNotification(w.DidChangeWatchedFilesNotification.type,p),__textDocumentSync:void 0,onDidOpenTextDocument:p=>i.onNotification(w.DidOpenTextDocumentNotification.type,p),onDidChangeTextDocument:p=>i.onNotification(w.DidChangeTextDocumentNotification.type,p),onDidCloseTextDocument:p=>i.onNotification(w.DidCloseTextDocumentNotification.type,p),onWillSaveTextDocument:p=>i.onNotification(w.WillSaveTextDocumentNotification.type,p),onWillSaveTextDocumentWaitUntil:p=>i.onRequest(w.WillSaveTextDocumentWaitUntilRequest.type,p),onDidSaveTextDocument:p=>i.onNotification(w.DidSaveTextDocumentNotification.type,p),sendDiagnostics:p=>i.sendNotification(w.PublishDiagnosticsNotification.type,p),onHover:p=>i.onRequest(w.HoverRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),onCompletion:p=>i.onRequest(w.CompletionRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onCompletionResolve:p=>i.onRequest(w.CompletionResolveRequest.type,p),onSignatureHelp:p=>i.onRequest(w.SignatureHelpRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),onDeclaration:p=>i.onRequest(w.DeclarationRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onDefinition:p=>i.onRequest(w.DefinitionRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onTypeDefinition:p=>i.onRequest(w.TypeDefinitionRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onImplementation:p=>i.onRequest(w.ImplementationRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onReferences:p=>i.onRequest(w.ReferencesRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onDocumentHighlight:p=>i.onRequest(w.DocumentHighlightRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onDocumentSymbol:p=>i.onRequest(w.DocumentSymbolRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onWorkspaceSymbol:p=>i.onRequest(w.WorkspaceSymbolRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onWorkspaceSymbolResolve:p=>i.onRequest(w.WorkspaceSymbolResolveRequest.type,p),onCodeAction:p=>i.onRequest(w.CodeActionRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onCodeActionResolve:p=>i.onRequest(w.CodeActionResolveRequest.type,(l,C)=>p(l,C)),onCodeLens:p=>i.onRequest(w.CodeLensRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onCodeLensResolve:p=>i.onRequest(w.CodeLensResolveRequest.type,(l,C)=>p(l,C)),onDocumentFormatting:p=>i.onRequest(w.DocumentFormattingRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),onDocumentRangeFormatting:p=>i.onRequest(w.DocumentRangeFormattingRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),onDocumentOnTypeFormatting:p=>i.onRequest(w.DocumentOnTypeFormattingRequest.type,(l,C)=>p(l,C)),onRenameRequest:p=>i.onRequest(w.RenameRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),onPrepareRename:p=>i.onRequest(w.PrepareRenameRequest.type,(l,C)=>p(l,C)),onDocumentLinks:p=>i.onRequest(w.DocumentLinkRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onDocumentLinkResolve:p=>i.onRequest(w.DocumentLinkResolveRequest.type,(l,C)=>p(l,C)),onDocumentColor:p=>i.onRequest(w.DocumentColorRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onColorPresentation:p=>i.onRequest(w.ColorPresentationRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onFoldingRanges:p=>i.onRequest(w.FoldingRangeRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onSelectionRanges:p=>i.onRequest(w.SelectionRangeRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),(0,q.attachPartialResult)(i,l))),onExecuteCommand:p=>i.onRequest(w.ExecuteCommandRequest.type,(l,C)=>p(l,C,(0,q.attachWorkDone)(i,l),void 0)),dispose:()=>i.dispose()};for(let p of m)p.attach(x);return i.onRequest(w.InitializeRequest.type,p=>{t.initialize(p),qe.string(p.trace)&&(o.trace=w.Trace.fromString(p.trace));for(let l of m)l.initialize(p.capabilities);if(N){let l=N(p,new w.CancellationTokenSource().token,(0,q.attachWorkDone)(i,p),void 0);return T(l).then(C=>{if(C instanceof w.ResponseError)return C;let P=C;P||(P={capabilities:{}});let M=P.capabilities;M||(M={},P.capabilities=M),M.textDocumentSync===void 0||M.textDocumentSync===null?M.textDocumentSync=qe.number(x.__textDocumentSync)?x.__textDocumentSync:w.TextDocumentSyncKind.None:!qe.number(M.textDocumentSync)&&!qe.number(M.textDocumentSync.change)&&(M.textDocumentSync.change=qe.number(x.__textDocumentSync)?x.__textDocumentSync:w.TextDocumentSyncKind.None);for(let W of m)W.fillServerCapabilities(M);return P})}else{let l={capabilities:{textDocumentSync:w.TextDocumentSyncKind.None}};for(let C of m)C.fillServerCapabilities(l.capabilities);return l}}),i.onRequest(w.ShutdownRequest.type,()=>{if(t.shutdownReceived=!0,D)return D(new w.CancellationTokenSource().token)}),i.onNotification(w.ExitNotification.type,()=>{try{if(A)return A()}finally{t.shutdownReceived?t.exit(0):t.exit(1)}}),i.onNotification(w.SetTraceNotification.type,p=>{o.trace=w.Trace.fromString(p.value)}),x}});var Yf=S(be=>{"use strict";var $p=be&&be.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),zp=be&&be.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Vc=be&&be.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i1){let r=n[0],i=n[1];r.length===0&&i.length>1&&i[1]===":"&&n.shift()}return Ue.normalize(n.join("/"))}function zc(){return process.platform==="win32"}function _i(e,t,n,r){let i="NODE_PATH",o=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((s,c)=>{let g=process.env,d=Object.create(null);Object.keys(g).forEach(h=>d[h]=g[h]),t&&$c.existsSync(t)&&(d[i]?d[i]=t+Ue.delimiter+d[i]:d[i]=t,r&&r(`NODE_PATH value is: ${d[i]}`)),d.ELECTRON_RUN_AS_NODE="1";try{let h=(0,Kc.fork)("",[],{cwd:n,env:d,execArgv:["-e",o]});if(h.pid===void 0){c(new Error(`Starting process to resolve node module ${e} failed`));return}h.on("error",m=>{c(m)}),h.on("message",m=>{m.c==="r"&&(h.send({c:"e"}),m.s?s(m.r):c(new Error(`Failed to resolve module: ${e}`)))});let v={c:"rs",a:e};h.send(v)}catch(h){c(h)}})}function Bc(e){let t="npm",n=Object.create(null);Object.keys(process.env).forEach(o=>n[o]=process.env[o]),n.NO_UPDATE_NOTIFIER="true";let r={encoding:"utf8",env:n};zc()&&(t="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,Kc.spawnSync)(t,["config","get","prefix"],r).stdout;if(!o){e&&e("'npm config get prefix' didn't return a value.");return}let s=o.trim();return e&&e(`'npm config get prefix' value is: ${s}`),s.length>0?zc()?Ue.join(s,"node_modules"):Ue.join(s,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}function Vp(e){let t="yarn",n={encoding:"utf8"};zc()&&(t="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,Kc.spawnSync)(t,["global","dir","--json"],n),o=i.stdout;if(!o){e&&(e("'yarn global dir' didn't return a value."),i.stderr&&e(i.stderr));return}let s=o.trim().split(/\r?\n/);for(let c of s)try{let g=JSON.parse(c);if(g.type==="log")return Ue.join(g.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}var Qc;(function(e){let t;function n(){return t!==void 0||(process.platform==="win32"?t=!1:t=!$c.existsSync(__filename.toUpperCase())||!$c.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=n;function r(i,o){return n()?Ue.normalize(o).indexOf(Ue.normalize(i))===0:Ue.normalize(o).toLowerCase().indexOf(Ue.normalize(i).toLowerCase())===0}e.isParent=r})(Qc||(be.FileSystem=Qc={}));function Kp(e,t,n,r){return n?(Ue.isAbsolute(n)||(n=Ue.join(e,n)),_i(t,n,n,r).then(i=>Qc.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${t} from node path location.`))).then(void 0,i=>_i(t,Bc(r),e,r))):_i(t,Bc(r),e,r)}});var em=S(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var Jf=require("util"),st=tt(),Xc=class e extends st.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(t="utf-8"){super(t)}emptyBuffer(){return e.emptyBuffer}fromString(t,n){return Buffer.from(t,n)}toString(t,n){return t instanceof Buffer?t.toString(n):new Jf.TextDecoder(n).decode(t)}asNative(t,n){return n===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,n):Buffer.from(t,0,n)}allocNative(t){return Buffer.allocUnsafe(t)}},Yc=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),st.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),st.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),st.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),st.Disposable.create(()=>this.stream.off("data",t))}},Jc=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),st.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),st.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),st.Disposable.create(()=>this.stream.off("end",t))}write(t,n){return new Promise((r,i)=>{let o=s=>{s==null?r():i(s)};typeof t=="string"?this.stream.write(t,n,o):this.stream.write(t,o)})}end(){this.stream.end()}},Zf=Object.freeze({messageBuffer:Object.freeze({create:e=>new Xc(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new Jf.TextDecoder(t.charset).decode(e)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:e=>new Yc(e),asWritableStream:e=>new Jc(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function Zc(){return Zf}(function(e){function t(){st.RAL.install(Zf)}e.install=t})(Zc||(Zc={}));ea.default=Zc});var sa=S(G=>{"use strict";var nm=G&&G.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Xp=G&&G.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),oa=G&&G.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;ithis.fireError(r)),n.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),xe.Disposable.create(()=>this.process.off("message",t))}};G.IPCMessageReader=ta;var na=class extends xe.AbstractMessageWriter{process;errorCount;constructor(t){super(),this.process=t,this.errorCount=0;let n=this.process;n.on("error",r=>this.fireError(r)),n.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,t)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};G.IPCMessageWriter=na;var ra=class extends xe.AbstractMessageReader{onData;constructor(t){super(),this.onData=new xe.Emitter,t.on("close",()=>this.fireClose),t.on("error",n=>this.fireError(n)),t.on("message",n=>{this.onData.fire(n)})}listen(t){return this.onData.event(t)}};G.PortMessageReader=ra;var ia=class extends xe.AbstractMessageWriter{port;errorCount;constructor(t){super(),this.port=t,this.errorCount=0,t.on("close",()=>this.fireClose()),t.on("error",n=>this.fireError(n))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};G.PortMessageWriter=ia;var jt=class extends xe.ReadableStreamMessageReader{constructor(t,n="utf-8"){super((0,Yn.default)().stream.asReadableStream(t),n)}};G.SocketMessageReader=jt;var Ft=class extends xe.WriteableStreamMessageWriter{socket;constructor(t,n){super((0,Yn.default)().stream.asWritableStream(t),n),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};G.SocketMessageWriter=Ft;var vi=class extends xe.ReadableStreamMessageReader{constructor(t,n){super((0,Yn.default)().stream.asReadableStream(t),n)}};G.StreamMessageReader=vi;var bi=class extends xe.WriteableStreamMessageWriter{constructor(t,n){super((0,Yn.default)().stream.asWritableStream(t),n)}};G.StreamMessageWriter=bi;var ny=process.env.XDG_RUNTIME_DIR,ry=new Map([["linux",107],["darwin",102]]);function iy(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,tm.randomBytes)(16).toString("hex")}-sock`;let e=32,t=10,n=ty.realpathSync(ny??ey.tmpdir()),r=ry.get(process.platform);if(r!==void 0&&(e=Math.min(r-n.length-t,e)),e<16)throw new Error(`Unable to generate a random pipe name with ${e} characters.`);let i=(0,tm.randomBytes)(Math.floor(e/2)).toString("hex");return Zp.join(n,`lsp-${i}.sock`)}function oy(e,t="utf-8"){let n,r=new Promise((i,o)=>{n=i});return new Promise((i,o)=>{let s=(0,Ci.createServer)(c=>{s.close(),n([new jt(c,t),new Ft(c,t)])});s.on("error",o),s.listen(e,()=>{s.removeListener("error",o),i({onConnected:()=>r})})})}function sy(e,t="utf-8"){let n=(0,Ci.createConnection)(e);return[new jt(n,t),new Ft(n,t)]}function cy(e,t="utf-8"){let n,r=new Promise((i,o)=>{n=i});return new Promise((i,o)=>{let s=(0,Ci.createServer)(c=>{s.close(),n([new jt(c,t),new Ft(c,t)])});s.on("error",o),s.listen(e,"127.0.0.1",()=>{s.removeListener("error",o),i({onConnected:()=>r})})})}function ay(e,t="utf-8"){let n=(0,Ci.createConnection)(e,"127.0.0.1");return[new jt(n,t),new Ft(n,t)]}function uy(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function ly(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function dy(e,t,n,r){n||(n=xe.NullLogger);let i=uy(e)?new vi(e):e,o=ly(t)?new bi(t):t;return xe.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,xe.createMessageConnection)(i,o,n,r)}});var ca=S(ct=>{"use strict";var fy=ct&&ct.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),rm=ct&&ct.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&fy(t,e,n)};Object.defineProperty(ct,"__esModule",{value:!0});ct.createProtocolConnection=hy;var my=sa();rm(sa(),ct);rm(te(),ct);function hy(e,t,n,r){return(0,my.createMessageConnection)(e,t,n,r)}});var aa=S(pe=>{"use strict";var gy=pe&&pe.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),om=pe&&pe.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&gy(t,e,n)};Object.defineProperty(pe,"__esModule",{value:!0});pe.ProposedFeatures=pe.NotebookDocuments=pe.TextDocuments=pe.SemanticTokensBuilder=void 0;var py=Oc();Object.defineProperty(pe,"SemanticTokensBuilder",{enumerable:!0,get:function(){return py.SemanticTokensBuilder}});om(te(),pe);var yy=qc();Object.defineProperty(pe,"TextDocuments",{enumerable:!0,get:function(){return yy.TextDocuments}});var Ty=Gc();Object.defineProperty(pe,"NotebookDocuments",{enumerable:!0,get:function(){return Ty.NotebookDocuments}});om(Hc(),pe);var im;(function(e){e.all={__brand:"features"}})(im||(pe.ProposedFeatures=im={}))});var la=S(Ce=>{"use strict";var um=Ce&&Ce.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),_y=Ce&&Ce.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),lm=Ce&&Ce.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i{try{process.kill(r,0)}catch{Ii(),process.exit(In?0:1)}},3e3))}catch{}}for(let n=2;n{let t=e.processId;ua.number(t)&&fm===void 0&&setInterval(()=>{try{process.kill(t,0)}catch{process.exit(In?0:1)}},3e3)},get shutdownReceived(){return In},set shutdownReceived(e){In=e},exit:e=>{Ii(),process.exit(e)}};function Iy(e,t,n,r){let i,o,s,c;return e!==void 0&&e.__brand==="features"&&(i=e,e=t,t=n,n=r),Lt.ConnectionStrategy.is(e)||Lt.ConnectionOptions.is(e)?c=e:(o=e,s=t,c=n),Sy(o,s,c,i)}function Sy(e,t,n,r){let i=!1;if(!e&&!t&&process.argv.length>2){let c,g,d=process.argv.slice(2);for(let h=0;h{Ii(),process.exit(In?0:1)}),c.on("close",()=>{Ii(),process.exit(In?0:1)})}let s=c=>{let g=(0,Lt.createProtocolConnection)(e,t,c,n);return i&&Dy(c),g};return(0,vy.createConnection)(s,Cy,r)}function Dy(e){function t(r){return r.map(i=>typeof i=="string"?i:(0,sm.inspect)(i)).join(" ")}let n=new Map;console.assert=function(i,...o){if(!i)if(o.length===0)e.error("Assertion failed");else{let[s,...c]=o;e.error(`Assertion failed: ${s} ${t(c)}`)}},console.count=function(i="default"){let o=String(i),s=n.get(o)??0;s+=1,n.set(o,s),e.log(`${o}: ${o}`)},console.countReset=function(i){i===void 0?n.clear():n.delete(String(i))},console.debug=function(...i){e.log(t(i))},console.dir=function(i,o){e.log((0,sm.inspect)(i,o))},console.log=function(...i){e.log(t(i))},console.error=function(...i){e.error(t(i))},console.trace=function(...i){let o=new Error().stack.replace(/(.+\n){2}/,""),s="Trace";i.length!==0&&(s+=`: ${t(i)}`),e.log(`${s} +${o}`)},console.warn=function(...i){e.warn(t(i))}}});var pm={};Xa(pm,{TextDocument:()=>da});function fa(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);fa(r,t),fa(i,t);let o=0,s=0,c=0;for(;on.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function wy(e){let t=gm(e.range);return t!==e.range?{newText:e.newText,range:t}:e}var Si,da,ym=Ka(()=>{"use strict";Si=class e{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(e.isIncremental(r)){let i=gm(r.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+r.text+this._content.substring(s,this._content.length);let c=Math.max(i.start.line,0),g=Math.max(i.end.line,0),d=this._lineOffsets,h=mm(r.text,!1,o);if(g-c===h.length)for(let m=0,T=h.length;mt?i=s:r=s+1}let o=r-1;return t=this.ensureBeforeEOL(t,n[o]),{line:o,character:t-n[o]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line];if(t.character<=0)return r;let i=t.line+1=n.length){let s=n.length-1;return{start:{line:s,character:0},end:{line:s,character:this._content.length-n[s]}}}else if(t<0)return{start:{line:0,character:0},end:{line:0,character:0}};let r=n[t],i=t+1=n.length)return"";if(t<0)return"";let r=t+1n&&hm(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}};(function(e){function t(i,o,s,c){return new Si(i,o,s,c)}e.create=t;function n(i,o,s){if(i instanceof Si)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(i,o){let s=i.getText(),c=fa(o.map(wy),(h,v)=>{let m=h.range.start.line-v.range.start.line;return m===0?h.range.start.character-v.range.start.character:m}),g=0,d=[];for(let h of c){let v=i.offsetAt(h.range.start);if(vg&&d.push(s.substring(g,v)),h.newText.length&&d.push(h.newText),g=i.offsetAt(h.range.end)}return d.push(s.substr(g)),d.join("")}e.applyEdits=r})(da||(da={}))});var Zn=S(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.DATATYPE_SET=ye.KEYWORD_SET=ye.PUNCTUATION=ye.OPERATORS=ye.DATATYPES=ye.KEYWORDS=void 0;ye.KEYWORDS=["ABS","AND","AS","ATN","CALL","COS","DIM","EACH","ELSE","ENDIF","EOF","EXIT","EXP","FALSE","FOR","FRAC","IF","IN","INT","IS","LOG","MOD","NEXT","NOT","NULL","OR","RETURN","RND","ROUND","SHL","SHR","SIN","SQR","SQRT","STEP","TAN","THEN","TO","TRUE","WHILE","XOR"];ye.DATATYPES=["DISCRETE","INTEGER","MESSAGE","REAL"];ye.OPERATORS=["==","<>","<=",">=","->","=","+","-","<",">","*","/","%","!","~","|"];ye.PUNCTUATION=["(",")","[","]",";",",",":","."];ye.KEYWORD_SET=new Set(ye.KEYWORDS);ye.DATATYPE_SET=new Set(ye.DATATYPES)});var tr=S(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.positionAt=ha;er.offsetAt=ky;er.sourceRange=Ry;function ma(e,t){if(!Number.isInteger(t)||t<0||t>e.length)throw new RangeError(`Offset ${t} is outside the source.`)}function Tm(e,t){if(!Number.isInteger(t)||t<0)throw new RangeError(`${e} ${t} must be a non-negative integer.`)}function _m(e){let t=[0];for(let n=0;n=t.length)return e.length;let r=t[n+1];return e[r-1]===` +`&&(r-=1),e[r-1]==="\r"&&(r-=1),r}function ha(e,t){ma(e,t);let n=_m(e),r=0,i=n.length;for(;r+1=n.length)throw new RangeError(`Line ${t.line} is outside the source.`);let r=n[t.line],i=Py(e,n,t.line),o=r+t.character;if(o>i)throw new RangeError(`Character ${t.character} is outside line ${t.line}.`);return o}function Ry(e,t){if(ma(e,t.start),ma(e,t.end),t.end{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.TokenKind=void 0;var vm;(function(e){e.Identifier="Identifier",e.Keyword="Keyword",e.Datatype="Datatype",e.Number="Number",e.String="String",e.Operator="Operator",e.Punctuation="Punctuation",e.Comment="Comment",e.Whitespace="Whitespace",e.Newline="Newline",e.Unknown="Unknown",e.EOF="EOF"})(vm||(Di.TokenKind=vm={}))});var rr=S(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.tokenize=xy;var Pi=Zn(),Pe=at();function bm(e){return e!==void 0&&/[\p{L}_$#]/u.test(e)}function nr(e){return e!==void 0&&/[\p{L}\p{N}_$#]/u.test(e)}function wi(e){return e!==void 0&&/[0-9]/.test(e)}function Oy(e){let t=e.toUpperCase();return Pi.DATATYPE_SET.has(t)?Pe.TokenKind.Datatype:Pi.KEYWORD_SET.has(t)?Pe.TokenKind.Keyword:Pe.TokenKind.Identifier}function xy(e){let t=[],n=0,r=0,i=0,o=()=>({line:r,character:i}),s=d=>{for(;n{let v=n,m=o();s(h),t.push({kind:d,lexeme:e.slice(v,h),span:{start:v,end:h},range:{start:m,end:o()}})};for(;ne.startsWith(m,n));if(h!==void 0){c(Pe.TokenKind.Operator,n+h.length);continue}if(Pi.PUNCTUATION.includes(d)){c(Pe.TokenKind.Punctuation,n+1);continue}let v=e.codePointAt(n);c(Pe.TokenKind.Unknown,n+(v!==void 0&&v>65535?2:1))}let g=o();return t.push({kind:Pe.TokenKind.EOF,lexeme:"",span:{start:n,end:n},range:{start:g,end:{...g}}}),t}});var ya=S(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.extractDocumentMetadata=Qy;var Ut=tr(),My=at(),Ey=rr(),Cm="[\\p{L}_$#][\\p{L}\\p{N}_$#-]*",qy=/^[ \t]*@([A-Za-z]+)(?:[ \t]+([^\r\n]*?))?[ \t]*$/gmu,Ny=/^[ \t]*(Type|Name|Description|Trigger|Event|Shortcut|Returns?|Tagname\[\.field\]|Condition|Condition Type)[ \t]*:[ \t]*([^\r\n]*?)[ \t]*$/gimu,Ay=new RegExp(`^[ \\t]*(DISCRETE|INTEGER|MESSAGE|REAL)[ \\t]+(${Cm})(?:[ \\t]+([^\\r\\n]*?))?[ \\t]*$`,"gimu"),Gy={quickfunction:"QuickFunction",datachange:"DataChange",condition:"Condition",conditionalscript:"Condition",application:"Application",applicationscript:"Application",window:"Window",windowscript:"Window",keyscript:"KeyScript",generic:"Generic"},jy={onshow:"OnShow",whilerunning:"WhileRunning",onclose:"OnClose"},Fy=new Set(["scripttype","name","description","event","trigger","shortcut","param","returns"]);function ut(e,t,n,r="warning"){return{code:e,message:t,severity:r,range:n,source:"intouch-metadata"}}function ir(e,t,n,r,i,o){let c=(n.index??0)+n[0].lastIndexOf(r),g=(0,Ut.sourceRange)(e,{start:t.span.start+c,end:t.span.start+c+r.length});return{value:i,raw:r,...g,source:o}}function Im(e){return Gy[e.replace(/[ \t_-]+/g,"").toLowerCase()]}function Ly(e){return jy[e.replace(/[ \t_-]+/g,"").toLowerCase()]}function Wy(e,t){return typeof e=="string"&&typeof t=="string"?e.localeCompare(t,"en",{sensitivity:"base"})===0:e===t}function Wt(e,t,n,r){let i=t[0]??n[0];if(i!==void 0){for(let o of[...t.slice(1),...n])Wy(i.value,o.value)||r.push(ut("metadata-conflict",`${e} '${o.raw}' conflicts with higher-priority ${i.source} metadata '${i.raw}'.`,o.range));return i}}function Uy(e,t,n,r){for(let i of t.lexeme.matchAll(qy)){let o=i[1],s=(i[2]??"").trim(),c=o.toLowerCase(),g=t.span.start+(i.index??0)+i[0].indexOf(`@${o}`)+1,d=(0,Ut.sourceRange)(e,{start:g,end:g+o.length}).range;if(!Fy.has(c)){r.push(ut("unknown-metadata-field",`Unknown QuickScript metadata field '@${o}'.`,d,"information"));continue}if(s.length===0){r.push(ut("invalid-metadata-value",`Metadata field '@${o}' requires a value.`,d));continue}if(c==="scripttype"){let v=Im(s),m=ir(e,t,i,s,v??"Unknown","explicit");v===void 0?r.push(ut("invalid-script-type",`Unknown QuickScript script type '${s}'.`,m.range)):n.scriptTypes.push(m);continue}if(c==="param"){let v=s.match(new RegExp(`^(${Cm})[ \\t]+(DISCRETE|INTEGER|MESSAGE|REAL)(?:[ \\t]+([\\s\\S]*))?$`,"iu")),m=ir(e,t,i,s,s,"explicit");if(v===null){r.push(ut("invalid-metadata-value","Metadata field '@Param' must use '@Param Name TYPE Description...'.",m.range));continue}let T=m.span.start+s.indexOf(v[1]),D=m.span.start+s.indexOf(v[2],v[1].length);n.explicitParameters.push({name:v[1],datatype:v[2].toUpperCase(),description:v[3]?.trim()||void 0,range:m.range,nameRange:(0,Ut.sourceRange)(e,{start:T,end:T+v[1].length}).range,datatypeRange:(0,Ut.sourceRange)(e,{start:D,end:D+v[2].length}).range});continue}let h=ir(e,t,i,s,s,"explicit");switch(c){case"name":n.names.push(h);break;case"description":n.descriptions.push(h);break;case"event":n.events.push(h);break;case"trigger":n.triggers.push(h);break;case"shortcut":n.shortcuts.push(h);break;case"returns":n.returnTypes.push({...h,value:s.toUpperCase()});break}}}function Hy(e){let t=e.lexeme.match(/\bParameters\s*:\s*([\s\S]*?)(?:\r?\n[ \t]*\r?\n|\bUsage\s*:|\bVersion\s+history\s*:|\{<|$)/iu);if(t===null)return;let n=(t.index??0)+t[0].indexOf(t[1]);return{text:t[1],start:n}}function $y(e,t,n){for(let i of t.lexeme.matchAll(Ny)){let o=i[1].toLowerCase(),s=i[2].trim();if(s.length===0)continue;if(o==="type"){n.legacyScriptType??=s;let g=Im(s);n.scriptTypes.push(ir(e,t,i,s,g??"Unknown","legacy"));continue}let c=ir(e,t,i,s,s,"legacy");switch(o){case"name":n.names.push(c);break;case"description":n.descriptions.push(c);break;case"event":n.events.push(c);break;case"trigger":n.triggers.push(c);break;case"shortcut":n.shortcuts.push(c);break;case"tagname[.field]":n.triggers.push(c);break;case"condition":n.triggers.push(c);break;case"condition type":n.events.push(c);break;case"return":case"returns":n.returnTypes.push({...c,value:s.toUpperCase()});break}}let r=Hy(t);if(r!==void 0)for(let i of r.text.matchAll(Ay)){let o=i[1],s=i[2],c=r.start+(i.index??0),g=t.span.start+c+i[0].indexOf(o),d=t.span.start+c+i[0].indexOf(s,i[0].indexOf(o)+o.length);n.legacyParameters.push({name:s,datatype:o.toUpperCase(),description:i[3]?.trim()||void 0,range:(0,Ut.sourceRange)(e,{start:g,end:t.span.start+c+i[0].trimEnd().length}).range,nameRange:(0,Ut.sourceRange)(e,{start:d,end:d+s.length}).range,datatypeRange:(0,Ut.sourceRange)(e,{start:g,end:g+o.length}).range})}}function zy(e){if(/^[ \t]*Script[ \t]*:[ \t]*$/imu.test(e))return!0;let t=/^[ \t]*Type[ \t]*:[ \t]*[^\r\n]+$/imu.test(e),n=/^[ \t]*(?:Name|Tagname\[\.field\]|Condition)[ \t]*:[ \t]*[^\r\n]+$/imu.test(e);return t&&n}function By(e){if(e===void 0)return;let t=e.replace(/^.*[\\/]/,"").replace(/\.(?:vbi|vi)$/i,"").replace(/_\d+(?:\.\d+){1,3}$/i,"");for(let[n,r]of[["QF_","QuickFunction"],["DCH_","DataChange"],["CS_","Condition"],["APP_","Application"],["KEY_","KeyScript"]])if(t.toUpperCase().startsWith(n))return{scriptType:r,name:t.slice(n.length)}}function Qy(e,t={}){let n=[],r={scriptTypes:[],names:[],events:[],triggers:[],shortcuts:[],descriptions:[],returnTypes:[],explicitParameters:[],legacyParameters:[]},i=(t.tokens??(0,Ey.tokenize)(e)).filter(P=>P.kind===My.TokenKind.Comment);for(let P of i)Uy(e,P,r,n),zy(P.lexeme)&&$y(e,P,r);let o=P=>P.filter(M=>M.source==="explicit"),s=P=>P.filter(M=>M.source==="legacy"),c=Wt("Script type",o(r.scriptTypes),s(r.scriptTypes),n),g=Wt("Name",o(r.names),s(r.names),n),d=Wt("Event",o(r.events),s(r.events),n),h=Wt("Trigger",o(r.triggers),s(r.triggers),n),v=Wt("Shortcut",o(r.shortcuts),s(r.shortcuts),n),m=Wt("Description",o(r.descriptions),s(r.descriptions),n),T=Wt("Return type",o(r.returnTypes),s(r.returnTypes),n),D=r.explicitParameters.length>0?r.explicitParameters:r.legacyParameters;if(r.explicitParameters.length>0&&r.legacyParameters.length>0){let P=M=>M.map(W=>`${W.name.toUpperCase()}:${W.datatype.toUpperCase()}`).join(",");P(r.explicitParameters)!==P(r.legacyParameters)&&n.push(ut("metadata-conflict","Legacy parameter metadata conflicts with higher-priority explicit @Param metadata.",r.legacyParameters[0].range))}let N=By(t.fileName),A=c?.value??N?.scriptType??"Generic",x=g?.value??N?.name,p=d?.value;if(A==="Window"&&d!==void 0){let P=Ly(d.value);P===void 0?(n.push(ut("invalid-window-event",`Unknown Window script event '${d.value}'.`,d.range)),p=void 0):p=P}else d!==void 0&&!["Application","Condition"].includes(A)&&n.push(ut("metadata-conflict",`Event metadata is not supported for ${A} scripts.`,d.range));A==="Window"&&T!==void 0&&n.push(ut("metadata-conflict","Window scripts cannot declare a return type.",T.range));let l=[c,g,d,h,v,m,T].flatMap(P=>P===void 0?[]:[P.source]);r.explicitParameters.length>0?l.push("explicit"):r.legacyParameters.length>0&&l.push("legacy");let C=l.includes("explicit")?"explicit":l.includes("legacy")?"legacy":N===void 0?"none":"filename";return{scriptType:A,name:x,nameRange:g?.range,event:p,eventRange:d?.range,trigger:h?.value,triggerRange:h?.range,shortcut:v?.value,shortcutRange:v?.range,description:m?.value,descriptionRange:m?.range,parameters:D,returnType:T?.value,returnTypeRange:T?.range,metadataSource:C,legacyScriptType:r.legacyScriptType,diagnostics:n}}});var Ri=S(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.parseQuickScript=oT;var Vy=Zn(),ki=tr(),ne=at(),Ky=rr(),Sm=new Map([["OR",1],["XOR",1],["|",1],["AND",2],["==",3],["<>",3],["<",3],["<=",3],[">",3],[">=",3],["IS",3],["SHL",4],["SHR",4],["+",5],["-",5],["*",6],["/",6],["%",6],["MOD",6]]),Dm=new Set(["+","-","NOT","!","~"]),Xy=new Set(["TRUE","FALSE","NULL","EOF"]),Yy=new Set(["DIM","AS","CALL","IF","THEN","ELSE","ENDIF","FOR","TO","STEP","NEXT","WHILE","EXIT","RETURN"]),Jy=new Set(["ACTIVATEAPP","HIDE","PLAYSOUND","SENDKEYS","SHOW","STARTAPP"]);function Zy(e){return e.kind===ne.TokenKind.Whitespace||e.kind===ne.TokenKind.Newline||e.kind===ne.TokenKind.Comment||e.kind===ne.TokenKind.EOF}function Pt(e){return e===void 0?void 0:e.lexeme.toUpperCase()}function Ie(e){return e?.kind===ne.TokenKind.Keyword?Pt(e):void 0}function wm(e,t,n=t){return(0,ki.sourceRange)(e,{start:t.span.start,end:n.span.end})}function eT(e,t){let n=t.length===0?0:t[t.length-1].span.end;return(0,ki.sourceRange)(e,{start:n,end:n}).range}function Te(e,t,n){return{code:e,message:t,severity:"error",range:n.range}}function He(e,t,n,r){return{code:t,message:n,severity:"error",range:eT(e,r)}}function tT(e,t){return e.filter(n=>n.range.start.line===t&&!Zy(n))}function Pm(e,t){return e.some(n=>n.kind===ne.TokenKind.Comment&&n.range.end.line>n.range.start.line&&n.range.start.line<=t&&n.range.end.line>=t)}function km(e){return e===void 0?void 0:e.kind===ne.TokenKind.Keyword?Pt(e):e.lexeme}var Ta=class{constructor(t){this.tokens=t,this.position=0}parse(){if(this.tokens.length===0)return{code:"missing-expression",message:"Expected a QuickScript expression."};if(this.parseBinary(1),this.issue!==void 0)return this.issue;if(this.position=this.tokens.length){this.issue={code:"missing-expression",message:"Expected an expression after the operator."};return}this.parseBinary(n+1)}}parseUnary(){for(;Dm.has(km(this.tokens[this.position])??"");)this.position+=1;this.parsePostfix()}parsePostfix(){for(this.parsePrimary();this.issue===void 0&&this.position"||t===":"){if(this.position+=1,!this.isMemberName(this.tokens[this.position])){this.issue={code:"missing-expression",message:`Expected an identifier after '${t}'.`,token:this.tokens[this.position]};return}this.position+=1;continue}return}}parsePrimary(){let t=this.tokens[this.position];if(t===void 0){this.issue={code:"missing-expression",message:"Expected a QuickScript expression."};return}if(Pt(t)==="CALL"){this.parseCallExpression(t);return}if(t.lexeme==="("){this.position+=1,this.parseBinary(1),this.expectClosing(")",t);return}if(t.kind===ne.TokenKind.Identifier||t.kind===ne.TokenKind.Number||t.kind===ne.TokenKind.String||this.isCallableKeyword(t)||Xy.has(Pt(t)??"")){this.position+=1;return}this.issue={code:"unexpected-token",message:`Unexpected token '${t.lexeme}' in expression.`,token:t}}parseCallExpression(t){this.position+=1;let n=this.tokens[this.position];if(!this.isName(n)){this.issue={code:"missing-call-target",message:"CALL requires a callable name.",token:n??t};return}for(this.position+=1;[".","->",":"].includes(this.tokens[this.position]?.lexeme??"");){let i=this.tokens[this.position];if(this.position+=1,!this.isName(this.tokens[this.position])){this.issue={code:"missing-expression",message:`Expected an identifier after '${i.lexeme}'.`,token:this.tokens[this.position]};return}this.position+=1}let r=this.tokens[this.position];if(r?.lexeme!=="("){this.issue={code:"missing-call-arguments",message:"CALL requires '(' after the callable name.",token:r};return}this.parseArguments(r)}parseArguments(t){if(this.position+=1,this.tokens[this.position]?.lexeme!==")")for(;this.issue===void 0&&(this.parseBinary(1),this.tokens[this.position]?.lexeme===",");)this.position+=1;this.expectClosing(")",t)}expectClosing(t,n){if(this.issue===void 0){if(this.tokens[this.position]?.lexeme!==t){this.issue={code:"unclosed-delimiter",message:`Expected '${t}' to close '${n.lexeme}'.`,token:this.tokens[this.position]};return}this.position+=1}}isName(t){return t?.kind===ne.TokenKind.Identifier||this.isCallableKeyword(t)}isMemberName(t){return t?.kind===ne.TokenKind.Number||this.isName(t)}isCallableKeyword(t){return t?.kind===ne.TokenKind.Keyword&&!Yy.has(Pt(t)??"")&&!Sm.has(Pt(t)??"")&&!Dm.has(Pt(t)??"")}};function nT(e,t,n){return n.token===void 0?He(e,n.code,n.message,t):Te(n.code,n.message,n.token)}function Ne(e,t,n){let r=new Ta(t).parse();return r===void 0?!0:(n.push(nT(e,t,r)),!1)}var _a=class{constructor(t,n,r){this.source=t,this.tokens=n,this.diagnostics=r,this.position=0,this.statements=[]}parse(){for(;this.positionc.lexeme==="(")&&this.diagnostics.push(Te("missing-call-arguments","CALL requires '(' after the callable name.",n)),this.position=r;let s=this.consumeTerminator("CALL statement",i[i.length-1]??t);this.statements.push({kind:"call",first:t,last:s,name:n})}parseIf(){let t=this.consume(),n=this.findTopLevelKeyword(this.position,new Set(["THEN"])),r=t;if(n<0){let i=this.tokens.slice(this.position);this.diagnostics.push(He(this.source,"missing-then","IF requires 'THEN' after its condition.",i.length>0?i:[t])),this.position=this.tokens.length,r=i[i.length-1]??t}else Ne(this.source,this.tokens.slice(this.position,n),this.diagnostics),this.position=n,r=this.consume(),this.current()?.lexeme===";"&&(this.diagnostics.push(Te("unexpected-semicolon","IF header must not be terminated after THEN.",this.current())),this.consume());this.statements.push({kind:"if",first:t,last:r,open:"if"})}parseElse(){let t=this.consume();this.current()?.lexeme===";"&&(this.diagnostics.push(Te("unexpected-semicolon","ELSE must not be terminated with a semicolon.",this.current())),this.consume()),this.statements.push({kind:"else",first:t,last:t,middle:!0})}parseFor(){let t=this.consume(),n=this.current();if(n?.kind!==ne.TokenKind.Identifier?this.diagnostics.push(n===void 0?He(this.source,"missing-loop-variable","FOR requires a loop variable.",[t]):Te("missing-loop-variable","FOR requires a loop variable.",n)):this.consume(),this.current()?.lexeme!=="="){let o=this.current();this.diagnostics.push(o===void 0?He(this.source,"expected-equals","Expected '=' after FOR loop variable.",n===void 0?[t]:[t,n]):Te("expected-equals","Expected '=' after FOR loop variable.",o)),o?.lexeme==="=="&&this.consume()}else this.consume();let r=this.findTopLevelKeyword(this.position,new Set(["TO"])),i=n??t;if(r<0){let o=this.headerEnd(this.position),s=this.tokens.slice(this.position,o);this.diagnostics.push(He(this.source,"missing-to","FOR requires 'TO' after the initial expression.",s.length>0?s:[t])),this.position=o,i=s[s.length-1]??i}else{Ne(this.source,this.tokens.slice(this.position,r),this.diagnostics),this.position=r+1;let o=this.findTopLevelKeyword(this.position,new Set(["STEP"])),s=this.headerEnd(this.position),c=o>=0&&o=0&&o0&&Ne(this.source,r,this.diagnostics),this.position=n;let i=this.consumeTerminator("RETURN statement",r[r.length-1]??t);this.statements.push({kind:"return",first:t,last:i})}parseIdentifierStatement(){let t=this.current(),n=this.statementBoundary(this.position),r=this.tokens.slice(this.position,n),i=this.findTopLevelLexeme(this.position,"="),o=i>=this.position&&iv.lexeme==="=")&&r.some(v=>Ie(v)==="TO");this.statements.push({kind:c,first:t,last:d,name:c==="direct-call"?t:void 0,recoveredLoop:h})}statementBoundary(t){let n=0;for(let r=t;r",":"].includes(t[n].lexeme)&&[ne.TokenKind.Identifier,ne.TokenKind.Number].includes(t[n+1]?.kind)){n+=2;continue}if(t[n].lexeme==="["){let r=t.findIndex((i,o)=>o>n&&i.lexeme==="]");if(r<0||!Ne(this.source,t.slice(n+1,r),[]))return!1;n=r+1;continue}return!1}return!0}looksLikeDirectCall(t){return t.length<3||t[0].kind!==ne.TokenKind.Identifier&&t[0].kind!==ne.TokenKind.Keyword?!1:t.some(n=>n.lexeme==="(")}consumeTerminator(t,n){return this.current()?.lexeme===";"?this.consume():(this.diagnostics.push(He(this.source,"missing-semicolon",`${t} is missing the required semicolon.`,[n])),n)}current(){return this.tokens[this.position]}consume(){let t=this.tokens[this.position];return this.position+=1,t}};function rT(e,t){let n=0;for(let r=t;ri.lexeme===";"))return r}return e.length-1}function iT(e,t){let n=rT(e,t);if(n>t)return n;let r=e[t],i=Ie(r[0])==="IF",o=Ie(r[0])==="ELSE"&&Ie(r[1])==="IF";if(!i&&!o||r.some(d=>Ie(d)==="THEN"))return t;let s=i&&r.length===1,c=["AND","OR","NOT"].includes(Ie(r[r.length-1])??""),g=["AND","OR"].includes(Ie(e[t+1]?.[0])??"");if(!s&&!c&&!g)return t;for(let d=t+1;dIe(h)==="THEN"))return d;return t}function oT(e){let t=(0,Ky.tokenize)(e),n=e.length===0?1:e.split(/\r\n|\r|\n/).length,r=Array.from({length:n},(m,T)=>tT(t,T)),i=[],o=[],s=[],c=new Array(n),g=[],d=[];for(let m=0;mT.kind==="dim"&&T.datatype!==void 0))if(!Vy.DATATYPE_SET.has(m.datatype.toUpperCase())){let T=m.datatypeRange??m.range,D=`${T.start.line}:${T.start.character}`;if(h.has(D))continue;h.add(D),s.push({code:"unknown-datatype",message:`Unknown datatype '${m.datatype}'.`,severity:"error",range:T})}let v=(0,ki.sourceRange)(e,{start:0,end:e.length});return{source:e,tokens:t,statements:i,blocks:o,diagnostics:s,lines:c,...v}}});var qm=S(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.formatQuickScriptLexically=Mm;sr.formatQuickScriptStructure=Em;sr.formatQuickScript=hT;var L=at(),Ia=rr(),sT=Ri();function Rm(e){return e===void 0||e.kind===L.TokenKind.Newline||e.kind===L.TokenKind.EOF}function Ca(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].kind!==L.TokenKind.Whitespace&&e[n].kind!==L.TokenKind.Newline)return e[n]}function xm(e,t){for(let n=t+1;n0&&/^[ \t\f\v]+$/.test(e[e.length-1])&&e.pop()}function ba(e){or(e);let t=e[e.length-1];t!==void 0&&!t.endsWith(` +`)&&!t.endsWith("\r")&&e.push(" ")}function cT(e,t){if(e[t].lexeme!=="-"||xm(e,t)?.kind!==L.TokenKind.Number)return!1;let n=Ca(e,t);return n===void 0||n.kind===L.TokenKind.Operator||n.kind===L.TokenKind.Punctuation&&["(","[",",",";",":"].includes(n.lexeme)}function aT(e,t){return e.split(/\r\n|\r|\n/).map(r=>r.replace(/[ \t\f\v]+$/g,"")).join(t)}function Mm(e,t={}){let n=t.lineEnding??`\r +`,r=e.replace(/\r\n|\r|\n/g,n),i=(0,Ia.tokenize)(r);if(i.some(d=>d.kind===L.TokenKind.String&&!d.lexeme.endsWith('"'))||i.some(d=>d.kind===L.TokenKind.Unknown&&d.lexeme==="}"))return{text:r,changed:r!==e};let o=[],s=!1,c=!1;for(let d=0;d")||_e(v,t.regionBlockCodeBegin??"{region"))&&(c=!0),T!==void 0&&(T.kind===L.TokenKind.Identifier||T.kind===L.TokenKind.Keyword||T.kind===L.TokenKind.Datatype)&&(o.push(" "),s=!0);continue}o.push(h.lexeme)}let g=aT(o.join(""),n);return{text:g,changed:g!==e}}function uT(e){let t=Number.isInteger(e.indentSize)&&e.indentSize>=1&&e.indentSize<=10?e.indentSize:4;return e.insertSpaces===!1?" ":" ".repeat(t)}function lT(e){let t=(0,Ia.tokenize)(e),n=[];for(let r of t)r.kind===L.TokenKind.EOF||r.kind===L.TokenKind.Newline||(r.kind===L.TokenKind.Whitespace?n.length>0&&n[n.length-1]!==" "&&n.push(" "):n.push(r.lexeme));return n.join("").replace(/[ \t]+$/g,"")}function _e(e,t){return t!==void 0&&t.length>0&&e.toLowerCase().startsWith(t.toLowerCase())}function dT(e,t){return _e(e,t.blockCodeBegin??"{>")||_e(e,t.blockCodeEnd??"{<")||_e(e,t.blockCodeExclude??"{#")||_e(e,t.regionBlockCodeBegin??"{region")||_e(e,t.regionBlockCodeEnd??"{endregion")||_e(e,t.regionBlockCodeExclude??"{#")}function fT(e){let n=e.split(/\r\n|\r|\n/).slice(1,e.endsWith("}")?-1:void 0).filter(i=>i.trim().length>0);if(n.length===0)return"";let r=n[0].match(/^[ \t]*/)?.[0]??"";for(let i of n.slice(1)){let o=i.match(/^[ \t]*/)?.[0]??"";for(;r.length>0&&!o.startsWith(r);)r=r.slice(0,-1)}return r}function mT(e,t){let n=new Map;for(let r of(0,Ia.tokenize)(e)){if(r.kind!==L.TokenKind.Comment||r.range.end.line<=r.range.start.line)continue;let i=e.lastIndexOf(` +`,r.span.start-1)+1,o=e.slice(i,r.span.start),s=r.lexeme.trimStart();/^[ \t]*$/.test(o)&&s.startsWith("{")&&n.set(r.range.start.line,{token:r,directive:dT(s,t),contentIndent:fT(r.lexeme)})}return n}function Om(e,t,n){if(e.trim().length===0)return"";if(t.contentTargetIndent!==void 0&&t.contentOriginalIndent!==void 0)return t.alignClosingLine===!0&&n===t.endLine?t.targetIndent+e.trimStart():e.startsWith(t.contentOriginalIndent)?t.contentTargetIndent+e.slice(t.contentOriginalIndent.length):t.contentTargetIndent+e.trimStart();if(e.startsWith(t.originalIndent))return t.targetIndent+e.slice(t.originalIndent.length);let r=e.match(/^[ \t]*/)?.[0]??"",i=t.targetIndent.length-t.originalIndent.length;return i<0?e.slice(Math.min(-i,r.length)):i>0?t.targetIndent.slice(0,i)+e:e}function Em(e,t={}){let n=t.lineEnding??`\r +`,r=e.replace(/\r\n|\r|\n/g,n),i=(0,sT.parseQuickScript)(r),o=r.split(n),s=mT(r,t),c=[],g=uT(t),d=0,h=0,v,m=t.removeEmptyLines===!1?Number.POSITIVE_INFINITY:Math.max(0,t.allowedNumberOfEmptyLines??1);for(let D=0;D")||_e(x,t.regionBlockCodeBegin??"{region"))&&M?.directive!==!0&&(d+=1)}let T=c.join(n);return{text:T,changed:T!==e,diagnostics:i.diagnostics}}function hT(e,t={}){let n=Mm(e,t),r=Em(n.text,t);return{...r,changed:r.text!==e}}});var xi=S(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.KNOWN_FUNCTIONS=void 0;Oi.KNOWN_FUNCTIONS=[{name:"Abs",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Ack",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"ActivateApp",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"AddPermission",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckAll",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckDisplay",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckGroup",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckRecent",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckSelect",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckSelectedGroup",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckSelectedPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckSelectedTag",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almAckTag",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almDefQuery",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almMoveWindow",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almQuery",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectAll",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectGroup",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectionCount",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectItem",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSelectTag",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSetQueryByName",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almShowStats",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressAll",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressDisplay",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressGroup",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressRetain",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressSelected",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressSelectedGroup",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressSelectedPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressSelectedTag",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almSuppressTag",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almUnselectAll",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"almUnsuppressAll",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"AnnotateLayout",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUFindAlarmGroupInstance",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUFindFileInstance",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUFindPrinterInstance",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetAlarmGroupText",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetConfigurationFilePath",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetInstanceCount",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetPrinterJobCount",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetPrinterName",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetPrinterStatus",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetQueryAlarmState",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetQueryFromPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetQueryProcessingState",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUGetQueryToPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUIsInstanceUsed",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUSetAlarmGroupText",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUSetQueryAlarmState",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUSetQueryFromPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUSetQueryToPriority",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUSetTimeoutValues",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUStartInstance",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUStartQuery",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUStopInstance",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUStopQuery",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"APUTranslateErrorCode",category:"IT-functions Ground Teil 1",sourceComment:"IT-functions Ground Teil 1"},{name:"ArcCos",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"ArcSin",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"ArcTan",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"AttemptInvisibleLogon",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ChangePassword",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ChangeWindowColor",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"Clip_cursor",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"ConvertTemp",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Cos",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"CreateFilenameFromDate",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"DateTimeGMT",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"DialogStringEntry",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"DialogValueEntry",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"DText",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"EnableDisableKeys",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"Exp",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"FileCopy",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FileDelete",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FileMove",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FilePrint",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"FileReadFields",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FileReadMessage",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FileSelect",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"FileWriteFields",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"FileWriteMessage",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"GeoArea",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"GeoEqualSideArea",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"GeoVolume",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"GetAccountStatus",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetCursorPosition",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"GetDiscOffMsg",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetDiscOnMsg",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetNodeName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetPropertyD",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetPropertyI",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetPropertyM",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"GetWindowName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"Hide",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"Hide_cursor",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"HideSelf",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetLastError",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetPenName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetTimeAtScooter",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetTimeStringAtScooter",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetValue",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetValueAtScooter",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTGetValueAtZone",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTScrollLeft",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTScrollRight",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTSelectTag",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTSetPenName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTUpdateToCurrentTime",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTZoomIn",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"HTZoomOut",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"InfoAppActive",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoAppStatus",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"InfoAppTitle",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoAppTitleExpand",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"InfoDisk",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoDosEnv",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoFile",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoInTouchAppDir",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoResources",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"InfoWinEnv",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"INIReadInteger",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"INIReadString",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"INIWriteInteger",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"INIWriteString",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"Int",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"InTouchVersion",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"InvisibleVerifyCredentials",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IODisableFailover",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOForceFailover",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOGetAccessNameStatus",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOGetActiveSourceName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOGetApplication",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOGetNode",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOGetTopic",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOReinitAccessName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOReinitialize",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IORRGetItemActiveState",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"IORRGetSystemInfo",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"IORRWriteState",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"IOSetAccessName",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOSetItem",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOSetRemoteReferences",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IOStartUninitConversations",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IsAnyAsyncFunctionBusy",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IsAssignedRole",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"IsNodeAppRunning",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXAppActivate",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXCheckDate",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXConvertDate",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXConvertDateString",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXConvertDateTime",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXConvertDateTimeString",category:"IT-functions Ground Teil 2",sourceComment:"IT-functions Ground Teil 2"},{name:"ITXCreateDate",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ITXCreateDateTime",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ITXCreateDateTimeUTC",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ITXCreateDirectory",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXCreateSubDirectory",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXGetProfileInt",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXGetProfileString",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXPutProfileInt",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXPutProfileString",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXRemoveDirectory",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXRemoveSubDirectory",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXResizeApplication",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXSetLocalTime",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXSetSystemDate",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXSetSystemTime",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXShowHelpByNumber",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ITXShowHelpByString",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ITXStartAppInDirectory",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"ITXWindowCtrl",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"LaunchTagViewer",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Log",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"LogMessage",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"LogN",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Logoff",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"LogonCurrentUser",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"MessageBox",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"MetFromStdFluid",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"MetFromStdLinear",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"MetFromStdWeight",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"MoveWindow",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"NumberRecipes",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"OpenWindowsList",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Pi",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"PlaySound",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PostLogonDialog",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PrintHT",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PrintScreen",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PrintWindow",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptGetTrendType",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptLoadTrendCfg",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptPanCurrentPen",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptPanTime",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptPauseTrend",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptRefreshTrend",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSaveTrendCfg",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetCurrentPen",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetPen",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetPenEx",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetTimeAxis",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetTimeAxisToCurrent",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetTrend",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptSetTrendType",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptZoomCurrentPen",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ptZoomTime",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PwdUserAdd",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PwdUserDelete",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PwdUserEdit",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PwdUserGetIndex",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"PwdUserRead",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"QueryGroupMembership",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"RecipeDelete",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeGetMessage",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeLoad",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeSave",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeSelectNextRecipe",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeSelectPreviousRecipe",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeSelectRecipe",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"RecipeSelectUnit",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"ReloadWindowViewer",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"RestartWindowViewer",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Restore_clip",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Round",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"SendKeys",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SendMail",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SendSMTPMail",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SendSMTPMailwAttachment",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SetCursorPosition",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"SetPropertyD",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SetPropertyI",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SetPropertyM",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SetTagEU",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SetWindowPrinter",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Sgn",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Show",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Show_cursor",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"ShowAt",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ShowHome",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"ShowTopLeftAt",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Sin",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"SPCEXSetDataset",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetEndDate",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetEndTime",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetOutputFile",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetProduct",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetStartDate",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SPCEXSetStartTime",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLAppendStatement",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLClearParam",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLClearStatement",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLClearTable",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLCommit",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLConnect",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLCreateTable",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLDelete",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLDisconnect",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLDropTable",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLEnd",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLErrorMsg",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLExecute",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLFirst",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLGetRecord",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLInsert",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLInsertEnd",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLInsertExecute",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLInsertPrepare",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLLast",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLLoadStatement",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLManageDSN",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLNext",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLNumRows",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLPrepareStatement",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLPrev",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLRollback",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSelect",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamChar",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamDate",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamDateTime",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamDecimal",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamFloat",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamInt",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamLong",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamNull",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetParamTime",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLSetStatement",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLTransact",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLUpdate",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"SQLUpdateCurrent",category:"Intouch AddOns functions",sourceComment:"Intouch AddOns functions"},{name:"Sqrt",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"StartApp",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"StdFromMetFluid",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"StdFromMetLinear",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"StdFromMetWeight",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"StringASCII",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringChar",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringCompare",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringCompareEncrypted",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"StringCompareNoCase",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringFromGMTTimeToLocal",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringFromIntg",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringFromReal",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringFromTime",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringFromTimeLocal",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringInString",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringLeft",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringLen",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringLower",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringMid",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringReplace",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringRight",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringSpace",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringTest",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringToIntg",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringToReal",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringTrim",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"StringUpper",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"SwitchDisplayLanguage",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SysBeep",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"SystemIsNT",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"TagExists",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"Tan",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"Text",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"Trunc",category:"IT-functions-Math",sourceComment:"IT-functions-Math"},{name:"TseGetClientId",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"TseGetClientNodeName",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"TseQueryRunningOnClient",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"TseQueryRunningOnConsole",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"UTCDateTime",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcAddItem",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcClear",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcDeleteItem",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcDeleteSelection",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcErrorMessage",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcFindItem",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcGetItem",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcGetItemData",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcInsertItem",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcLoadList",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcLoadText",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcSaveList",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcSaveText",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wcSetItemData",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WindowState",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWAlwaysOnTop",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWBeep32",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWCntx32",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWContext",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWControl",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWControlPanel",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWDosCommand",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWExecute",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWGetServiceExeName",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWGetServiceName",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWGetServiceStatus",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWIsDayLightSaving",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWMoveWindow",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWMultiMonitorNode",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWPoke",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWPrimaryMonitorHeight",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWPrimaryMonitorWidth",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWRequest",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWServiceControl",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWServiceControlError",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWShutDownWin95",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWShutDownWinNT40",category:"IT-functions-System",sourceComment:"IT-functions-System"},{name:"WWStartApp",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"wwStringFromTime",category:"Intouch String functions",sourceComment:"Intouch String functions"},{name:"WWVirtualMonitorHeight",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"},{name:"WWVirtualMonitorWidth",category:"IT-functions Ground Teil 3",sourceComment:"IT-functions Ground Teil 3"}]});var jm=S(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.completions=pT;cr.hoverAt=yT;cr.documentSymbols=TT;var Gm=xi(),Nm=Zn(),Am=at();function gT(e,t){return(t.line>e.start.line||t.line===e.start.line&&t.character>=e.start.character)&&(t.line{let i=r.label.toUpperCase();t.has(i)||t.set(i,r)};for(let r of Nm.KEYWORDS)n({label:r,kind:"keyword",detail:"QuickScript keyword"});for(let r of Nm.DATATYPES)n({label:r,kind:"datatype",detail:"QuickScript datatype"});for(let r of Gm.KNOWN_FUNCTIONS)n({label:r.name,kind:"function",detail:r.sourceComment||r.category});for(let r of e.symbols)n({label:r.name,kind:"variable",detail:r.datatype?`Local ${r.datatype} variable`:"Local variable"});for(let r of e.document.statements.filter(i=>i.kind==="call"&&i.name!==void 0))n({label:r.name,kind:"call-target",detail:"Document call target"});return[...t.values()].sort((r,i)=>r.label.localeCompare(i.label,"en",{sensitivity:"base"}))}function yT(e,t){let n=e.document.tokens.find(o=>gT(o.range,t));if(n===void 0)return;if(n.kind===Am.TokenKind.Keyword)return{label:n.lexeme.toUpperCase(),detail:"QuickScript keyword",range:n.range};if(n.kind===Am.TokenKind.Datatype)return{label:n.lexeme.toUpperCase(),detail:"QuickScript datatype",range:n.range};let r=e.symbols.find(o=>o.name.toUpperCase()===n.lexeme.toUpperCase());if(r!==void 0)return{label:r.name,detail:r.datatype?`Local ${r.datatype} variable`:"Local variable",range:n.range};let i=Gm.KNOWN_FUNCTIONS.find(o=>o.name.toUpperCase()===n.lexeme.toUpperCase());if(i!==void 0)return{label:i.name,detail:i.sourceComment||i.category,range:n.range};if(/^(SYS_|MA_|SMEL_|HER_)/i.test(n.lexeme))return{label:n.lexeme,detail:"Hermes system variable",range:n.range}}function TT(e){let t=e.document.blocks.map(s=>({name:s.kind.toUpperCase(),kind:s.kind,range:s.range,selectionRange:s.opener,children:[]})),n=[];for(let s of e.document.blocks)s.parentId===void 0?n.push(t[s.id]):t[s.parentId].children.push(t[s.id]);let r=[...e.symbols.map(s=>({name:s.name,kind:"variable",range:s.range,selectionRange:s.selectionRange,children:[]})),...n],i=e.metadata,o=i.nameRange??i.triggerRange??e.document.range;if(i.scriptType==="QuickFunction"&&i.name!==void 0)return[{name:i.name,kind:"function",range:e.document.range,selectionRange:o,children:r}];if(i.scriptType==="Window"&&i.name!==void 0){let s=i.event===void 0?r:[{name:i.event,kind:"event",range:e.document.range,selectionRange:i.eventRange??o,children:r}];return[{name:i.name,kind:"window",range:e.document.range,selectionRange:o,children:s}]}if(i.scriptType==="Application"){let s=i.name??"Application",c=i.event===void 0?r:[{name:i.event,kind:"event",range:e.document.range,selectionRange:i.eventRange??o,children:r}];return[{name:s,kind:"application",range:e.document.range,selectionRange:o,children:c}]}if(i.scriptType==="DataChange"||i.scriptType==="Condition"){let s=i.scriptType==="DataChange"?"data-change":"condition";return[{name:i.name??i.trigger??i.scriptType,kind:s,range:e.document.range,selectionRange:o,children:r}]}if(i.scriptType==="KeyScript"){let s=i.name??"KeyScript",c=i.shortcut===void 0?r:[{name:i.shortcut,kind:"event",range:e.document.range,selectionRange:i.shortcutRange??o,children:r}];return[{name:s,kind:"key-script",range:e.document.range,selectionRange:o,children:c}]}return r}});var Fm=S(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.QUALITY_DIAGNOSTIC_CODES=void 0;kt.qualityDiagnostics=DT;var Sn=at();kt.QUALITY_DIAGNOSTIC_CODES={nonAsciiIdentifier:"quickscript.naming.nonAsciiIdentifier",windowWhitespace:"quickscript.naming.windowWhitespace",windowNonAscii:"quickscript.naming.windowNonAscii"};var _T=/^[A-Za-z0-9_$#-]+$/,vT=new Set(["HIDE","SHOW"]),bT=new Set(["HIDE","INFOAPPSTATUS","INFOAPPTITLEEXPAND","MOVEWINDOW","PRINTWINDOW","SHOW","SHOWAT","SHOWTOPLEFTAT","WINDOWSTATE"]);function CT(e){return e.document.tokens.filter(t=>![Sn.TokenKind.Whitespace,Sn.TokenKind.Newline,Sn.TokenKind.Comment,Sn.TokenKind.EOF].includes(t.kind))}function IT(e){return e.lexeme.startsWith('"')&&e.lexeme.endsWith('"')?e.lexeme.slice(1,-1):e.lexeme.slice(1)}function ST(e){let t=CT(e),n=[];for(let r=0;r")){if(vT.has(i)&&t[r+1]?.kind===Sn.TokenKind.String){n.push(t[r+1]);continue}bT.has(i)&&t[r+1]?.lexeme==="("&&t[r+2]?.kind===Sn.TokenKind.String&&n.push(t[r+2])}}return n}function Sa(e,t,n,r){if(n!=="off")return{code:e,message:t,severity:n,range:r.range,source:"intouch-quality"}}function DT(e,t={}){let n=[],r=new Set,i=t.nonAsciiIdentifiers??"warning";for(let o of e.identifiers){let s=o.name.toUpperCase();if(_T.test(o.name)||r.has(s))continue;r.add(s);let c=Sa(kt.QUALITY_DIAGNOSTIC_CODES.nonAsciiIdentifier,`Avoid non-ASCII characters in identifier '${o.name}'.`,i,o);c!==void 0&&n.push(c)}for(let o of ST(e)){let s=IT(o);if(/\s/u.test(s)){let c=Sa(kt.QUALITY_DIAGNOSTIC_CODES.windowWhitespace,"Avoid whitespace in window names.",t.windowWhitespace??"warning",o);c!==void 0&&n.push(c)}if(/[^\x00-\x7f]/u.test(s)){let c=Sa(kt.QUALITY_DIAGNOSTIC_CODES.windowNonAscii,"Avoid non-ASCII characters in window names.",t.windowNonAscii??"warning",o);c!==void 0&&n.push(c)}}return n}});var $m=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.quickFunctionDeclarations=Hm;$t.quickFunctionNames=OT;$t.analyzeQuickScript=xT;$t.definitionAt=MT;$t.referencesAt=ET;var wT=Ri(),Lm=ya(),PT=xi(),Da=tr(),Ht=at();function Wm(e,t){return(t.line>e.start.line||t.line===e.start.line&&t.character>=e.start.character)&&(t.line=0;n-=1)if(![Ht.TokenKind.Whitespace,Ht.TokenKind.Newline,Ht.TokenKind.Comment].includes(e[n].kind))return e[n]}function RT(e,t){for(let n=t+1;n({name:n.name,kind:"parameter",range:n.nameRange})),metadata:t}]}function Hm(e,t={}){return Um(e,(0,Lm.extractDocumentMetadata)(e,t))}function OT(e){let t=new Map;for(let n of Hm(e))t.set(n.name.toUpperCase(),n.name);return[...t.values()]}function xT(e,t={}){let n=(0,wT.parseQuickScript)(e),r=(0,Lm.extractDocumentMetadata)(e,{fileName:t.fileName,tokens:n.tokens}),i=[...n.diagnostics,...r.diagnostics],o=[],s=Um(e,r),c=new Map,g=new Set(PT.KNOWN_FUNCTIONS.map(T=>T.name.toUpperCase()));for(let T of s)g.add(T.name.toUpperCase());for(let T of t.knownFunctionNames??[])g.add(T.toUpperCase());for(let T of n.statements.filter(D=>D.kind==="dim"&&D.name!==void 0&&D.nameRange!==void 0)){let D=T.name.toUpperCase();if(c.get(D)!==void 0){i.push({code:"duplicate-local",message:`Local variable '${T.name}' is already declared.`,severity:"error",range:T.nameRange});continue}let A={id:o.length,name:T.name,kind:"variable",range:T.range,selectionRange:T.nameRange,datatype:T.datatype,scopeId:0};o.push(A),c.set(D,A)}let d=new Map;for(let T of o)d.set((0,Da.offsetAt)(e,T.selectionRange.start),T);let h=new Set;for(let T of n.statements.filter(D=>D.kind==="call"&&D.name!==void 0&&D.nameRange!==void 0))h.add((0,Da.offsetAt)(e,T.nameRange.start));let v=r.trigger===void 0||r.triggerRange===void 0?[]:[{name:r.trigger,kind:"trigger",range:r.triggerRange}],m=s.flatMap(T=>[{name:T.name,kind:"function",range:T.nameRange},...T.parameters]);r.trigger!==void 0&&r.triggerRange!==void 0&&m.push({name:r.trigger,kind:"global",range:r.triggerRange});for(let T of o)m.push({name:T.name,kind:"local",range:T.selectionRange});for(let T=0;T"){m.push({name:D.lexeme,kind:"member",range:D.range});continue}let x=c.get(D.lexeme.toUpperCase()),p=RT(n.tokens,T),l=h.has(D.span.start)||p?.lexeme==="(";if(m.push({name:D.lexeme,kind:l?"function":x===void 0?"global":"local",range:D.range}),l&&!g.has(D.lexeme.toUpperCase())&&i.push({code:"unknown-function",message:`Unknown QuickScript function '${D.lexeme}'.`,severity:"warning",range:D.range}),x!==void 0||l){let C=l?"call":p?.lexeme==="="?"write":"read";v.push({name:D.lexeme,kind:C,range:D.range,declarationId:x?.id})}}return{document:n,scopes:[{id:0,kind:"document",range:n.range,symbolIds:o.map(T=>T.id)}],symbols:o,references:v,identifiers:m,quickFunctions:s,metadata:r,diagnostics:i}}function MT(e,t){let n=e.references.find(r=>Wm(r.range,t));return n?.declarationId===void 0?void 0:e.symbols[n.declarationId]?.selectionRange}function ET(e,t,n=!0){let r=e.references.find(i=>Wm(i.range,t));return r?.declarationId===void 0?[]:e.references.filter(i=>i.declarationId===r.declarationId&&(n||i.kind!=="declaration")).map(i=>i.range)}});var wa=S(ue=>{"use strict";var qT=ue&&ue.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),$e=ue&&ue.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&qT(t,e,n)};Object.defineProperty(ue,"__esModule",{value:!0});$e(Zn(),ue);$e(ya(),ue);$e(qm(),ue);$e(xi(),ue);$e(jm(),ue);$e(Ri(),ue);$e(Fm(),ue);$e($m(),ue);$e(tr(),ue);$e(at(),ue);$e(rr(),ue)});var Ra=S(ke=>{"use strict";var NT=ke&&ke.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),AT=ke&&ke.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),GT=ke&&ke.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;ie.start.line||t.line===e.start.line&&t.character>=e.start.character)&&(t.linen.kind==="call"),symbols:LT(e.uri,t.metadata)}}var Ei=class{constructor(){this.workspaceDocuments=new Map,this.openDocuments=new Map}replaceWorkspaceDocuments(t){this.workspaceDocuments.clear();for(let n of t)this.workspaceDocuments.set(zt(n.uri),ka(n))}updateWorkspaceDocument(t){this.workspaceDocuments.set(zt(t.uri),ka(t))}removeWorkspaceDocument(t){this.workspaceDocuments.delete(zt(t))}updateDocument(t){this.openDocuments.set(zt(t.uri),ka({uri:t.uri,text:t.getText()}))}removeDocument(t){this.openDocuments.delete(zt(t))}entries(){let t=new Map(this.workspaceDocuments);for(let[n,r]of this.openDocuments)t.set(n,r);return[...t.values()].sort((n,r)=>n.uri.localeCompare(r.uri,"en"))}entry(t){let n=zt(t);return this.openDocuments.get(n)??this.workspaceDocuments.get(n)}symbols(){return this.entries().flatMap(t=>t.symbols)}quickFunctions(t){let n=t?.toUpperCase();return this.symbols().filter(r=>r.kind==="QuickFunction"&&(n===void 0||r.name.toUpperCase()===n))}knownFunctionNames(){let t=new Map;for(let n of this.quickFunctions())t.set(n.name.toUpperCase(),n.name);return[...t.values()].sort((n,r)=>n.localeCompare(r,"en",{sensitivity:"base"}))}uniqueQuickFunction(t){let n=this.quickFunctions(t);return n.length===1?n[0]:void 0}symbolAt(t,n){return this.entry(t)?.symbols.find(r=>Pa(r.definitionRange,n))}symbolNameAt(t,n){let r=this.entry(t),i=this.symbolAt(t,n);return i?.kind!=="QuickFunction"?r?.calls.find(o=>Pa(o.range,n))?.name:i!==void 0?i.name:r?.calls.find(o=>Pa(o.range,n))?.name}references(t,n){let r=t.toUpperCase(),i=n?this.quickFunctions(t).map(s=>({name:s.name,kind:"declaration",uri:s.uri,range:s.definitionRange})):[],o=this.entries().flatMap(s=>s.calls.filter(c=>c.name.toUpperCase()===r).map(c=>({name:c.name,kind:"call",uri:s.uri,range:c.range})));return[...i,...o].sort((s,c)=>s.uri.localeCompare(c.uri,"en")||s.range.start.line-c.range.start.line||s.range.start.character-c.range.start.character)}diagnostics(t){let n=this.entry(t);if(n===void 0)return[];let r=[];for(let i of n.symbols.filter(o=>o.kind==="QuickFunction"))this.quickFunctions(i.name).length>1&&r.push({code:"duplicate-quickfunction",message:`QuickFunction '${i.name}' has multiple workspace definitions.`,severity:"warning",range:i.definitionRange,source:"intouch-metadata"});for(let i of n.calls)this.quickFunctions(i.name).length>1&&r.push({code:"ambiguous-quickfunction",message:`QuickFunction call '${i.name}' has multiple workspace definitions.`,severity:"warning",range:i.range,source:"intouch-metadata"});return r}};ke.WorkspaceSymbolIndex=Ei;ke.WorkspaceFunctionIndex=Ei});var Km=S(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.serverCapabilities=WT;Ye.diagnosticsFor=BT;Ye.formattingEdits=QT;Ye.symbolsFor=VT;Ye.definitionFor=KT;Ye.referencesFor=XT;Ye.completionsFor=YT;Ye.hoverFor=JT;var z=la(),Rt=wa(),Bm=Ra();function WT(){return{capabilities:{textDocumentSync:z.TextDocumentSyncKind.Incremental,documentFormattingProvider:!0,documentSymbolProvider:!0,definitionProvider:!0,referencesProvider:!0,completionProvider:{resolveProvider:!1},hoverProvider:!0}}}function UT(e){switch(e){case"keyword":return z.CompletionItemKind.Keyword;case"datatype":return z.CompletionItemKind.TypeParameter;case"variable":return z.CompletionItemKind.Variable;case"call-target":return z.CompletionItemKind.Method;default:return z.CompletionItemKind.Function}}function HT(e){switch(e){case"error":return z.DiagnosticSeverity.Error;case"information":return z.DiagnosticSeverity.Information;case"hint":return z.DiagnosticSeverity.Hint;default:return z.DiagnosticSeverity.Warning}}function Qm(e){return e instanceof Bm.WorkspaceSymbolIndex?e:void 0}function $T(e){let t=Qm(e);return t===void 0?e:t.knownFunctionNames()}function Dn(e,t){return(0,Rt.analyzeQuickScript)(e.getText(),{knownFunctionNames:$T(t),fileName:(0,Bm.documentFileName)(e.uri)})}function zT(e){let t=e.metadata.parameters.map(r=>`${r.name}: ${r.datatype}`).join(", "),n=e.metadata.returnType===void 0?"":`: ${e.metadata.returnType}`;return`${e.name}(${t})${n}`}function Vm(e){let t=zT(e);return e.metadata.description===void 0?t:`${t} + +${e.metadata.description}`}function BT(e,t,n={}){let r=Dn(e,t),i=Qm(t)?.diagnostics(e.uri)??[];return[...r.diagnostics,...i,...(0,Rt.qualityDiagnostics)(r,n.qualityDiagnostics)].map(o=>({code:o.code,message:o.message,range:o.range,severity:HT(o.severity),source:o.source??"intouch-language"}))}function QT(e,t){let n=(0,Rt.formatQuickScript)(e.getText(),t);return n.changed?[z.TextEdit.replace(z.Range.create(z.Position.create(0,0),e.positionAt(e.getText().length)),n.text)]:[]}function VT(e){let t=r=>{switch(r){case"variable":return z.SymbolKind.Variable;case"function":return z.SymbolKind.Function;case"window":return z.SymbolKind.Namespace;case"event":return z.SymbolKind.Event;case"application":return z.SymbolKind.Module;case"data-change":return z.SymbolKind.Event;case"condition":return z.SymbolKind.Event;case"key-script":return z.SymbolKind.Event;default:return z.SymbolKind.Struct}},n=r=>z.DocumentSymbol.create(r.name,void 0,t(r.kind),r.range,r.selectionRange,r.children.map(n));return(0,Rt.documentSymbols)(Dn(e)).map(n)}function KT(e,t,n){let r=(0,Rt.definitionAt)(Dn(e,n),t);if(r!==void 0)return z.Location.create(e.uri,r);if(n===void 0)return;let i=n.symbolNameAt(e.uri,t);if(i===void 0)return;let o=n.uniqueQuickFunction(i);return o===void 0?void 0:z.Location.create(o.uri,o.definitionRange)}function XT(e,t,n,r){let i=(0,Rt.referencesAt)(Dn(e,r),t,n);if(i.length>0)return i.map(s=>z.Location.create(e.uri,s));if(r===void 0)return[];let o=r.symbolNameAt(e.uri,t);return o===void 0?[]:r.references(o,n).map(s=>z.Location.create(s.uri,s.range))}function YT(e,t){let n=new Set((t?.symbols()??[]).filter(o=>!o.callable).map(o=>o.name.toUpperCase())),r=(0,Rt.completions)(Dn(e,t)).filter(o=>o.kind!=="call-target"||!n.has(o.label.toUpperCase())),i=new Map(r.map(o=>[o.label.toUpperCase(),{label:o.label,kind:UT(o.kind),detail:o.detail}]));for(let o of t?.quickFunctions()??[]){let s=t?.quickFunctions(o.name).length??0;i.set(o.name.toUpperCase(),{label:o.name,kind:z.CompletionItemKind.Function,detail:s>1?`Ambiguous workspace QuickFunction (${s} definitions)`:Vm(o)})}return[...i.values()].sort((o,s)=>o.label.localeCompare(s.label,"en",{sensitivity:"base"}))}function JT(e,t,n){let r=n?.symbolAt(e.uri,t);if(r!==void 0&&r.kind!=="QuickFunction"){let s=r.metadata.event??r.metadata.shortcut??r.metadata.trigger,c=s===void 0?r.kind:`${r.kind}: ${s}`;return{contents:{kind:"markdown",value:`**${r.name}** + +${c}`},range:r.definitionRange}}let i=n?.symbolNameAt(e.uri,t);if(i!==void 0){let s=n.quickFunctions(i);if(s.length>1)return{contents:{kind:"markdown",value:`**${i}** + +Ambiguous workspace QuickFunction (${s.length} definitions).`}};if(s.length===1)return{contents:{kind:"markdown",value:`**${s[0].name}** + +${Vm(s[0])}`},range:n?.entry(e.uri)?.calls.find(c=>c.name.toUpperCase()===i.toUpperCase()&&c.range.start.line===t.line&&c.range.start.character<=t.character&&c.range.end.character>t.character)?.range}}let o=(0,Rt.hoverAt)(Dn(e,n),t);return o===void 0?void 0:{contents:{kind:"markdown",value:`**${o.label}** + +${o.detail}`},range:o.range}}});var Ym=S(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.readSettings=ZT;qi.formattingSettings=e_;function lt(e){return typeof e=="object"&&e!==null?e:{}}function Xm(e){return typeof e=="number"?e:void 0}function Oa(e){return typeof e=="boolean"?e:void 0}function Bt(e){return typeof e=="string"?e:void 0}function xa(e){let t=Bt(e)?.toLowerCase();return t!==void 0&&["off","hint","information","warning","error"].includes(t)?t:void 0}function ZT(e){let t=lt(e),n=t.VBI===void 0?t:lt(t.VBI),r=lt(n.formatter),i=lt(r.EmptyLine),o=lt(r.BC),s=lt(r.Region),c=lt(r.Misc),g=lt(n.diagnostics),d=lt(g.naming);return{allowedNumberOfEmptyLines:Xm(i.allowedNumberOfEmptyLines),removeEmptyLines:Oa(i.RemoveEmptyLines),removeEmptyLinesInComments:Oa(i.EmptyLinesAlsoInComment),blockCodeBegin:Bt(o.BlockCodeBegin),blockCodeEnd:Bt(o.BlockCodeEnd),blockCodeExclude:Bt(o.BlockCodeExclude),regionBlockCodeBegin:Bt(s.BlockCodeBegin),regionBlockCodeEnd:Bt(s.BlockCodeEnd),regionBlockCodeExclude:Bt(s.BlockCodeExclude),insertSpaces:Oa(c.ReplaceTabToSpaces),indentSize:Xm(c.IndentSize),qualityDiagnostics:{nonAsciiIdentifiers:xa(d.nonAsciiIdentifiers),windowWhitespace:xa(d.windowWhitespace),windowNonAscii:xa(d.windowNonAscii)}}}function e_(e,t){return{...e,insertSpaces:e.insertSpaces??t.insertSpaces,indentSize:e.indentSize??t.tabSize}}});var t_=exports&&exports.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n_=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r_=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i(Jm=(e.workspaceFolders?.map(n=>n.uri)??(e.rootUri===null||e.rootUri===void 0?[]:[e.rootUri])).filter(n=>n.startsWith("file:")).map(n=>(0,qa.fileURLToPath)(n)),await u_(Jm),(0,Ot.serverCapabilities)()));ve.onInitialized(async()=>{let e=await ve.workspace.getConfiguration({section:"VBI"});Ni=(0,Na.readSettings)({VBI:e}),Qt()});ve.onDidChangeConfiguration(e=>{Ni=(0,Na.readSettings)(e.settings),Qt()});ve.onDidChangeWatchedFiles(e=>{(async()=>{for(let t of e.changes.filter(n=>/\.(?:vbi|vi)$/i.test(n.uri))){if(t.type===Ma.FileChangeType.Deleted){Ae.removeWorkspaceDocument(t.uri);continue}try{Ae.updateWorkspaceDocument({uri:t.uri,text:await Ea.promises.readFile((0,qa.fileURLToPath)(t.uri),"utf8")})}catch{Ae.removeWorkspaceDocument(t.uri)}}Qt()})()});ze.onDidOpen(e=>{Ae.updateDocument(e.document),Qt()});ze.onDidChangeContent(e=>{Ae.updateDocument(e.document),Qt()});ze.onDidClose(e=>{Ae.removeDocument(e.document.uri),ve.sendDiagnostics({uri:e.document.uri,diagnostics:[]}),Qt()});ve.onDocumentFormatting(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?[]:(0,Ot.formattingEdits)(t,(0,Na.formattingSettings)(Ni,e.options))});ve.onDocumentSymbol(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?[]:(0,Ot.symbolsFor)(t)});ve.onDefinition(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?void 0:(0,Ot.definitionFor)(t,e.position,Ae)});ve.onReferences(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?[]:(0,Ot.referencesFor)(t,e.position,e.context.includeDeclaration,Ae)});ve.onCompletion(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?[]:(0,Ot.completionsFor)(t,Ae)});ve.onHover(e=>{let t=ze.get(e.textDocument.uri);return t===void 0?void 0:(0,Ot.hoverFor)(t,e.position,Ae)});ve.onShutdown(()=>{});ze.listen(ve);ve.listen(); +//# sourceMappingURL=server.js.map diff --git a/docs/architecture/intouch-core-preparation.md b/docs/architecture/intouch-core-preparation.md index 19672cb..ef89d0c 100644 --- a/docs/architecture/intouch-core-preparation.md +++ b/docs/architecture/intouch-core-preparation.md @@ -1,52 +1,129 @@ -# InTouch Core Preparation Audit - -## Current extension shape - -The repository is a single npm-managed VS Code extension. `package.json` -registers language ID `intouch` for `.vbi` and `.vi`, a TextMate grammar, -snippets, a formatter command, and the theme. `src/extension.ts` is the VS Code -activation boundary; compiled output is `out/` and the bundle is -`dist/extension.js`. - -No `packages/`, tokenizer, parser, language server, LSP transport, semantic -definition/reference provider, or diagnostics provider exists yet. - -## Migration inventory - -| Current source | Current responsibility | Future target module | Dependencies | Risk | -| --- | --- | --- | --- | --- | -| `src/extension.ts` | Activates VS Code command and formatting provider | `packages/vscode-extension` | VS Code API, formatter adapter | Keep VS Code effects at this boundary. | -| `src/functions.ts` | Reads editor configuration, creates `TextEdit`s, invokes formatting | `packages/vscode-extension` plus thin adapter | VS Code API and formatter pipeline | Separate editor I/O from pure formatting without changing output. | -| `src/formatCore.ts` | Whitespace, keyword, string/comment preservation, and indentation pipeline | `packages/core/formatter` | `const.ts`, `nestingdef.ts`, formatter tests | Regex ordering and fixture compatibility are behavior-sensitive. | -| `src/const.ts` | Formatter keywords and operators | `packages/core/language-data` | Formatter pipeline | Grammar has overlapping but not identical vocabulary. | -| `src/nestingdef.ts` | Nesting/exclusion definitions | `packages/core/syntax` | Formatter pipeline | Existing blocks must be characterized by tests before extraction. | -| `syntaxes/intouch.tmLanguage.json` | TextMate lexical highlighting, functions, data types, and scopes | Retain in `packages/vscode-extension` initially; later generate/shared language data only after validation | VS Code TextMate grammar | Highlighting patterns are not a parser specification. | -| `language-configuration.json`, `snippets/vbi.json` | Editor rules and authoring snippets | `packages/vscode-extension` | VS Code contribution model | Keep declarative assets out of core. | -| `src/test/suite/*.test.ts` and `testfiles/` | Extension-host tests and formatter golden fixtures | Core formatter test suite plus extension integration tests | Mocha, VS Code test host | Fixtures should stay byte-for-byte stable unless behavior intentionally changes. | - -## Language knowledge and duplication - -Language vocabulary currently appears in the grammar and formatter constants; -block behavior appears in the formatter and language configuration. This is -useful evidence but not yet one canonical typed model. The first core milestone -should inventory these sets, write characterization tests for their intentional -overlap/divergence, and then extract a VS Code-independent language-data and -formatter surface. - -## Diagnostics and semantic navigation - -The README lists diagnostics such as unmatched `IF`/`ENDIF` and `FOR`/`NEXT` as -planned. No diagnostics implementation was found. A future tokenizer and -structure parser should first support formatter-safe token boundaries, block -matching, declarations, and scopes; only then should diagnostics, document -symbols, definitions, and references be implemented. - -## Recommended next autonomous block - -1. Create a read-only language-data inventory from grammar, formatter constants, - nesting definitions, and fixtures. -2. Add characterization tests that protect existing formatter output and record - intentional vocabulary differences. -3. Define a small VS Code-independent `intouch-core` API and extract only pure - language data and formatting helpers behind it. -4. Do not create LSP transport or Serena QuickScript integration in that block. +# InTouch Language Architecture + +## Dependency direction + +```text +QuickScript source + | + v +packages/core + tokenizer -> document metadata extractor -> parser -> semantics + -> quality diagnostics + -> language features + | | + | +-> structural formatter + | | + v v +packages/language-server (LSP transport and protocol conversion) + | + v +src/extension.ts (thin VS Code language client) +``` + +`packages/core` is editor-independent. The formatter directly consumes core +tokens and parser structure; it does not depend on LSP types or transport. +`packages/language-server` converts core results into LSP responses. The VS +Code extension starts that server, synchronizes `intouch` documents and `VBI` +settings, and retains the existing grammar, snippets, theme, and formatter +command contributions. + +## Canonical language layers + +The tokenizer is the only lexical interpretation used by the parser, +formatter, and semantic services. Tokens retain their original lexemes and +zero-based UTF-16, half-open offset and position ranges. Strings, brace +comments, apostrophe comments, incomplete input, dashed identifiers, and +QuickScript operators therefore pass through one shared scanner. + +The recoverable parser is the only structural interpretation. It represents +`DIM`, `CALL`, `IF`/`ELSE`/`ENDIF`, `FOR`/`NEXT`, and the repository-evidenced +`WHILE`/`NEXT` form. Blocks expose opener, body, middle, closer, parent, child, +and full ranges. Invalid nesting and missing closers produce diagnostics +without preventing later lines from being parsed or formatted. + +The formatter exposes `formatQuickScript(source, options)` and returns a +`FormatResult`. Its first stage formats lexical tokens while emitting string +and comment lexemes unchanged. Its second stage uses parser line structure for +indentation and configured comment block markers. Formatting is deterministic, +document-wide, and idempotent. Historical regex and character-scanning +formatter implementations have been removed. + +## Semantic model and language features + +Each `.vbi` or `.vi` document has one canonical metadata model and one local +scope. Metadata is extracted only from comment tokens, with explicit `@` +fields taking priority over structured legacy headers and filename fallbacks. +`DIM` declarations provide local variable symbols and case-insensitive uses. +A URI-aware incremental language-server index adds cross-file QuickFunction +definitions and call references without moving editor or transport types into +core. + +Core diagnostics currently cover: + +- missing `ENDIF` and `NEXT`; +- invalid block nesting and duplicate `ELSE`; +- duplicate local `DIM` declarations; +- unknown `DIM` datatypes; +- unresolved function calls. + +Quality diagnostics are a separate post-semantic layer. They report technically +valid but less portable or maintainable names and never change parser validity, +symbols, navigation, or formatter output. Quality diagnostics use +`intouch-quality` as their LSP source, while syntax and semantic diagnostics +continue to use `intouch-language`. + +The initial quality rules cover non-ASCII identifiers and literal InTouch +window names containing whitespace or non-ASCII characters. Identifier +candidates come from the semantic model, including local and external uses plus +QuickFunction and parameter declarations extracted from metadata comment +tokens. Window strings are inspected only as arguments of documented window +commands/functions. + +The language service provides metadata-aware document symbols, local and +cross-file definition/reference results, completion, and hover. Completion includes QuickScript keywords and +datatypes, document locals and call targets, and known InTouch/Hermes function +names. The function catalog is generated from +`syntaxes/intouch.tmLanguage.json`; it is not maintained as a parallel manual +list. Hover descriptions use only document facts or labels already present in +that source grammar. + +## Language server and VS Code boundary + +The language server supports initialize/shutdown, incremental text document +synchronization, document formatting, document symbols, definition, +references, completion, hover, and publish diagnostics. Feature conversion is +unit-tested independently, and a child-process protocol test exercises the +server lifecycle plus cross-file workspace requests without a VS Code process. +The initial workspace scan reads `.vbi` and `.vi` once. Open/change and watched +file events replace only the affected URI entry; requests do not reread or +reparse every workspace file. + +`src/extension.ts` contains no parser, formatter, or semantic logic. It starts +`dist/server.js` through `vscode-languageclient`, registers `vbi-format` as a +request to VS Code's standard format command, and lets the language client own +all providers. The TextMate grammar remains the syntax-highlighting surface; +snippets and the theme remain declarative VS Code assets. + +## Deliberate limits before manual HIL + +- Formatting is document-wide; selection/range formatting is not advertised. +- Local-variable navigation remains document-local. +- QuickFunction metadata supplies callable workspace symbols, cross-file + definition/reference locations, signatures, hover, and completion without + inventing executable declaration syntax. +- Window, Application, DataChange, Condition, and KeyScript documents are + non-callable workspace symbols. Window events are limited to `OnShow`, + `WhileRunning`, and `OnClose`. +- Signature metadata is canonical, but an LSP Signature Help provider remains + planned. +- Duplicate Window-event diagnostics remain deferred until version/backup + exports can be distinguished reliably. +- Project-wide variable symbol indexing and cross-file variable navigation are + not implemented. +- `.vbi` and `.vi` remain excluded from Serena semantic indexing; the native + language server provides their semantics. + +The automated implementation is considered ready for manual HIL only after +compile, core tests, protocol tests, VS Code extension-host tests, lint, +prepublish bundling, VSIX packaging, and repository freshness checks pass. The +manual procedure is documented in [Manual QuickScript HIL](../testing/manual-hil.md). diff --git a/docs/language/document-metadata.md b/docs/language/document-metadata.md new file mode 100644 index 0000000..0c16cc9 --- /dev/null +++ b/docs/language/document-metadata.md @@ -0,0 +1,183 @@ +# QuickScript Document Metadata + +## Purpose and syntax boundary + +QuickScript document metadata describes the script container around executable +QuickScript. It is stored inside an ordinary brace comment and is not native +QuickScript syntax. The tokenizer emits the complete block as comment trivia; +the metadata extractor is a separate consumer of that same lossless comment +token. + +```text +{> +@ScriptType QuickFunction +@Name GetSomething +@Description Returns something useful. +@Param Source MESSAGE Source value. +@Param Index INTEGER Requested index. +@Returns MESSAGE +{<} +``` + +Metadata text cannot produce parser or semantic diagnostics as executable code. +Metadata-specific diagnostics use the `intouch-metadata` source. Formatting may +move the whole comment block to its structural indentation while preserving its +content and relative internal indentation. + +## Canonical document types + +The editor-independent core model supports these canonical script types: + +- `QuickFunction`: a callable workspace function; +- `DataChange`: a data-change script with optional trigger metadata; +- `Condition`: a condition script with optional trigger and condition event; +- `Application`: an application script; +- `Window`: a non-callable window event script; +- `KeyScript`: a non-callable canonical InTouch shortcut script; +- `Generic`: valid QuickScript without a more specific classification; +- `Unknown`: structured metadata named a script type that is not yet modeled. + +`KeyScript` is an InTouch document type, not a project-specific helper type. +Its shortcut is modeled separately from executable QuickScript. + +## Explicit fields + +Field names are matched case-insensitively. The canonical spellings below are +recommended. Leading and trailing horizontal whitespace is ignored; field +values are otherwise preserved. + +| Field | Value | +| --- | --- | +| `@ScriptType` | One canonical script type listed above. | +| `@Name` | Document, function, window, or script name. | +| `@Description` | One-line sourced description. | +| `@Event` | Window event, or a sourced Application/Condition event. | +| `@Trigger` | DataChange/Condition trigger symbol. | +| `@Shortcut` | KeyScript shortcut such as `Ctrl+d`. | +| `@Param` | `Name TYPE Description...`; description is optional. | +| `@Returns` | QuickFunction return datatype. | + +The initial parameter datatypes are `DISCRETE`, `INTEGER`, `MESSAGE`, and +`REAL`. Parameters remain ordered. The model contains enough signature data for +completion and hover. LSP Signature Help is intentionally deferred until a +separate provider is implemented. + +Unknown `@` fields produce the informational `unknown-metadata-field` +diagnostic. Missing or malformed values produce `invalid-metadata-value`. +Unknown explicit script types produce `invalid-script-type`. + +## Window scripts + +Only these Window events are canonical in the initial model: + +- `OnShow`; +- `WhileRunning`; +- `OnClose`. + +```text +{> +@ScriptType Window +@Name MainOverview +@Event OnShow +@Description Initializes the window when it is opened. +{<} +``` + +Event values are matched case-insensitively and normalized to the canonical +spelling. Other Window events produce `invalid-window-event`. A Window script +is indexed as a non-callable Window container plus a WindowEvent symbol, so its +name does not resolve `CALL MainOverview()` and is not offered as a function +completion. A Window return type conflicts with its document type. + +Duplicate Window-event diagnostics are deliberately deferred. Versioned or +backup exports cannot yet be distinguished reliably enough to avoid false +positives. Documents with explicit Window metadata are still grouped by Window +name and event in the workspace symbol model. + +## KeyScripts + +A KeyScript can use explicit metadata: + +```text +{> +@ScriptType KeyScript +@Name OpenPrintWindow +@Shortcut Ctrl+d +{<} +``` + +Legacy `Type: KeyScript` and `Shortcut:` fields are also supported. KeyScripts +appear as non-callable document symbols and never enter QuickFunction +resolution or completion. + +## Legacy header compatibility + +Structured classic headers remain supported: + +```text +{> +Script: +Type: QuickFunction +Name: GetSomething + +Parameters: +Message Source +Integer Index +{<} +``` + +The extractor recognizes structured legacy labels only in a comment containing +`Script:` or a `Type:` plus an identity field. Supported real-corpus mappings +include: + +- `QuickFunction` -> `QuickFunction`; +- `datachange` -> `DataChange`, with `Tagname[.field]:` as its trigger; +- `ConditionalScript` -> `Condition`, with `Condition:` as its trigger and + `Condition Type:` as its sourced event; +- `ApplicationScript` -> `Application`; +- `KeyScript` -> `KeyScript`, with `Shortcut:` as its shortcut. + +Legacy parameter lines use `TYPE Name Description...`. Arbitrary comments that +merely contain words such as `function`, `window`, or `script` are not metadata. + +## Source priority and conflicts + +Each field follows this priority: + +1. explicit `@` metadata; +2. structured classic headers; +3. unambiguous InTouch export metadata when a separate source becomes + available; +4. filename fallback; +5. `Generic` or `Unknown`. + +The current real corpus represents export context through structured classic +headers, so there is no separate non-comment export source yet. The canonical +model reserves that source without guessing one. + +When explicit and legacy values disagree, the explicit value wins and a +warning-level `metadata-conflict` identifies the lower-priority value. Known +field/type incompatibilities also use `metadata-conflict`; they are never +QuickScript syntax errors. + +Filename conventions are fallback hints only. In the absence of structured +metadata, `QF_`, `DCH_`, `CS_`, `APP_`, and `KEY_` can classify a document and +remove a trailing numeric version. Metadata always overrides the filename. + +## Workspace behavior + +The language server incrementally indexes `.vbi` and `.vi` documents by URI. +Each entry retains canonical metadata, symbol kind, callability, definition +range, and call references. A QuickFunction declared in +`SomethingCompletelyDifferent.vbi` is therefore resolved by `@Name`, without a +`QF_` prefix. + +Workspace QuickFunctions provide cross-file diagnostics, completion, hover, +definition, and references. A workspace definition has richer information and +takes precedence over a static native or Hermes catalog entry with the same +name. Duplicate QuickFunction definitions produce deterministic duplicate and +ambiguity diagnostics; definition requests never choose an arbitrary file. + +Trigger metadata is represented as a semantic reference without inventing a +global-variable definition or producing an `unknown-variable` diagnostic. +Project-wide tag-dictionary indexing remains outside this metadata block. diff --git a/docs/language/quickscript-grammar.md b/docs/language/quickscript-grammar.md new file mode 100644 index 0000000..eaf7830 --- /dev/null +++ b/docs/language/quickscript-grammar.md @@ -0,0 +1,146 @@ +# QuickScript Grammar + +This document is the canonical syntax contract for the QuickScript subset +implemented by the extension. It describes InTouch QuickScript, not Visual +Basic, VBA, VBScript, Pascal, PowerShell, or JavaScript. + +## Evidence and dialect boundary + +The grammar is based, in descending order of authority, on: + +1. AVEVA InTouch and System Platform documentation for QuickScript statement + termination, brace comments, control structures, and operator families; +2. repository QuickScript in `LanguageDefinition/test.vbi` and the `.vbi` / `.vi` + formatter fixtures; +3. `packages/core/src/languageData.ts`, `syntaxes/intouch.tmLanguage.json`, and + `snippets/vbi.json`; +4. parser, formatter, language-server, and behavior-baseline tests. + +The AVEVA QuickScript .NET manuals also describe `FOR EACH`, `ELSEIF`, +`TRY`/`CATCH`, and a `WHILE` form. Those constructs are not assumed to be valid +classic InTouch QuickScript merely because the related dialect supports them. +`FOR EACH`, `ELSEIF`, and `TRY`/`CATCH` remain outside the implemented grammar. +The repository-evidenced `WHILE expression` / `NEXT;` form remains supported. + +## Lexical elements + +The tokenizer is the lexical authority. The grammar consumes its identifiers, +keywords, datatypes, number and string literals, operators, punctuation, +comments, newlines, and EOF token. Comments are trivia for syntax. Newlines are +statement recovery boundaries but do not replace required semicolons. + +Identifiers include normal, system, and instance-qualified names supported by +the tokenizer. Member and instance access use `.`, `->`, and `:`. Bracketed +index access is accepted after an assignable or expression primary. + +## Expressions + +The expression parser uses the following precedence, from lowest to highest: + +```ebnf +expression = logicalOr ; +logicalOr = logicalAnd, { ("OR" | "XOR" | "|"), logicalAnd } ; +logicalAnd = comparison, { "AND", comparison } ; +comparison = shift, { ("==" | "<>" | "<" | "<=" | ">" | ">=" | "IS"), shift } ; +shift = additive, { ("SHL" | "SHR"), additive } ; +additive = multiplicative, { ("+" | "-"), multiplicative } ; +multiplicative = unary, { ("*" | "/" | "%" | "MOD"), unary } ; +unary = { "+" | "-" | "NOT" | "!" | "~" }, postfix ; +postfix = primary, { callSuffix | memberSuffix | indexSuffix } ; +primary = callExpression | identifier | number | string | "TRUE" | + "FALSE" | "NULL" | "EOF" | "(", expression, ")" ; +callExpression = "CALL", callable, "(", [ arguments ], ")" ; +callSuffix = "(", [ expression, { ",", expression } ], ")" ; +memberSuffix = ("." | "->" | ":"), identifier ; +indexSuffix = "[", expression, "]" ; +``` + +Function names are syntactic identifiers. Whether a callable is a known +InTouch, Hermes, or workspace QuickFunction is a separate semantic diagnostic. + +## Statements + +```ebnf +document = { statement | comment } ; + +statement = dimStatement | assignment | callStatement | + directCallStatement | commandStatement | + ifHeader | elseHeader | endifStatement | + forHeader | nextStatement | whileHeader | exitForStatement | + returnStatement ; + +dimStatement = "DIM", identifier, { ",", identifier }, "AS", datatype, ";" ; +assignment = assignable, "=", expression, ";" ; +callStatement = callExpression, ";" ; +directCallStatement = callable, "(", [ arguments ], ")", ";" ; +commandStatement = commandName, expression, ";" ; +arguments = expression, { ",", expression } ; +assignable = identifier, { memberSuffix | indexSuffix } ; +callable = identifier, { memberSuffix } ; +commandName = "ACTIVATEAPP" | "HIDE" | "PLAYSOUND" | "SENDKEYS" | + "SHOW" | "STARTAPP" ; + +ifHeader = "IF", expression, "THEN" ; +elseHeader = "ELSE" ; +endifStatement = "ENDIF", ";" ; + +forHeader = "FOR", identifier, "=", expression, "TO", expression, + [ "STEP", expression ] ; +nextStatement = "NEXT", ";" ; +whileHeader = "WHILE", expression ; + +exitForStatement = "EXIT", "FOR", ";" ; +returnStatement = "RETURN", [ expression ], ";" ; +``` + +`IF` bodies may start on the same physical line. Inline forms such as +`IF condition THEN EXIT FOR; ENDIF;` are therefore valid. A multiline `IF` +condition may continue across newlines when the preceding physical line ends +in `AND`, `OR`, or `NOT`. + +`FOR` and the repository-evidenced `WHILE` form are closed by `NEXT;`. +`EXIT FOR;` never opens or closes a loop. + +A function call may be used as a statement with or without `CALL`, as shown by +the repository corpus. Real HIL QuickScript also establishes `CALL` as an +expression prefix, including assignment values and nested arguments such as +`Value = CALL Foo();` and `Value = Bar(CALL Foo());`. Syntax validation and +callable-name resolution remain separate. Other bare expressions are not +statements. In particular, `X + X + 1;` is invalid while `X = X + 1;` is an assignment. +The listed classic command statements use the repository-evidenced +parenthesis-free form; the same names may still use normal call syntax when +followed by `(`. + +## Terminators + +| Production | Required terminator | +| --- | --- | +| `DIM`, assignment, `CALL`, direct call, command, `EXIT FOR`, `RETURN` | `;` | +| `ENDIF`, `NEXT` | `;` | +| `IF ... THEN`, `ELSE`, `FOR ... TO ... [STEP ...]`, `WHILE ...` | none | + +Consequently, `THEN;` and `ELSE;` contain an unexpected terminator. A newline +does not satisfy a missing terminator on an assignment or other terminated +statement. + +## Recovery contract + +The parser reports the nearest violated expectation and then synchronizes at a +semicolon, a physical newline, `ELSE`, `ENDIF`, `NEXT`, another recognized +statement start, or EOF. A malformed loop-shaped header is recovered as an +open loop only for nesting, so its later `NEXT;` does not become a second +primary error. + +Missing delimiters, `THEN`, `TO`, `=`, and required semicolons are reported at +the missing position or conflicting token. Unexpected semicolons are reported +on the semicolon itself. Function-name and datatype validation remains semantic +and does not change expression syntax. + +## Known open areas + +- Classic InTouch evidence is still required before enabling `FOR EACH`, + `ELSEIF`, `TRY`/`CATCH`, or a different `WHILE` terminator. +- The tokenizer recognizes a small compatibility set of symbolic operators; + only the precedence groups documented above are parsed. +- The grammar validates syntax and nesting but does not perform type checking, + overload resolution, constant folding, or runtime tag validation. diff --git a/docs/language/quickscript.md b/docs/language/quickscript.md index 98bb823..544e186 100644 --- a/docs/language/quickscript.md +++ b/docs/language/quickscript.md @@ -9,39 +9,115 @@ semantic approximation. ## Current repository evidence -The current language knowledge is distributed deliberately across the extension: +Language knowledge is divided by responsibility: -- `syntaxes/intouch.tmLanguage.json`: lexical highlighting patterns, built-in - functions, data types, dot fields, and language scopes. -- `src/const.ts`: formatter keywords and operators. -- `src/nestingdef.ts` and `src/formatCore.ts`: block and indentation behavior. -- `language-configuration.json` and `snippets/vbi.json`: editor behavior and - authoring templates. -- `src/test/suite/testfiles/`: formatter fixtures that capture supported - formatting behavior. +- `syntaxes/intouch.tmLanguage.json` provides lexical highlighting patterns, + native InTouch functions, dot fields, and presentation scopes. +- `packages/core/src/languageData.ts` provides canonical lexical keywords, + datatypes, operators, and punctuation. +- `packages/core/src/tokenizer.ts` and `parser.ts` provide canonical lexical + and structural interpretation. +- `packages/core/src/generatedFunctionCatalog.ts` is generated from the + TextMate grammar for completion, hover, and known-function diagnostics; it + contains public native InTouch knowledge only and is not edited manually. +- `language-configuration.json` and `snippets/vbi.json` provide editor behavior + and authoring templates. +- core tests and `src/test/suite/testfiles/` capture parser and formatter + behavior, including incomplete input and real-world formatting cases. -The runtime vendor documentation remains authoritative when it conflicts with -repository evidence. Any semantic uncertainty is an escalation point; do not -guess from a similar language. +Runtime vendor documentation remains authoritative when it conflicts with +repository evidence. Semantic uncertainty is an escalation point; do not guess +from a similar language. -## Tooling boundary +The implemented statement, expression, terminator, and recovery contract is +defined in [QuickScript Grammar](quickscript-grammar.md). This scope document +describes ownership and architecture; it does not define a second grammar. -Serena excludes QuickScript until a native InTouch language server exists. -ProjectAtlas can index these files as neutral text for repository navigation -and lexical search only. Neither tool currently supplies QuickScript symbols, -definitions, references, or diagnostics. +## Tooling boundary -## Planned architecture +Serena uses the thin QuickScript adapter to connect to the native language +server. ProjectAtlas may index `.vbi` and `.vi` structurally for repository +navigation and lexical search. The extension's native language server supplies +QuickScript symbols, local and QuickFunction cross-file +definitions/references, completion, hover, formatting, and diagnostics. -The approved future target is: +## Implemented architecture ```text -packages/ - core/ - language-server/ - vscode-extension/ +packages/core -> packages/language-server -> src/extension.ts ``` -`core` and the language server must be independent of the VS Code API. This -document records the boundary only; it does not introduce the package split or -language-server implementation. +`packages/core` owns the editor-independent tokenizer, recoverable parser, +formatter, and semantic model. `packages/language-server` exposes those +features through LSP without depending on the VS Code API. `src/extension.ts` +is a thin VS Code language client. + +The tokenizer is the only lexical interpretation. The parser is the only block +and statement interpretation. Formatter and semantics reuse those models rather +than implementing independent string, comment, keyword, operator, whitespace, +or nesting recognition. + +The formatter directly consumes core tokens and parser structure. The language +server exposes the same engine through LSP formatting, and the VS Code client +uses that standard request. TextMate grammar, snippets, and themes remain +secondary presentation assets rather than semantic parsers. + +## Multiline brace-comment formatting + +A normal multiline `{ ... }` comment is reindented as one text block. The +formatter calculates the opening line's original and structural target indent, +then applies that same delta to every physical line through the closing brace. +Relative indentation and comment text are otherwise preserved. + +Brace-comment closure takes lexical priority over formatter metadata. A marker +such as `{> following code shall be nested}` that contains `}` on its physical +line is one closed comment token, so its nesting directive can affect the real +QuickScript lines that follow. A marker such as `{>` without `}` on that line +opens a multiline brace comment through the next `}`. Its complete span, +including a later `{<}` closing line, is comment trivia and cannot contribute +parser or semantic diagnostics. The formatter indents that metadata comment as +one block while preserving relative indentation inside it. + +Known callable resolution combines the generated public native InTouch catalog +with QuickFunction declarations discovered in the current document and +workspace. Workspace declarations remain a separate, richer source and take +precedence for definition and hover. Project-specific function catalogs must be +supplied externally or locally by a workspace and are not bundled by default; +isolated files may therefore report project calls as unresolved. + +Document/script classification comes from the canonical comment-based metadata +model described in [QuickScript Document Metadata](document-metadata.md). +Explicit `@` metadata and structured classic headers take priority over +filename conventions. QuickFunction names therefore do not require `QF_`. +Window scripts (`OnShow`, `WhileRunning`, `OnClose`) and canonical InTouch +KeyScripts/shortcuts are non-callable document symbols. + +## Diagnostic layers + +Diagnostics retain three separate responsibilities: + +- syntax diagnostics report invalid QuickScript structure or expressions; +- semantic diagnostics report invalid language facts such as unknown datatypes + or unresolved call targets; +- quality diagnostics report technically valid names that are less portable or + maintainable. + +The initial quality codes are: + +- `quickscript.naming.nonAsciiIdentifier` for non-ASCII characters in semantic + identifiers, including QuickFunction and parameter metadata; +- `quickscript.naming.windowWhitespace` for whitespace in a literal window name; +- `quickscript.naming.windowNonAscii` for non-ASCII characters in a literal + window name. + +Window rules apply only when the literal is the window argument of a documented +InTouch window operation. Ordinary strings and all comments remain isolated. +The rules do not rename symbols or affect formatting, hover, completion, +definition, or references. + +Each rule defaults to `warning` and accepts `off`, `hint`, `information`, +`warning`, or `error` through these existing `VBI` settings: + +- `VBI.diagnostics.naming.nonAsciiIdentifiers`; +- `VBI.diagnostics.naming.windowWhitespace`; +- `VBI.diagnostics.naming.windowNonAscii`. diff --git a/docs/testing/manual-hil.md b/docs/testing/manual-hil.md new file mode 100644 index 0000000..abaad1a --- /dev/null +++ b/docs/testing/manual-hil.md @@ -0,0 +1,103 @@ +# Manual QuickScript HIL + +## Purpose + +This checklist validates the local extension against real, user-selected +`.vbi` and `.vi` files. Automated fixtures cannot confirm compatibility with +the user's production QuickScript corpus, so completion of this checklist is a +manual release gate. + +## Preparation + +1. Keep an untouched backup or use disposable copies of the real files. +2. Build the local extension with `npm run vscode:prepublish`. +3. Start the Extension Development Host with the repository's VS Code launch + configuration, or install the locally generated VSIX from `npm run makePackage`. +4. Open one representative `.vbi` and one representative `.vi` file and verify + that the language mode is `Intouch`. + +## Language-server checks + +For each file: + +1. Confirm that activation completes without an extension-host or language + server error. +2. Open the Outline view and confirm that local `DIM` variables and nested + `IF`, `FOR`, and evidenced `WHILE` blocks appear with plausible ranges. +3. Trigger completion in code and verify representative keywords, datatypes, + InTouch functions, Hermes helpers, local variables, and existing `CALL` + targets. +4. Hover a local variable, a known native InTouch function, and a workspace + QuickFunction; + verify that unknown project identifiers do not receive invented details. +5. Use Go to Definition and Find All References on a local `DIM` variable. + Confirm that results stay within the document and do not jump to unrelated + member fields or similarly named identifiers. +6. Review diagnostics. Confirm that valid files do not show false missing-block, + duplicate-local, or datatype errors. + +## Formatter safety checks + +Use disposable copies and review the full diff after formatting: + +1. Run **Format Document** once. +2. Confirm expected keyword casing, operator spacing, comma/semicolon spacing, + blank-line policy, and indentation for nested `IF`/`ELSE`/`ENDIF`, + `FOR`/`NEXT`, and configured comment/region blocks. +3. Confirm that string contents, brace-comment contents, apostrophe-comment + contents, dashed identifiers, instance prefixes, UNC paths, and a final line + without a newline retain their meaning and content. +4. Confirm that inline `IF ... ENDIF`, `EXIT FOR`, multiline IF expressions, + and incomplete trailing statements are not dropped or structurally moved. +5. Run **Format Document** a second time and confirm that it produces no diff. + +## Diagnostic recovery check + +In a separate disposable document, introduce one case at a time: + +- an `IF` without `ENDIF`; +- a `FOR` without `NEXT`; +- an unexpected `ELSE`, `ENDIF`, or `NEXT`; +- a duplicate local `DIM` name with different casing; +- an unknown datatype. + +Confirm that the expected diagnostic appears at a useful range, later symbols +and completion remain available, and removing the error clears the diagnostic. + +## Result recording + +Record the tested file types, representative constructs, any formatter diff, +and pass/fail status. Do not merge, publish, tag, or release until the user +confirms this HIL gate. A HIL correction round may explicitly require a new +locally committed patch version for its uniquely identifiable VSIX artifact. + +## 2026-08-20 manual HIL round 1 + +Status: `MANUAL HIL ROUND 1: FAIL – FIXABLE FINDINGS`. + +- F1 LOW: The visible copyright range still ended in 2025. +- F2 HIGH: Standalone `{>` / `{<}` comment-nesting markers caused the tokenizer + to treat the enclosed content as one brace comment, so the formatter skipped + the required extra indentation. +- F3 HIGH: Unknown `CALL` targets were not resolved or diagnosed. +- F4 HIGH: Unknown function calls in expressions were not resolved or + diagnosed. + +Confirmed checks from the manual run: + +- PASS: language id is `intouch`. +- PASS: the language-server diagnostic pipeline is active. +- PASS: unknown datatype diagnostics are visible. +- PASS: general formatting outside extra nesting looked plausible in the + sampled file. + +The local fix build for the retest uses package version `1.5.1` and the +expected file name `intouch-language-1.5.1.vsix`. This is an HIL artifact only: +there is no tag, publish, Marketplace release, GitHub release, or merge to +`main`. + +Artifact created on 2026-08-20: + +- Path: `intouch-language-1.5.1.vsix` +- Size: 221154 bytes +- SHA-256: `5A2394245744E0790AD9151F513A4F62E1A8DCE9F497BE733F569D0764435428` diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..5881c71 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,41 @@ +import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin'; +import typescriptEslintParser from '@typescript-eslint/parser'; + +export default [ + { + ignores: [ + '**/*.js', + '.Temp/**', + '.projectatlas/**', + '.serena/**', + '.vscode-test/**', + 'dist/**', + 'node_modules/**', + 'out/**', + ], + }, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parser: typescriptEslintParser, + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + }, + plugins: { + '@typescript-eslint': typescriptEslintPlugin, + }, + rules: { + ...typescriptEslintPlugin.configs.recommended.rules, + }, + }, + { + files: ['scripts/**/*.ts', 'src/**/*.ts', 'src/**/*.tsx'], + rules: { + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-unused-vars': 'warn', + }, + }, +]; diff --git a/out/const.js b/out/const.js deleted file mode 100644 index 9f152a2..0000000 --- a/out/const.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.REGEX = exports.KEYWORDS = exports.TRENNER = exports.NO_SPACE_ITEMS = exports.DOUBLE_OPERATORS = exports.SINGLE_OPERATORS = exports.FORMATS = exports.BACKSLASH = exports.SQUOTE = exports.DQUOTE = exports.CRLF = exports.LF = exports.CR = exports.TAB = void 0; -// Character Constants -exports.TAB = "\t"; -exports.CR = "\r"; -exports.LF = "\n"; -exports.CRLF = "\r\n"; -exports.DQUOTE = '\"'; -exports.SQUOTE = "\'"; -exports.BACKSLASH = "\\"; -exports.FORMATS = [exports.TAB, exports.CR, exports.LF, exports.CRLF, exports.DQUOTE, exports.SQUOTE, exports.BACKSLASH]; -exports.SINGLE_OPERATORS = ['=', '+', '-', '<', '>', '*', '/', '%', '!', '~', '|']; -// export const SINGLE_OPERATORS: string[] = ['=', '+', '<', '>', '*', '/', '%', '!', '~', '|'];//23.01.2022 remove - as single Operator, because it can be used in variables -// BUGFIX 2025-09-25: '=>" was mistakenly defined instead of '>=' which caused -// the formatter to produce '> =' (separating '>' and '='). Corrected to '>='. -exports.DOUBLE_OPERATORS = ['==', '<>', '<=', '>=']; -exports.NO_SPACE_ITEMS = ['(', ')', '[', ']', ';']; -exports.TRENNER = [';', ' ']; -exports.KEYWORDS = [ - "NULL", "EOF", "AS", "IF", "ENDIF", "ELSE", "WHILE", "FOR", "next", "DIM", "THEN", - "EXIT", "EACH", "STEP", "IN", "RETURN", "CALL", "MOD", "AND", "NOT", "IS", - "OR", "XOR", "Abs", "TO", "SHL", "SHR", "discrete", "integer", "real", "message", - // Added math / intrinsic style functions for uppercasing in formatter 2025-09-25 - "sqr", "sin", "cos", "tan", "atn", "exp", "log", "int", "frac", "round", "rnd", "sqrt" -]; -/* Misk keywords from .json - MOD|AND|NOT|IS|OR|XOR|Abs|TO|SHL|SHR - IF|ENDIF|ELSE|WHILE|FOR|NEXT|DIM|THEN|EXIT|EACH|STEP|IN|RETURN|CALL - NULL|EOF|AS|True|False - discrete|integer|real|message -*/ -const gm_TAB_NOT_IN_COMMENT = new RegExp(/(?![^{]*})\t/, 'gm'); -const gm_MOR_1_WSP = new RegExp(/\s{1,}/, 'gm'); //more then one whitespace -const gm_MOR_2_WSP = new RegExp(/\s{2,}/, 'gm'); //more then two whitespace -const gm_MOR_2_WSP_NO_TAB = new RegExp(/\s{2,}(?\/\?\s]+)/, 'gm'); -const gm_GET_ALL_Numbers = new RegExp(/-?\d*\d/, 'gm'); -exports.REGEX = { - gm_TAB_NOT_IN_COMMENT, - gm_MOR_1_WSP, - gm_MOR_2_WSP, - g_CHECK_OPEN_COMMENT, - g_CHECK_CLOSE_COMMENT, - gm_GET_NESTING, - gm_GET_STRING, - gm_GET_WSP_IN_STRING, - gm_MOR_2_WSP_NO_TAB, - gm_GET_ALL_WORDS, - gm_GET_ALL_Numbers -}; -//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/out/extension.js b/out/extension.js deleted file mode 100644 index 38b468b..0000000 --- a/out/extension.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.activate = activate; -exports.deactivate = deactivate; -const vscode = require("vscode"); -const functions_1 = require("./functions"); -function activate(context) { - vscode.commands.registerCommand('vbi-format', () => { - const { activeTextEditor } = vscode.window; - if (activeTextEditor) { - //&& activeTextEditor.document.languageId === 'intouch' - const { document } = activeTextEditor; - let start = new vscode.Position(0, 0); - let end = new vscode.Position(document.lineCount - 1, document.lineAt(document.lineCount - 1).text.length); - let r = new vscode.Range(start, end); - return (0, functions_1.formatTE)(r); - } - }); - //https://vscode-docs.readthedocs.io/en/latest/extensionAPI/vscode-api/ - vscode.languages.registerDocumentFormattingEditProvider({ scheme: 'file', language: 'intouch' }, { - provideDocumentFormattingEdits(document) { - const { activeTextEditor } = vscode.window; - let start = new vscode.Position(0, 0); - let end = new vscode.Position(document.lineCount - 1, document.lineAt(document.lineCount - 1).text.length); - let r = new vscode.Range(start, end); - return (0, functions_1.formatTE)(r); - } - }); -} -//It will be invoked on deactivation -function deactivate() { } -//# sourceMappingURL=extension.js.map \ No newline at end of file diff --git a/out/formatCore.js b/out/formatCore.js deleted file mode 100644 index 3ca4f87..0000000 --- a/out/formatCore.js +++ /dev/null @@ -1,618 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.preFormat = preFormat; -exports.formatNestings = formatNestings; -exports.pureFormatPipeline = pureFormatPipeline; -// Pure formatting core extracted from formats.ts for test fixture generation without vscode dependency -const const_1 = require("./const"); -const nestingdef_1 = require("./nestingdef"); -function preFormat(text, config) { - // Normalize all line endings to CRLF up front while preserving intent of single blank lines. - // Replace any lone CR or LF with CRLF for internal processing. - text = text.replace(/\r\n|\n|\r/g, '\r\n'); - let txt = text.split(""); - let buf = ""; - let modified = 0; - let LineCount = 1; - let ColumnCount = 0; - let inComment = false; - let inString = false; - for (let i = 0; i <= txt.length - 1; i++) { - ColumnCount++; - if (modified > 0) { - modified--; - } - else { - modified = 0; - if (inString && txt[i] === '"') { - inString = false; - } - else if (!inComment && txt[i] === '"') { - inString = true; - } - if (txt[i] === '\n') { - if (inString) { - return text; // abort on multi-line string error - } - LineCount++; - ColumnCount = 0; - } - if (!inComment && txt[i] === '}') { - return text; // malformed comment closure - } - else if (txt[i] === '{') { - inComment = true; - } - else if (inComment && txt[i] === '}') { - inComment = false; - } - if (!inString) { - if (!(modified > 0) && (!inComment || config.KeywordUppercaseAlsoInComment)) { - // Keywords: replace slice with uppercase version WITHOUT consuming the following char ("after"). - // The previous implementation appended the following char and set modified accordingly, which could - // duplicate CR characters or interfere with blank line handling when the next char was a line break. - for (let kw of const_1.KEYWORDS) { - const slice = text.substr(i, kw.length); - const before = text[i - 1]; - const after = text[i + kw.length]; - if (slice.toLowerCase() === kw.toLowerCase()) { - if (CheckCRLForWhitespace(before) && CheckCRLForWhitespace(after)) { - buf += kw.toUpperCase(); - modified = kw.length - 1; // we consumed only the keyword characters - break; - } - } - } - // Double operators - if (!(modified > 0)) { - for (let op of const_1.DOUBLE_OPERATORS) { - const slice = text.substr(i, op.length); - if (slice === op) { - if (text[i - 1] !== ' ') - buf += ' '; - buf += op; - if (text[i + op.length] !== ' ') - buf += ' '; - modified = op.length - 1; - break; - } - } - } - // Single operators (improved spacing rules) - if (!(modified > 0)) { - const isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c || ''); - const isVarStart = (c) => /[A-Za-z]/.test(c || ''); - const isVarBody = (c) => /[A-Za-z0-9$-]/.test(c || ''); - for (let op of const_1.SINGLE_OPERATORS) { - if (txt[i] !== op) - continue; - // Detect multi-segment dashed identifier (e.g. new12-issue-dashed-variable) and keep dashes untouched. - // Clarified rule: even simple letter-dash-letter (a-b) or e-f is a valid variable token and must remain unspaced. - if (op === '-') { - const prevCh = text[i - 1]; - const nextCh = text[i + 1]; - // Determine if dash sits inside a variable token according to rule: - // Variable token pattern: [A-Za-z][A-Za-z0-9$-]* (segments after first letter may start with digits or $) - if (isVarBody(prevCh) && isVarBody(nextCh)) { - let start = i - 1; - while (start >= 0 && isVarBody(text[start])) - start--; - start++; - let end = i + 1; - while (end < text.length && isVarBody(text[end])) - end++; - const token = text.slice(start, end); - if (isVarStart(text[start])) { - // Treat every dash inside such a token as part of variable (including single letter-dash-letter) - buf += '-'; - modified = -1; - break; - } - } - } - // Determine unary minus (attach to number) => previous non-space char is an operator boundary - let unaryMinus = false; - if (op === '-') { - // look backwards for first non-space char already emitted in buf - let k = buf.length - 1; - while (k >= 0 && /[ \t]/.test(buf[k])) - k--; - const prev = k >= 0 ? buf[k] : undefined; - const nextChar = text[i + 1]; - if ((prev === undefined || /[=+\-*/,(;{}]/.test(prev) || prev === '\n' || prev === '\r') && /[0-9]/.test(nextChar)) { - unaryMinus = true; - } - } - // NEW rule: minus between identifiers (letters/underscore) must always be spaced as binary - let isBinary = !(op === '-' && unaryMinus); - // Space before (binary only) - if (isBinary && buf.length > 0 && !/[ \t\r\n]/.test(buf[buf.length - 1])) { - buf += ' '; - } - // Emit operator - buf += op; - // Space after (binary; plus always binary; keep unary minus tight with number) - if (isBinary) { - const next = text[i + 1]; - if (next && !/[ \t\r\n]/.test(next)) { - buf += ' '; - } - } - modified = -1; - break; - } - } - } - } - if (modified === 0) { - buf += txt[i]; - } - } - } - // normalize spaces before semicolon + trim line tails - // Sanitize any duplicated or stray carriage returns that may have been produced by earlier logic - // Examples seen in tests: lines ending with an embedded "\r" (content + \r + CRLF) resulting from prior keyword logic. - buf = buf - .replace(/\r\r\n/g, const_1.CRLF) // collapse CRCRLF -> CRLF - .replace(/\r(?!\n)/g, ''); // remove lone CR not followed by LF - let lines = buf.split(const_1.CRLF).map(l => l.replace(/\s+$/g, '')); - // Preserve single blank lines: collapse only runs >1 here (final pipeline still may apply config rules). - const newLines = []; - let emptyRun = 0; - for (const line of lines) { - if (line === '') { - emptyRun++; - if (emptyRun === 1) - newLines.push(''); // keep exactly one - continue; - } - else { - emptyRun = 0; - newLines.push(line); - } - } - let normalized = newLines.join(const_1.CRLF); - // Post-processing normalizations: - // 1. Ensure binary minus has space after when pattern like 'f -g' (but keep dashed identifiers like a-b-c) - // 2. Collapse accidental double (or more) spaces between '=' and '>' in malformed '= >' sequences - // Apply targeted spacing fix outside of quoted strings only. - normalized = (() => { - let out = ''; - let inStr = false; - let inComment = false; - let inIfDepth = 0; // >0 while inside IF (...) - const isIdentStart = (c) => /[A-Za-z]/.test(c); - for (let i = 0; i < normalized.length; i++) { - let ch = normalized[i]; - if (ch === '"') { - inStr = !inStr; - out += ch; - continue; - } - if (!inStr) { - // Track simple single-line comment braces { ... } - if (ch === '{') { - inComment = true; - out += ch; - continue; - } - if (ch === '}' && inComment) { - inComment = false; /* fall through to spacing rule below */ - } - // IF keyword normalization (only when not in comment) patterns: if( / if ( - if (!inComment && (ch === 'i' || ch === 'I') && (normalized[i + 1] === 'f' || normalized[i + 1] === 'F')) { - // Normalize IF keyword followed by '(': style 'IF (a ... ) THEN' - let j = i + 2; // after 'if' - while (j < normalized.length && normalized[j] === ' ') - j++; - if (normalized[j] === '(') { - out += 'IF ('; - // skip any spaces after '(' - let k = j + 1; - while (k < normalized.length && normalized[k] === ' ') - k++; - inIfDepth = 1; - i = k - 1; // continue from first non-space after '(' - continue; - } - } - // After ')' followed by THEN (case-insensitive, maybe without space) - if (!inComment && ch === ')') { - // If we're closing IF (...), remove any trailing spaces before ')' - if (inIfDepth > 0) { - while (out.length > 0 && out[out.length - 1] === ' ') - out = out.slice(0, -1); - inIfDepth = 0; - } - out += ')'; - // Handle THEN following - let j = i + 1; - while (j < normalized.length && normalized[j] === ' ') - j++; - const ahead = normalized.slice(j, j + 4).toLowerCase(); - if (ahead === 'then') { - out += ' THEN'; - i = j + 3; - continue; - } - // generic: ensure space after ')' if next is identifier - let next = normalized[i + 1]; - if (next && isIdentStart(next)) { - out += ' '; - } - continue; - } - // Ensure space before inline comment brace directly after THEN (THEN{ -> THEN {) - if (!inComment && (ch === 'T' || ch === 't') && normalized.slice(i, i + 4).toLowerCase() === 'then') { - let j = i + 4; - while (j < normalized.length && normalized[j] === ' ') - j++; - if (normalized[j] === '{') { - out += 'THEN '; - i = i + 3; // consumed THEN - continue; - } - } - // Rule: ensure single space after semicolon if next char (non newline) is not space - if (!inComment && ch === ';') { - const next = normalized[i + 1]; - if (next && next !== ' ' && next !== '\r' && next !== '\n') { - out += '; '; - continue; - } - } - // Rule: ensure space after closing '}' of a comment if next non-space is identifier - if (ch === '}') { - let j = i + 1; - while (j < normalized.length && normalized[j] === ' ') - j++; - if (j < normalized.length && isIdentStart(normalized[j]) && normalized[i + 1] !== ' ') { - out += '} '; - continue; - } - } - // Ensure space after pattern X -Y (but not inside dashed identifiers) => convert 'X -Y' to 'X - Y' - if (!inComment && /[A-Za-z0-9_]/.test(ch) && normalized[i + 1] === ' ' && normalized[i + 2] === '-' && /[A-Za-z_]/.test(normalized[i + 3])) { - // Check that this is not inside a multi-dash variable: look backwards to start of run and forwards to end - let back = out.length - 1; - while (back >= 0 && /[A-Za-z0-9$-]/.test(out[back])) - back--; - let forward = i + 3; - while (forward < normalized.length && /[A-Za-z0-9$-]/.test(normalized[forward])) - forward++; - const run = (out.slice(back + 1) + normalized.slice(i, forward)); - if (!/^[A-Za-z][A-Za-z0-9$-]*-[A-Za-z0-9$-]*-[A-Za-z0-9$-]*$/.test(run)) { - out += ch + ' - ' + normalized[i + 3]; - i += 3; - continue; - } - } - // Comma spacing in argument lists: remove preceding spaces, enforce single space after unless next is ) or EOL - if (!inComment && ch === ',') { - while (out.length > 0 && out[out.length - 1] === ' ') - out = out.slice(0, -1); - out += ','; - let next = normalized[i + 1]; - if (next && next !== ' ' && next !== ')' && next !== '\r' && next !== '\n') { - out += ' '; - } - continue; - } - } - out += ch; - } - return out.replace(/= {2,}>/g, '= >'); - })(); - // Final sanitation: remove any spaces directly before semicolons outside strings/comments (strings already preserved above) - // Remove spaces before semicolons only outside of string literals AND outside brace comments - normalized = normalized.split(const_1.CRLF).map(line => { - // Entire line is a single-line brace comment -> leave unchanged - if (/^\s*\{[^{}]*\}\s*$/.test(line)) - return line; - // Split code part and trailing brace comment (if any) - const braceIndex = line.indexOf('{'); - let codePart = line; - let commentPart = ''; - if (braceIndex !== -1) { - codePart = line.slice(0, braceIndex); - commentPart = line.slice(braceIndex); // keep as-is - } - // Within codePart, protect strings, then remove spaces before semicolons - const rebuilt = codePart.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).map(seg => { - if (seg.startsWith('"') && seg.endsWith('"')) - return seg; // string literal - return seg.replace(/(\S)\s+;/g, '$1;'); - }).join(''); - return rebuilt + commentPart; - }).join(const_1.CRLF); - return normalized; -} -function formatNestings(text, config) { - let buf = ""; - let codeFragments = []; - let regex = ""; - let nestingCounter = 0; - let nestingCounterPrevious = 0; - // Simple nesting only; multiline IF experimental logic removed - let multilineComment = false; - let thisLineBack = false; - // Multiline IF expression handling state - let multiIfActive = false; - let multiIfBaseDepth = 0; - let regexCB = `^${config.BlockCodeBegin}`; - let regexCEx = `^${config.BlockCodeExclude}`; - let regexCE = `^${config.BlockCodeEnd}`; - let regexRegionCB = `^${config.RegionBlockCodeBegin}`; - let regexRegionCEx = `^${config.RegionBlockCodeExclude}`; - let regexRegionCE = `^${config.RegionBlockCodeEnd}`; - const hadFinalCRLF = text.endsWith(const_1.CRLF); - codeFragments = text.split(const_1.CRLF); - for (let i = 0; i < codeFragments.length; i++) { - const prevMultilineState = multilineComment; // remember state entering this line - let isEmptyLine = false; - codeFragments[i] = codeFragments[i].replace(/\s+$/g, ""); - if (codeFragments[i] === "") - isEmptyLine = true; - if (codeFragments[i].search(const_1.REGEX.g_CHECK_OPEN_COMMENT) !== -1) - multilineComment = true; - if (codeFragments[i].search(const_1.REGEX.g_CHECK_CLOSE_COMMENT) !== -1) - multilineComment = false; - let str = codeFragments[i].match(const_1.REGEX.gm_GET_STRING); - if (str) { - // Protect ALL string literals on the line by masking spaces/tabs/semicolons - let protectedLine = codeFragments[i]; - for (const item of str) { - let strw = item.replace(/\s(? { - regex = `((?![^{]*})(${item}))`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) - exclude = true; - }); - if (!multiIfActive) { - if (inlineIf) { - // no nesting change - } - else if (continuationTrigger) { - multiIfActive = true; - multiIfBaseDepth = nestingCounterPrevious; // visual base - } - else { - for (let n of nestingdef_1.NESTINGS) { - if (!exclude) { - regex = `((?![^{]*})(\\b${n.keyword})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { - nestingCounter++; - } - } - if (n.multiline !== '') { - regex = `((?![^{]*})(\\b${n.multiline})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { } - } - if (n.middle !== '') { - regex = `((?![^{]*})(\\b${n.middle})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { - thisLineBack = true; - break; - } - } - regex = `((?![^{]*})(\\b${n.end})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { - nestingCounter--; - if (nestingCounter < 0) - nestingCounter = 0; - thisLineBack = true; - break; - } - } - } - } - else { - // multiIfActive - if (hasTHEN) { - nestingCounter++; // start IF body after this line - thisLineBack = true; // keep THEN at expression level - multiIfActive = false; - } - } - } - } - if (!isEmptyLine) { - // If we are inside a multi-line brace comment block OR this is the closing line - // (previous line(s) were multiline comment and this one ends with a closing brace) - // then we preserve indentation exactly as-is (no added / removed indent). - const closesMultiline = prevMultilineState && codeFragments[i].includes('}'); - if (multilineComment || closesMultiline || prevMultilineState) { - // Restore original line (with its original indentation) because we may have trimmed earlier logic - codeFragments[i] = originalLine; - multiIfActive = false; // reset multi-IF state when traversing comment blocks - if (nestingCounterPrevious !== nestingCounter) - nestingCounterPrevious = nestingCounter; - continue; - } - // Determine visual depth for real code lines - let visualDepth = nestingCounterPrevious; - if (multiIfActive) { - // lines after initial IF (continuation lines) show baseDepth+2 now (user request) - const initialLine = /\bIF\b/i.test(codeFragments[i]) && !/\bTHEN\b/i.test(codeFragments[i]); - if (!initialLine) - visualDepth = multiIfBaseDepth + 2; - } - else if (thisLineBack && /\bTHEN\b/i.test(codeFragments[i])) { - // THEN closing expression line: show continuation depth (base+2) and do NOT drop back - visualDepth = (multiIfBaseDepth + 2); - thisLineBack = false; // keep indentation level, prevent getNesting from skipping one level - } - const prefix = getNesting(visualDepth, thisLineBack, config); - codeFragments[i] = prefix + codeFragments[i]; - if (nestingCounterPrevious !== nestingCounter) - nestingCounterPrevious = nestingCounter; - thisLineBack = false; - } - } - // Final trailing whitespace cleanup - codeFragments = codeFragments.map(l => l.replace(/[ \t]+$/g, '')); - for (let i = 0; i < codeFragments.length; i++) { - const isLast = i === codeFragments.length - 1; - if (!isLast) - buf += codeFragments[i] + const_1.CRLF; - else { - if (codeFragments[i] !== '') { - buf += codeFragments[i]; - if (hadFinalCRLF) - buf += const_1.CRLF; - } - } - } - // Collapse multiple inner spaces (not leading indentation) outside of strings and outside single-line brace comments - const collapsed = buf.split(const_1.CRLF).map(line => { - if (line.trim() === '') - return line; - // Mask single-line brace comments { ... } to preserve interior spacing - const comments = line.match(/\{[^{}\r\n]*\}/g) || []; - const commentTokens = []; - let masked = line; - comments.forEach((c, idx) => { - const token = `@@C${idx}@@`; - commentTokens.push(c); - masked = masked.replace(c, token); - }); - // Split by string literals (simple non-escaped quote handling) - const segments = masked.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).filter(s => s !== ''); - let rebuilt = ''; - segments.forEach(seg => { - if (seg.startsWith('"') && seg.endsWith('"')) { - rebuilt += seg; // keep string literal - } - else { - const m = seg.match(/^(\s*)(.*)$/); - if (m) { - const ind = m[1]; - const rest = m[2].replace(/ {2,}/g, ' '); - rebuilt += ind + rest; - } - else { - rebuilt += seg.replace(/ {2,}/g, ' '); - } - } - }); - // Restore comments - commentTokens.forEach((c, idx) => { - rebuilt = rebuilt.replace(`@@C${idx}@@`, c); - }); - return rebuilt; - }).join(const_1.CRLF); - return collapsed; -} -function getNesting(n, thisLineBack, config) { - let temp = ""; - if (n !== 0) { - // Determine indent unit based on configuration - const useSpaces = (config.ReplaceTabToSpaces !== false); // default true - const indentSize = (typeof config.IndentSize === 'number' && config.IndentSize >= 1 && config.IndentSize <= 10) ? config.IndentSize : 4; - const indentUnit = useSpaces ? ' '.repeat(indentSize) : '\t'; - for (let i = 0; i < n; i++) { - if (thisLineBack) { - thisLineBack = false; - } - else { - temp += indentUnit; - } - } - } - return temp; -} -function CheckCRLForWhitespace(s) { - if (s === undefined || s === '' || s === '\n' || s === '\r') - return true; // line/file start boundaries - return const_1.FORMATS.concat(const_1.SINGLE_OPERATORS, const_1.DOUBLE_OPERATORS, const_1.TRENNER).some(item => s === item); -} -function pureFormatPipeline(text, config) { - let formatted = preFormat(text, config); - formatted = formatNestings(formatted, config); - const nEL = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - let regex; - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - formatted = formatted.replace(regex, const_1.CRLF); - } - // Indentation normalization: replace leading tabs with spaces if configured - const useSpaces = (config.ReplaceTabToSpaces !== false); // default true - const indentSize = (typeof config.IndentSize === 'number' && config.IndentSize >= 1 && config.IndentSize <= 10) ? config.IndentSize : 4; - if (useSpaces) { - const tabRegex = /^\t+/gm; - formatted = formatted.replace(tabRegex, (m) => ' '.repeat(m.length * indentSize)); - } - return formatted; -} -//# sourceMappingURL=formatCore.js.map \ No newline at end of file diff --git a/out/formats.js b/out/formats.js deleted file mode 100644 index 9a8ec27..0000000 --- a/out/formats.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -// Delegation wrapper only – real formatting logic lives in formatCore.ts -// Single Source of Truth: modify formatting rules in formatCore.ts -// This file provides stable export names for the rest of the extension. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.preFormat = preFormat; -exports.formatNestings = formatNestings; -exports.fullFormatPipeline = fullFormatPipeline; -const formatCore_1 = require("./formatCore"); -function preFormat(text, config) { - return (0, formatCore_1.preFormat)(text, config); -} -function formatNestings(text, config) { - return (0, formatCore_1.formatNestings)(text, config); -} -function fullFormatPipeline(text, config) { - return (0, formatCore_1.pureFormatPipeline)(text, config); -} -// Note: If VSCode-specific logging or telemetry is needed later, inject it here -// without duplicating core logic. -//# sourceMappingURL=formats.js.map \ No newline at end of file diff --git a/out/functions.js b/out/functions.js deleted file mode 100644 index 7700709..0000000 --- a/out/functions.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.info = exports.config = void 0; -exports.formatTE = formatTE; -exports.getConfig = getConfig; -exports.log = log; -exports.cloneArray = cloneArray; -const vscode = require("vscode"); -const vscode_1 = require("vscode"); -const formats_1 = require("./formats"); -const const_1 = require("./const"); -exports.config = {}; -function formatTE(range) { - exports.config = getConfig(); - let document = vscode_1.window.activeTextEditor.document; - const newText = format(range, document, exports.config); - return [vscode.TextEdit.replace(range, newText)]; -} -function format(range, document, config) { - // PURE IMPLEMENTATION (Refactor 2025-09-14): No direct editor side-effects anymore. - let regex; - let formatted = document.getText(range); - // 1. Keyword / Operator Formatting - formatted = (0, formats_1.preFormat)(formatted, config); - // 2. Nestings - formatted = (0, formats_1.formatNestings)(formatted, config); - // 3. Remove EmptyLines - const nEL = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - formatted = formatted.replace(regex, const_1.CRLF); - } - return formatted; -} -//---------------------------------------------------------------- -//---------------------------------------------------------------- -function getConfig() { - //https://code.visualstudio.com/api/references/contribution-points - //debug - exports.config.debug = false; //workspace.getConfiguration().get('VBI.formatter.debug.active'); - exports.config.debugToChannel = true; //workspace.getConfiguration().get('VBI.formatter.debug.debugToChannel'); - //Live empty Lines - exports.config.allowedNumberOfEmptyLines = vscode_1.workspace.getConfiguration().get('VBI.formatter.EmptyLine.allowedNumberOfEmptyLines'); - if (exports.config.allowedNumberOfEmptyLines < 0 || exports.config.allowedNumberOfEmptyLines > 50) { - exports.config.allowedNumberOfEmptyLines = 1; - } - exports.config.RemoveEmptyLines = vscode_1.workspace.getConfiguration().get('VBI.formatter.EmptyLine.RemoveEmptyLines'); - exports.config.EmptyLinesAlsoInComment = vscode_1.workspace.getConfiguration().get('VBI.formatter.EmptyLine.EmptyLinesAlsoInComment'); - //codeblock-Nesting settings - exports.config.BlockCodeBegin = vscode_1.workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeBegin'); - exports.config.BlockCodeEnd = vscode_1.workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeEnd'); - exports.config.BlockCodeExclude = vscode_1.workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeExclude'); - //Region codeblock-Nesting settings - exports.config.RegionBlockCodeBegin = vscode_1.workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeBegin'); - exports.config.RegionBlockCodeEnd = vscode_1.workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeEnd'); - exports.config.RegionBlockCodeExclude = vscode_1.workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeExclude'); - //misc - exports.config.ReplaceTabToSpaces = vscode_1.workspace.getConfiguration().get('VBI.formatter.Misc.ReplaceTabToSpaces'); - exports.config.IndentSize = vscode_1.workspace.getConfiguration().get('VBI.formatter.Misc.IndentSize'); - if (typeof exports.config.IndentSize !== 'number' || exports.config.IndentSize < 1 || exports.config.IndentSize > 10) { - exports.config.IndentSize = 4; - } - if (typeof exports.config.ReplaceTabToSpaces !== 'boolean') { - exports.config.ReplaceTabToSpaces = true; // fallback to default from package.json - } - //config.AllowInlineIFClause = workspace.getConfiguration().get('VBI.formatter.AllowInlineIFClause'); - //log this - console.log('getConfig():', exports.config); - return exports.config; -} -/** - * @param cat Type String --> define Category [info,warn,error] - * @param o Rest Parameter, Type Any --> Data to Log - */ -exports.info = vscode.window.createOutputChannel("VBI-Info"); -function log(cat, ...o) { - function mapObject(obj) { - switch (typeof obj) { - case 'undefined': - return 'undefined'; - case 'object': - let ret = ''; - for (const [key, value] of Object.entries(obj)) { - ret += (`${key}: ${value}\n`); - } - return ret; - default: - return obj; //function,symbol,boolean - } - } - if (exports.config.debug) { - if (exports.config.debugToChannel) { - switch (cat.toLowerCase()) { - case 'info': - //info.appendLine('INFO:'); - o.map((args) => { - exports.info.appendLine('INFO:' + mapObject(args)); - }); - exports.info.show(); - return; - case 'warn': - //info.appendLine('WARN:'); - o.map((args) => { - exports.info.appendLine('WARN:' + mapObject(args)); - }); - exports.info.show(); - return; - case 'error': - let err = ''; - //info.appendLine('ERROR: '); - //err += mapObject(cat) + ": \r\n"; - o.map((args) => { - err += mapObject(args); - }); - exports.info.appendLine(err); - vscode.window.showErrorMessage(err); //.replace(/(\r\n|\n|\r)/gm,"") - exports.info.show(); - return; - default: - //info.appendLine('INFO-Other:'); - //info.appendLine('INFO-Other:' + mapObject(cat)); - o.map((args) => { - exports.info.appendLine('INFO-Other:' + mapObject(args)); - }); - exports.info.show(); - return; - } - } - else { - switch (cat.toLowerCase()) { - case 'info': - console.log('INFO:', o); - return; - case 'warn': - console.log('WARNING:', o); - return; - case 'error': - console.error('ERROR:', o); - return; - default: - console.log('log:', cat, o); - return; - } - } - } - else if (cat.toLowerCase() === 'error') { // show Error in vc, and log it to console - let err = ''; - o.map((args) => { - err += mapObject(args); - }); - console.error('ERROR:', o); - vscode.window.showErrorMessage(err); //.replace(/(\r\n|\n|\r)/gm,"") - return; - } -} -function cloneArray(arr) { - return [...arr]; -} -//# sourceMappingURL=functions.js.map \ No newline at end of file diff --git a/out/nestingdef.js b/out/nestingdef.js deleted file mode 100644 index 7cf2270..0000000 --- a/out/nestingdef.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NESTINGS = exports.EXCLUDE_KEYWORDS = void 0; -exports.EXCLUDE_KEYWORDS = ["EXIT FOR"]; -exports.NESTINGS = [ - { - keyword: "if", - middle: "else", - end: "endif", - multiline: "then", - }, - { - keyword: "for", - middle: "", - end: "next", - multiline: "", - }, - { - keyword: "while", - middle: "", - end: "next", - multiline: "", - } -]; -//# sourceMappingURL=nestingdef.js.map \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5b56cea..5c31798 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,48 +1,44 @@ { "name": "intouch-language", - "version": "1.5.0", + "version": "1.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "intouch-language", - "version": "1.5.0", + "version": "1.6.0", "hasInstallScript": true, "license": "GPL-3.0-or-later", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "vscode-languageclient": "^10.1.0" + }, "devDependencies": { - "@types/glob": "^9.0.0", "@types/mocha": "^10.0.10", - "@types/node": "^24.5.2", - "@types/vscode": "^1.104.0", - "@typescript-eslint/eslint-plugin": "^8.44.1", - "@typescript-eslint/parser": "^8.44.1", + "@types/node": "^24.13.3", + "@types/vscode": "1.104.0", + "@typescript-eslint/eslint-plugin": "^8.67.0", + "@typescript-eslint/parser": "^8.67.0", "@vscode/test-electron": "^2.5.2", - "color": "^5.0.2", - "cross-env": "^10.0.0", - "esbuild": "^0.25.10", - "eslint": "^9.36.0", - "glob": "^11.1.0", - "mocha": "^11.7.2", - "nodemon": "^3.1.10", - "rimraf": "^6.0.1", - "source-map-support": "^0.5.21", - "typescript": "^5.9.2" + "color": "^5.0.3", + "esbuild": "^0.28.2", + "eslint": "^9.39.5", + "glob": "^13.0.6", + "mocha": "^11.8.0", + "nodemon": "^3.1.14", + "rimraf": "^6.1.3", + "typescript": "^5.9.3" }, "engines": { "vscode": "^1.104.0" } }, - "node_modules/@epic-web/invariant": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", - "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", - "dev": true, - "license": "MIT" - }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.10.tgz", - "integrity": "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", "cpu": [ "ppc64" ], @@ -57,9 +53,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.10.tgz", - "integrity": "sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", "cpu": [ "arm" ], @@ -74,9 +70,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.10.tgz", - "integrity": "sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", "cpu": [ "arm64" ], @@ -91,9 +87,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.10.tgz", - "integrity": "sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", "cpu": [ "x64" ], @@ -108,9 +104,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.10.tgz", - "integrity": "sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", "cpu": [ "arm64" ], @@ -125,9 +121,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.10.tgz", - "integrity": "sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", "cpu": [ "x64" ], @@ -142,9 +138,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.10.tgz", - "integrity": "sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", "cpu": [ "arm64" ], @@ -159,9 +155,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.10.tgz", - "integrity": "sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", "cpu": [ "x64" ], @@ -176,9 +172,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.10.tgz", - "integrity": "sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", "cpu": [ "arm" ], @@ -193,9 +189,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.10.tgz", - "integrity": "sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", "cpu": [ "arm64" ], @@ -210,9 +206,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.10.tgz", - "integrity": "sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", "cpu": [ "ia32" ], @@ -227,9 +223,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.10.tgz", - "integrity": "sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", "cpu": [ "loong64" ], @@ -244,9 +240,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.10.tgz", - "integrity": "sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", "cpu": [ "mips64el" ], @@ -261,9 +257,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.10.tgz", - "integrity": "sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", "cpu": [ "ppc64" ], @@ -278,9 +274,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.10.tgz", - "integrity": "sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", "cpu": [ "riscv64" ], @@ -295,9 +291,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.10.tgz", - "integrity": "sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", "cpu": [ "s390x" ], @@ -312,9 +308,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.10.tgz", - "integrity": "sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", "cpu": [ "x64" ], @@ -329,9 +325,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.10.tgz", - "integrity": "sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", "cpu": [ "arm64" ], @@ -346,9 +342,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.10.tgz", - "integrity": "sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", "cpu": [ "x64" ], @@ -363,9 +359,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.10.tgz", - "integrity": "sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", "cpu": [ "arm64" ], @@ -380,9 +376,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.10.tgz", - "integrity": "sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", "cpu": [ "x64" ], @@ -397,9 +393,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.10.tgz", - "integrity": "sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", "cpu": [ "arm64" ], @@ -414,9 +410,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.10.tgz", - "integrity": "sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", "cpu": [ "x64" ], @@ -431,9 +427,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.10.tgz", - "integrity": "sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", "cpu": [ "arm64" ], @@ -448,9 +444,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.10.tgz", - "integrity": "sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", "cpu": [ "ia32" ], @@ -465,9 +461,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.10.tgz", - "integrity": "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", "cpu": [ "x64" ], @@ -482,9 +478,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", - "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", "dev": true, "license": "MIT", "dependencies": { @@ -501,9 +497,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", - "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", "dev": true, "license": "MIT", "engines": { @@ -511,24 +507,24 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", - "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", + "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^2.1.6", + "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", - "minimatch": "^3.1.2" + "minimatch": "^3.1.5" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@eslint/config-array/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -537,9 +533,9 @@ } }, "node_modules/@eslint/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", "dependencies": { @@ -550,19 +546,22 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.1.tgz", - "integrity": "sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", "dev": true, "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@eslint/core": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz", - "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -573,20 +572,20 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", - "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.6.tgz", + "integrity": "sha512-l2Ul9PrHsPCKcEY/ac7VgFj9D80C7S68sOKc618SyHDPK36s1XcFebXY0iTzUVn4Yq+YbwvSnDmCz9yxjX+QrA==", "dev": true, "license": "MIT", "dependencies": { - "ajv": "^6.12.4", + "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", + "js-yaml": "^4.3.0", + "minimatch": "^3.1.5", "strip-json-comments": "^3.1.1" }, "engines": { @@ -597,9 +596,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -618,9 +617,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", "dependencies": { @@ -631,9 +630,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.36.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.36.0.tgz", - "integrity": "sha512-uhCbYtYynH30iZErszX78U+nR3pJU3RHGQ57NXy5QupD4SBVwDeU8TNBy+MjMngc1UyIW9noKqsRqfjQTBU2dw==", + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz", + "integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==", "dev": true, "license": "MIT", "engines": { @@ -644,9 +643,9 @@ } }, "node_modules/@eslint/object-schema": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", - "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -654,13 +653,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz", - "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^0.15.2", + "@eslint/core": "^0.17.0", "levn": "^0.4.1" }, "engines": { @@ -668,29 +667,43 @@ } }, "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", "dev": true, "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, "engines": { "node": ">=18.18.0" } }, "node_modules/@humanfs/node": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", - "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanfs/core": "^0.19.1", + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" }, "engines": { "node": ">=18.18.0" } }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -719,28 +732,13 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@isaacs/balanced-match": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", - "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "20 || >=22" - } + "node_modules/@intouch-language/core": { + "resolved": "packages/core", + "link": true }, - "node_modules/@isaacs/brace-expansion": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", - "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@isaacs/balanced-match": "^4.0.1" - }, - "engines": { - "node": "20 || >=22" - } + "node_modules/@intouch-language/language-server": { + "resolved": "packages/language-server", + "link": true }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -760,44 +758,6 @@ "node": ">=12" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -810,23 +770,12 @@ } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, - "node_modules/@types/glob": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-9.0.0.tgz", - "integrity": "sha512-00UxlRaIUvYm4R4W9WYkN8/J+kV8fmOQ7okeH6YFtGWFMt3odD45tpG5yA5wnL7HE6lLgjaTW5n14ju2hl2NNA==", - "deprecated": "This is a stub types definition. glob provides its own type definitions, so you do not need this installed.", - "dev": true, - "license": "MIT", - "dependencies": { - "glob": "*" - } - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -842,13 +791,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz", - "integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==", + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz", + "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.12.0" + "undici-types": "~7.18.0" } }, "node_modules/@types/vscode": { @@ -859,21 +808,20 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.44.1.tgz", - "integrity": "sha512-molgphGqOBT7t4YKCSkbasmu1tb1MgrZ2szGzHbclF7PNmOkSTQVHy+2jXOSnxvR3+Xe1yySHFZoqMpz3TfQsw==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.67.0.tgz", + "integrity": "sha512-Un7Heoyj65NREbKAyIrFxeM143NZpExWmy1Nep4DLeQOeLlTeumPjoNKnBrU5D5moWXbPJgRa5Uwcdu0faVNGQ==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.44.1", - "@typescript-eslint/type-utils": "8.44.1", - "@typescript-eslint/utils": "8.44.1", - "@typescript-eslint/visitor-keys": "8.44.1", - "graphemer": "^1.4.0", - "ignore": "^7.0.0", + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/type-utils": "8.67.0", + "@typescript-eslint/utils": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -883,23 +831,23 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.44.1", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" + "@typescript-eslint/parser": "^8.67.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.44.1.tgz", - "integrity": "sha512-EHrrEsyhOhxYt8MTg4zTF+DJMuNBzWwgvvOYNj/zm1vnaD/IC5zCXFehZv94Piqa2cRFfXrTFxIvO95L7Qc/cw==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.67.0.tgz", + "integrity": "sha512-fUBfTuuEulWqX6V8+O3PtScV01tzYYRUDTAirHFKoRAt7nOzoGiPt0M/bB47wWNy0coOOcgEwAMUtBpykMxl6w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.44.1", - "@typescript-eslint/types": "8.44.1", - "@typescript-eslint/typescript-estree": "8.44.1", - "@typescript-eslint/visitor-keys": "8.44.1", - "debug": "^4.3.4" + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "debug": "^4.4.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -909,20 +857,20 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.44.1.tgz", - "integrity": "sha512-ycSa60eGg8GWAkVsKV4E6Nz33h+HjTXbsDT4FILyL8Obk5/mx4tbvCNsLf9zret3ipSumAOG89UcCs/KRaKYrA==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.67.0.tgz", + "integrity": "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.44.1", - "@typescript-eslint/types": "^8.44.1", - "debug": "^4.3.4" + "@typescript-eslint/tsconfig-utils": "^8.67.0", + "@typescript-eslint/types": "^8.67.0", + "debug": "^4.4.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -932,18 +880,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.44.1.tgz", - "integrity": "sha512-NdhWHgmynpSvyhchGLXh+w12OMT308Gm25JoRIyTZqEbApiBiQHD/8xgb6LqCWCFcxFtWwaVdFsLPQI3jvhywg==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.67.0.tgz", + "integrity": "sha512-EgvsleTwS4E+WzzSvem8fAUubLwatMNF1B5hHSLQxcvs7q2dtRhGyujHwLJSYlG41niJ7GP24Aha2+0mb1b2kg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.44.1", - "@typescript-eslint/visitor-keys": "8.44.1" + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -954,9 +902,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.44.1.tgz", - "integrity": "sha512-B5OyACouEjuIvof3o86lRMvyDsFwZm+4fBOqFHccIctYgBjqR3qT39FBYGN87khcgf0ExpdCBeGKpKRhSFTjKQ==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.67.0.tgz", + "integrity": "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg==", "dev": true, "license": "MIT", "engines": { @@ -967,21 +915,21 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.44.1.tgz", - "integrity": "sha512-KdEerZqHWXsRNKjF9NYswNISnFzXfXNDfPxoTh7tqohU/PRIbwTmsjGK6V9/RTYWau7NZvfo52lgVk+sJh0K3g==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.67.0.tgz", + "integrity": "sha512-aVWDXbRmdXO9siTfX4ditQI1T9+zVcNazT48EJCD0v40/9RIFoUgZ05CmGEq9H2gixRpjUn/iplwvlcvutJW/Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.44.1", - "@typescript-eslint/typescript-estree": "8.44.1", - "@typescript-eslint/utils": "8.44.1", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0", + "@typescript-eslint/utils": "8.67.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -991,14 +939,14 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.44.1.tgz", - "integrity": "sha512-Lk7uj7y9uQUOEguiDIDLYLJOrYHQa7oBiURYVFqIpGxclAFQ78f6VUOM8lI2XEuNOKNB7XuvM2+2cMXAoq4ALQ==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.67.0.tgz", + "integrity": "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww==", "dev": true, "license": "MIT", "engines": { @@ -1010,22 +958,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.44.1.tgz", - "integrity": "sha512-qnQJ+mVa7szevdEyvfItbO5Vo+GfZ4/GZWWDRRLjrxYPkhM+6zYB2vRYwCsoJLzqFCdZT4mEqyJoyzkunsZ96A==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.67.0.tgz", + "integrity": "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.44.1", - "@typescript-eslint/tsconfig-utils": "8.44.1", - "@typescript-eslint/types": "8.44.1", - "@typescript-eslint/visitor-keys": "8.44.1", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^2.1.0" + "@typescript-eslint/project-service": "8.67.0", + "@typescript-eslint/tsconfig-utils": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1035,20 +982,59 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/@typescript-eslint/utils": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.44.1.tgz", - "integrity": "sha512-DpX5Fp6edTlocMCwA+mHY8Mra+pPjRZ0TfHkXI8QFelIKcbADQz1LUPNtzOFUriBB2UYqw4Pi9+xV4w9ZczHFg==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.67.0.tgz", + "integrity": "sha512-U9D1FdwEWBwok3hxxSdhclMb0twvt9QnjIQ0VfQ1AiX2epnpSgv2ubVDsayOFyY8K6FX+AQ7E0FKWVG3iKsj1A==", "dev": true, "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.44.1", - "@typescript-eslint/types": "8.44.1", - "@typescript-eslint/typescript-estree": "8.44.1" + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1058,19 +1044,19 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.44.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.44.1.tgz", - "integrity": "sha512-576+u0QD+Jp3tZzvfRfxon0EA2lzcDt3lhUbsC6Lgzy9x2VR4E+JUiNyGHi5T8vk0TV+fpJ5GLG1JsJuWCaKhw==", + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.67.0.tgz", + "integrity": "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.44.1", - "eslint-visitor-keys": "^4.2.1" + "@typescript-eslint/types": "8.67.0", + "eslint-visitor-keys": "^5.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1081,13 +1067,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "dev": true, "license": "Apache-2.0", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^20.19.0 || ^22.13.0 || >=24" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1111,9 +1097,9 @@ } }, "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", + "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", "dev": true, "license": "MIT", "bin": { @@ -1144,9 +1130,9 @@ } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", "dev": true, "license": "MIT", "dependencies": { @@ -1251,9 +1237,9 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", + "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", "dev": true, "license": "MIT", "dependencies": { @@ -1280,13 +1266,6 @@ "dev": true, "license": "ISC" }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "license": "MIT" - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1451,23 +1430,23 @@ } }, "node_modules/color": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/color/-/color-5.0.2.tgz", - "integrity": "sha512-e2hz5BzbUPcYlIRHo8ieAhYgoajrJr+hWoceg6E345TPsATMUKqDgzt8fSXZJJbxfpiPzkWyphz8yn8At7q3fA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/color/-/color-5.0.3.tgz", + "integrity": "sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA==", "dev": true, "license": "MIT", "dependencies": { - "color-convert": "^3.0.1", - "color-string": "^2.0.0" + "color-convert": "^3.1.3", + "color-string": "^2.1.3" }, "engines": { "node": ">=18" } }, "node_modules/color-convert": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-3.1.2.tgz", - "integrity": "sha512-UNqkvCDXstVck3kdowtOTWROIJQwafjOfXSmddoDrXo4cewMKmusCeF22Q24zvjR8nwWib/3S/dfyzPItPEiJg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-3.1.3.tgz", + "integrity": "sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg==", "dev": true, "license": "MIT", "dependencies": { @@ -1478,9 +1457,9 @@ } }, "node_modules/color-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-2.0.2.tgz", - "integrity": "sha512-9vEt7gE16EW7Eu7pvZnR0abW9z6ufzhXxGXZEVU9IqPdlsUiMwJeJfRtq0zePUmnbHGT9zajca7mX8zgoayo4A==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-2.1.1.tgz", + "integrity": "sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg==", "dev": true, "license": "MIT", "engines": { @@ -1488,9 +1467,9 @@ } }, "node_modules/color-string": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-2.1.2.tgz", - "integrity": "sha512-RxmjYxbWemV9gKu4zPgiZagUxbH3RQpEIO77XoSSX0ivgABDZ+h8Zuash/EMFLTI4N9QgFPOJ6JQpPZKFxa+dA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-2.1.4.tgz", + "integrity": "sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg==", "dev": true, "license": "MIT", "dependencies": { @@ -1514,24 +1493,6 @@ "dev": true, "license": "MIT" }, - "node_modules/cross-env": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.0.0.tgz", - "integrity": "sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@epic-web/invariant": "^1.0.0", - "cross-spawn": "^7.0.6" - }, - "bin": { - "cross-env": "dist/bin/cross-env.js", - "cross-env-shell": "dist/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=20" - } - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -1610,9 +1571,9 @@ "license": "MIT" }, "node_modules/esbuild": { - "version": "0.25.10", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.10.tgz", - "integrity": "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -1623,32 +1584,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.10", - "@esbuild/android-arm": "0.25.10", - "@esbuild/android-arm64": "0.25.10", - "@esbuild/android-x64": "0.25.10", - "@esbuild/darwin-arm64": "0.25.10", - "@esbuild/darwin-x64": "0.25.10", - "@esbuild/freebsd-arm64": "0.25.10", - "@esbuild/freebsd-x64": "0.25.10", - "@esbuild/linux-arm": "0.25.10", - "@esbuild/linux-arm64": "0.25.10", - "@esbuild/linux-ia32": "0.25.10", - "@esbuild/linux-loong64": "0.25.10", - "@esbuild/linux-mips64el": "0.25.10", - "@esbuild/linux-ppc64": "0.25.10", - "@esbuild/linux-riscv64": "0.25.10", - "@esbuild/linux-s390x": "0.25.10", - "@esbuild/linux-x64": "0.25.10", - "@esbuild/netbsd-arm64": "0.25.10", - "@esbuild/netbsd-x64": "0.25.10", - "@esbuild/openbsd-arm64": "0.25.10", - "@esbuild/openbsd-x64": "0.25.10", - "@esbuild/openharmony-arm64": "0.25.10", - "@esbuild/sunos-x64": "0.25.10", - "@esbuild/win32-arm64": "0.25.10", - "@esbuild/win32-ia32": "0.25.10", - "@esbuild/win32-x64": "0.25.10" + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" } }, "node_modules/escalade": { @@ -1675,26 +1636,25 @@ } }, "node_modules/eslint": { - "version": "9.36.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.36.0.tgz", - "integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==", + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.5.tgz", + "integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.0", - "@eslint/config-helpers": "^0.3.1", - "@eslint/core": "^0.15.2", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.36.0", - "@eslint/plugin-kit": "^0.3.5", + "@eslint/config-array": "^0.21.2", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.6", + "@eslint/js": "9.39.5", + "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", + "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", @@ -1713,7 +1673,7 @@ "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", + "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -1766,9 +1726,9 @@ } }, "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -1800,9 +1760,9 @@ } }, "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "dev": true, "license": "ISC", "dependencies": { @@ -1844,9 +1804,9 @@ } }, "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -1896,36 +1856,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1940,16 +1870,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fastq": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -2018,9 +1938,9 @@ } }, "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", "dev": true, "license": "ISC" }, @@ -2080,24 +2000,18 @@ } }, "node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", - "minimatch": "^10.1.1", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2116,17 +2030,40 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/glob/node_modules/minimatch": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", - "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "@isaacs/brace-expansion": "^5.0.0" + "brace-expansion": "^5.0.8" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2145,13 +2082,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2327,6 +2257,16 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -2364,27 +2304,21 @@ "dev": true, "license": "ISC" }, - "node_modules/jackspeak": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", - "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2502,39 +2436,15 @@ } }, "node_modules/lru-cache": { - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.2.tgz", - "integrity": "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg==", + "version": "11.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", + "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/mimic-function": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", @@ -2549,13 +2459,13 @@ } }, "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^2.0.2" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -2565,19 +2475,19 @@ } }, "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "engines": { "node": ">=16 || 14 >=14.17" } }, "node_modules/mocha": { - "version": "11.7.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.2.tgz", - "integrity": "sha512-lkqVJPmqqG/w5jmmFtiRvtA2jkDyNVUcefFJKb2uyX4dekk8Okgqop3cgbFiaIvj8uCRJVTP5x9dfxGyXm2jvQ==", + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.8.0.tgz", + "integrity": "sha512-VyCeUdGN3A9lmCTTgG4yuvY9ixxaDk+xt2R/7/+1AP6EqNG+G9OKkzBwhVtVYoNX8YsxNSgAl8mOv3IAeOpFbw==", "dev": true, "license": "MIT", "dependencies": { @@ -2589,6 +2499,7 @@ "find-up": "^5.0.0", "glob": "^10.4.5", "he": "^1.2.0", + "is-path-inside": "^3.0.3", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", "minimatch": "^9.0.5", @@ -2702,16 +2613,16 @@ "license": "MIT" }, "node_modules/nodemon": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", - "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==", + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", "dev": true, "license": "MIT", "dependencies": { "chokidar": "^3.5.2", "debug": "^4", "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", + "minimatch": "^10.2.1", "pstree.remy": "^1.1.8", "semver": "^7.5.3", "simple-update-notifier": "^2.0.0", @@ -2730,15 +2641,27 @@ "url": "https://opencollective.com/nodemon" } }, + "node_modules/nodemon/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/nodemon/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/nodemon/node_modules/chokidar": { @@ -2790,16 +2713,19 @@ } }, "node_modules/nodemon/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^5.0.8" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/nodemon/node_modules/readdirp": { @@ -3057,9 +2983,9 @@ } }, "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -3067,7 +2993,7 @@ "minipass": "^7.1.2" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -3081,9 +3007,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true, "license": "MIT", "engines": { @@ -3127,27 +3053,6 @@ "node": ">=6" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -3225,26 +3130,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.3.tgz", + "integrity": "sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" + "glob": "^13.0.3", + "package-json-from-dist": "^1.0.1" }, "bin": { "rimraf": "dist/esm/bin.mjs" @@ -3256,30 +3150,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3288,10 +3158,9 @@ "license": "MIT" }, "node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", - "dev": true, + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -3366,27 +3235,6 @@ "node": ">=10" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/stdin-discarder": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", @@ -3540,6 +3388,54 @@ "node": ">=8" } }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -3564,9 +3460,9 @@ } }, "node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", "dev": true, "license": "MIT", "engines": { @@ -3590,9 +3486,9 @@ } }, "node_modules/typescript": { - "version": "5.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", - "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3611,9 +3507,9 @@ "license": "MIT" }, "node_modules/undici-types": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz", - "integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==", + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", "dev": true, "license": "MIT" }, @@ -3634,6 +3530,100 @@ "dev": true, "license": "MIT" }, + "node_modules/vscode-jsonrpc": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-9.0.1.tgz", + "integrity": "sha512-rfuA6T75H6m5EkbhtEPzre9pT0HPcDI2MMy4+nPFIBks5J8JBAUHD4tRYSgaBOijIEC7SRkC1kKyXTLqbmh9jw==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageclient": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-10.1.0.tgz", + "integrity": "sha512-XXRx6lqVitQy/oOLr9MfNYRG+MbQkhXkDaxbQMiKxEm8zZNfheRFUKNb8UYNh2stn9btl2wQM5wZFJjJvoc+jA==", + "license": "MIT", + "dependencies": { + "minimatch": "^10.2.5", + "semver": "^7.8.1", + "vscode-languageserver-protocol": "3.18.2", + "vscode-languageserver-textdocument": "1.0.13" + }, + "engines": { + "vscode": "^1.91.0" + } + }, + "node_modules/vscode-languageclient/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/vscode-languageclient/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/vscode-languageclient/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/vscode-languageserver": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-10.1.0.tgz", + "integrity": "sha512-9gEWpXkYGXoqG7pBnE8O8hx/yP7+Aabn4+peQ3KDicQv6qunHSWyLTud3OF0w4S2+HfDD+5HqYKiXQW9HAU6mA==", + "license": "MIT", + "dependencies": { + "vscode-languageserver-protocol": "3.18.2" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.18.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.18.2.tgz", + "integrity": "sha512-XRyDbT0Pp3sSNti3JmxVEUMySWCSi1hhM+/KUlCy1hV1zmrqpM1OwO12EAki8blhmLuIMpaJrYbo0OzGVfK2Qg==", + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "9.0.1", + "vscode-languageserver-types": "3.18.0" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.13.tgz", + "integrity": "sha512-nx0ZHwMGIsVkzFG3/VLeJYBLTaFBRuNdGDvevvjuoayU5EOS2fEYazOhtCM3PI9ClMMg5igc0uwXtAq4tJj+Dw==", + "license": "MIT" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.18.0.tgz", + "integrity": "sha512-8TsGPNMIMiiBdkORgRSvLjuiEIiAFtO+KssmYWxQ+uSVvlf7RjK8YKCOjPzZ+YA04jXEV7+7LvkSmHkhpNS99g==", + "license": "MIT" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3874,6 +3864,17 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "packages/core": { + "name": "@intouch-language/core" + }, + "packages/language-server": { + "name": "@intouch-language/language-server", + "dependencies": { + "@intouch-language/core": "*", + "vscode-languageserver": "^10.1.0", + "vscode-languageserver-textdocument": "^1.0.12" + } } } } diff --git a/package.json b/package.json index fb1a922..48d0692 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "intouch-language", - "displayName": "Intouch-Language and Formatter for VSCode. (c)2021-2025 vitalyruhl", - "description": "Intouch-Language syntax highlighting, formatter and code snippets for VSCode", - "version": "1.5.0", + "displayName": "Intouch-Language and Formatter for VSCode. (c)2021-2026 vitalyruhl", + "description": "Native InTouch QuickScript language server, formatter and diagnostics for VS Code", + "version": "1.6.0", "icon": "images/logo.png", "publisher": "Vitaly-ruhl", "engines": { @@ -28,14 +28,21 @@ ], "keywords": [ "Intouch", - "Invensys", + "QuickScript", + "AVEVA", "Wonderware", - "Aveva", "formatter", - "theme", - "dark" + "language-server", + "LSP" ], "main": "./dist/extension.js", + "activationEvents": [ + "onLanguage:intouch", + "onCommand:vbi-format" + ], + "workspaces": [ + "packages/*" + ], "contributes": { "themes": [ { @@ -143,12 +150,31 @@ "type": "boolean", "default": true, "markdownDescription": "Replace tabs with spaces." - },"VBI.formatter.Misc.IndentSize": { + }, + "VBI.formatter.Misc.IndentSize": { "type": "number", "default": 4, "minimum": 1, "maximum": 10, "markdownDescription": "Number of spaces to use for each indentation level (1-10)." + }, + "VBI.diagnostics.naming.nonAsciiIdentifiers": { + "type": "string", + "enum": ["off", "hint", "information", "warning", "error"], + "default": "warning", + "markdownDescription": "Severity for non-ASCII identifier quality diagnostics." + }, + "VBI.diagnostics.naming.windowWhitespace": { + "type": "string", + "enum": ["off", "hint", "information", "warning", "error"], + "default": "warning", + "markdownDescription": "Severity for whitespace in literal InTouch window names." + }, + "VBI.diagnostics.naming.windowNonAscii": { + "type": "string", + "enum": ["off", "hint", "information", "warning", "error"], + "default": "warning", + "markdownDescription": "Severity for non-ASCII characters in literal InTouch window names." } } } @@ -156,11 +182,18 @@ "scripts": { "start": "nodemon --watch src src/index.js", "build:theme": "node src/index.js", - "compile": "tsc -p ./", - "bundle": "esbuild ./out/extension.js --bundle --platform=node --external:vscode --format=cjs --minify --sourcemap --outfile=dist/extension.js", + "compile": "rimraf ./out && npm run generate:language-data && npm run compile:core && npm run compile:language-server && tsc -p ./", + "compile:core": "tsc -p ./packages/core", + "compile:language-server": "tsc -p ./packages/language-server", + "generate:language-data": "node ./scripts/generate-language-data.js", + "bundle": "npm run bundle:extension && npm run bundle:server", + "bundle:extension": "esbuild ./out/extension.js --bundle --platform=node --external:vscode --format=cjs --minify --sourcemap --outfile=dist/extension.js", + "bundle:server": "esbuild ./out/language-server/src/server.js --bundle --platform=node --format=cjs --minify --sourcemap --outfile=dist/server.js", "vscode:prepublish": "npm run compile && npm run build:theme && npm run bundle", "postinstall": "npm run compile", - "test": "npm run compile && node ./out/test/runTest.js", + "test": "npm run compile && npm run test:core && npm run test:language-server && npm run bundle && node ./out/test/runTest.js", + "test:core": "mocha --ui tdd \"out/core/test/**/*.test.js\"", + "test:language-server": "mocha --ui tdd \"out/language-server/test/**/*.test.js\"", "update:fixtures": "npm run compile && node ./scripts/update-fixtures.js", "watch": "tsc -watch -p ./", "lint": "eslint . --ext .ts,.tsx", @@ -181,24 +214,24 @@ "description": "%ext.capabilities.untrustedWorkspaces.description%" } }, + "dependencies": { + "vscode-languageclient": "^10.1.0" + }, "devDependencies": { - "esbuild": "^0.25.10", - "@types/glob": "^9.0.0", "@types/mocha": "^10.0.10", - "@types/node": "^24.5.2", - "@types/vscode": "^1.104.0", - "@typescript-eslint/eslint-plugin": "^8.44.1", - "@typescript-eslint/parser": "^8.44.1", + "@types/node": "^24.13.3", + "@types/vscode": "1.104.0", + "@typescript-eslint/eslint-plugin": "^8.67.0", + "@typescript-eslint/parser": "^8.67.0", "@vscode/test-electron": "^2.5.2", - "color": "^5.0.2", - "cross-env": "^10.0.0", - "eslint": "^9.36.0", - "glob": "^11.1.0", - "mocha": "^11.7.2", - "nodemon": "^3.1.10", - "rimraf": "^6.0.1", - "source-map-support": "^0.5.21", - "typescript": "^5.9.2" + "color": "^5.0.3", + "esbuild": "^0.28.2", + "eslint": "^9.39.5", + "glob": "^13.0.6", + "mocha": "^11.8.0", + "nodemon": "^3.1.14", + "rimraf": "^6.1.3", + "typescript": "^5.9.3" }, "__metadata": { "id": "834eb420-2978-4100-b7de-2430fc88e429", diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..0fb4413 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,7 @@ +{ + "name": "@intouch-language/core", + "private": true, + "description": "Editor-independent QuickScript language primitives", + "main": "../../../out/core/src/index.js", + "types": "../../../out/core/src/index.d.ts" +} diff --git a/packages/core/src/documentMetadata.ts b/packages/core/src/documentMetadata.ts new file mode 100644 index 0000000..a9c1715 --- /dev/null +++ b/packages/core/src/documentMetadata.ts @@ -0,0 +1,373 @@ +import { CoreDiagnostic } from './parser'; +import { Range, SourceSpan, sourceRange } from './source'; +import { Token, TokenKind } from './token'; +import { tokenize } from './tokenizer'; + +export type QuickScriptScriptType = + | 'QuickFunction' + | 'DataChange' + | 'Condition' + | 'Application' + | 'Window' + | 'KeyScript' + | 'Generic' + | 'Unknown'; + +export type WindowEvent = 'OnShow' | 'WhileRunning' | 'OnClose'; +export type MetadataSourceKind = 'explicit' | 'legacy' | 'export' | 'filename' | 'none'; + +export interface QuickScriptParameterMetadata { + name: string; + datatype: string; + description?: string; + range: Range; + nameRange: Range; + datatypeRange: Range; +} + +export interface QuickScriptDocumentMetadata { + scriptType: QuickScriptScriptType; + name?: string; + nameRange?: Range; + event?: string; + eventRange?: Range; + trigger?: string; + triggerRange?: Range; + shortcut?: string; + shortcutRange?: Range; + description?: string; + descriptionRange?: Range; + parameters: QuickScriptParameterMetadata[]; + returnType?: string; + returnTypeRange?: Range; + metadataSource: MetadataSourceKind; + legacyScriptType?: string; + diagnostics: CoreDiagnostic[]; +} + +export interface MetadataExtractionOptions { + fileName?: string; + /** Reuse the canonical token stream when extraction is part of semantic analysis. */ + tokens?: readonly Token[]; +} + +interface LocatedValue { + value: T; + raw: string; + range: Range; + span: SourceSpan; + source: Exclude; +} + +interface MetadataCandidates { + scriptTypes: LocatedValue[]; + names: LocatedValue[]; + events: LocatedValue[]; + triggers: LocatedValue[]; + shortcuts: LocatedValue[]; + descriptions: LocatedValue[]; + returnTypes: LocatedValue[]; + explicitParameters: QuickScriptParameterMetadata[]; + legacyParameters: QuickScriptParameterMetadata[]; + legacyScriptType?: string; +} + +const IDENTIFIER = '[\\p{L}_$#][\\p{L}\\p{N}_$#-]*'; +const EXPLICIT_FIELD = /^[ \t]*@([A-Za-z]+)(?:[ \t]+([^\r\n]*?))?[ \t]*$/gmu; +const LEGACY_FIELD = /^[ \t]*(Type|Name|Description|Trigger|Event|Shortcut|Returns?|Tagname\[\.field\]|Condition|Condition Type)[ \t]*:[ \t]*([^\r\n]*?)[ \t]*$/gimu; +const LEGACY_PARAMETER = new RegExp(`^[ \\t]*(DISCRETE|INTEGER|MESSAGE|REAL)[ \\t]+(${IDENTIFIER})(?:[ \\t]+([^\\r\\n]*?))?[ \\t]*$`, 'gimu'); +const SCRIPT_TYPE_NAMES: Readonly> = { + quickfunction: 'QuickFunction', + datachange: 'DataChange', + condition: 'Condition', + conditionalscript: 'Condition', + application: 'Application', + applicationscript: 'Application', + window: 'Window', + windowscript: 'Window', + keyscript: 'KeyScript', + generic: 'Generic', +}; +const WINDOW_EVENTS: Readonly> = { + onshow: 'OnShow', + whilerunning: 'WhileRunning', + onclose: 'OnClose', +}; +const KNOWN_FIELDS = new Set(['scripttype', 'name', 'description', 'event', 'trigger', 'shortcut', 'param', 'returns']); + +function metadataDiagnostic(code: string, message: string, range: Range, severity: CoreDiagnostic['severity'] = 'warning'): CoreDiagnostic { + return { code, message, severity, range, source: 'intouch-metadata' }; +} + +function locatedValue(source: string, token: Token, match: RegExpMatchArray, raw: string, value: T, sourceKind: 'explicit' | 'legacy'): LocatedValue { + const matchStart = match.index ?? 0; + const valueStart = matchStart + match[0].lastIndexOf(raw); + const located = sourceRange(source, { + start: token.span.start + valueStart, + end: token.span.start + valueStart + raw.length, + }); + return { value, raw, ...located, source: sourceKind }; +} + +function normalizeScriptType(raw: string): QuickScriptScriptType | undefined { + return SCRIPT_TYPE_NAMES[raw.replace(/[ \t_-]+/g, '').toLowerCase()]; +} + +function normalizeWindowEvent(raw: string): WindowEvent | undefined { + return WINDOW_EVENTS[raw.replace(/[ \t_-]+/g, '').toLowerCase()]; +} + +function valueEquals(left: unknown, right: unknown): boolean { + return typeof left === 'string' && typeof right === 'string' + ? left.localeCompare(right, 'en', { sensitivity: 'base' }) === 0 + : left === right; +} + +function selectValue( + label: string, + explicit: readonly LocatedValue[], + legacy: readonly LocatedValue[], + diagnostics: CoreDiagnostic[], +): LocatedValue | undefined { + const preferred = explicit[0] ?? legacy[0]; + if (preferred === undefined) return undefined; + for (const duplicate of [...explicit.slice(1), ...legacy]) { + if (!valueEquals(preferred.value, duplicate.value)) { + diagnostics.push(metadataDiagnostic( + 'metadata-conflict', + `${label} '${duplicate.raw}' conflicts with higher-priority ${preferred.source} metadata '${preferred.raw}'.`, + duplicate.range, + )); + } + } + return preferred; +} + +function parseExplicitFields(source: string, token: Token, candidates: MetadataCandidates, diagnostics: CoreDiagnostic[]): void { + for (const match of token.lexeme.matchAll(EXPLICIT_FIELD)) { + const field = match[1]; + const raw = (match[2] ?? '').trim(); + const normalizedField = field.toLowerCase(); + const fieldStart = token.span.start + (match.index ?? 0) + match[0].indexOf(`@${field}`) + 1; + const fieldRange = sourceRange(source, { start: fieldStart, end: fieldStart + field.length }).range; + if (!KNOWN_FIELDS.has(normalizedField)) { + diagnostics.push(metadataDiagnostic( + 'unknown-metadata-field', + `Unknown QuickScript metadata field '@${field}'.`, + fieldRange, + 'information', + )); + continue; + } + if (raw.length === 0) { + diagnostics.push(metadataDiagnostic('invalid-metadata-value', `Metadata field '@${field}' requires a value.`, fieldRange)); + continue; + } + if (normalizedField === 'scripttype') { + const scriptType = normalizeScriptType(raw); + const value = locatedValue(source, token, match, raw, scriptType ?? 'Unknown', 'explicit'); + if (scriptType === undefined) { + diagnostics.push(metadataDiagnostic('invalid-script-type', `Unknown QuickScript script type '${raw}'.`, value.range)); + } else { + candidates.scriptTypes.push(value); + } + continue; + } + if (normalizedField === 'param') { + const parameter = raw.match(new RegExp(`^(${IDENTIFIER})[ \\t]+(DISCRETE|INTEGER|MESSAGE|REAL)(?:[ \\t]+([\\s\\S]*))?$`, 'iu')); + const value = locatedValue(source, token, match, raw, raw, 'explicit'); + if (parameter === null) { + diagnostics.push(metadataDiagnostic('invalid-metadata-value', `Metadata field '@Param' must use '@Param Name TYPE Description...'.`, value.range)); + continue; + } + const nameOffset = value.span.start + raw.indexOf(parameter[1]); + const datatypeOffset = value.span.start + raw.indexOf(parameter[2], parameter[1].length); + candidates.explicitParameters.push({ + name: parameter[1], + datatype: parameter[2].toUpperCase(), + description: parameter[3]?.trim() || undefined, + range: value.range, + nameRange: sourceRange(source, { start: nameOffset, end: nameOffset + parameter[1].length }).range, + datatypeRange: sourceRange(source, { start: datatypeOffset, end: datatypeOffset + parameter[2].length }).range, + }); + continue; + } + const value = locatedValue(source, token, match, raw, raw, 'explicit'); + switch (normalizedField) { + case 'name': candidates.names.push(value); break; + case 'description': candidates.descriptions.push(value); break; + case 'event': candidates.events.push(value); break; + case 'trigger': candidates.triggers.push(value); break; + case 'shortcut': candidates.shortcuts.push(value); break; + case 'returns': candidates.returnTypes.push({ ...value, value: raw.toUpperCase() }); break; + } + } +} + +function legacyParameterSection(token: Token): { text: string; start: number } | undefined { + const section = token.lexeme.match(/\bParameters\s*:\s*([\s\S]*?)(?:\r?\n[ \t]*\r?\n|\bUsage\s*:|\bVersion\s+history\s*:|\{<|$)/iu); + if (section === null) return undefined; + const start = (section.index ?? 0) + section[0].indexOf(section[1]); + return { text: section[1], start }; +} + +function parseLegacyFields(source: string, token: Token, candidates: MetadataCandidates): void { + for (const match of token.lexeme.matchAll(LEGACY_FIELD)) { + const label = match[1].toLowerCase(); + const raw = match[2].trim(); + if (raw.length === 0) continue; + if (label === 'type') { + candidates.legacyScriptType ??= raw; + const scriptType = normalizeScriptType(raw); + candidates.scriptTypes.push(locatedValue(source, token, match, raw, scriptType ?? 'Unknown', 'legacy')); + continue; + } + const value = locatedValue(source, token, match, raw, raw, 'legacy'); + switch (label) { + case 'name': candidates.names.push(value); break; + case 'description': candidates.descriptions.push(value); break; + case 'event': candidates.events.push(value); break; + case 'trigger': candidates.triggers.push(value); break; + case 'shortcut': candidates.shortcuts.push(value); break; + case 'tagname[.field]': candidates.triggers.push(value); break; + case 'condition': candidates.triggers.push(value); break; + case 'condition type': candidates.events.push(value); break; + case 'return': + case 'returns': candidates.returnTypes.push({ ...value, value: raw.toUpperCase() }); break; + } + } + const section = legacyParameterSection(token); + if (section === undefined) return; + for (const match of section.text.matchAll(LEGACY_PARAMETER)) { + const datatype = match[1]; + const name = match[2]; + const lineStart = section.start + (match.index ?? 0); + const datatypeStart = token.span.start + lineStart + match[0].indexOf(datatype); + const nameStart = token.span.start + lineStart + match[0].indexOf(name, match[0].indexOf(datatype) + datatype.length); + candidates.legacyParameters.push({ + name, + datatype: datatype.toUpperCase(), + description: match[3]?.trim() || undefined, + range: sourceRange(source, { start: datatypeStart, end: token.span.start + lineStart + match[0].trimEnd().length }).range, + nameRange: sourceRange(source, { start: nameStart, end: nameStart + name.length }).range, + datatypeRange: sourceRange(source, { start: datatypeStart, end: datatypeStart + datatype.length }).range, + }); + } +} + +function isStructuredLegacyComment(text: string): boolean { + if (/^[ \t]*Script[ \t]*:[ \t]*$/imu.test(text)) return true; + const hasType = /^[ \t]*Type[ \t]*:[ \t]*[^\r\n]+$/imu.test(text); + const hasIdentity = /^[ \t]*(?:Name|Tagname\[\.field\]|Condition)[ \t]*:[ \t]*[^\r\n]+$/imu.test(text); + return hasType && hasIdentity; +} + +function filenameFallback(fileName: string | undefined): { scriptType: QuickScriptScriptType; name: string } | undefined { + if (fileName === undefined) return undefined; + const stem = fileName.replace(/^.*[\\/]/, '').replace(/\.(?:vbi|vi)$/i, '').replace(/_\d+(?:\.\d+){1,3}$/i, ''); + for (const [prefix, scriptType] of [ + ['QF_', 'QuickFunction'], + ['DCH_', 'DataChange'], + ['CS_', 'Condition'], + ['APP_', 'Application'], + ['KEY_', 'KeyScript'], + ] as const) { + if (stem.toUpperCase().startsWith(prefix)) { + return { scriptType, name: stem.slice(prefix.length) }; + } + } + return undefined; +} + +/** Extract canonical document metadata exclusively from comment tokens plus an optional filename fallback. */ +export function extractDocumentMetadata(source: string, options: MetadataExtractionOptions = {}): QuickScriptDocumentMetadata { + const diagnostics: CoreDiagnostic[] = []; + const candidates: MetadataCandidates = { + scriptTypes: [], + names: [], + events: [], + triggers: [], + shortcuts: [], + descriptions: [], + returnTypes: [], + explicitParameters: [], + legacyParameters: [], + }; + const comments = (options.tokens ?? tokenize(source)).filter(token => token.kind === TokenKind.Comment); + for (const token of comments) { + parseExplicitFields(source, token, candidates, diagnostics); + if (isStructuredLegacyComment(token.lexeme)) parseLegacyFields(source, token, candidates); + } + + const explicit = (values: readonly LocatedValue[]): LocatedValue[] => values.filter(value => value.source === 'explicit'); + const legacy = (values: readonly LocatedValue[]): LocatedValue[] => values.filter(value => value.source === 'legacy'); + const scriptType = selectValue('Script type', explicit(candidates.scriptTypes), legacy(candidates.scriptTypes), diagnostics); + const name = selectValue('Name', explicit(candidates.names), legacy(candidates.names), diagnostics); + const event = selectValue('Event', explicit(candidates.events), legacy(candidates.events), diagnostics); + const trigger = selectValue('Trigger', explicit(candidates.triggers), legacy(candidates.triggers), diagnostics); + const shortcut = selectValue('Shortcut', explicit(candidates.shortcuts), legacy(candidates.shortcuts), diagnostics); + const description = selectValue('Description', explicit(candidates.descriptions), legacy(candidates.descriptions), diagnostics); + const returnType = selectValue('Return type', explicit(candidates.returnTypes), legacy(candidates.returnTypes), diagnostics); + const parameters = candidates.explicitParameters.length > 0 ? candidates.explicitParameters : candidates.legacyParameters; + if (candidates.explicitParameters.length > 0 && candidates.legacyParameters.length > 0) { + const signature = (items: readonly QuickScriptParameterMetadata[]): string => items + .map(parameter => `${parameter.name.toUpperCase()}:${parameter.datatype.toUpperCase()}`) + .join(','); + if (signature(candidates.explicitParameters) !== signature(candidates.legacyParameters)) { + diagnostics.push(metadataDiagnostic( + 'metadata-conflict', + 'Legacy parameter metadata conflicts with higher-priority explicit @Param metadata.', + candidates.legacyParameters[0].range, + )); + } + } + const fallback = filenameFallback(options.fileName); + const resolvedScriptType = scriptType?.value ?? fallback?.scriptType ?? 'Generic'; + const resolvedName = name?.value ?? fallback?.name; + + let resolvedEvent = event?.value; + if (resolvedScriptType === 'Window' && event !== undefined) { + const normalized = normalizeWindowEvent(event.value); + if (normalized === undefined) { + diagnostics.push(metadataDiagnostic('invalid-window-event', `Unknown Window script event '${event.value}'.`, event.range)); + resolvedEvent = undefined; + } else { + resolvedEvent = normalized; + } + } else if (event !== undefined && !['Application', 'Condition'].includes(resolvedScriptType)) { + diagnostics.push(metadataDiagnostic('metadata-conflict', `Event metadata is not supported for ${resolvedScriptType} scripts.`, event.range)); + } + if (resolvedScriptType === 'Window' && returnType !== undefined) { + diagnostics.push(metadataDiagnostic('metadata-conflict', 'Window scripts cannot declare a return type.', returnType.range)); + } + + const metadataSources: MetadataSourceKind[] = [scriptType, name, event, trigger, shortcut, description, returnType] + .flatMap(value => value === undefined ? [] : [value.source]); + if (candidates.explicitParameters.length > 0) metadataSources.push('explicit'); + else if (candidates.legacyParameters.length > 0) metadataSources.push('legacy'); + const metadataSource: MetadataSourceKind = metadataSources.includes('explicit') + ? 'explicit' + : metadataSources.includes('legacy') + ? 'legacy' + : fallback === undefined ? 'none' : 'filename'; + + return { + scriptType: resolvedScriptType, + name: resolvedName, + nameRange: name?.range, + event: resolvedEvent, + eventRange: event?.range, + trigger: trigger?.value, + triggerRange: trigger?.range, + shortcut: shortcut?.value, + shortcutRange: shortcut?.range, + description: description?.value, + descriptionRange: description?.range, + parameters, + returnType: returnType?.value, + returnTypeRange: returnType?.range, + metadataSource, + legacyScriptType: candidates.legacyScriptType, + diagnostics, + }; +} diff --git a/packages/core/src/formatter.ts b/packages/core/src/formatter.ts new file mode 100644 index 0000000..9da2aab --- /dev/null +++ b/packages/core/src/formatter.ts @@ -0,0 +1,406 @@ +import { Token, TokenKind } from './token'; +import { tokenize } from './tokenizer'; +import { CoreDiagnostic, parseQuickScript } from './parser'; + +export interface FormatOptions { + lineEnding?: '\n' | '\r\n'; + indentSize?: number; + insertSpaces?: boolean; + removeEmptyLines?: boolean; + removeEmptyLinesInComments?: boolean; + allowedNumberOfEmptyLines?: number; + blockCodeBegin?: string; + blockCodeEnd?: string; + blockCodeExclude?: string; + regionBlockCodeBegin?: string; + regionBlockCodeEnd?: string; + regionBlockCodeExclude?: string; +} + +export interface FormatResult { + text: string; + changed: boolean; + diagnostics?: CoreDiagnostic[]; +} + +function isLineBoundary(token: Token | undefined): boolean { + return token === undefined || token.kind === TokenKind.Newline || token.kind === TokenKind.EOF; +} + +function previousSignificant(tokens: readonly Token[], index: number): Token | undefined { + for (let current = index - 1; current >= 0; current -= 1) { + if (tokens[current].kind !== TokenKind.Whitespace && tokens[current].kind !== TokenKind.Newline) { + return tokens[current]; + } + } + return undefined; +} + +function nextSignificant(tokens: readonly Token[], index: number): Token | undefined { + for (let current = index + 1; current < tokens.length; current += 1) { + if (tokens[current].kind !== TokenKind.Whitespace) { + return tokens[current]; + } + } + return undefined; +} + +function trimHorizontalWhitespace(output: string[]): void { + if (output.length > 0 && /^[ \t\f\v]+$/.test(output[output.length - 1])) { + output.pop(); + } +} + +function appendSingleSpace(output: string[]): void { + trimHorizontalWhitespace(output); + const tail = output[output.length - 1]; + if (tail !== undefined && !tail.endsWith('\n') && !tail.endsWith('\r')) { + output.push(' '); + } +} + +function isUnaryMinus(tokens: readonly Token[], index: number): boolean { + if (tokens[index].lexeme !== '-' || nextSignificant(tokens, index)?.kind !== TokenKind.Number) { + return false; + } + const previous = previousSignificant(tokens, index); + return previous === undefined + || previous.kind === TokenKind.Operator + || (previous.kind === TokenKind.Punctuation && ['(', '[', ',', ';', ':'].includes(previous.lexeme)); +} + +function normalizeLineTails(text: string, lineEnding: '\n' | '\r\n'): string { + const lines = text.split(/\r\n|\r|\n/).map(line => line.replace(/[ \t\f\v]+$/g, '')); + return lines.join(lineEnding); +} + +/** + * Apply lexical QuickScript formatting without editor or file-system dependencies. + * String and comment lexemes are emitted unchanged; all classification comes from the tokenizer. + */ +export function formatQuickScriptLexically(source: string, options: FormatOptions = {}): FormatResult { + const lineEnding = options.lineEnding ?? '\r\n'; + const normalizedSource = source.replace(/\r\n|\r|\n/g, lineEnding); + const tokens = tokenize(normalizedSource); + + // Match the legacy safety behavior for incomplete strings and unmatched closing comments. + if (tokens.some(token => token.kind === TokenKind.String && !token.lexeme.endsWith('"')) + || tokens.some(token => token.kind === TokenKind.Unknown && token.lexeme === '}')) { + return { text: normalizedSource, changed: normalizedSource !== source }; + } + + const output: string[] = []; + let skipWhitespace = false; + let preserveStandaloneDirectiveContent = false; + for (let index = 0; index < tokens.length; index += 1) { + const token = tokens[index]; + if (token.kind === TokenKind.EOF) { + break; + } + const standaloneDirective = token.kind === TokenKind.Comment ? token.lexeme.trim() : undefined; + const closesStandaloneDirective = standaloneDirective !== undefined + && (matchesDirective(standaloneDirective, options.blockCodeEnd ?? '{<') + || matchesDirective(standaloneDirective, options.regionBlockCodeEnd ?? '{endregion')); + if (closesStandaloneDirective) { + preserveStandaloneDirectiveContent = false; + } + if (preserveStandaloneDirectiveContent) { + output.push(token.lexeme); + continue; + } + if (token.kind === TokenKind.Newline) { + trimHorizontalWhitespace(output); + output.push(lineEnding); + skipWhitespace = false; + continue; + } + if (token.kind === TokenKind.Whitespace) { + if (!skipWhitespace) { + output.push(token.lexeme); + } + skipWhitespace = false; + continue; + } + skipWhitespace = false; + + const next = nextSignificant(tokens, index); + if (token.kind === TokenKind.Keyword || token.kind === TokenKind.Datatype) { + output.push(token.lexeme.toUpperCase()); + continue; + } + + if (token.kind === TokenKind.Operator) { + if (isUnaryMinus(tokens, index)) { + output.push('-'); + skipWhitespace = true; + continue; + } + appendSingleSpace(output); + output.push(token.lexeme); + if (!isLineBoundary(next)) { + output.push(' '); + } + skipWhitespace = true; + continue; + } + + if (token.kind === TokenKind.Punctuation) { + if (token.lexeme === '(' || token.lexeme === '[') { + const previous = previousSignificant(tokens, index); + trimHorizontalWhitespace(output); + if (token.lexeme === '(' && previous?.kind === TokenKind.Keyword && previous.lexeme.toUpperCase() === 'IF') { + appendSingleSpace(output); + } + output.push(token.lexeme); + skipWhitespace = true; + continue; + } + if (token.lexeme === ')' || token.lexeme === ']') { + trimHorizontalWhitespace(output); + output.push(token.lexeme); + if (next !== undefined && (next.kind === TokenKind.Identifier || next.kind === TokenKind.Keyword || next.kind === TokenKind.Datatype)) { + output.push(' '); + skipWhitespace = true; + } + continue; + } + if (token.lexeme === ',' || token.lexeme === ';') { + trimHorizontalWhitespace(output); + output.push(token.lexeme); + if (!isLineBoundary(next) && !(token.lexeme === ',' && next?.lexeme === ')')) { + output.push(' '); + } + skipWhitespace = true; + continue; + } + } + + if (token.kind === TokenKind.Comment) { + const previous = previousSignificant(tokens, index); + if (previous?.kind === TokenKind.Keyword + && previous.lexeme.toUpperCase() === 'THEN' + && previous.range.end.line === token.range.start.line) { + appendSingleSpace(output); + } + output.push(token.lexeme); + const opensStandaloneDirective = standaloneDirective !== undefined + && !standaloneDirective.endsWith('}') + && (matchesDirective(standaloneDirective, options.blockCodeBegin ?? '{>') + || matchesDirective(standaloneDirective, options.regionBlockCodeBegin ?? '{region')); + if (opensStandaloneDirective) { + preserveStandaloneDirectiveContent = true; + } + if (next !== undefined && (next.kind === TokenKind.Identifier || next.kind === TokenKind.Keyword || next.kind === TokenKind.Datatype)) { + output.push(' '); + skipWhitespace = true; + } + continue; + } + + output.push(token.lexeme); + } + + const text = normalizeLineTails(output.join(''), lineEnding); + return { text, changed: text !== source }; +} + +function normalizedIndent(options: FormatOptions): string { + const size = Number.isInteger(options.indentSize) && options.indentSize! >= 1 && options.indentSize! <= 10 + ? options.indentSize! + : 4; + return options.insertSpaces === false ? '\t' : ' '.repeat(size); +} + +function normalizeStructuredLine(line: string): string { + const tokens = tokenize(line); + const output: string[] = []; + for (const token of tokens) { + if (token.kind === TokenKind.EOF || token.kind === TokenKind.Newline) { + continue; + } + if (token.kind === TokenKind.Whitespace) { + if (output.length > 0 && output[output.length - 1] !== ' ') { + output.push(' '); + } + } else { + output.push(token.lexeme); + } + } + return output.join('').replace(/[ \t]+$/g, ''); +} + +function matchesDirective(line: string, marker: string | undefined): boolean { + return marker !== undefined && marker.length > 0 && line.toLowerCase().startsWith(marker.toLowerCase()); +} + +interface MultilineCommentShift { + endLine: number; + originalIndent: string; + targetIndent: string; + contentOriginalIndent?: string; + contentTargetIndent?: string; + alignClosingLine?: boolean; +} + +function isFormatterDirective(line: string, options: FormatOptions): boolean { + return matchesDirective(line, options.blockCodeBegin ?? '{>') + || matchesDirective(line, options.blockCodeEnd ?? '{<') + || matchesDirective(line, options.blockCodeExclude ?? '{#') + || matchesDirective(line, options.regionBlockCodeBegin ?? '{region') + || matchesDirective(line, options.regionBlockCodeEnd ?? '{endregion') + || matchesDirective(line, options.regionBlockCodeExclude ?? '{#'); +} + +interface MultilineCommentStart { + token: Token; + directive: boolean; + contentIndent: string; +} + +function sharedContentIndent(comment: string): string { + const physicalLines = comment.split(/\r\n|\r|\n/); + const lines = physicalLines.slice(1, comment.endsWith('}') ? -1 : undefined).filter(line => line.trim().length > 0); + if (lines.length === 0) return ''; + let shared = lines[0].match(/^[ \t]*/)?.[0] ?? ''; + for (const line of lines.slice(1)) { + const leading = line.match(/^[ \t]*/)?.[0] ?? ''; + while (shared.length > 0 && !leading.startsWith(shared)) shared = shared.slice(0, -1); + } + return shared; +} + +function multilineCommentStarts(source: string, options: FormatOptions): Map { + const starts = new Map(); + for (const token of tokenize(source)) { + if (token.kind !== TokenKind.Comment || token.range.end.line <= token.range.start.line) continue; + const lineStart = source.lastIndexOf('\n', token.span.start - 1) + 1; + const beforeComment = source.slice(lineStart, token.span.start); + const trimmed = token.lexeme.trimStart(); + if (/^[ \t]*$/.test(beforeComment) && trimmed.startsWith('{')) { + starts.set(token.range.start.line, { + token, + directive: isFormatterDirective(trimmed, options), + contentIndent: sharedContentIndent(token.lexeme), + }); + } + } + return starts; +} + +function shiftCommentLine(line: string, shift: MultilineCommentShift, lineNumber: number): string { + if (line.trim().length === 0) return ''; + if (shift.contentTargetIndent !== undefined && shift.contentOriginalIndent !== undefined) { + if (shift.alignClosingLine === true && lineNumber === shift.endLine) { + return shift.targetIndent + line.trimStart(); + } + if (line.startsWith(shift.contentOriginalIndent)) { + return shift.contentTargetIndent + line.slice(shift.contentOriginalIndent.length); + } + return shift.contentTargetIndent + line.trimStart(); + } + if (line.startsWith(shift.originalIndent)) { + return shift.targetIndent + line.slice(shift.originalIndent.length); + } + const leading = line.match(/^[ \t]*/)?.[0] ?? ''; + const delta = shift.targetIndent.length - shift.originalIndent.length; + if (delta < 0) return line.slice(Math.min(-delta, leading.length)); + if (delta > 0) return shift.targetIndent.slice(0, delta) + line; + return line; +} + +/** Apply parser-driven indentation to lexically normalized QuickScript. */ +export function formatQuickScriptStructure(source: string, options: FormatOptions = {}): FormatResult { + const lineEnding = options.lineEnding ?? '\r\n'; + const normalizedSource = source.replace(/\r\n|\r|\n/g, lineEnding); + const document = parseQuickScript(normalizedSource); + const sourceLines = normalizedSource.split(lineEnding); + const commentStarts = multilineCommentStarts(normalizedSource, options); + const output: string[] = []; + const indent = normalizedIndent(options); + let directiveDepth = 0; + let blankCount = 0; + let commentShift: MultilineCommentShift | undefined; + const maximumBlankLines = options.removeEmptyLines === false + ? Number.POSITIVE_INFINITY + : Math.max(0, options.allowedNumberOfEmptyLines ?? 1); + + for (let lineNumber = 0; lineNumber < sourceLines.length; lineNumber += 1) { + const original = sourceLines[lineNumber].replace(/[ \t]+$/g, ''); + const structure = document.lines[lineNumber]; + if (commentShift !== undefined && lineNumber <= commentShift.endLine) { + if (original.trim().length === 0) { + if (options.removeEmptyLinesInComments !== true) { + blankCount = 0; + output.push(shiftCommentLine(original, commentShift, lineNumber)); + } else { + blankCount += 1; + if (blankCount <= maximumBlankLines) output.push(''); + } + } else { + blankCount = 0; + output.push(shiftCommentLine(original, commentShift, lineNumber)); + } + if (lineNumber === commentShift.endLine) commentShift = undefined; + continue; + } + if (original.trim().length === 0) { + if (structure?.preserveIndent && options.removeEmptyLinesInComments !== true) { + blankCount = 0; + output.push(original); + continue; + } + blankCount += 1; + if (blankCount <= maximumBlankLines || lineNumber === sourceLines.length - 1) { + output.push(''); + } + continue; + } + blankCount = 0; + + const trimmed = original.trimStart(); + const closesDirective = matchesDirective(trimmed, options.blockCodeEnd ?? '{<') + || matchesDirective(trimmed, options.regionBlockCodeEnd ?? '{endregion'); + const excludesDirective = matchesDirective(trimmed, options.blockCodeExclude ?? '{#') + || matchesDirective(trimmed, options.regionBlockCodeExclude ?? '{#'); + if (closesDirective) { + directiveDepth = Math.max(0, directiveDepth - 1); + } + + const back = excludesDirective ? 1 : 0; + const depth = Math.max(0, (structure?.indentDepth ?? 0) + directiveDepth - back); + const multilineComment = commentStarts.get(lineNumber); + if (multilineComment !== undefined) { + const originalIndent = original.match(/^[ \t]*/)?.[0] ?? ''; + const targetIndent = indent.repeat(depth); + output.push(targetIndent + original.slice(originalIndent.length)); + commentShift = { + endLine: multilineComment.token.range.end.line, + originalIndent, + targetIndent, + contentOriginalIndent: multilineComment.directive ? multilineComment.contentIndent : undefined, + contentTargetIndent: multilineComment.directive ? targetIndent + indent : undefined, + alignClosingLine: multilineComment.directive && multilineComment.token.lexeme.endsWith('}'), + }; + } else if (structure?.preserveIndent) { + output.push(original); + } else { + output.push(indent.repeat(depth) + normalizeStructuredLine(trimmed)); + } + + const opensDirective = matchesDirective(trimmed, options.blockCodeBegin ?? '{>') + || matchesDirective(trimmed, options.regionBlockCodeBegin ?? '{region'); + if (opensDirective && multilineComment?.directive !== true) { + directiveDepth += 1; + } + } + + const text = output.join(lineEnding); + return { text, changed: text !== source, diagnostics: document.diagnostics }; +} + +/** Format QuickScript through the canonical tokenizer and structure parser. */ +export function formatQuickScript(source: string, options: FormatOptions = {}): FormatResult { + const lexical = formatQuickScriptLexically(source, options); + const structured = formatQuickScriptStructure(lexical.text, options); + return { ...structured, changed: structured.text !== source }; +} diff --git a/packages/core/src/generatedFunctionCatalog.ts b/packages/core/src/generatedFunctionCatalog.ts new file mode 100644 index 0000000..8d39d3c --- /dev/null +++ b/packages/core/src/generatedFunctionCatalog.ts @@ -0,0 +1,1891 @@ +// Generated from syntaxes/intouch.tmLanguage.json by scripts/generate-language-data.js. +// Do not edit this file manually. + +export interface KnownFunction { + name: string; + category: string; + sourceComment: string; +} + +export const KNOWN_FUNCTIONS: readonly KnownFunction[] = [ + { + "name": "Abs", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Ack", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "ActivateApp", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "AddPermission", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckAll", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckDisplay", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckGroup", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckRecent", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckSelect", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckSelectedGroup", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckSelectedPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckSelectedTag", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almAckTag", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almDefQuery", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almMoveWindow", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almQuery", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectAll", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectGroup", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectionCount", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectItem", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSelectTag", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSetQueryByName", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almShowStats", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressAll", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressDisplay", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressGroup", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressRetain", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressSelected", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressSelectedGroup", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressSelectedPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressSelectedTag", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almSuppressTag", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almUnselectAll", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "almUnsuppressAll", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "AnnotateLayout", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUFindAlarmGroupInstance", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUFindFileInstance", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUFindPrinterInstance", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetAlarmGroupText", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetConfigurationFilePath", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetInstanceCount", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetPrinterJobCount", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetPrinterName", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetPrinterStatus", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetQueryAlarmState", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetQueryFromPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetQueryProcessingState", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUGetQueryToPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUIsInstanceUsed", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUSetAlarmGroupText", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUSetQueryAlarmState", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUSetQueryFromPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUSetQueryToPriority", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUSetTimeoutValues", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUStartInstance", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUStartQuery", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUStopInstance", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUStopQuery", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "APUTranslateErrorCode", + "category": "IT-functions Ground Teil 1", + "sourceComment": "IT-functions Ground Teil 1" + }, + { + "name": "ArcCos", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "ArcSin", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "ArcTan", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "AttemptInvisibleLogon", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ChangePassword", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ChangeWindowColor", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "Clip_cursor", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "ConvertTemp", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Cos", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "CreateFilenameFromDate", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "DateTimeGMT", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "DialogStringEntry", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "DialogValueEntry", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "DText", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "EnableDisableKeys", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "Exp", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "FileCopy", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FileDelete", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FileMove", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FilePrint", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "FileReadFields", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FileReadMessage", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FileSelect", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "FileWriteFields", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "FileWriteMessage", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "GeoArea", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "GeoEqualSideArea", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "GeoVolume", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "GetAccountStatus", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetCursorPosition", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "GetDiscOffMsg", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetDiscOnMsg", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetNodeName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetPropertyD", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetPropertyI", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetPropertyM", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "GetWindowName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "Hide", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "Hide_cursor", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "HideSelf", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetLastError", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetPenName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetTimeAtScooter", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetTimeStringAtScooter", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetValue", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetValueAtScooter", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTGetValueAtZone", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTScrollLeft", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTScrollRight", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTSelectTag", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTSetPenName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTUpdateToCurrentTime", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTZoomIn", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "HTZoomOut", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "InfoAppActive", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoAppStatus", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "InfoAppTitle", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoAppTitleExpand", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "InfoDisk", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoDosEnv", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoFile", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoInTouchAppDir", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoResources", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "InfoWinEnv", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "INIReadInteger", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "INIReadString", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "INIWriteInteger", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "INIWriteString", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "Int", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "InTouchVersion", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "InvisibleVerifyCredentials", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IODisableFailover", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOForceFailover", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOGetAccessNameStatus", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOGetActiveSourceName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOGetApplication", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOGetNode", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOGetTopic", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOReinitAccessName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOReinitialize", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IORRGetItemActiveState", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "IORRGetSystemInfo", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "IORRWriteState", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "IOSetAccessName", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOSetItem", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOSetRemoteReferences", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IOStartUninitConversations", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IsAnyAsyncFunctionBusy", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IsAssignedRole", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "IsNodeAppRunning", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXAppActivate", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXCheckDate", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXConvertDate", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXConvertDateString", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXConvertDateTime", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXConvertDateTimeString", + "category": "IT-functions Ground Teil 2", + "sourceComment": "IT-functions Ground Teil 2" + }, + { + "name": "ITXCreateDate", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ITXCreateDateTime", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ITXCreateDateTimeUTC", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ITXCreateDirectory", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXCreateSubDirectory", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXGetProfileInt", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXGetProfileString", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXPutProfileInt", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXPutProfileString", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXRemoveDirectory", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXRemoveSubDirectory", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXResizeApplication", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXSetLocalTime", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXSetSystemDate", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXSetSystemTime", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXShowHelpByNumber", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ITXShowHelpByString", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ITXStartAppInDirectory", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "ITXWindowCtrl", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "LaunchTagViewer", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Log", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "LogMessage", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "LogN", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Logoff", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "LogonCurrentUser", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "MessageBox", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "MetFromStdFluid", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "MetFromStdLinear", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "MetFromStdWeight", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "MoveWindow", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "NumberRecipes", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "OpenWindowsList", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Pi", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "PlaySound", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PostLogonDialog", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PrintHT", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PrintScreen", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PrintWindow", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptGetTrendType", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptLoadTrendCfg", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptPanCurrentPen", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptPanTime", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptPauseTrend", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptRefreshTrend", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSaveTrendCfg", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetCurrentPen", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetPen", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetPenEx", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetTimeAxis", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetTimeAxisToCurrent", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetTrend", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptSetTrendType", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptZoomCurrentPen", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ptZoomTime", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PwdUserAdd", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PwdUserDelete", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PwdUserEdit", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PwdUserGetIndex", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "PwdUserRead", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "QueryGroupMembership", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "RecipeDelete", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeGetMessage", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeLoad", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeSave", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeSelectNextRecipe", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeSelectPreviousRecipe", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeSelectRecipe", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "RecipeSelectUnit", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "ReloadWindowViewer", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "RestartWindowViewer", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Restore_clip", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Round", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "SendKeys", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SendMail", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SendSMTPMail", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SendSMTPMailwAttachment", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SetCursorPosition", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "SetPropertyD", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SetPropertyI", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SetPropertyM", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SetTagEU", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SetWindowPrinter", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Sgn", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Show", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Show_cursor", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "ShowAt", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ShowHome", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "ShowTopLeftAt", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Sin", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "SPCEXSetDataset", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetEndDate", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetEndTime", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetOutputFile", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetProduct", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetStartDate", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SPCEXSetStartTime", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLAppendStatement", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLClearParam", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLClearStatement", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLClearTable", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLCommit", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLConnect", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLCreateTable", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLDelete", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLDisconnect", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLDropTable", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLEnd", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLErrorMsg", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLExecute", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLFirst", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLGetRecord", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLInsert", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLInsertEnd", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLInsertExecute", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLInsertPrepare", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLLast", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLLoadStatement", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLManageDSN", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLNext", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLNumRows", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLPrepareStatement", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLPrev", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLRollback", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSelect", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamChar", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamDate", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamDateTime", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamDecimal", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamFloat", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamInt", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamLong", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamNull", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetParamTime", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLSetStatement", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLTransact", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLUpdate", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "SQLUpdateCurrent", + "category": "Intouch AddOns functions", + "sourceComment": "Intouch AddOns functions" + }, + { + "name": "Sqrt", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "StartApp", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "StdFromMetFluid", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "StdFromMetLinear", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "StdFromMetWeight", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "StringASCII", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringChar", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringCompare", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringCompareEncrypted", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "StringCompareNoCase", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringFromGMTTimeToLocal", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringFromIntg", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringFromReal", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringFromTime", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringFromTimeLocal", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringInString", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringLeft", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringLen", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringLower", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringMid", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringReplace", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringRight", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringSpace", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringTest", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringToIntg", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringToReal", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringTrim", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "StringUpper", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "SwitchDisplayLanguage", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SysBeep", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "SystemIsNT", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "TagExists", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "Tan", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "Text", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "Trunc", + "category": "IT-functions-Math", + "sourceComment": "IT-functions-Math" + }, + { + "name": "TseGetClientId", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "TseGetClientNodeName", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "TseQueryRunningOnClient", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "TseQueryRunningOnConsole", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "UTCDateTime", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcAddItem", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcClear", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcDeleteItem", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcDeleteSelection", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcErrorMessage", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcFindItem", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcGetItem", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcGetItemData", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcInsertItem", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcLoadList", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcLoadText", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcSaveList", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcSaveText", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wcSetItemData", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WindowState", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWAlwaysOnTop", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWBeep32", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWCntx32", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWContext", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWControl", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWControlPanel", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWDosCommand", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWExecute", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWGetServiceExeName", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWGetServiceName", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWGetServiceStatus", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWIsDayLightSaving", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWMoveWindow", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWMultiMonitorNode", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWPoke", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWPrimaryMonitorHeight", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWPrimaryMonitorWidth", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWRequest", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWServiceControl", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWServiceControlError", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWShutDownWin95", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWShutDownWinNT40", + "category": "IT-functions-System", + "sourceComment": "IT-functions-System" + }, + { + "name": "WWStartApp", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "wwStringFromTime", + "category": "Intouch String functions", + "sourceComment": "Intouch String functions" + }, + { + "name": "WWVirtualMonitorHeight", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + }, + { + "name": "WWVirtualMonitorWidth", + "category": "IT-functions Ground Teil 3", + "sourceComment": "IT-functions Ground Teil 3" + } +] as const; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts new file mode 100644 index 0000000..724c3be --- /dev/null +++ b/packages/core/src/index.ts @@ -0,0 +1,11 @@ +export * from './languageData'; +export * from './documentMetadata'; +export * from './formatter'; +export * from './generatedFunctionCatalog'; +export * from './languageService'; +export * from './parser'; +export * from './quality'; +export * from './semantics'; +export * from './source'; +export * from './token'; +export * from './tokenizer'; diff --git a/packages/core/src/languageData.ts b/packages/core/src/languageData.ts new file mode 100644 index 0000000..de5c98a --- /dev/null +++ b/packages/core/src/languageData.ts @@ -0,0 +1,76 @@ +/** + * Lexical language data shared by the new core. + * + * Built-in and project-specific function names intentionally remain in the TextMate grammar + * until that larger inventory can be migrated without creating a partial third source of truth. + */ +export const KEYWORDS = [ + 'ABS', + 'AND', + 'AS', + 'ATN', + 'CALL', + 'COS', + 'DIM', + 'EACH', + 'ELSE', + 'ENDIF', + 'EOF', + 'EXIT', + 'EXP', + 'FALSE', + 'FOR', + 'FRAC', + 'IF', + 'IN', + 'INT', + 'IS', + 'LOG', + 'MOD', + 'NEXT', + 'NOT', + 'NULL', + 'OR', + 'RETURN', + 'RND', + 'ROUND', + 'SHL', + 'SHR', + 'SIN', + 'SQR', + 'SQRT', + 'STEP', + 'TAN', + 'THEN', + 'TO', + 'TRUE', + 'WHILE', + 'XOR', +] as const; + +export const DATATYPES = ['DISCRETE', 'INTEGER', 'MESSAGE', 'REAL'] as const; + +/** Operators are ordered longest-first for deterministic matching. */ +export const OPERATORS = [ + '==', + '<>', + '<=', + '>=', + '->', + '=', + '+', + '-', + '<', + '>', + '*', + '/', + '%', + '!', + '~', + '|', +] as const; + +export const PUNCTUATION = ['(', ')', '[', ']', ';', ',', ':', '.'] as const; + +export const KEYWORD_SET: ReadonlySet = new Set(KEYWORDS); +export const DATATYPE_SET: ReadonlySet = new Set(DATATYPES); diff --git a/packages/core/src/languageService.ts b/packages/core/src/languageService.ts new file mode 100644 index 0000000..5617c36 --- /dev/null +++ b/packages/core/src/languageService.ts @@ -0,0 +1,152 @@ +import { KNOWN_FUNCTIONS } from './generatedFunctionCatalog'; +import { DATATYPES, KEYWORDS } from './languageData'; +import { SemanticModel } from './semantics'; +import { Position, Range } from './source'; +import { TokenKind } from './token'; + +export type CompletionKind = 'keyword' | 'datatype' | 'function' | 'variable' | 'call-target'; + +export interface CompletionEntry { + label: string; + kind: CompletionKind; + detail: string; +} + +export interface HoverEntry { + label: string; + detail: string; + range: Range; +} + +export interface DocumentSymbolEntry { + name: string; + kind: 'variable' | 'if' | 'for' | 'while' | 'function' | 'window' | 'event' | 'application' | 'data-change' | 'condition' | 'key-script'; + range: Range; + selectionRange: Range; + children: DocumentSymbolEntry[]; +} + +function contains(range: Range, position: Position): boolean { + return (position.line > range.start.line || (position.line === range.start.line && position.character >= range.start.character)) + && (position.line < range.end.line || (position.line === range.end.line && position.character < range.end.character)); +} + +/** Return deterministic completion data from canonical language data and the current document. */ +export function completions(model: SemanticModel): CompletionEntry[] { + const entries = new Map(); + const add = (entry: CompletionEntry): void => { + const key = entry.label.toUpperCase(); + if (!entries.has(key)) { + entries.set(key, entry); + } + }; + for (const label of KEYWORDS) add({ label, kind: 'keyword', detail: 'QuickScript keyword' }); + for (const label of DATATYPES) add({ label, kind: 'datatype', detail: 'QuickScript datatype' }); + for (const item of KNOWN_FUNCTIONS) add({ label: item.name, kind: 'function', detail: item.sourceComment || item.category }); + for (const symbol of model.symbols) add({ label: symbol.name, kind: 'variable', detail: symbol.datatype ? `Local ${symbol.datatype} variable` : 'Local variable' }); + for (const statement of model.document.statements.filter(candidate => candidate.kind === 'call' && candidate.name !== undefined)) { + add({ label: statement.name!, kind: 'call-target', detail: 'Document call target' }); + } + return [...entries.values()].sort((left, right) => left.label.localeCompare(right.label, 'en', { sensitivity: 'base' })); +} + +/** Return sourced hover facts only; unknown identifiers intentionally have no hover. */ +export function hoverAt(model: SemanticModel, position: Position): HoverEntry | undefined { + const token = model.document.tokens.find(candidate => contains(candidate.range, position)); + if (token === undefined) { + return undefined; + } + if (token.kind === TokenKind.Keyword) { + return { label: token.lexeme.toUpperCase(), detail: 'QuickScript keyword', range: token.range }; + } + if (token.kind === TokenKind.Datatype) { + return { label: token.lexeme.toUpperCase(), detail: 'QuickScript datatype', range: token.range }; + } + const local = model.symbols.find(symbol => symbol.name.toUpperCase() === token.lexeme.toUpperCase()); + if (local !== undefined) { + return { label: local.name, detail: local.datatype ? `Local ${local.datatype} variable` : 'Local variable', range: token.range }; + } + const known = KNOWN_FUNCTIONS.find(item => item.name.toUpperCase() === token.lexeme.toUpperCase()); + if (known !== undefined) { + return { label: known.name, detail: known.sourceComment || known.category, range: token.range }; + } + if (/^(SYS_|MA_|SMEL_|HER_)/i.test(token.lexeme)) { + return { label: token.lexeme, detail: 'Hermes system variable', range: token.range }; + } + return undefined; +} + +/** Build a hierarchical outline from local declarations and parser block relationships. */ +export function documentSymbols(model: SemanticModel): DocumentSymbolEntry[] { + const blocks = model.document.blocks.map(block => ({ + name: block.kind.toUpperCase(), + kind: block.kind, + range: block.range, + selectionRange: block.opener, + children: [] as DocumentSymbolEntry[], + })); + const roots: DocumentSymbolEntry[] = []; + for (const block of model.document.blocks) { + if (block.parentId === undefined) roots.push(blocks[block.id]); + else blocks[block.parentId].children.push(blocks[block.id]); + } + const body = [ + ...model.symbols.map(symbol => ({ + name: symbol.name, + kind: 'variable' as const, + range: symbol.range, + selectionRange: symbol.selectionRange, + children: [], + })), + ...roots, + ]; + const metadata = model.metadata; + const selectionRange = metadata.nameRange ?? metadata.triggerRange ?? model.document.range; + if (metadata.scriptType === 'QuickFunction' && metadata.name !== undefined) { + return [{ + name: metadata.name, + kind: 'function', + range: model.document.range, + selectionRange, + children: body, + }]; + } + if (metadata.scriptType === 'Window' && metadata.name !== undefined) { + const eventChildren = metadata.event === undefined ? body : [{ + name: metadata.event, + kind: 'event' as const, + range: model.document.range, + selectionRange: metadata.eventRange ?? selectionRange, + children: body, + }]; + return [{ name: metadata.name, kind: 'window', range: model.document.range, selectionRange, children: eventChildren }]; + } + if (metadata.scriptType === 'Application') { + const name = metadata.name ?? 'Application'; + const children = metadata.event === undefined ? body : [{ + name: metadata.event, + kind: 'event' as const, + range: model.document.range, + selectionRange: metadata.eventRange ?? selectionRange, + children: body, + }]; + return [{ name, kind: 'application', range: model.document.range, selectionRange, children }]; + } + if (metadata.scriptType === 'DataChange' || metadata.scriptType === 'Condition') { + const kind = metadata.scriptType === 'DataChange' ? 'data-change' as const : 'condition' as const; + const name = metadata.name ?? metadata.trigger ?? metadata.scriptType; + return [{ name, kind, range: model.document.range, selectionRange, children: body }]; + } + if (metadata.scriptType === 'KeyScript') { + const name = metadata.name ?? 'KeyScript'; + const children = metadata.shortcut === undefined ? body : [{ + name: metadata.shortcut, + kind: 'event' as const, + range: model.document.range, + selectionRange: metadata.shortcutRange ?? selectionRange, + children: body, + }]; + return [{ name, kind: 'key-script', range: model.document.range, selectionRange, children }]; + } + return body; +} diff --git a/packages/core/src/parser.ts b/packages/core/src/parser.ts new file mode 100644 index 0000000..3309698 --- /dev/null +++ b/packages/core/src/parser.ts @@ -0,0 +1,861 @@ +import { DATATYPE_SET } from './languageData'; +import { Range, SourceSpan, sourceRange } from './source'; +import { Token, TokenKind } from './token'; +import { tokenize } from './tokenizer'; + +export type BlockKind = 'if' | 'for' | 'while'; +export type StatementKind = + | 'dim' + | 'assignment' + | 'call' + | 'direct-call' + | 'command' + | 'if' + | 'else' + | 'endif' + | 'for' + | 'next' + | 'while' + | 'exit-for' + | 'return' + | 'unknown'; +export type DiagnosticSeverity = 'error' | 'warning' | 'information' | 'hint'; + +export interface CoreDiagnostic { + code: string; + message: string; + severity: DiagnosticSeverity; + range: Range; + source?: string; +} + +export interface StatementNode { + kind: StatementKind; + range: Range; + span: SourceSpan; + name?: string; + nameRange?: Range; + datatype?: string; + datatypeRange?: Range; + parentBlockId?: number; +} + +export interface BlockNode { + id: number; + kind: BlockKind; + parentId?: number; + childIds: number[]; + range: Range; + span: SourceSpan; + bodyRange: Range; + bodySpan: SourceSpan; + opener: Range; + middle?: Range; + closer?: Range; +} + +export interface LineStructure { + line: number; + indentDepth: number; + preserveIndent: boolean; +} + +export interface QuickScriptDocument { + source: string; + tokens: Token[]; + statements: StatementNode[]; + blocks: BlockNode[]; + diagnostics: CoreDiagnostic[]; + lines: LineStructure[]; + range: Range; + span: SourceSpan; +} + +interface OpenBlock { + block: BlockNode; + opener: Token; + hasElse: boolean; +} + +interface ParsedStatement { + kind: StatementKind; + first: Token; + last: Token; + names?: Token[]; + datatype?: Token; + name?: Token; + open?: BlockKind; + middle?: boolean; + close?: 'endif' | 'next'; + recoveredLoop?: boolean; +} + +interface ExpressionIssue { + code: 'missing-call-arguments' | 'missing-call-target' | 'missing-expression' | 'unexpected-token' | 'unclosed-delimiter'; + message: string; + token?: Token; +} + +const BINARY_PRECEDENCE = new Map([ + ['OR', 1], + ['XOR', 1], + ['|', 1], + ['AND', 2], + ['==', 3], + ['<>', 3], + ['<', 3], + ['<=', 3], + ['>', 3], + ['>=', 3], + ['IS', 3], + ['SHL', 4], + ['SHR', 4], + ['+', 5], + ['-', 5], + ['*', 6], + ['/', 6], + ['%', 6], + ['MOD', 6], +]); + +const UNARY_OPERATORS = new Set(['+', '-', 'NOT', '!', '~']); +const LITERAL_KEYWORDS = new Set(['TRUE', 'FALSE', 'NULL', 'EOF']); +const CONTROL_KEYWORDS = new Set([ + 'DIM', 'AS', 'CALL', 'IF', 'THEN', 'ELSE', 'ENDIF', 'FOR', 'TO', 'STEP', 'NEXT', 'WHILE', 'EXIT', 'RETURN', +]); +const COMMAND_STATEMENTS = new Set(['ACTIVATEAPP', 'HIDE', 'PLAYSOUND', 'SENDKEYS', 'SHOW', 'STARTAPP']); + +function isTrivia(token: Token): boolean { + return token.kind === TokenKind.Whitespace + || token.kind === TokenKind.Newline + || token.kind === TokenKind.Comment + || token.kind === TokenKind.EOF; +} + +function word(token: Token | undefined): string | undefined { + return token === undefined ? undefined : token.lexeme.toUpperCase(); +} + +function keyword(token: Token | undefined): string | undefined { + return token?.kind === TokenKind.Keyword ? word(token) : undefined; +} + +function tokenNodeRange(source: string, first: Token, last: Token = first): { span: SourceSpan; range: Range } { + return sourceRange(source, { start: first.span.start, end: last.span.end }); +} + +function zeroWidthRange(source: string, tokens: readonly Token[]): Range { + const offset = tokens.length === 0 ? 0 : tokens[tokens.length - 1].span.end; + return sourceRange(source, { start: offset, end: offset }).range; +} + +function diagnostic(code: string, message: string, token: Token): CoreDiagnostic { + return { code, message, severity: 'error', range: token.range }; +} + +function endDiagnostic(source: string, code: string, message: string, tokens: readonly Token[]): CoreDiagnostic { + return { code, message, severity: 'error', range: zeroWidthRange(source, tokens) }; +} + +function lineTokens(tokens: readonly Token[], line: number): Token[] { + return tokens.filter(token => token.range.start.line === line && !isTrivia(token)); +} + +function spanningCommentAt(tokens: readonly Token[], line: number): boolean { + return tokens.some(token => token.kind === TokenKind.Comment + && token.range.end.line > token.range.start.line + && token.range.start.line <= line + && token.range.end.line >= line); +} + +function tokenValue(token: Token | undefined): string | undefined { + return token === undefined ? undefined : token.kind === TokenKind.Keyword ? word(token) : token.lexeme; +} + +class ExpressionParser { + private position = 0; + private issue: ExpressionIssue | undefined; + + public constructor(private readonly tokens: readonly Token[]) {} + + public parse(): ExpressionIssue | undefined { + if (this.tokens.length === 0) { + return { code: 'missing-expression', message: 'Expected a QuickScript expression.' }; + } + this.parseBinary(1); + if (this.issue !== undefined) return this.issue; + if (this.position < this.tokens.length) { + return { + code: 'unexpected-token', + message: `Unexpected token '${this.tokens[this.position].lexeme}' in expression.`, + token: this.tokens[this.position], + }; + } + return undefined; + } + + private parseBinary(minimumPrecedence: number): void { + this.parseUnary(); + while (this.issue === undefined) { + const precedence = BINARY_PRECEDENCE.get(tokenValue(this.tokens[this.position]) ?? ''); + if (precedence === undefined || precedence < minimumPrecedence) return; + this.position += 1; + if (this.position >= this.tokens.length) { + this.issue = { code: 'missing-expression', message: 'Expected an expression after the operator.' }; + return; + } + this.parseBinary(precedence + 1); + } + } + + private parseUnary(): void { + while (UNARY_OPERATORS.has(tokenValue(this.tokens[this.position]) ?? '')) this.position += 1; + this.parsePostfix(); + } + + private parsePostfix(): void { + this.parsePrimary(); + while (this.issue === undefined && this.position < this.tokens.length) { + const value = this.tokens[this.position].lexeme; + if (value === '(') { + const opening = this.tokens[this.position]; + this.parseArguments(opening); + continue; + } + if (value === '[') { + const opening = this.tokens[this.position]; + this.position += 1; + this.parseBinary(1); + this.expectClosing(']', opening); + continue; + } + if (value === '.' || value === '->' || value === ':') { + this.position += 1; + if (!this.isMemberName(this.tokens[this.position])) { + this.issue = { code: 'missing-expression', message: `Expected an identifier after '${value}'.`, token: this.tokens[this.position] }; + return; + } + this.position += 1; + continue; + } + return; + } + } + + private parsePrimary(): void { + const token = this.tokens[this.position]; + if (token === undefined) { + this.issue = { code: 'missing-expression', message: 'Expected a QuickScript expression.' }; + return; + } + if (word(token) === 'CALL') { + this.parseCallExpression(token); + return; + } + if (token.lexeme === '(') { + this.position += 1; + this.parseBinary(1); + this.expectClosing(')', token); + return; + } + if (token.kind === TokenKind.Identifier || token.kind === TokenKind.Number || token.kind === TokenKind.String + || this.isCallableKeyword(token) || LITERAL_KEYWORDS.has(word(token) ?? '')) { + this.position += 1; + return; + } + this.issue = { code: 'unexpected-token', message: `Unexpected token '${token.lexeme}' in expression.`, token }; + } + + private parseCallExpression(call: Token): void { + this.position += 1; + const target = this.tokens[this.position]; + if (!this.isName(target)) { + this.issue = { + code: 'missing-call-target', + message: 'CALL requires a callable name.', + token: target ?? call, + }; + return; + } + this.position += 1; + while (['.', '->', ':'].includes(this.tokens[this.position]?.lexeme ?? '')) { + const separator = this.tokens[this.position]; + this.position += 1; + if (!this.isName(this.tokens[this.position])) { + this.issue = { + code: 'missing-expression', + message: `Expected an identifier after '${separator.lexeme}'.`, + token: this.tokens[this.position], + }; + return; + } + this.position += 1; + } + const opening = this.tokens[this.position]; + if (opening?.lexeme !== '(') { + this.issue = { + code: 'missing-call-arguments', + message: "CALL requires '(' after the callable name.", + token: opening, + }; + return; + } + this.parseArguments(opening); + } + + private parseArguments(opening: Token): void { + this.position += 1; + if (this.tokens[this.position]?.lexeme !== ')') { + while (this.issue === undefined) { + this.parseBinary(1); + if (this.tokens[this.position]?.lexeme !== ',') break; + this.position += 1; + } + } + this.expectClosing(')', opening); + } + + private expectClosing(value: ')' | ']', opening: Token): void { + if (this.issue !== undefined) return; + if (this.tokens[this.position]?.lexeme !== value) { + this.issue = { + code: 'unclosed-delimiter', + message: `Expected '${value}' to close '${opening.lexeme}'.`, + token: this.tokens[this.position], + }; + return; + } + this.position += 1; + } + + private isName(token: Token | undefined): boolean { + return token?.kind === TokenKind.Identifier || this.isCallableKeyword(token); + } + + private isMemberName(token: Token | undefined): boolean { + return token?.kind === TokenKind.Number || this.isName(token); + } + + private isCallableKeyword(token: Token | undefined): boolean { + return token?.kind === TokenKind.Keyword + && !CONTROL_KEYWORDS.has(word(token) ?? '') + && !BINARY_PRECEDENCE.has(word(token) ?? '') + && !UNARY_OPERATORS.has(word(token) ?? ''); + } +} + +function expressionIssue(source: string, tokens: readonly Token[], issue: ExpressionIssue): CoreDiagnostic { + return issue.token === undefined + ? endDiagnostic(source, issue.code, issue.message, tokens) + : diagnostic(issue.code, issue.message, issue.token); +} + +function validateExpression(source: string, tokens: readonly Token[], diagnostics: CoreDiagnostic[]): boolean { + const issue = new ExpressionParser(tokens).parse(); + if (issue === undefined) return true; + diagnostics.push(expressionIssue(source, tokens, issue)); + return false; +} + +class StatementParser { + private position = 0; + private readonly statements: ParsedStatement[] = []; + + public constructor( + private readonly source: string, + private readonly tokens: readonly Token[], + private readonly diagnostics: CoreDiagnostic[], + ) {} + + public parse(): ParsedStatement[] { + while (this.position < this.tokens.length) { + const start = this.position; + this.parseStatement(); + if (this.position <= start) this.position += 1; + } + return this.statements; + } + + private parseStatement(): void { + switch (keyword(this.current())) { + case 'DIM': this.parseDim(); return; + case 'CALL': this.parseCall(); return; + case 'IF': this.parseIf(); return; + case 'ELSE': this.parseElse(); return; + case 'ENDIF': this.parseCloser('endif'); return; + case 'FOR': this.parseFor(); return; + case 'NEXT': this.parseCloser('next'); return; + case 'WHILE': this.parseWhile(); return; + case 'EXIT': this.parseExit(); return; + case 'RETURN': this.parseReturn(); return; + default: this.parseIdentifierStatement(); + } + } + + private parseDim(): void { + const first = this.consume(); + const names: Token[] = []; + let expectName = true; + while (this.position < this.tokens.length && keyword(this.current()) !== 'AS' && this.current()?.lexeme !== ';') { + const token = this.consume(); + if (expectName && token.kind === TokenKind.Identifier) { + names.push(token); + expectName = false; + } else if (!expectName && token.lexeme === ',') { + expectName = true; + } else { + this.diagnostics.push(diagnostic('unexpected-token', `Unexpected token '${token.lexeme}' in DIM declaration.`, token)); + } + } + if (names.length === 0 || expectName) { + this.diagnostics.push(endDiagnostic(this.source, 'missing-identifier', 'DIM requires a variable name.', this.tokens.slice(0, this.position))); + } + let datatype: Token | undefined; + if (keyword(this.current()) !== 'AS') { + this.diagnostics.push(endDiagnostic(this.source, 'missing-as', "DIM requires 'AS' before the datatype.", this.tokens.slice(0, this.position))); + } else { + this.consume(); + datatype = this.current(); + if (datatype === undefined || datatype.lexeme === ';') { + this.diagnostics.push(endDiagnostic(this.source, 'missing-datatype', 'DIM requires a datatype after AS.', this.tokens.slice(0, this.position))); + } else { + this.consume(); + } + } + const last = this.consumeTerminator('DIM statement', datatype ?? names[names.length - 1] ?? first); + this.statements.push({ kind: 'dim', first, last, names, datatype }); + } + + private parseCall(): void { + const first = this.consume(); + const name = this.current(); + const end = this.statementBoundary(this.position); + const expression = this.tokens.slice(this.position, end); + const valid = validateExpression(this.source, expression, this.diagnostics); + if (name === undefined || (name.kind !== TokenKind.Identifier && name.kind !== TokenKind.Keyword)) { + this.diagnostics.push(endDiagnostic(this.source, 'missing-call-target', 'CALL requires a callable name.', [first])); + } else if (valid && !expression.some(token => token.lexeme === '(')) { + this.diagnostics.push(diagnostic('missing-call-arguments', "CALL requires '(' after the callable name.", name)); + } + this.position = end; + const last = this.consumeTerminator('CALL statement', expression[expression.length - 1] ?? first); + this.statements.push({ kind: 'call', first, last, name }); + } + + private parseIf(): void { + const first = this.consume(); + const thenIndex = this.findTopLevelKeyword(this.position, new Set(['THEN'])); + let last = first; + if (thenIndex < 0) { + const expression = this.tokens.slice(this.position); + this.diagnostics.push(endDiagnostic(this.source, 'missing-then', "IF requires 'THEN' after its condition.", expression.length > 0 ? expression : [first])); + this.position = this.tokens.length; + last = expression[expression.length - 1] ?? first; + } else { + validateExpression(this.source, this.tokens.slice(this.position, thenIndex), this.diagnostics); + this.position = thenIndex; + last = this.consume(); + if (this.current()?.lexeme === ';') { + this.diagnostics.push(diagnostic('unexpected-semicolon', 'IF header must not be terminated after THEN.', this.current()!)); + this.consume(); + } + } + this.statements.push({ kind: 'if', first, last, open: 'if' }); + } + + private parseElse(): void { + const first = this.consume(); + if (this.current()?.lexeme === ';') { + this.diagnostics.push(diagnostic('unexpected-semicolon', 'ELSE must not be terminated with a semicolon.', this.current()!)); + this.consume(); + } + this.statements.push({ kind: 'else', first, last: first, middle: true }); + } + + private parseFor(): void { + const first = this.consume(); + const target = this.current(); + if (target?.kind !== TokenKind.Identifier) { + this.diagnostics.push(target === undefined + ? endDiagnostic(this.source, 'missing-loop-variable', 'FOR requires a loop variable.', [first]) + : diagnostic('missing-loop-variable', 'FOR requires a loop variable.', target)); + } else { + this.consume(); + } + if (this.current()?.lexeme !== '=') { + const conflicting = this.current(); + this.diagnostics.push(conflicting === undefined + ? endDiagnostic(this.source, 'expected-equals', "Expected '=' after FOR loop variable.", target === undefined ? [first] : [first, target]) + : diagnostic('expected-equals', "Expected '=' after FOR loop variable.", conflicting)); + if (conflicting?.lexeme === '==') this.consume(); + } else { + this.consume(); + } + + const toIndex = this.findTopLevelKeyword(this.position, new Set(['TO'])); + let last = target ?? first; + if (toIndex < 0) { + const end = this.headerEnd(this.position); + const expression = this.tokens.slice(this.position, end); + this.diagnostics.push(endDiagnostic(this.source, 'missing-to', "FOR requires 'TO' after the initial expression.", expression.length > 0 ? expression : [first])); + this.position = end; + last = expression[expression.length - 1] ?? last; + } else { + validateExpression(this.source, this.tokens.slice(this.position, toIndex), this.diagnostics); + this.position = toIndex + 1; + const stepIndex = this.findTopLevelKeyword(this.position, new Set(['STEP'])); + const end = this.headerEnd(this.position); + const limitEnd = stepIndex >= 0 && stepIndex < end ? stepIndex : end; + const limit = this.tokens.slice(this.position, limitEnd); + validateExpression(this.source, limit, this.diagnostics); + last = limit[limit.length - 1] ?? this.tokens[toIndex]; + if (stepIndex >= 0 && stepIndex < end) { + const step = this.tokens.slice(stepIndex + 1, end); + validateExpression(this.source, step, this.diagnostics); + last = step[step.length - 1] ?? this.tokens[stepIndex]; + } + this.position = end; + } + if (this.current()?.lexeme === ';') { + this.diagnostics.push(diagnostic('unexpected-semicolon', 'FOR header must not be terminated with a semicolon.', this.current()!)); + this.consume(); + } + this.statements.push({ kind: 'for', first, last, open: 'for' }); + } + + private parseWhile(): void { + const first = this.consume(); + const end = this.headerEnd(this.position); + const expression = this.tokens.slice(this.position, end); + validateExpression(this.source, expression, this.diagnostics); + this.position = end; + const last = expression[expression.length - 1] ?? first; + if (this.current()?.lexeme === ';') { + this.diagnostics.push(diagnostic('unexpected-semicolon', 'WHILE header must not be terminated with a semicolon.', this.current()!)); + this.consume(); + } + this.statements.push({ kind: 'while', first, last, open: 'while' }); + } + + private parseCloser(close: 'endif' | 'next'): void { + const first = this.consume(); + const label = close === 'endif' ? 'ENDIF' : 'NEXT'; + const last = this.consumeTerminator(`${label} statement`, first); + this.statements.push({ kind: close, first, last, close }); + } + + private parseExit(): void { + const first = this.consume(); + let last = first; + if (keyword(this.current()) !== 'FOR') { + this.diagnostics.push(this.current() === undefined + ? endDiagnostic(this.source, 'missing-exit-target', "EXIT requires 'FOR'.", [first]) + : diagnostic('missing-exit-target', "EXIT requires 'FOR'.", this.current()!)); + } else { + last = this.consume(); + } + last = this.consumeTerminator('EXIT FOR statement', last); + this.statements.push({ kind: 'exit-for', first, last }); + } + + private parseReturn(): void { + const first = this.consume(); + const end = this.statementBoundary(this.position); + const expression = this.tokens.slice(this.position, end); + if (expression.length > 0) validateExpression(this.source, expression, this.diagnostics); + this.position = end; + const last = this.consumeTerminator('RETURN statement', expression[expression.length - 1] ?? first); + this.statements.push({ kind: 'return', first, last }); + } + + private parseIdentifierStatement(): void { + const first = this.current()!; + const end = this.statementBoundary(this.position); + const body = this.tokens.slice(this.position, end); + const assignmentIndex = this.findTopLevelLexeme(this.position, '='); + const assignmentInBody = assignmentIndex >= this.position && assignmentIndex < end; + const isDirectCall = this.looksLikeDirectCall(body); + let kind: StatementKind = 'unknown'; + + if (COMMAND_STATEMENTS.has(word(first) ?? '') && body[1]?.lexeme !== '(') { + validateExpression(this.source, body.slice(1), this.diagnostics); + kind = 'command'; + } else if (assignmentInBody) { + const target = this.tokens.slice(this.position, assignmentIndex); + if (!this.isAssignable(target)) { + this.diagnostics.push(diagnostic('invalid-statement', `Unknown or invalid QuickScript statement '${first.lexeme}'.`, first)); + } else { + kind = 'assignment'; + } + validateExpression(this.source, this.tokens.slice(assignmentIndex + 1, end), this.diagnostics); + } else if (isDirectCall) { + validateExpression(this.source, body, this.diagnostics); + kind = 'direct-call'; + } else { + const validExpression = validateExpression(this.source, body, []); + this.diagnostics.push(diagnostic( + validExpression ? 'expected-assignment' : 'invalid-statement', + validExpression ? 'Expected assignment or valid QuickScript statement.' : `Unknown or invalid QuickScript statement '${first.lexeme}'.`, + first, + )); + } + + this.position = end; + const requiresTerminator = kind !== 'unknown' || this.current()?.lexeme === ';'; + const last = requiresTerminator + ? this.consumeTerminator( + kind === 'assignment' ? 'Assignment' : kind === 'direct-call' ? 'Function call' : kind === 'command' ? 'Command statement' : 'Statement', + body[body.length - 1] ?? first, + ) + : body[body.length - 1] ?? first; + const recoveredLoop = kind === 'unknown' + && body.some(token => token.lexeme === '=') + && body.some(token => keyword(token) === 'TO'); + this.statements.push({ kind, first, last, name: kind === 'direct-call' ? first : undefined, recoveredLoop }); + } + + private statementBoundary(start: number): number { + let depth = 0; + for (let index = start; index < this.tokens.length; index += 1) { + const token = this.tokens[index]; + if (token.lexeme === '(' || token.lexeme === '[') depth += 1; + if (token.lexeme === ')' || token.lexeme === ']') depth = Math.max(0, depth - 1); + if (token.lexeme === ';' || (depth === 0 && ['ELSE', 'ENDIF', 'NEXT'].includes(keyword(token) ?? ''))) return index; + } + return this.tokens.length; + } + + private headerEnd(start: number): number { + let depth = 0; + for (let index = start; index < this.tokens.length; index += 1) { + const token = this.tokens[index]; + if (token.lexeme === '(' || token.lexeme === '[') depth += 1; + if (token.lexeme === ')' || token.lexeme === ']') depth = Math.max(0, depth - 1); + if (depth === 0 && token.lexeme === ';') return index; + } + return this.tokens.length; + } + + private findTopLevelKeyword(start: number, values: ReadonlySet): number { + let depth = 0; + for (let index = start; index < this.tokens.length; index += 1) { + const token = this.tokens[index]; + if (token.lexeme === '(' || token.lexeme === '[') depth += 1; + if (token.lexeme === ')' || token.lexeme === ']') depth = Math.max(0, depth - 1); + if (depth === 0 && values.has(keyword(token) ?? '')) return index; + } + return -1; + } + + private findTopLevelLexeme(start: number, value: string): number { + let depth = 0; + for (let index = start; index < this.tokens.length; index += 1) { + const token = this.tokens[index]; + if (token.lexeme === '(' || token.lexeme === '[') depth += 1; + if (token.lexeme === ')' || token.lexeme === ']') depth = Math.max(0, depth - 1); + if (depth === 0 && token.lexeme === value) return index; + } + return -1; + } + + private isAssignable(tokens: readonly Token[]): boolean { + if (tokens.length === 0 || tokens[0].kind !== TokenKind.Identifier) return false; + let index = 1; + while (index < tokens.length) { + if (['.', '->', ':'].includes(tokens[index].lexeme) + && [TokenKind.Identifier, TokenKind.Number].includes(tokens[index + 1]?.kind)) { + index += 2; + continue; + } + if (tokens[index].lexeme === '[') { + const closing = tokens.findIndex((token, candidate) => candidate > index && token.lexeme === ']'); + if (closing < 0 || !validateExpression(this.source, tokens.slice(index + 1, closing), [])) return false; + index = closing + 1; + continue; + } + return false; + } + return true; + } + + private looksLikeDirectCall(tokens: readonly Token[]): boolean { + if (tokens.length < 3 || (tokens[0].kind !== TokenKind.Identifier && tokens[0].kind !== TokenKind.Keyword)) return false; + return tokens.some(token => token.lexeme === '('); + } + + private consumeTerminator(label: string, fallback: Token): Token { + if (this.current()?.lexeme === ';') return this.consume(); + this.diagnostics.push(endDiagnostic(this.source, 'missing-semicolon', `${label} is missing the required semicolon.`, [fallback])); + return fallback; + } + + private current(): Token | undefined { + return this.tokens[this.position]; + } + + private consume(): Token { + const token = this.tokens[this.position]; + this.position += 1; + return token; + } +} + +function delimiterContinuationEnd(tokensByLine: readonly Token[][], startLine: number): number { + let depth = 0; + for (let line = startLine; line < tokensByLine.length; line += 1) { + for (const token of tokensByLine[line]) { + if (token.lexeme === '(' || token.lexeme === '[') depth += 1; + if (token.lexeme === ')' || token.lexeme === ']') depth = Math.max(0, depth - 1); + } + if (depth === 0 || tokensByLine[line].some(token => token.lexeme === ';')) return line; + } + return tokensByLine.length - 1; +} + +function continuationEnd(tokensByLine: readonly Token[][], startLine: number): number { + const delimiterEnd = delimiterContinuationEnd(tokensByLine, startLine); + if (delimiterEnd > startLine) return delimiterEnd; + const first = tokensByLine[startLine]; + const startsIf = keyword(first[0]) === 'IF'; + const startsElseIf = keyword(first[0]) === 'ELSE' && keyword(first[1]) === 'IF'; + if ((!startsIf && !startsElseIf) || first.some(token => keyword(token) === 'THEN')) return startLine; + const bareIf = startsIf && first.length === 1; + const trailingContinuation = ['AND', 'OR', 'NOT'].includes(keyword(first[first.length - 1]) ?? ''); + const leadingContinuation = ['AND', 'OR'].includes(keyword(tokensByLine[startLine + 1]?.[0]) ?? ''); + if (!bareIf && !trailingContinuation && !leadingContinuation) return startLine; + for (let line = startLine + 1; line < tokensByLine.length; line += 1) { + if (tokensByLine[line].some(token => keyword(token) === 'THEN')) return line; + } + return startLine; +} + +/** Parse recoverable QuickScript grammar and structure from the canonical token stream. */ +export function parseQuickScript(source: string): QuickScriptDocument { + const tokens = tokenize(source); + const lineCount = source.length === 0 ? 1 : source.split(/\r\n|\r|\n/).length; + const tokensByLine = Array.from({ length: lineCount }, (_, line) => lineTokens(tokens, line)); + const statements: StatementNode[] = []; + const blocks: BlockNode[] = []; + const diagnostics: CoreDiagnostic[] = []; + const lines: LineStructure[] = new Array(lineCount); + const stack: OpenBlock[] = []; + const recoveredForStackDepths: number[] = []; + + for (let line = 0; line < lineCount; line += 1) { + const physicalTokens = tokensByLine[line]; + const endLine = continuationEnd(tokensByLine, line); + const significant = endLine === line ? physicalTokens : tokensByLine.slice(line, endLine + 1).flat(); + let visualDepth = stack.length + recoveredForStackDepths.length; + const firstValue = keyword(significant[0]); + if (firstValue === 'ELSE' || firstValue === 'ENDIF' || firstValue === 'NEXT') visualDepth = Math.max(0, visualDepth - 1); + lines[line] = { line, indentDepth: visualDepth, preserveIndent: spanningCommentAt(tokens, line) }; + for (let continuationLine = line + 1; continuationLine <= endLine; continuationLine += 1) { + lines[continuationLine] = { + line: continuationLine, + indentDepth: visualDepth + 2, + preserveIndent: spanningCommentAt(tokens, continuationLine), + }; + } + + const parsed = significant.length === 0 ? [] : new StatementParser(source, significant, diagnostics).parse(); + for (const statement of parsed) { + const parentBlockId = stack[stack.length - 1]?.block.id; + const located = tokenNodeRange(source, statement.first, statement.last); + if (statement.kind === 'dim' && statement.names !== undefined) { + for (const name of statement.names) { + statements.push({ + kind: 'dim', + ...located, + name: name.lexeme, + nameRange: name.range, + datatype: statement.datatype?.lexeme, + datatypeRange: statement.datatype?.range, + parentBlockId, + }); + } + } else { + statements.push({ + kind: statement.kind, + ...located, + name: statement.name?.lexeme, + nameRange: statement.name?.range, + parentBlockId, + }); + } + + if (statement.recoveredLoop) recoveredForStackDepths.push(stack.length); + if (statement.open !== undefined) { + const parent = stack[stack.length - 1]?.block; + const blockLocated = tokenNodeRange(source, statement.first, statement.last); + const block: BlockNode = { + id: blocks.length, + kind: statement.open, + parentId: parent?.id, + childIds: [], + ...blockLocated, + bodyRange: { start: statement.last.range.end, end: statement.last.range.end }, + bodySpan: { start: statement.last.span.end, end: statement.last.span.end }, + opener: statement.first.range, + }; + blocks.push(block); + parent?.childIds.push(block.id); + stack.push({ block, opener: statement.first, hasElse: false }); + continue; + } + if (statement.middle) { + const open = stack[stack.length - 1]; + if (open?.block.kind !== 'if') diagnostics.push(diagnostic('invalid-nesting', 'ELSE has no matching IF.', statement.first)); + else if (open.hasElse) diagnostics.push(diagnostic('duplicate-else', 'IF block has more than one ELSE.', statement.first)); + else { + open.hasElse = true; + open.block.middle = statement.first.range; + } + continue; + } + if (statement.close !== undefined) { + const recoveredDepth = recoveredForStackDepths[recoveredForStackDepths.length - 1]; + if (statement.close === 'next' && recoveredDepth === stack.length) { + recoveredForStackDepths.pop(); + continue; + } + const expected = statement.close === 'endif' ? ['if'] : ['for', 'while']; + const open = stack[stack.length - 1]; + if (open === undefined || !expected.includes(open.block.kind)) { + const label = statement.close === 'endif' ? 'ENDIF' : 'NEXT'; + diagnostics.push(diagnostic('invalid-nesting', `${label} has no matching ${statement.close === 'endif' ? 'IF' : 'FOR or WHILE'}.`, statement.first)); + } else { + stack.pop(); + open.block.closer = statement.first.range; + open.block.span.end = statement.last.span.end; + open.block.range.end = statement.last.range.end; + open.block.bodySpan.end = statement.first.span.start; + open.block.bodyRange.end = statement.first.range.start; + } + } + } + line = endLine; + } + + for (const open of stack) { + const closer = open.block.kind === 'if' ? 'ENDIF' : 'NEXT'; + diagnostics.push(diagnostic(`missing-${closer.toLowerCase()}`, `${open.block.kind.toUpperCase()} block is missing ${closer}.`, open.opener)); + open.block.span.end = source.length; + open.block.range.end = sourceRange(source, { start: source.length, end: source.length }).range.end; + open.block.bodySpan.end = source.length; + open.block.bodyRange.end = open.block.range.end; + } + + const diagnosedDatatypes = new Set(); + for (const statement of statements.filter(candidate => candidate.kind === 'dim' && candidate.datatype !== undefined)) { + if (!DATATYPE_SET.has(statement.datatype!.toUpperCase())) { + const range = statement.datatypeRange ?? statement.range; + const key = `${range.start.line}:${range.start.character}`; + if (diagnosedDatatypes.has(key)) continue; + diagnosedDatatypes.add(key); + diagnostics.push({ code: 'unknown-datatype', message: `Unknown datatype '${statement.datatype}'.`, severity: 'error', range }); + } + } + + const documentRange = sourceRange(source, { start: 0, end: source.length }); + return { source, tokens, statements, blocks, diagnostics, lines, ...documentRange }; +} diff --git a/packages/core/src/quality.ts b/packages/core/src/quality.ts new file mode 100644 index 0000000..048e40c --- /dev/null +++ b/packages/core/src/quality.ts @@ -0,0 +1,121 @@ +import { CoreDiagnostic, DiagnosticSeverity } from './parser'; +import { SemanticModel } from './semantics'; +import { Token, TokenKind } from './token'; + +export const QUALITY_DIAGNOSTIC_CODES = { + nonAsciiIdentifier: 'quickscript.naming.nonAsciiIdentifier', + windowWhitespace: 'quickscript.naming.windowWhitespace', + windowNonAscii: 'quickscript.naming.windowNonAscii', +} as const; + +export type QualityDiagnosticSeverity = DiagnosticSeverity | 'off'; + +export interface QualityDiagnosticSettings { + nonAsciiIdentifiers?: QualityDiagnosticSeverity; + windowWhitespace?: QualityDiagnosticSeverity; + windowNonAscii?: QualityDiagnosticSeverity; +} + +const ASCII_IDENTIFIER = /^[A-Za-z0-9_$#-]+$/; +const WINDOW_COMMANDS = new Set(['HIDE', 'SHOW']); +const WINDOW_FUNCTIONS = new Set([ + 'HIDE', + 'INFOAPPSTATUS', + 'INFOAPPTITLEEXPAND', + 'MOVEWINDOW', + 'PRINTWINDOW', + 'SHOW', + 'SHOWAT', + 'SHOWTOPLEFTAT', + 'WINDOWSTATE', +]); + +function significantTokens(model: SemanticModel): Token[] { + return model.document.tokens.filter(token => ![ + TokenKind.Whitespace, + TokenKind.Newline, + TokenKind.Comment, + TokenKind.EOF, + ].includes(token.kind)); +} + +function stringContent(token: Token): string { + return token.lexeme.startsWith('"') && token.lexeme.endsWith('"') + ? token.lexeme.slice(1, -1) + : token.lexeme.slice(1); +} + +function windowNameTokens(model: SemanticModel): Token[] { + const tokens = significantTokens(model); + const windows: Token[] = []; + for (let index = 0; index < tokens.length; index += 1) { + const name = tokens[index].lexeme.toUpperCase(); + const previous = tokens[index - 1]; + if (previous?.lexeme === '.' || previous?.lexeme === '->') continue; + if (WINDOW_COMMANDS.has(name) && tokens[index + 1]?.kind === TokenKind.String) { + windows.push(tokens[index + 1]); + continue; + } + if (WINDOW_FUNCTIONS.has(name) + && tokens[index + 1]?.lexeme === '(' + && tokens[index + 2]?.kind === TokenKind.String) { + windows.push(tokens[index + 2]); + } + } + return windows; +} + +function qualityDiagnostic( + code: string, + message: string, + severity: QualityDiagnosticSeverity, + tokenOrRange: Pick, +): CoreDiagnostic | undefined { + if (severity === 'off') return undefined; + return { code, message, severity, range: tokenOrRange.range, source: 'intouch-quality' }; +} + +/** Analyze maintainability conventions without changing QuickScript validity or symbols. */ +export function qualityDiagnostics( + model: SemanticModel, + settings: QualityDiagnosticSettings = {}, +): CoreDiagnostic[] { + const diagnostics: CoreDiagnostic[] = []; + const diagnosedIdentifiers = new Set(); + const identifierSeverity = settings.nonAsciiIdentifiers ?? 'warning'; + for (const identifier of model.identifiers) { + const normalized = identifier.name.toUpperCase(); + if (ASCII_IDENTIFIER.test(identifier.name) || diagnosedIdentifiers.has(normalized)) continue; + diagnosedIdentifiers.add(normalized); + const diagnostic = qualityDiagnostic( + QUALITY_DIAGNOSTIC_CODES.nonAsciiIdentifier, + `Avoid non-ASCII characters in identifier '${identifier.name}'.`, + identifierSeverity, + identifier, + ); + if (diagnostic !== undefined) diagnostics.push(diagnostic); + } + + for (const token of windowNameTokens(model)) { + const content = stringContent(token); + if (/\s/u.test(content)) { + const diagnostic = qualityDiagnostic( + QUALITY_DIAGNOSTIC_CODES.windowWhitespace, + 'Avoid whitespace in window names.', + settings.windowWhitespace ?? 'warning', + token, + ); + if (diagnostic !== undefined) diagnostics.push(diagnostic); + } + if (/[^\x00-\x7f]/u.test(content)) { + const diagnostic = qualityDiagnostic( + QUALITY_DIAGNOSTIC_CODES.windowNonAscii, + 'Avoid non-ASCII characters in window names.', + settings.windowNonAscii ?? 'warning', + token, + ); + if (diagnostic !== undefined) diagnostics.push(diagnostic); + } + } + return diagnostics; +} diff --git a/packages/core/src/semantics.ts b/packages/core/src/semantics.ts new file mode 100644 index 0000000..6115858 --- /dev/null +++ b/packages/core/src/semantics.ts @@ -0,0 +1,240 @@ +import { CoreDiagnostic, QuickScriptDocument, parseQuickScript } from './parser'; +import { MetadataExtractionOptions, QuickScriptDocumentMetadata, extractDocumentMetadata } from './documentMetadata'; +import { KNOWN_FUNCTIONS } from './generatedFunctionCatalog'; +import { Position, Range, offsetAt, sourceRange } from './source'; +import { Token, TokenKind } from './token'; + +export type SymbolKind = 'variable' | 'call-target'; +export type ReferenceKind = 'declaration' | 'read' | 'write' | 'call' | 'trigger'; +export type SemanticIdentifierKind = 'function' | 'parameter' | 'local' | 'global' | 'member'; + +export interface QuickSymbol { + id: number; + name: string; + kind: SymbolKind; + range: Range; + selectionRange: Range; + datatype?: string; + scopeId: number; +} + +export interface QuickReference { + name: string; + kind: ReferenceKind; + range: Range; + declarationId?: number; +} + +export interface SemanticIdentifier { + name: string; + kind: SemanticIdentifierKind; + range: Range; +} + +export interface QuickFunctionDeclaration { + name: string; + nameRange: Range; + parameters: SemanticIdentifier[]; + metadata: QuickScriptDocumentMetadata; +} + +export interface Scope { + id: number; + kind: 'document'; + range: Range; + symbolIds: number[]; +} + +export interface SemanticModel { + document: QuickScriptDocument; + scopes: Scope[]; + symbols: QuickSymbol[]; + references: QuickReference[]; + identifiers: SemanticIdentifier[]; + quickFunctions: QuickFunctionDeclaration[]; + metadata: QuickScriptDocumentMetadata; + diagnostics: CoreDiagnostic[]; +} + +export interface AnalyzeOptions { + /** Additional QuickFunctions resolved by the language-server workspace index. */ + knownFunctionNames?: Iterable; + /** Optional filename used only after structured metadata sources are exhausted. */ + fileName?: string; +} + +function contains(range: Range, position: Position): boolean { + return (position.line > range.start.line || (position.line === range.start.line && position.character >= range.start.character)) + && (position.line < range.end.line || (position.line === range.end.line && position.character < range.end.character)); +} + +function precedingSignificant(tokens: readonly Token[], index: number): Token | undefined { + for (let current = index - 1; current >= 0; current -= 1) { + if (![TokenKind.Whitespace, TokenKind.Newline, TokenKind.Comment].includes(tokens[current].kind)) { + return tokens[current]; + } + } + return undefined; +} + +function nextSignificant(tokens: readonly Token[], index: number): Token | undefined { + for (let current = index + 1; current < tokens.length; current += 1) { + if (![TokenKind.Whitespace, TokenKind.Newline, TokenKind.Comment].includes(tokens[current].kind)) { + return tokens[current]; + } + } + return undefined; +} + +function quickFunctionDeclarationFromMetadata(source: string, metadata: QuickScriptDocumentMetadata): QuickFunctionDeclaration[] { + if (metadata.scriptType !== 'QuickFunction' || metadata.name === undefined) return []; + return [{ + name: metadata.name, + nameRange: metadata.nameRange ?? sourceRange(source, { start: 0, end: 0 }).range, + parameters: metadata.parameters.map(parameter => ({ + name: parameter.name, + kind: 'parameter', + range: parameter.nameRange, + })), + metadata, + }]; +} + +/** Extract QuickFunction declarations only from canonical comment tokens. */ +export function quickFunctionDeclarations(source: string, options: MetadataExtractionOptions = {}): QuickFunctionDeclaration[] { + return quickFunctionDeclarationFromMetadata(source, extractDocumentMetadata(source, options)); +} + +/** Extract documented QuickFunction names from established Script metadata blocks. */ +export function quickFunctionNames(source: string): string[] { + const names = new Map(); + for (const declaration of quickFunctionDeclarations(source)) names.set(declaration.name.toUpperCase(), declaration.name); + return [...names.values()]; +} + +/** Build document-local QuickScript declarations, uses, scopes, and semantic diagnostics. */ +export function analyzeQuickScript(source: string, options: AnalyzeOptions = {}): SemanticModel { + const document = parseQuickScript(source); + const metadata = extractDocumentMetadata(source, { fileName: options.fileName, tokens: document.tokens }); + const diagnostics = [...document.diagnostics, ...metadata.diagnostics]; + const symbols: QuickSymbol[] = []; + const quickFunctions = quickFunctionDeclarationFromMetadata(source, metadata); + const declarationsByName = new Map(); + const knownCallableNames = new Set(KNOWN_FUNCTIONS.map(item => item.name.toUpperCase())); + for (const declaration of quickFunctions) { + knownCallableNames.add(declaration.name.toUpperCase()); + } + for (const name of options.knownFunctionNames ?? []) { + knownCallableNames.add(name.toUpperCase()); + } + + for (const declaration of document.statements.filter(statement => statement.kind === 'dim' && statement.name !== undefined && statement.nameRange !== undefined)) { + const normalized = declaration.name!.toUpperCase(); + const existing = declarationsByName.get(normalized); + if (existing !== undefined) { + diagnostics.push({ + code: 'duplicate-local', + message: `Local variable '${declaration.name}' is already declared.`, + severity: 'error', + range: declaration.nameRange!, + }); + continue; + } + const symbol: QuickSymbol = { + id: symbols.length, + name: declaration.name!, + kind: 'variable', + range: declaration.range, + selectionRange: declaration.nameRange!, + datatype: declaration.datatype, + scopeId: 0, + }; + symbols.push(symbol); + declarationsByName.set(normalized, symbol); + } + + const declarationOffsets = new Map(); + for (const symbol of symbols) { + declarationOffsets.set(offsetAt(source, symbol.selectionRange.start), symbol); + } + const statementCallTargets = new Set(); + for (const call of document.statements.filter(statement => statement.kind === 'call' && statement.name !== undefined && statement.nameRange !== undefined)) { + statementCallTargets.add(offsetAt(source, call.nameRange!.start)); + } + + const references: QuickReference[] = metadata.trigger === undefined || metadata.triggerRange === undefined ? [] : [{ + name: metadata.trigger, + kind: 'trigger', + range: metadata.triggerRange, + }]; + const identifiers: SemanticIdentifier[] = quickFunctions.flatMap(declaration => [ + { name: declaration.name, kind: 'function' as const, range: declaration.nameRange }, + ...declaration.parameters, + ]); + if (metadata.trigger !== undefined && metadata.triggerRange !== undefined) { + identifiers.push({ name: metadata.trigger, kind: 'global', range: metadata.triggerRange }); + } + for (const symbol of symbols) identifiers.push({ name: symbol.name, kind: 'local', range: symbol.selectionRange }); + for (let index = 0; index < document.tokens.length; index += 1) { + const token = document.tokens[index]; + if (token.kind !== TokenKind.Identifier) { + continue; + } + const declaration = declarationOffsets.get(token.span.start); + if (declaration !== undefined) { + references.push({ name: token.lexeme, kind: 'declaration', range: token.range, declarationId: declaration.id }); + continue; + } + const previous = precedingSignificant(document.tokens, index); + if (previous?.lexeme === '.' || previous?.lexeme === '->') { + identifiers.push({ name: token.lexeme, kind: 'member', range: token.range }); + continue; + } + const resolved = declarationsByName.get(token.lexeme.toUpperCase()); + const next = nextSignificant(document.tokens, index); + const isFunctionCall = statementCallTargets.has(token.span.start) || next?.lexeme === '('; + identifiers.push({ + name: token.lexeme, + kind: isFunctionCall ? 'function' : resolved === undefined ? 'global' : 'local', + range: token.range, + }); + if (isFunctionCall && !knownCallableNames.has(token.lexeme.toUpperCase())) { + diagnostics.push({ + code: 'unknown-function', + message: `Unknown QuickScript function '${token.lexeme}'.`, + severity: 'warning', + range: token.range, + }); + } + if (resolved !== undefined || isFunctionCall) { + const kind: ReferenceKind = isFunctionCall ? 'call' : next?.lexeme === '=' ? 'write' : 'read'; + references.push({ name: token.lexeme, kind, range: token.range, declarationId: resolved?.id }); + } + } + + return { + document, + scopes: [{ id: 0, kind: 'document', range: document.range, symbolIds: symbols.map(symbol => symbol.id) }], + symbols, + references, + identifiers, + quickFunctions, + metadata, + diagnostics, + }; +} + +export function definitionAt(model: SemanticModel, position: Position): Range | undefined { + const reference = model.references.find(candidate => contains(candidate.range, position)); + return reference?.declarationId === undefined ? undefined : model.symbols[reference.declarationId]?.selectionRange; +} + +export function referencesAt(model: SemanticModel, position: Position, includeDeclaration = true): Range[] { + const occurrence = model.references.find(candidate => contains(candidate.range, position)); + if (occurrence?.declarationId === undefined) { + return []; + } + return model.references + .filter(candidate => candidate.declarationId === occurrence.declarationId && (includeDeclaration || candidate.kind !== 'declaration')) + .map(candidate => candidate.range); +} diff --git a/packages/core/src/source.ts b/packages/core/src/source.ts new file mode 100644 index 0000000..6de5342 --- /dev/null +++ b/packages/core/src/source.ts @@ -0,0 +1,120 @@ +/** A zero-based UTF-16 offset into a source string. */ +export type Offset = number; + +/** A zero-based line and UTF-16 character position. */ +export interface Position { + line: number; + character: number; +} + +/** A half-open position range: start is inclusive and end is exclusive. */ +export interface Range { + start: Position; + end: Position; +} + +/** A half-open offset span: start is inclusive and end is exclusive. */ +export interface SourceSpan { + start: Offset; + end: Offset; +} + +/** The equivalent offset and position representations of a source range. */ +export interface SourceRange { + span: SourceSpan; + range: Range; +} + +function assertOffset(source: string, offset: Offset): void { + if (!Number.isInteger(offset) || offset < 0 || offset > source.length) { + throw new RangeError(`Offset ${offset} is outside the source.`); + } +} + +function assertPositionPart(name: string, value: number): void { + if (!Number.isInteger(value) || value < 0) { + throw new RangeError(`${name} ${value} must be a non-negative integer.`); + } +} + +function getLineStarts(source: string): number[] { + const starts = [0]; + for (let offset = 0; offset < source.length; offset += 1) { + if (source[offset] === '\r' && source[offset + 1] === '\n') { + offset += 1; + starts.push(offset + 1); + } else if (source[offset] === '\r' || source[offset] === '\n') { + starts.push(offset + 1); + } + } + return starts; +} + +function getLineContentEnd(source: string, lineStarts: number[], line: number): number { + if (line + 1 >= lineStarts.length) { + return source.length; + } + + let end = lineStarts[line + 1]; + if (source[end - 1] === '\n') { + end -= 1; + } + if (source[end - 1] === '\r') { + end -= 1; + } + return end; +} + +/** Convert an offset to a zero-based UTF-16 position. */ +export function positionAt(source: string, offset: Offset): Position { + assertOffset(source, offset); + const lineStarts = getLineStarts(source); + let low = 0; + let high = lineStarts.length; + + while (low + 1 < high) { + const middle = Math.floor((low + high) / 2); + if (lineStarts[middle] <= offset) { + low = middle; + } else { + high = middle; + } + } + + return { line: low, character: offset - lineStarts[low] }; +} + +/** Convert a zero-based UTF-16 position to an offset. */ +export function offsetAt(source: string, position: Position): Offset { + assertPositionPart('Line', position.line); + assertPositionPart('Character', position.character); + const lineStarts = getLineStarts(source); + if (position.line >= lineStarts.length) { + throw new RangeError(`Line ${position.line} is outside the source.`); + } + + const lineStart = lineStarts[position.line]; + const lineEnd = getLineContentEnd(source, lineStarts, position.line); + const offset = lineStart + position.character; + if (offset > lineEnd) { + throw new RangeError(`Character ${position.character} is outside line ${position.line}.`); + } + return offset; +} + +/** Create equivalent half-open offset and position ranges for a source span. */ +export function sourceRange(source: string, span: SourceSpan): SourceRange { + assertOffset(source, span.start); + assertOffset(source, span.end); + if (span.end < span.start) { + throw new RangeError('A source span cannot end before it starts.'); + } + + return { + span: { ...span }, + range: { + start: positionAt(source, span.start), + end: positionAt(source, span.end), + }, + }; +} diff --git a/packages/core/src/token.ts b/packages/core/src/token.ts new file mode 100644 index 0000000..2145c49 --- /dev/null +++ b/packages/core/src/token.ts @@ -0,0 +1,24 @@ +import { Range, SourceSpan } from './source'; + +export enum TokenKind { + Identifier = 'Identifier', + Keyword = 'Keyword', + Datatype = 'Datatype', + Number = 'Number', + String = 'String', + Operator = 'Operator', + Punctuation = 'Punctuation', + Comment = 'Comment', + Whitespace = 'Whitespace', + Newline = 'Newline', + Unknown = 'Unknown', + EOF = 'EOF', +} + +/** A token whose lexeme and half-open locations refer to the original source. */ +export interface Token { + kind: TokenKind; + lexeme: string; + span: SourceSpan; + range: Range; +} diff --git a/packages/core/src/tokenizer.ts b/packages/core/src/tokenizer.ts new file mode 100644 index 0000000..e530bec --- /dev/null +++ b/packages/core/src/tokenizer.ts @@ -0,0 +1,165 @@ +import { DATATYPE_SET, KEYWORD_SET, OPERATORS, PUNCTUATION } from './languageData'; +import { Position } from './source'; +import { Token, TokenKind } from './token'; + +function isIdentifierStart(character: string | undefined): boolean { + return character !== undefined && /[\p{L}_$#]/u.test(character); +} + +function isIdentifierPart(character: string | undefined): boolean { + return character !== undefined && /[\p{L}\p{N}_$#]/u.test(character); +} + +function isDigit(character: string | undefined): boolean { + return character !== undefined && /[0-9]/.test(character); +} + +function classifyWord(word: string): TokenKind { + const normalized = word.toUpperCase(); + if (DATATYPE_SET.has(normalized)) { + return TokenKind.Datatype; + } + if (KEYWORD_SET.has(normalized)) { + return TokenKind.Keyword; + } + return TokenKind.Identifier; +} + +/** Tokenize QuickScript source without file I/O or editor dependencies. */ +export function tokenize(source: string): Token[] { + const tokens: Token[] = []; + let offset = 0; + let line = 0; + let character = 0; + + const currentPosition = (): Position => ({ line, character }); + + const advanceTo = (end: number): void => { + while (offset < end) { + if (source[offset] === '\r' && source[offset + 1] === '\n' && offset + 1 < end) { + offset += 2; + line += 1; + character = 0; + } else if (source[offset] === '\r' || source[offset] === '\n') { + offset += 1; + line += 1; + character = 0; + } else { + offset += 1; + character += 1; + } + } + }; + + const emit = (kind: TokenKind, end: number): void => { + const start = offset; + const startPosition = currentPosition(); + advanceTo(end); + tokens.push({ + kind, + lexeme: source.slice(start, end), + span: { start, end }, + range: { start: startPosition, end: currentPosition() }, + }); + }; + + while (offset < source.length) { + const current = source[offset]; + + if (current === '\r' || current === '\n') { + emit(TokenKind.Newline, current === '\r' && source[offset + 1] === '\n' ? offset + 2 : offset + 1); + continue; + } + + if (/[ \t\f\v]/.test(current)) { + let end = offset + 1; + while (end < source.length && /[ \t\f\v]/.test(source[end])) { + end += 1; + } + emit(TokenKind.Whitespace, end); + continue; + } + + if (current === '"') { + let end = offset + 1; + while (end < source.length && source[end] !== '\r' && source[end] !== '\n') { + if (source[end] === '"') { + end += 1; + break; + } else { + end += 1; + } + } + emit(TokenKind.String, end); + continue; + } + + if (current === '{') { + const closingBrace = source.indexOf('}', offset + 1); + emit(TokenKind.Comment, closingBrace === -1 ? source.length : closingBrace + 1); + continue; + } + + if (current === "'") { + let end = offset + 1; + while (end < source.length && source[end] !== '\r' && source[end] !== '\n') { + end += 1; + } + emit(TokenKind.Comment, end); + continue; + } + + if (isDigit(current)) { + let end = offset + 1; + while (isDigit(source[end])) { + end += 1; + } + if (source[end] === '.' && isDigit(source[end + 1])) { + end += 1; + while (isDigit(source[end])) { + end += 1; + } + } else if (isIdentifierPart(source[end]) || (source[end] === '-' && isIdentifierStart(source[end + 1]))) { + while (isIdentifierPart(source[end]) || (source[end] === '-' && isIdentifierPart(source[end + 1]))) { + end += 1; + } + emit(TokenKind.Identifier, end); + continue; + } + emit(TokenKind.Number, end); + continue; + } + + if (isIdentifierStart(current)) { + let end = offset + 1; + while (isIdentifierPart(source[end]) || (source[end] === '-' && isIdentifierPart(source[end + 1]))) { + end += 1; + } + emit(classifyWord(source.slice(offset, end)), end); + continue; + } + + const operator = OPERATORS.find(candidate => source.startsWith(candidate, offset)); + if (operator !== undefined) { + emit(TokenKind.Operator, offset + operator.length); + continue; + } + + if ((PUNCTUATION as readonly string[]).includes(current)) { + emit(TokenKind.Punctuation, offset + 1); + continue; + } + + const codePoint = source.codePointAt(offset); + emit(TokenKind.Unknown, offset + (codePoint !== undefined && codePoint > 0xffff ? 2 : 1)); + } + + const position = currentPosition(); + tokens.push({ + kind: TokenKind.EOF, + lexeme: '', + span: { start: offset, end: offset }, + range: { start: position, end: { ...position } }, + }); + return tokens; +} diff --git a/packages/core/test/documentMetadata.test.ts b/packages/core/test/documentMetadata.test.ts new file mode 100644 index 0000000..4323efe --- /dev/null +++ b/packages/core/test/documentMetadata.test.ts @@ -0,0 +1,119 @@ +import * as assert from 'assert'; + +import { extractDocumentMetadata } from '../src/documentMetadata'; +import { analyzeQuickScript } from '../src/semantics'; + +suite('QuickScript document metadata', () => { + test('extracts explicit QuickFunction metadata exclusively from comment tokens', () => { + const source = [ + '{>', + '@ScriptType QuickFunction', + '@Name GetSomething', + '@Description Returns something useful.', + '@Param Source MESSAGE Source value.', + '@Param Index INTEGER Requested index.', + '@Returns MESSAGE', + 'CALL MissingExample() remains comment text.', + '{<}', + ].join('\n'); + const metadata = extractDocumentMetadata(source, { fileName: 'SomethingCompletelyDifferent.vbi' }); + const model = analyzeQuickScript(source, { fileName: 'SomethingCompletelyDifferent.vbi' }); + + assert.strictEqual(metadata.scriptType, 'QuickFunction'); + assert.strictEqual(metadata.name, 'GetSomething'); + assert.strictEqual(metadata.metadataSource, 'explicit'); + assert.deepStrictEqual(metadata.parameters.map(parameter => [parameter.name, parameter.datatype, parameter.description]), [ + ['Source', 'MESSAGE', 'Source value.'], + ['Index', 'INTEGER', 'Requested index.'], + ]); + assert.strictEqual(metadata.returnType, 'MESSAGE'); + assert.deepStrictEqual(model.diagnostics, []); + assert.strictEqual(model.quickFunctions[0].name, 'GetSomething'); + }); + + test('extracts documented legacy InTouch script types and context fields', () => { + const cases = [ + ['Type: QuickFunction\nName: Foo\nParameters:\nInteger Index', 'QuickFunction', 'Foo', undefined, undefined], + ['Type: ApplicationScript\nName: APP_Application_on_startup', 'Application', 'APP_Application_on_startup', undefined, undefined], + ['Type: datachange\nTagname[.field]: SomeTag', 'DataChange', undefined, 'SomeTag', undefined], + ['Type: ConditionalScript\nName: ConditionScript\nCondition: Ready\nCondition Type: OnTrue', 'Condition', 'ConditionScript', 'Ready', 'OnTrue'], + ] as const; + + for (const [body, scriptType, name, trigger, event] of cases) { + const metadata = extractDocumentMetadata(`{>\n${body}\n{<}`); + assert.strictEqual(metadata.scriptType, scriptType); + assert.strictEqual(metadata.name, name); + assert.strictEqual(metadata.trigger, trigger); + assert.strictEqual(metadata.event, event); + assert.strictEqual(metadata.metadataSource, 'legacy'); + } + }); + + test('preserves DataChange triggers as metadata references without variable diagnostics', () => { + const model = analyzeQuickScript('{>\n@ScriptType DataChange\n@Trigger SomeGlobalVariable\n{<}'); + + assert.deepStrictEqual(model.references.map(reference => [reference.name, reference.kind]), [['SomeGlobalVariable', 'trigger']]); + assert.ok(!model.diagnostics.some(diagnostic => diagnostic.code === 'unknown-variable')); + }); + + test('models KeyScript shortcuts as canonical InTouch metadata', () => { + const legacy = extractDocumentMetadata([ + '{>', + 'Type: KeyScript', + 'Name: KEY_Ctrl_D', + 'Parameters:', + 'Shortcut: Ctrl+d', + '{<}', + ].join('\n')); + const explicit = extractDocumentMetadata([ + '{>', + '@ScriptType KeyScript', + '@Name OpenPrintWindow', + '@Shortcut Ctrl+d', + '{<}', + ].join('\n')); + + assert.deepStrictEqual([legacy.scriptType, legacy.shortcut], ['KeyScript', 'Ctrl+d']); + assert.deepStrictEqual([explicit.scriptType, explicit.shortcut], ['KeyScript', 'Ctrl+d']); + }); + + test('prefers explicit metadata, reports conflicts, and uses filenames only as fallback', () => { + const conflict = extractDocumentMetadata([ + '{>', + '@ScriptType QuickFunction', + '@Name ExplicitName', + 'Type: DataChange', + 'Name: LegacyName', + '{<}', + ].join('\n'), { fileName: 'DCH_FileName_1.0.0.vbi' }); + const fallback = extractDocumentMetadata('', { fileName: 'QF_FallbackName_1.0.0.vbi' }); + + assert.deepStrictEqual([conflict.scriptType, conflict.name, conflict.metadataSource], ['QuickFunction', 'ExplicitName', 'explicit']); + assert.strictEqual(conflict.diagnostics.filter(diagnostic => diagnostic.code === 'metadata-conflict').length, 2); + assert.deepStrictEqual([fallback.scriptType, fallback.name, fallback.metadataSource], ['QuickFunction', 'FallbackName', 'filename']); + }); + + test('validates Window events without making Window scripts callable', () => { + for (const event of ['OnShow', 'WhileRunning', 'OnClose']) { + const source = `{>\n@ScriptType Window\n@Name MainWindow\n@Event ${event}\n{<}`; + const model = analyzeQuickScript(source); + assert.deepStrictEqual([model.metadata.scriptType, model.metadata.event], ['Window', event]); + assert.deepStrictEqual(model.quickFunctions, []); + assert.deepStrictEqual(model.diagnostics, []); + } + + const invalid = extractDocumentMetadata('{>\n@ScriptType Window\n@Name MainWindow\n@Event OnBanana\n@Returns INTEGER\n{<}'); + assert.deepStrictEqual(invalid.diagnostics.map(diagnostic => diagnostic.code), ['invalid-window-event', 'metadata-conflict']); + }); + + test('reports malformed known and unknown explicit fields as metadata diagnostics', () => { + const metadata = extractDocumentMetadata('{>\n@ScriptType Banana\n@Name\n@FooBar Value\n{<}'); + + assert.deepStrictEqual(metadata.diagnostics.map(diagnostic => [diagnostic.code, diagnostic.source]), [ + ['invalid-script-type', 'intouch-metadata'], + ['invalid-metadata-value', 'intouch-metadata'], + ['unknown-metadata-field', 'intouch-metadata'], + ]); + assert.strictEqual(metadata.scriptType, 'Generic'); + }); +}); diff --git a/packages/core/test/fixtures/incomplete.vi b/packages/core/test/fixtures/incomplete.vi new file mode 100644 index 0000000..4a56f19 --- /dev/null +++ b/packages/core/test/fixtures/incomplete.vi @@ -0,0 +1,4 @@ +DIM Reading AS REAL; +IF Reading > + MessageText = "unfinished input + @ diff --git a/packages/core/test/fixtures/representative.vbi b/packages/core/test/fixtures/representative.vbi new file mode 100644 index 0000000..c785662 --- /dev/null +++ b/packages/core/test/fixtures/representative.vbi @@ -0,0 +1,11 @@ +{ Representative QuickScript tokenizer fixture } +DIM MessageText AS MESSAGE; +DIM Index AS INTEGER; + +IF Index >= 1 THEN + LogMessage("IF and { braces } stay in this string"); +ELSE + FOR Index = 1 TO 2 STEP 1 + CALL WorkspaceFunction(); ' Workspace QuickFunction call target + NEXT; +ENDIF; diff --git a/packages/core/test/formatter.test.ts b/packages/core/test/formatter.test.ts new file mode 100644 index 0000000..76996c4 --- /dev/null +++ b/packages/core/test/formatter.test.ts @@ -0,0 +1,232 @@ +import * as assert from 'assert'; + +import { formatQuickScript, formatQuickScriptLexically } from '../src/formatter'; + +suite('QuickScript lexical formatter', () => { + test('normalizes tokens while preserving strings and comments', () => { + const string = '"if a==b then {not a comment};"'; + const comment = '{ if a==b then "not a string"; }'; + const result = formatQuickScriptLexically(`dim Value as integer;\nMessageText=${string};\n${comment}`); + + assert.strictEqual(result.text, `DIM Value AS INTEGER;\r\nMessageText = ${string};\r\n${comment}`); + assert.strictEqual(result.changed, true); + }); + + test('keeps dashed identifiers distinct from spaced subtraction', () => { + const result = formatQuickScriptLexically('d- e + SYS-Tag - nextValue;'); + + assert.strictEqual(result.text, 'd - e + SYS-Tag - nextValue;'); + }); + + test('recognizes a closing quote after a trailing path separator', () => { + const result = formatQuickScriptLexically('Path="\\\\share\\"; call Start(Path);'); + + assert.strictEqual(result.text, 'Path = "\\\\share\\"; CALL Start(Path);'); + }); + + test('is idempotent', () => { + const once = formatQuickScriptLexically('if ( Value>=-1 ) then\nLogMessage("a b");\nendif;').text; + const twice = formatQuickScriptLexically(once).text; + + assert.strictEqual(twice, once); + }); + + test('returns normalized but otherwise unchanged malformed source', () => { + const source = 'Message = "unfinished\nIF Value>1 THEN'; + const result = formatQuickScriptLexically(source); + + assert.strictEqual(result.text, 'Message = "unfinished\r\nIF Value>1 THEN'); + }); + + test('uses parser structure for stable indentation', () => { + const source = 'if Ready then\nfor Index=1 to 2\ncall Run(Index);\nnext;\nelse\ncall Stop();\nendif;'; + const once = formatQuickScript(source); + const twice = formatQuickScript(once.text); + + assert.strictEqual(once.text, [ + 'IF Ready THEN', + ' FOR Index = 1 TO 2', + ' CALL Run(Index);', + ' NEXT;', + 'ELSE', + ' CALL Stop();', + 'ENDIF;', + ].join('\r\n')); + assert.strictEqual(twice.text, once.text); + assert.strictEqual(twice.changed, false); + }); + + test('preserves multiline comment blank lines unless explicitly configured', () => { + const source = '{\nfirst\n\n\nsecond\n}\n\n\nValue=1;'; + const preserved = formatQuickScript(source, { allowedNumberOfEmptyLines: 1 }); + const compacted = formatQuickScript(source, { allowedNumberOfEmptyLines: 1, removeEmptyLinesInComments: true }); + + assert.ok(preserved.text.includes('first\r\n\r\n\r\nsecond')); + assert.ok(compacted.text.includes('first\r\n\r\nsecond')); + assert.ok(!compacted.text.includes('first\r\n\r\n\r\nsecond')); + }); + + test('restores normal formatting after the reported multiline brace comment', () => { + const source = [ + 'CALL HideAllPLS();', + '', + '{Debug-Status Zwischenspeichern}', + '', + '{ DIM altDebug AS DISCRETE;', + '', + 'altDebug = Sys_Debug_info;', + '', + 'Sys_Debug_info = 1; }', + '', + 'CALL xHerDebug(Funkt + " ", 0);', + ].join('\n'); + const once = formatQuickScript(source).text; + const twice = formatQuickScript(once).text; + + assert.strictEqual(once, source.replace(/\n/g, '\r\n')); + assert.strictEqual(twice, once); + }); + + test('moves a multiline brace comment as one relative-indentation block', () => { + const source = [ + '{------------------------------------------------------------------------------}', + '', + ' { Button:', + ' CALL HideAllPLS( );', + ' TAB_AAF.Name = AT01_B0008B0020B0.Name;', + ' TAB_Sollwert.Reference = "";', + ' TAB_Einheit = "";', + ' PLSActive=sys_true;', + ' CALL TABHER012EA( );', + ' }', + ].join('\n'); + const expected = [ + '{------------------------------------------------------------------------------}', + '', + '{ Button:', + ' CALL HideAllPLS( );', + ' TAB_AAF.Name = AT01_B0008B0020B0.Name;', + ' TAB_Sollwert.Reference = "";', + ' TAB_Einheit = "";', + ' PLSActive=sys_true;', + ' CALL TABHER012EA( );', + '}', + ].join('\r\n'); + + const once = formatQuickScript(source).text; + const twice = formatQuickScript(once).text; + + assert.strictEqual(once, expected); + assert.strictEqual(twice, once); + }); + + test('does not treat a later multiline comment as inline content of a preceding THEN', () => { + const source = [ + 'IF Ready THEN', + '', + ' {', + ' Documentation:', + ' Relative detail', + ' }', + 'ENDIF;', + ].join('\n'); + const expected = [ + 'IF Ready THEN', + '', + ' {', + ' Documentation:', + ' Relative detail', + ' }', + 'ENDIF;', + ].join('\r\n'); + const once = formatQuickScript(source).text; + + assert.strictEqual(once, expected); + assert.strictEqual(formatQuickScript(once).text, once); + }); + + test('formats a multiline metadata comment as one relative-indentation block', () => { + const source = [ + '{>', + ' Script:', + ' Relative detail', + '', + ' Version history:', + '{<}', + ].join('\n'); + const once = formatQuickScript(source).text; + + assert.strictEqual(once, [ + '{>', + ' Script:', + ' Relative detail', + '', + ' Version history:', + '{<}', + ].join('\r\n')); + assert.strictEqual(formatQuickScript(once).text, once); + }); + + test('keeps the real QuickFunction header stable and idempotent as one multiline comment', () => { + const source = [ + '{>', + ' Script:', + ' Type: QuickFunction', + ' Name: TABHER012EA', + '', + ' Parameters:', + ' No formal parameters.', + '', + ' Usage:', + ' CALL TABHER012EA( );', + '{<}', + ].join('\n'); + const once = formatQuickScript(source).text; + + assert.strictEqual(once, source.replace(/\n/g, '\r\n')); + assert.strictEqual(formatQuickScript(once).text, once); + }); + + test('preserves explicit document metadata content and relative indentation idempotently', () => { + const source = [ + '{>', + ' @ScriptType QuickFunction', + ' @Name GetSomething', + ' @Description Returns something useful.', + ' @Param Source MESSAGE Source value.', + ' @Param Index INTEGER Requested index.', + ' @Returns MESSAGE', + '{<}', + ].join('\n'); + const expected = [ + '{>', + ' @ScriptType QuickFunction', + ' @Name GetSomething', + ' @Description Returns something useful.', + ' @Param Source MESSAGE Source value.', + ' @Param Index INTEGER Requested index.', + ' @Returns MESSAGE', + '{<}', + ].join('\r\n'); + const once = formatQuickScript(source).text; + + assert.strictEqual(once, expected); + assert.strictEqual(formatQuickScript(once).text, once); + }); + + test('ends lexical preservation at a decorated block marker before later code', () => { + const source = [ + '{>', + 'protected payload', + '{<-------------------------------------------}', + '{ DIM altDebug AS DISCRETE;', + 'altDebug = Sys_Debug_info;', + 'Sys_Debug_info = 1; }', + 'call xHerDebug(Funkt+" ",0);', + ].join('\n'); + + const formatted = formatQuickScript(source).text; + + assert.ok(formatted.endsWith('CALL xHerDebug(Funkt + " ", 0);')); + }); +}); diff --git a/packages/core/test/languageService.test.ts b/packages/core/test/languageService.test.ts new file mode 100644 index 0000000..6a8e341 --- /dev/null +++ b/packages/core/test/languageService.test.ts @@ -0,0 +1,43 @@ +import * as assert from 'assert'; + +import { completions, documentSymbols, hoverAt } from '../src/languageService'; +import { analyzeQuickScript } from '../src/semantics'; + +suite('QuickScript language service', () => { + const source = 'DIM Counter AS INTEGER;\nIF Counter > 0 THEN\nCALL LogMessage("ok");\nCALL WorkspaceFunction();\nENDIF;'; + const model = analyzeQuickScript(source); + + test('offers keywords, datatypes, native functions, locals, and call targets', () => { + const entries = completions(model); + const byLabel = new Map(entries.map(entry => [entry.label.toUpperCase(), entry])); + + assert.strictEqual(byLabel.get('IF')?.kind, 'keyword'); + assert.strictEqual(byLabel.get('INTEGER')?.kind, 'datatype'); + assert.strictEqual(byLabel.get('LOGMESSAGE')?.kind, 'function'); + assert.strictEqual(byLabel.get('WORKSPACEFUNCTION')?.kind, 'call-target'); + assert.strictEqual(byLabel.get('COUNTER')?.kind, 'variable'); + }); + + test('returns hover only for facts backed by language or document data', () => { + assert.strictEqual(hoverAt(model, { line: 0, character: 5 })?.detail, 'Local INTEGER variable'); + assert.match(hoverAt(model, { line: 2, character: 8 })?.detail ?? '', /IT-functions/); + assert.strictEqual(hoverAt(analyzeQuickScript('Value = CALL WorkspaceFunction();'), { line: 0, character: 15 }), undefined); + assert.strictEqual(hoverAt(analyzeQuickScript('UnknownName;'), { line: 0, character: 2 }), undefined); + }); + + test('builds variable and hierarchical block symbols', () => { + const symbols = documentSymbols(model); + + assert.deepStrictEqual(symbols.map(symbol => symbol.kind), ['variable', 'if']); + }); + + test('builds metadata-backed QuickFunction, Window, and KeyScript outlines', () => { + const quickFunction = documentSymbols(analyzeQuickScript('{>\n@ScriptType QuickFunction\n@Name Foo\n{<}\nDIM Value AS INTEGER;')); + const window = documentSymbols(analyzeQuickScript('{>\n@ScriptType Window\n@Name MainWindow\n@Event OnShow\n{<}\nDIM Value AS INTEGER;')); + const keyScript = documentSymbols(analyzeQuickScript('{>\n@ScriptType KeyScript\n@Name OpenPrint\n@Shortcut Ctrl+d\n{<}')); + + assert.deepStrictEqual([quickFunction[0].name, quickFunction[0].kind, quickFunction[0].children[0].kind], ['Foo', 'function', 'variable']); + assert.deepStrictEqual([window[0].name, window[0].kind, window[0].children[0].name], ['MainWindow', 'window', 'OnShow']); + assert.deepStrictEqual([keyScript[0].name, keyScript[0].kind, keyScript[0].children[0].name], ['OpenPrint', 'key-script', 'Ctrl+d']); + }); +}); diff --git a/packages/core/test/parser.test.ts b/packages/core/test/parser.test.ts new file mode 100644 index 0000000..c7ea460 --- /dev/null +++ b/packages/core/test/parser.test.ts @@ -0,0 +1,304 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; + +import { parseQuickScript } from '../src/parser'; + +suite('QuickScript structure parser', () => { + test('builds nested IF and FOR blocks with parent-child ranges', () => { + const source = 'IF Ready THEN\nFOR Index = 1 TO 2\nCALL Run(Index);\nNEXT;\nELSE\nCALL Stop();\nENDIF;'; + const document = parseQuickScript(source); + + assert.deepStrictEqual(document.blocks.map(block => block.kind), ['if', 'for']); + assert.strictEqual(document.blocks[1].parentId, document.blocks[0].id); + assert.deepStrictEqual(document.blocks[0].childIds, [document.blocks[1].id]); + assert.ok(document.blocks.every(block => block.closer !== undefined)); + assert.deepStrictEqual(document.lines.map(line => line.indentDepth), [0, 1, 2, 1, 0, 1, 0]); + assert.deepStrictEqual(document.diagnostics, []); + }); + + test('recovers from invalid nesting and reports missing closers', () => { + const document = parseQuickScript('IF Ready THEN\nFOR Index = 1 TO 2\nENDIF;'); + + assert.ok(document.diagnostics.some(item => item.code === 'invalid-nesting')); + assert.ok(document.diagnostics.some(item => item.code === 'missing-endif')); + assert.ok(document.diagnostics.some(item => item.code === 'missing-next')); + }); + + test('parses DIM and CALL statements and diagnoses unknown datatypes', () => { + const document = parseQuickScript('DIM Counter AS INTEGER;\nDIM Broken AS Bogus;\nCALL Start(Counter);'); + const declarations = document.statements.filter(statement => statement.kind === 'dim'); + const call = document.statements.find(statement => statement.kind === 'call'); + + assert.deepStrictEqual(declarations.map(statement => [statement.name, statement.datatype]), [ + ['Counter', 'INTEGER'], + ['Broken', 'Bogus'], + ]); + assert.strictEqual(call?.name, 'Start'); + assert.ok(document.diagnostics.some(item => item.code === 'unknown-datatype')); + }); + + test('does not treat EXIT FOR as an opener', () => { + const document = parseQuickScript('FOR Index = 1 TO 2\nIF Done THEN EXIT FOR; ENDIF;\nNEXT;'); + + assert.deepStrictEqual(document.blocks.map(block => block.kind), ['for', 'if']); + assert.deepStrictEqual(document.diagnostics, []); + }); + + test('parses corpus-evidenced multiline IF continuations', () => { + const sources = [ + [ + 'IF', + ' Ready == 1 OR', + ' Waiting == 1 THEN', + 'Value = 1;', + 'ENDIF;', + ].join('\n'), + [ + 'IF Ready == 1 THEN', + 'ELSE IF Waiting == 1 OR', + ' Starting == 1 THEN', + 'Value = 2;', + 'ENDIF; ENDIF;', + ].join('\n'), + [ + 'IF (First > 0)', + ' OR (Second > 0)', + ' OR (Third > 0) THEN', + 'Value = 3;', + 'ENDIF;', + ].join('\n'), + ]; + + for (const source of sources) { + assert.deepStrictEqual(parseQuickScript(source).diagnostics, [], source); + } + }); + + test('accepts numeric dotfields and digit-prefixed tag names', () => { + const source = 'IF Parameter.08 == 0 THEN Value = 123Pump.Name; ENDIF;'; + + assert.deepStrictEqual(parseQuickScript(source).diagnostics, []); + }); + + test('supports multiple DIM names and repository-evidenced WHILE/NEXT blocks', () => { + const document = parseQuickScript('DIM First, Second AS REAL;\nWHILE First < Second\nFirst = First + 1;\nNEXT;'); + + assert.deepStrictEqual( + document.statements.filter(statement => statement.kind === 'dim').map(statement => statement.name), + ['First', 'Second'], + ); + assert.strictEqual(document.blocks[0].kind, 'while'); + assert.deepStrictEqual(document.lines.map(line => line.indentDepth), [0, 0, 1, 0]); + assert.deepStrictEqual(document.diagnostics, []); + }); + + test('diagnoses a missing DIM terminator without flagging a terminated DIM', () => { + const missing = parseQuickScript('DIM TEXT6 AS MESSAGE'); + const terminated = parseQuickScript('DIM TEXT6 AS MESSAGE;'); + const diagnostic = missing.diagnostics.find(item => item.code === 'missing-semicolon'); + + assert.ok(diagnostic); + assert.deepStrictEqual(diagnostic.range, { + start: { line: 0, character: 20 }, + end: { line: 0, character: 20 }, + }); + assert.ok(!terminated.diagnostics.some(item => item.code === 'missing-semicolon')); + }); + + test('diagnoses declaration- and FOR-shaped unknown statements locally without a NEXT cascade', () => { + const document = parseQuickScript([ + 'DI TEXT9 AS MESSAGE;', + 'FR TABINDEX = 1 TO StringLen(TEXT9)', + 'CALL LogMessage(TEXT9);', + 'NEXT;', + ].join('\n')); + const invalidStatements = document.diagnostics.filter(item => item.code === 'invalid-statement'); + + assert.deepStrictEqual(invalidStatements.map(item => item.range), [ + { start: { line: 0, character: 0 }, end: { line: 0, character: 2 } }, + { start: { line: 1, character: 0 }, end: { line: 1, character: 2 } }, + ]); + assert.ok(!document.diagnostics.some(item => item.code === 'invalid-nesting')); + }); + + test('does not require semicolons on block, control, or comment lines', () => { + const document = parseQuickScript([ + 'IF Ready THEN', + 'ELSE', + 'ENDIF;', + 'FOR Index = 1 TO 2', + 'NEXT;', + '{Comment}', + ].join('\n')); + + assert.ok(!document.diagnostics.some(item => item.code === 'missing-semicolon')); + }); + + test('treats brace, apostrophe, and metadata comments as syntax trivia', () => { + const sources = [ + [ + '{', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + 'IF X THEN;', + 'TABINDEX + TABINDEX + 1;', + '}', + ].join('\n'), + [ + '{>', + 'Script:', + 'Type: QuickFunction', + 'Name: Test', + '', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + '{<}', + ].join('\n'), + "' DIM X AS FALSCH; CALL NichtVorhanden();", + '{> Version Name Usage CALL DIM}', + '{< Version Name Usage CALL DIM}', + '{# Version Name Usage CALL DIM}', + '{region Version Name Usage CALL DIM}', + '{endregion Version Name Usage CALL DIM}', + ]; + + for (const source of sources) { + assert.deepStrictEqual(parseQuickScript(source).diagnostics, [], source); + } + }); + + test('parses code between same-line-closed nesting markers', () => { + const source = [ + '{> following code shall be nested}', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + '{<-------------------------------------------}', + ].join('\n'); + const document = parseQuickScript(source); + + assert.deepStrictEqual(document.statements.map(statement => statement.kind), ['dim', 'call']); + assert.deepStrictEqual(document.diagnostics.map(item => item.code), ['unknown-datatype']); + }); + + test('accepts CALL expressions in assignments, arguments, and multiline calls', () => { + const sources = [ + 'CALL Foo();', + 'X = CALL Foo();', + 'Object.Field = CALL Foo();', + 'X = Bar(CALL Foo());', + 'X = CALL Foo(Bar(1), Y);', + 'CALL Foo(CALL Bar());', + [ + 'TAB_HandF.Reference = CALL SetReferenceBool(', + ' tTopic,', + ' BYTE + 20,', + ' BitS1', + ');', + ].join('\n'), + [ + 'tTopic = StringLower(', + ' CALL GetSplittByIndex(', + ' TAB_AAFF.Reference,', + ' ".",', + ' 1', + ' )', + ');', + ].join('\n'), + ]; + + for (const source of sources) { + assert.deepStrictEqual(parseQuickScript(source).diagnostics, [], source); + } + }); + + test('accepts the documented statement and expression productions', () => { + const sources = [ + 'DIM First, Second AS REAL;', + 'TABINDEX = (TABINDEX + 1) * 2;', + 'STATION2:S09BNOnline = NOT (Value == 0 OR Ready == FALSE);', + 'CALL Run(StringMid(TextValue, 1, 2));', + 'LogMessage("ready");', + 'StartApp SYS_ToolsPath + "\\Scheduler.exe";', + 'Show "Overview";', + 'IF INDEX == cpuen THEN EXIT FOR; ENDIF;', + 'FOR I = 1 TO StringLen(TextValue) STEP 2\nNEXT;', + 'WHILE First < Second\nFirst = First + 1;\nNEXT;', + 'RETURN Temp_Return;', + ]; + + for (const source of sources) { + assert.deepStrictEqual(parseQuickScript(source).diagnostics, [], source); + } + }); + + test('keeps representative repository corpora diagnostic-clean', () => { + const fixtures = [ + path.resolve(__dirname, '../../../packages/core/test/fixtures/representative.vbi'), + path.resolve(__dirname, '../../../src/test/suite/testfiles/04.indentation.basic.nesting.tobe.vbi'), + path.resolve(__dirname, '../../../src/test/suite/testfiles/05.comment_rules.nesting.tobe.vbi'), + path.resolve(__dirname, '../../../src/test/suite/testfiles/06.region.nesting.tobe.vbi'), + path.resolve(__dirname, '../../../src/test/suite/testfiles/07.instance.highlight.tobe.vbi'), + ]; + + for (const fixture of fixtures) { + const diagnostics = parseQuickScript(fs.readFileSync(fixture, 'utf8')).diagnostics; + assert.deepStrictEqual(diagnostics, [], fixture); + } + }); + + test('derives focused negative diagnostics from grammar expectations', () => { + const cases: Array<{ + production: string; + source: string; + code: string; + start: { line: number; character: number }; + }> = [ + { production: 'DIM terminator', source: 'DIM X AS INTEGER', code: 'missing-semicolon', start: { line: 0, character: 16 } }, + { production: 'DIM identifier', source: 'DIM AS INTEGER;', code: 'missing-identifier', start: { line: 0, character: 3 } }, + { production: 'DIM AS', source: 'DIM X INTEGER;', code: 'missing-as', start: { line: 0, character: 13 } }, + { production: 'assignment terminator', source: 'X = X + 1', code: 'missing-semicolon', start: { line: 0, character: 9 } }, + { production: 'statement kind', source: 'X + X + 1;', code: 'expected-assignment', start: { line: 0, character: 0 } }, + { production: 'IF terminator', source: 'IF X == 1 THEN;\nENDIF;', code: 'unexpected-semicolon', start: { line: 0, character: 14 } }, + { production: 'IF THEN', source: 'IF X == 1\nENDIF;', code: 'missing-then', start: { line: 0, character: 9 } }, + { production: 'FOR assignment operator', source: 'FOR I == 1 TO 10\nNEXT;', code: 'expected-equals', start: { line: 0, character: 6 } }, + { production: 'FOR TO', source: 'FOR I = 1 10\nNEXT;', code: 'missing-to', start: { line: 0, character: 12 } }, + { production: 'FOR variable', source: 'FOR = 1 TO 10\nNEXT;', code: 'missing-loop-variable', start: { line: 0, character: 4 } }, + { production: 'CALL delimiter', source: 'CALL Foo(1; ', code: 'unclosed-delimiter', start: { line: 0, character: 10 } }, + { production: 'block end', source: 'NEXT;', code: 'invalid-nesting', start: { line: 0, character: 0 } }, + { production: 'block closer', source: 'IF Ready THEN', code: 'missing-endif', start: { line: 0, character: 0 } }, + { production: 'unknown declaration', source: 'DI X AS INTEGER;', code: 'invalid-statement', start: { line: 0, character: 0 } }, + ]; + + for (const item of cases) { + const found = parseQuickScript(item.source).diagnostics.find(candidate => candidate.code === item.code); + assert.ok(found, `${item.production}: expected ${item.code}`); + assert.deepStrictEqual(found.range.start, item.start, item.production); + } + }); + + test('recovers malformed loop-shaped statements without a NEXT cascade', () => { + const document = parseQuickScript('FR I = 1 TO 10\nCALL Run(I);\nNEXT;'); + + assert.ok(document.diagnostics.some(item => item.code === 'invalid-statement' && item.range.start.line === 0)); + assert.ok(!document.diagnostics.some(item => item.code === 'invalid-nesting')); + }); + + test('applies deterministic grammar mutations to valid statements', () => { + const mutations = [ + { source: 'X = X + 1;', mutate: (value: string) => value.replace(/;$/, ''), code: 'missing-semicolon' }, + { source: 'FOR I = 1 TO 10\nNEXT;', mutate: (value: string) => value.replace('I =', 'I =='), code: 'expected-equals' }, + { source: 'IF Ready THEN\nENDIF;', mutate: (value: string) => value.replace(' THEN', ''), code: 'missing-then' }, + { source: 'CALL Run(I);', mutate: (value: string) => value.replace(')', ''), code: 'unclosed-delimiter' }, + ]; + + for (const mutation of mutations) { + assert.deepStrictEqual(parseQuickScript(mutation.source).diagnostics, [], mutation.source); + assert.ok(parseQuickScript(mutation.mutate(mutation.source)).diagnostics.some(item => item.code === mutation.code)); + } + }); +}); diff --git a/packages/core/test/quality.test.ts b/packages/core/test/quality.test.ts new file mode 100644 index 0000000..278e7dc --- /dev/null +++ b/packages/core/test/quality.test.ts @@ -0,0 +1,110 @@ +import * as assert from 'assert'; + +import { + QUALITY_DIAGNOSTIC_CODES, + analyzeQuickScript, + definitionAt, + qualityDiagnostics, + referencesAt, +} from '../src'; + +suite('QuickScript quality diagnostics', () => { + test('warns once per non-ASCII identifier without changing language validity', () => { + const source = [ + 'DIM Größe AS INTEGER;', + 'DIM Lüfter1 AS DISCRETE;', + 'Größe = Größe + 1;', + ].join('\n'); + const model = analyzeQuickScript(source); + const diagnostics = qualityDiagnostics(model); + + assert.deepStrictEqual(model.diagnostics, []); + assert.deepStrictEqual(diagnostics.map(item => [item.code, item.severity, item.range.start]), [ + [QUALITY_DIAGNOSTIC_CODES.nonAsciiIdentifier, 'warning', { line: 0, character: 4 }], + [QUALITY_DIAGNOSTIC_CODES.nonAsciiIdentifier, 'warning', { line: 1, character: 4 }], + ]); + assert.ok(diagnostics.every(item => item.source === 'intouch-quality')); + }); + + test('keeps ASCII identifier forms clean', () => { + const model = analyzeQuickScript([ + 'DIM Groesse AS INTEGER;', + 'DIM TABINDEX AS INTEGER;', + 'DIM _Temp AS INTEGER;', + 'SYS_Tag-Name = $Second + #Trend;', + ].join('\n')); + + assert.deepStrictEqual(qualityDiagnostics(model), []); + }); + + test('checks QuickFunction and parameter declarations from metadata comment tokens', () => { + const source = [ + '{>', + 'Type: QuickFunction', + 'Name: Fünktion', + '', + 'Parameters:', + 'Integer Größe', + '', + 'Usage:', + 'CALL Fünktion(Größe);', + '{<}', + ].join('\n'); + const model = analyzeQuickScript(source); + + assert.deepStrictEqual(model.quickFunctions.map(item => item.name), ['Fünktion']); + assert.deepStrictEqual(model.quickFunctions[0].parameters.map(item => item.name), ['Größe']); + assert.deepStrictEqual(qualityDiagnostics(model).map(item => item.range.start), [ + { line: 2, character: 6 }, + { line: 5, character: 8 }, + ]); + }); + + test('checks only literal names in documented window-operation contexts', () => { + const source = [ + 'Show "Anlage1";', + 'Show "Anlage 1";', + 'Hide "Übersicht";', + 'ShowAt("Anlage Übersicht", 10, 20);', + 'MoveWindow("Fenster Zwei", 0, 0, 10, 10);', + 'PrintWindow("FensterÜ", 0, 0, 10, 10, 0);', + 'StatusMessage = "Störung Lüftung Süd";', + 'LogMessage("Störung Lüftung");', + ].join('\n'); + const diagnostics = qualityDiagnostics(analyzeQuickScript(source)); + + assert.deepStrictEqual(diagnostics.map(item => [item.code, item.range.start.line]), [ + [QUALITY_DIAGNOSTIC_CODES.windowWhitespace, 1], + [QUALITY_DIAGNOSTIC_CODES.windowNonAscii, 2], + [QUALITY_DIAGNOSTIC_CODES.windowWhitespace, 3], + [QUALITY_DIAGNOSTIC_CODES.windowNonAscii, 3], + [QUALITY_DIAGNOSTIC_CODES.windowWhitespace, 4], + [QUALITY_DIAGNOSTIC_CODES.windowNonAscii, 5], + ]); + }); + + test('keeps strings, brace comments, and apostrophe comments isolated', () => { + const source = [ + 'StatusMessage = "Störung Lüftung Süd";', + '{', + 'DIM Größe AS INTEGER;', + 'Show "Übersicht Anlage";', + '}', + '\' Show "Übersicht Anlage";', + ].join('\n'); + + assert.deepStrictEqual(qualityDiagnostics(analyzeQuickScript(source)), []); + }); + + test('supports configurable severity and off without changing navigation', () => { + const source = 'DIM Größe AS INTEGER;\nGröße = Größe + 1;'; + const model = analyzeQuickScript(source); + + assert.strictEqual(qualityDiagnostics(model, { nonAsciiIdentifiers: 'off' }).length, 0); + for (const severity of ['hint', 'information', 'warning', 'error'] as const) { + assert.strictEqual(qualityDiagnostics(model, { nonAsciiIdentifiers: severity })[0].severity, severity); + } + assert.deepStrictEqual(definitionAt(model, { line: 1, character: 1 }), { start: { line: 0, character: 4 }, end: { line: 0, character: 9 } }); + assert.strictEqual(referencesAt(model, { line: 0, character: 5 }).length, 3); + }); +}); diff --git a/packages/core/test/semantics.test.ts b/packages/core/test/semantics.test.ts new file mode 100644 index 0000000..b5ae370 --- /dev/null +++ b/packages/core/test/semantics.test.ts @@ -0,0 +1,114 @@ +import * as assert from 'assert'; + +import { KNOWN_FUNCTIONS } from '../src/generatedFunctionCatalog'; +import { analyzeQuickScript, definitionAt, referencesAt } from '../src/semantics'; + +suite('QuickScript semantic model', () => { + test('resolves document-local DIM declarations case-insensitively', () => { + const source = 'DIM Counter AS INTEGER;\nCounter = counter + 1;\nCALL Report(Counter);'; + const model = analyzeQuickScript(source); + + assert.deepStrictEqual(model.symbols.map(symbol => [symbol.name, symbol.datatype]), [['Counter', 'INTEGER']]); + assert.strictEqual(model.references.filter(reference => reference.declarationId === 0).length, 4); + assert.deepStrictEqual(definitionAt(model, { line: 1, character: 12 }), model.symbols[0].selectionRange); + assert.strictEqual(referencesAt(model, { line: 0, character: 5 }).length, 4); + }); + + test('reports duplicate local DIM declarations', () => { + const model = analyzeQuickScript('DIM Value AS REAL;\nDIM value AS REAL;'); + + assert.ok(model.diagnostics.some(item => item.code === 'duplicate-local')); + }); + + test('does not guess definitions for unknown names or member accesses', () => { + const model = analyzeQuickScript('DIM Value AS REAL;\nObject.Value = Unknown;'); + + assert.strictEqual(definitionAt(model, { line: 1, character: 7 }), undefined); + assert.strictEqual(definitionAt(model, { line: 1, character: 15 }), undefined); + }); + + test('does not emit syntax or semantic diagnostics from comment tokens', () => { + const sources = [ + [ + '{', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + 'IF X THEN;', + 'TABINDEX + TABINDEX + 1;', + '}', + ].join('\n'), + [ + '{>', + 'Script:', + 'Type: QuickFunction', + 'Name: Test', + '', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + '{<}', + ].join('\n'), + "' DIM X AS FALSCH; CALL NichtVorhanden();", + '{> Version Name Usage CALL DIM NichtVorhanden()}', + ]; + + for (const source of sources) { + assert.deepStrictEqual(analyzeQuickScript(source).diagnostics, [], source); + } + }); + + test('keeps diagnostics active between same-line-closed nesting markers', () => { + const model = analyzeQuickScript([ + '{> following code shall be nested}', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + '{<-------------------------------------------}', + ].join('\n')); + + assert.deepStrictEqual(model.diagnostics.map(item => item.code), ['unknown-datatype', 'unknown-function']); + }); + + test('preserves native function knowledge without accepting misspellings', () => { + const catalogEntries = ['LogMessage', 'StringLeft', 'TagExists'] + .map(name => KNOWN_FUNCTIONS.find(item => item.name === name)); + const model = analyzeQuickScript('CALL LogMessage("ok");\nCALL LogMessageX("ok");'); + + assert.ok(catalogEntries.every(item => item !== undefined)); + assert.deepStrictEqual( + model.diagnostics.filter(item => item.code === 'unknown-function').map(item => item.range.start), + [{ line: 1, character: 5 }], + ); + }); + + test('separates CALL expression syntax from known-function resolution', () => { + const known = analyzeQuickScript([ + 'X = CALL StringLeft(Source, 1);', + 'Object.Field = CALL StringRight(Topic, 1);', + 'X = StringLower(CALL StringLeft(Source, 1));', + ].join('\n')); + const unknown = analyzeQuickScript('X = CALL StringLeftX(Source, 1);'); + + assert.deepStrictEqual(known.diagnostics, []); + assert.deepStrictEqual(unknown.diagnostics.map(item => [item.code, item.range.start]), [ + ['unknown-function', { line: 0, character: 9 }], + ]); + }); + + test('uses the existing definition and reference path for CALL expression targets', () => { + const source = [ + 'DIM LocalCallable AS INTEGER;', + 'CALL LocalCallable();', + 'Value = CALL LocalCallable();', + 'Value = Wrapper(CALL LocalCallable());', + ].join('\n'); + const model = analyzeQuickScript(source, { knownFunctionNames: ['LocalCallable', 'Wrapper'] }); + const callReferences = model.references.filter(reference => reference.name === 'LocalCallable' && reference.kind === 'call'); + + assert.strictEqual(callReferences.length, 3); + assert.deepStrictEqual(definitionAt(model, { line: 2, character: 15 }), model.symbols[0].selectionRange); + assert.strictEqual(referencesAt(model, { line: 2, character: 15 }).length, 4); + }); +}); diff --git a/packages/core/test/source.test.ts b/packages/core/test/source.test.ts new file mode 100644 index 0000000..3127bc3 --- /dev/null +++ b/packages/core/test/source.test.ts @@ -0,0 +1,38 @@ +import * as assert from 'assert'; + +import { offsetAt, positionAt, sourceRange } from '../src/source'; + +suite('core source model', () => { + const source = 'alpha\r\nβ😀\n'; + + test('uses zero-based UTF-16 positions across supported newline forms', () => { + assert.deepStrictEqual(positionAt(source, 0), { line: 0, character: 0 }); + assert.deepStrictEqual(positionAt(source, 5), { line: 0, character: 5 }); + assert.deepStrictEqual(positionAt(source, 7), { line: 1, character: 0 }); + assert.deepStrictEqual(positionAt(source, 10), { line: 1, character: 3 }); + assert.deepStrictEqual(positionAt(source, 11), { line: 2, character: 0 }); + }); + + test('maps valid positions back to offsets', () => { + assert.strictEqual(offsetAt(source, { line: 0, character: 5 }), 5); + assert.strictEqual(offsetAt(source, { line: 1, character: 3 }), 10); + assert.strictEqual(offsetAt(source, { line: 2, character: 0 }), 11); + }); + + test('uses inclusive starts and exclusive ends for ranges', () => { + assert.deepStrictEqual(sourceRange(source, { start: 7, end: 10 }), { + span: { start: 7, end: 10 }, + range: { + start: { line: 1, character: 0 }, + end: { line: 1, character: 3 }, + }, + }); + }); + + test('rejects offsets and positions outside the source', () => { + assert.throws(() => positionAt(source, -1), RangeError); + assert.throws(() => positionAt(source, source.length + 1), RangeError); + assert.throws(() => offsetAt(source, { line: 1, character: 4 }), RangeError); + assert.throws(() => sourceRange(source, { start: 4, end: 3 }), RangeError); + }); +}); diff --git a/packages/core/test/tokenizer.test.ts b/packages/core/test/tokenizer.test.ts new file mode 100644 index 0000000..21c8f64 --- /dev/null +++ b/packages/core/test/tokenizer.test.ts @@ -0,0 +1,215 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; + +import { positionAt } from '../src/source'; +import { Token, TokenKind } from '../src/token'; +import { tokenize } from '../src/tokenizer'; + +function significant(tokens: Token[]): Token[] { + return tokens.filter(token => token.kind !== TokenKind.Whitespace && token.kind !== TokenKind.Newline); +} + +suite('QuickScript tokenizer', () => { + test('classifies representative declarations, control flow, calls, and values', () => { + const tokens = significant(tokenize('dim MessageText as message; IF Reading>=10.5 THEN CALL LogMessage("ok"); ENDIF;')); + const actual = tokens.map(token => [token.kind, token.lexeme]); + + assert.deepStrictEqual(actual, [ + [TokenKind.Keyword, 'dim'], + [TokenKind.Identifier, 'MessageText'], + [TokenKind.Keyword, 'as'], + [TokenKind.Datatype, 'message'], + [TokenKind.Punctuation, ';'], + [TokenKind.Keyword, 'IF'], + [TokenKind.Identifier, 'Reading'], + [TokenKind.Operator, '>='], + [TokenKind.Number, '10.5'], + [TokenKind.Keyword, 'THEN'], + [TokenKind.Keyword, 'CALL'], + [TokenKind.Identifier, 'LogMessage'], + [TokenKind.Punctuation, '('], + [TokenKind.String, '"ok"'], + [TokenKind.Punctuation, ')'], + [TokenKind.Punctuation, ';'], + [TokenKind.Keyword, 'ENDIF'], + [TokenKind.Punctuation, ';'], + [TokenKind.EOF, ''], + ]); + }); + + test('preserves case and treats native and workspace function names as identifiers', () => { + const tokens = significant(tokenize('CALL LogMessage(); CALL WorkspaceFunction();')); + const identifiers = tokens.filter(token => token.kind === TokenKind.Identifier); + + assert.deepStrictEqual(identifiers.map(token => token.lexeme), ['LogMessage', 'WorkspaceFunction']); + }); + + test('recognizes established identifier forms without splitting instance prefixes', () => { + const tokens = significant(tokenize('STATION1:S09BNOnline = SYS_Tag-Name; $Second = #Trend;')); + const identifiers = tokens.filter(token => token.kind === TokenKind.Identifier); + + assert.deepStrictEqual( + identifiers.map(token => token.lexeme), + ['STATION1', 'S09BNOnline', 'SYS_Tag-Name', '$Second', '#Trend'], + ); + }); + + test('keeps Unicode letters and numbers inside QuickScript identifiers', () => { + const tokens = significant(tokenize('Größe2 = Außentemperatur_1 + 123Pump.Name + 2-3;')); + const identifiers = tokens.filter(token => token.kind === TokenKind.Identifier); + + assert.deepStrictEqual(identifiers.map(token => token.lexeme), ['Größe2', 'Außentemperatur_1', '123Pump', 'Name']); + assert.ok(tokens.some(token => token.kind === TokenKind.Operator && token.lexeme === '-')); + }); + + test('keeps syntax-looking text inside strings and comments', () => { + const source = 'Empty = ""; Message = "IF {not a comment} then"; { IF a >= 1 }\n\' NEXT is a comment'; + const tokens = tokenize(source); + + assert.deepStrictEqual( + tokens.filter(token => token.kind === TokenKind.String).map(token => token.lexeme), + ['""', '"IF {not a comment} then"'], + ); + assert.deepStrictEqual( + tokens.filter(token => token.kind === TokenKind.Comment).map(token => token.lexeme), + ['{ IF a >= 1 }', "' NEXT is a comment"], + ); + }); + + test('ends a multiline brace comment at its closing brace and resumes code tokens', () => { + const source = [ + '{ DIM altDebug AS DISCRETE;', + '', + 'altDebug = Sys_Debug_info;', + '', + 'Sys_Debug_info = 1; }', + '', + 'CALL xHerDebug(Funkt + " ", 0);', + ].join('\n'); + const tokens = tokenize(source); + const comment = tokens.find(token => token.kind === TokenKind.Comment); + const call = tokens.find(token => token.kind === TokenKind.Keyword && token.lexeme === 'CALL'); + + assert.deepStrictEqual(comment?.range, { + start: { line: 0, character: 0 }, + end: { line: 4, character: 21 }, + }); + assert.deepStrictEqual(call?.range.start, { line: 6, character: 0 }); + }); + + test('keeps invalid-looking multiline QuickScript inside one comment token', () => { + const source = [ + '{', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + 'IF X THEN;', + 'TABINDEX + TABINDEX + 1;', + '}', + ].join('\n'); + const content = tokenize(source).filter(token => token.kind !== TokenKind.EOF); + + assert.strictEqual(content.length, 1); + assert.strictEqual(content[0].kind, TokenKind.Comment); + assert.strictEqual(content[0].lexeme, source); + }); + + test('keeps an unclosed metadata opener through the later closing brace in one comment token', () => { + const source = [ + '{>', + 'Script:', + 'Type: QuickFunction', + 'Name: Test', + '', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + '{<}', + ].join('\n'); + const content = tokenize(source).filter(token => token.kind !== TokenKind.EOF); + + assert.strictEqual(content.length, 1); + assert.strictEqual(content[0].kind, TokenKind.Comment); + assert.strictEqual(content[0].lexeme, source); + assert.strictEqual(content.map(token => token.lexeme).join(''), source); + }); + + test('keeps code between same-line-closed nesting markers as QuickScript tokens', () => { + const source = [ + '{> following code shall be nested}', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + '{<-------------------------------------------}', + ].join('\n'); + const tokens = tokenize(source); + const comments = tokens.filter(token => token.kind === TokenKind.Comment); + + assert.deepStrictEqual(comments.map(token => token.lexeme), [ + '{> following code shall be nested}', + '{<-------------------------------------------}', + ]); + assert.ok(tokens.some(token => token.kind === TokenKind.Keyword && token.lexeme === 'DIM')); + assert.ok(tokens.some(token => token.kind === TokenKind.Keyword && token.lexeme === 'CALL')); + assert.strictEqual(tokens.slice(0, -1).map(token => token.lexeme).join(''), source); + }); + + test('matches operators longest-first and recognizes QuickScript punctuation', () => { + const tokens = significant(tokenize('A==B; C<>D; E<=F; G>=H; Tag.Field->Method()[1], X:Y;')); + + assert.deepStrictEqual( + tokens.filter(token => token.kind === TokenKind.Operator).map(token => token.lexeme), + ['==', '<>', '<=', '>=', '->'], + ); + assert.deepStrictEqual( + tokens.filter(token => token.kind === TokenKind.Punctuation).map(token => token.lexeme), + [';', ';', ';', ';', '.', '(', ')', '[', ']', ',', ':', ';'], + ); + }); + + test('tracks CRLF positions and half-open offsets', () => { + const tokens = tokenize('IF\r\nReading >= 10;'); + const keyword = tokens[0]; + const newline = tokens[1]; + const identifier = tokens[2]; + + assert.deepStrictEqual(keyword.span, { start: 0, end: 2 }); + assert.deepStrictEqual(keyword.range, { start: { line: 0, character: 0 }, end: { line: 0, character: 2 } }); + assert.deepStrictEqual(newline.span, { start: 2, end: 4 }); + assert.deepStrictEqual(newline.range.end, { line: 1, character: 0 }); + assert.deepStrictEqual(identifier.range, { start: { line: 1, character: 0 }, end: { line: 1, character: 7 } }); + }); + + test('returns stable tokens for unclosed strings and unknown characters', () => { + const tokens = tokenize('Message = "unfinished\n@'); + + assert.strictEqual(tokens.find(token => token.kind === TokenKind.String)?.lexeme, '"unfinished'); + assert.strictEqual(tokens.find(token => token.kind === TokenKind.Unknown)?.lexeme, '@'); + assert.strictEqual(tokens[tokens.length - 1].kind, TokenKind.EOF); + }); + + for (const fixture of ['representative.vbi', 'incomplete.vi']) { + test(`maintains token invariants for ${fixture}`, () => { + const fixturePath = path.resolve(__dirname, '../../../packages/core/test/fixtures', fixture); + const source = fs.readFileSync(fixturePath, 'utf8'); + const tokens = tokenize(source); + const contentTokens = tokens.slice(0, -1); + + assert.strictEqual(contentTokens.map(token => token.lexeme).join(''), source); + assert.strictEqual(tokens[tokens.length - 1].kind, TokenKind.EOF); + for (let index = 0; index < tokens.length; index += 1) { + const token = tokens[index]; + assert.ok(token.span.start >= 0); + assert.ok(token.span.end >= token.span.start); + assert.ok(token.span.end <= source.length); + assert.deepStrictEqual(token.range.start, positionAt(source, token.span.start)); + assert.deepStrictEqual(token.range.end, positionAt(source, token.span.end)); + if (index > 0) { + assert.strictEqual(token.span.start, tokens[index - 1].span.end); + } + } + }); + } +}); diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 0000000..82ab3d2 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "declaration": true, + "lib": [ + "es2021" + ], + "module": "commonjs", + "outDir": "../../out/core", + "rootDir": ".", + "sourceMap": true, + "strict": true, + "target": "es2021", + "types": [ + "mocha", + "node" + ] + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ] +} diff --git a/packages/language-server/package.json b/packages/language-server/package.json new file mode 100644 index 0000000..a51e47b --- /dev/null +++ b/packages/language-server/package.json @@ -0,0 +1,12 @@ +{ + "name": "@intouch-language/language-server", + "private": true, + "description": "Editor-independent QuickScript language server", + "main": "../../../out/language-server/src/server.js", + "types": "../../../out/language-server/src/server.d.ts", + "dependencies": { + "@intouch-language/core": "*", + "vscode-languageserver": "^10.1.0", + "vscode-languageserver-textdocument": "^1.0.12" + } +} diff --git a/packages/language-server/src/features.ts b/packages/language-server/src/features.ts new file mode 100644 index 0000000..5f5e075 --- /dev/null +++ b/packages/language-server/src/features.ts @@ -0,0 +1,219 @@ +import { + CompletionItem, + CompletionItemKind, + Diagnostic, + DiagnosticSeverity, + DocumentSymbol, + Hover, + InitializeResult, + Location, + Position, + Range, + SymbolKind, + TextEdit, + TextDocumentSyncKind, +} from 'vscode-languageserver/node'; +import { TextDocument } from 'vscode-languageserver-textdocument'; +import { + FormatOptions, + QualityDiagnosticSettings, + analyzeQuickScript, + completions, + definitionAt, + documentSymbols, + formatQuickScript, + hoverAt, + qualityDiagnostics, + referencesAt, +} from '@intouch-language/core'; +import { WorkspaceSymbol, WorkspaceSymbolIndex, documentFileName } from './workspaceSymbols'; + +export interface ServerSettings extends FormatOptions { + qualityDiagnostics?: QualityDiagnosticSettings; +} + +export function serverCapabilities(): InitializeResult { + return { + capabilities: { + textDocumentSync: TextDocumentSyncKind.Incremental, + documentFormattingProvider: true, + documentSymbolProvider: true, + definitionProvider: true, + referencesProvider: true, + completionProvider: { resolveProvider: false }, + hoverProvider: true, + }, + }; +} + +function completionKind(kind: string): CompletionItemKind { + switch (kind) { + case 'keyword': return CompletionItemKind.Keyword; + case 'datatype': return CompletionItemKind.TypeParameter; + case 'variable': return CompletionItemKind.Variable; + case 'call-target': return CompletionItemKind.Method; + default: return CompletionItemKind.Function; + } +} + +function lspDiagnosticSeverity(severity: 'error' | 'warning' | 'information' | 'hint'): DiagnosticSeverity { + switch (severity) { + case 'error': return DiagnosticSeverity.Error; + case 'information': return DiagnosticSeverity.Information; + case 'hint': return DiagnosticSeverity.Hint; + default: return DiagnosticSeverity.Warning; + } +} + +function workspaceIndex(value: WorkspaceSymbolIndex | Iterable | undefined): WorkspaceSymbolIndex | undefined { + return value instanceof WorkspaceSymbolIndex ? value : undefined; +} + +function knownFunctionNames(value: WorkspaceSymbolIndex | Iterable | undefined): Iterable | undefined { + const index = workspaceIndex(value); + return index === undefined ? value as Iterable | undefined : index.knownFunctionNames(); +} + +function analyzeDocument(document: TextDocument, workspace?: WorkspaceSymbolIndex | Iterable) { + return analyzeQuickScript(document.getText(), { + knownFunctionNames: knownFunctionNames(workspace), + fileName: documentFileName(document.uri), + }); +} + +function quickFunctionSignature(symbol: WorkspaceSymbol): string { + const parameters = symbol.metadata.parameters + .map(parameter => `${parameter.name}: ${parameter.datatype}`) + .join(', '); + const returns = symbol.metadata.returnType === undefined ? '' : `: ${symbol.metadata.returnType}`; + return `${symbol.name}(${parameters})${returns}`; +} + +function workspaceFunctionDetail(symbol: WorkspaceSymbol): string { + const signature = quickFunctionSignature(symbol); + return symbol.metadata.description === undefined ? signature : `${signature}\n\n${symbol.metadata.description}`; +} + +export function diagnosticsFor( + document: TextDocument, + workspace?: WorkspaceSymbolIndex | Iterable, + settings: ServerSettings = {}, +): Diagnostic[] { + const model = analyzeDocument(document, workspace); + const workspaceDiagnostics = workspaceIndex(workspace)?.diagnostics(document.uri) ?? []; + return [...model.diagnostics, ...workspaceDiagnostics, ...qualityDiagnostics(model, settings.qualityDiagnostics)].map(item => ({ + code: item.code, + message: item.message, + range: item.range, + severity: lspDiagnosticSeverity(item.severity), + source: item.source ?? 'intouch-language', + })); +} + +export function formattingEdits(document: TextDocument, settings: ServerSettings): TextEdit[] { + const lineEnding = settings.lineEnding ?? (document.getText().includes('\r\n') ? '\r\n' : '\n'); + const result = formatQuickScript(document.getText(), { ...settings, lineEnding }); + if (!result.changed) { + return []; + } + return [TextEdit.replace(Range.create(Position.create(0, 0), document.positionAt(document.getText().length)), result.text)]; +} + +export function symbolsFor(document: TextDocument): DocumentSymbol[] { + const symbolKind = (kind: ReturnType[number]['kind']): SymbolKind => { + switch (kind) { + case 'variable': return SymbolKind.Variable; + case 'function': return SymbolKind.Function; + case 'window': return SymbolKind.Namespace; + case 'event': return SymbolKind.Event; + case 'application': return SymbolKind.Module; + case 'data-change': return SymbolKind.Event; + case 'condition': return SymbolKind.Event; + case 'key-script': return SymbolKind.Event; + default: return SymbolKind.Struct; + } + }; + const convert = (entry: ReturnType[number]): DocumentSymbol => DocumentSymbol.create( + entry.name, + undefined, + symbolKind(entry.kind), + entry.range, + entry.selectionRange, + entry.children.map(convert), + ); + return documentSymbols(analyzeDocument(document)).map(convert); +} + +export function definitionFor(document: TextDocument, position: Position, workspace?: WorkspaceSymbolIndex): Location | undefined { + const range = definitionAt(analyzeDocument(document, workspace), position); + if (range !== undefined) return Location.create(document.uri, range); + if (workspace === undefined) return undefined; + const name = workspace.symbolNameAt(document.uri, position); + if (name === undefined) return undefined; + const symbol = workspace.uniqueQuickFunction(name); + return symbol === undefined ? undefined : Location.create(symbol.uri, symbol.definitionRange); +} + +export function referencesFor(document: TextDocument, position: Position, includeDeclaration: boolean, workspace?: WorkspaceSymbolIndex): Location[] { + const local = referencesAt(analyzeDocument(document, workspace), position, includeDeclaration); + if (local.length > 0) return local.map(range => Location.create(document.uri, range)); + if (workspace === undefined) return []; + const name = workspace.symbolNameAt(document.uri, position); + return name === undefined ? [] : workspace.references(name, includeDeclaration) + .map(reference => Location.create(reference.uri, reference.range)); +} + +export function completionsFor(document: TextDocument, workspace?: WorkspaceSymbolIndex): CompletionItem[] { + const nonCallableNames = new Set((workspace?.symbols() ?? []) + .filter(symbol => !symbol.callable) + .map(symbol => symbol.name.toUpperCase())); + const coreEntries = completions(analyzeDocument(document, workspace)) + .filter(entry => entry.kind !== 'call-target' || !nonCallableNames.has(entry.label.toUpperCase())); + const entries = new Map(coreEntries.map(entry => [entry.label.toUpperCase(), { + label: entry.label, + kind: completionKind(entry.kind), + detail: entry.detail, + }])); + for (const symbol of workspace?.quickFunctions() ?? []) { + const duplicates = workspace?.quickFunctions(symbol.name).length ?? 0; + entries.set(symbol.name.toUpperCase(), { + label: symbol.name, + kind: CompletionItemKind.Function, + detail: duplicates > 1 ? `Ambiguous workspace QuickFunction (${duplicates} definitions)` : workspaceFunctionDetail(symbol), + }); + } + return [...entries.values()].sort((left, right) => left.label.localeCompare(right.label, 'en', { sensitivity: 'base' })); +} + +export function hoverFor(document: TextDocument, position: Position, workspace?: WorkspaceSymbolIndex): Hover | undefined { + const documentSymbol = workspace?.symbolAt(document.uri, position); + if (documentSymbol !== undefined && documentSymbol.kind !== 'QuickFunction') { + const context = documentSymbol.metadata.event ?? documentSymbol.metadata.shortcut ?? documentSymbol.metadata.trigger; + const detail = context === undefined ? documentSymbol.kind : `${documentSymbol.kind}: ${context}`; + return { + contents: { kind: 'markdown', value: `**${documentSymbol.name}**\n\n${detail}` }, + range: documentSymbol.definitionRange, + }; + } + const workspaceName = workspace?.symbolNameAt(document.uri, position); + if (workspaceName !== undefined) { + const candidates = workspace!.quickFunctions(workspaceName); + if (candidates.length > 1) { + return { contents: { kind: 'markdown', value: `**${workspaceName}**\n\nAmbiguous workspace QuickFunction (${candidates.length} definitions).` } }; + } + if (candidates.length === 1) { + return { + contents: { kind: 'markdown', value: `**${candidates[0].name}**\n\n${workspaceFunctionDetail(candidates[0])}` }, + range: workspace?.entry(document.uri)?.calls.find(reference => reference.name.toUpperCase() === workspaceName.toUpperCase() + && reference.range.start.line === position.line + && reference.range.start.character <= position.character + && reference.range.end.character > position.character)?.range, + }; + } + } + const hover = hoverAt(analyzeDocument(document, workspace), position); + return hover === undefined ? undefined : { + contents: { kind: 'markdown', value: `**${hover.label}**\n\n${hover.detail}` }, + range: hover.range, + }; +} diff --git a/packages/language-server/src/server.ts b/packages/language-server/src/server.ts new file mode 100644 index 0000000..9e9d101 --- /dev/null +++ b/packages/language-server/src/server.ts @@ -0,0 +1,147 @@ +import { + FileChangeType, + ProposedFeatures, + createConnection, +} from 'vscode-languageserver/node'; +import { TextDocument } from 'vscode-languageserver-textdocument'; +import { TextDocuments } from 'vscode-languageserver'; +import { promises as fs } from 'node:fs'; +import * as path from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +import { + ServerSettings, + completionsFor, + definitionFor, + diagnosticsFor, + formattingEdits, + hoverFor, + referencesFor, + serverCapabilities, + symbolsFor, +} from './features'; +import { formattingSettings, readSettings } from './settings'; +import { WorkspaceDocumentSource, WorkspaceSymbolIndex } from './workspaceSymbols'; + +const connection = createConnection(ProposedFeatures.all); +const documents = new TextDocuments(TextDocument); +const workspaceSymbols = new WorkspaceSymbolIndex(); +let settings: ServerSettings = {}; +let workspaceFolders: string[] = []; + +function publishDiagnostics(document: TextDocument): void { + connection.sendDiagnostics({ + uri: document.uri, + diagnostics: diagnosticsFor(document, workspaceSymbols, settings), + }); +} + +function republishOpenDocuments(): void { + for (const document of documents.all()) { + publishDiagnostics(document); + } +} + +async function quickScriptSources(folder: string): Promise { + const sources: WorkspaceDocumentSource[] = []; + const entries = await fs.readdir(folder, { withFileTypes: true }); + for (const entry of entries) { + if (entry.name === '.git' || entry.name === 'node_modules') { + continue; + } + const candidate = path.join(folder, entry.name); + if (entry.isDirectory()) { + sources.push(...await quickScriptSources(candidate)); + } else if (entry.isFile() && /\.(?:vbi|vi)$/i.test(entry.name)) { + sources.push({ uri: pathToFileURL(candidate).toString(), text: await fs.readFile(candidate, 'utf8') }); + } + } + return sources; +} + +async function refreshWorkspaceSymbols(folders: readonly string[]): Promise { + try { + const sources = (await Promise.all(folders.map(quickScriptSources))).flat(); + workspaceSymbols.replaceWorkspaceDocuments(sources); + republishOpenDocuments(); + } catch { + // Keep diagnostics available for open documents when a workspace file cannot be read. + } +} + +connection.onInitialize(async params => { + const folders = params.workspaceFolders?.map(folder => folder.uri) + ?? (params.rootUri === null || params.rootUri === undefined ? [] : [params.rootUri]); + workspaceFolders = folders + .filter(uri => uri.startsWith('file:')) + .map(uri => fileURLToPath(uri)); + await refreshWorkspaceSymbols(workspaceFolders); + return serverCapabilities(); +}); +connection.onInitialized(async () => { + const vbi = await connection.workspace.getConfiguration({ section: 'VBI' }); + settings = readSettings({ VBI: vbi }); + republishOpenDocuments(); +}); +connection.onDidChangeConfiguration(change => { + settings = readSettings(change.settings); + republishOpenDocuments(); +}); +connection.onDidChangeWatchedFiles(change => { + void (async () => { + for (const file of change.changes.filter(candidate => /\.(?:vbi|vi)$/i.test(candidate.uri))) { + if (file.type === FileChangeType.Deleted) { + workspaceSymbols.removeWorkspaceDocument(file.uri); + continue; + } + try { + workspaceSymbols.updateWorkspaceDocument({ uri: file.uri, text: await fs.readFile(fileURLToPath(file.uri), 'utf8') }); + } catch { + workspaceSymbols.removeWorkspaceDocument(file.uri); + } + } + republishOpenDocuments(); + })(); +}); +documents.onDidOpen(change => { + workspaceSymbols.updateDocument(change.document); + republishOpenDocuments(); +}); +documents.onDidChangeContent(change => { + workspaceSymbols.updateDocument(change.document); + republishOpenDocuments(); +}); +documents.onDidClose(change => { + workspaceSymbols.removeDocument(change.document.uri); + connection.sendDiagnostics({ uri: change.document.uri, diagnostics: [] }); + republishOpenDocuments(); +}); + +connection.onDocumentFormatting(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? [] : formattingEdits(document, formattingSettings(settings, params.options)); +}); +connection.onDocumentSymbol(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? [] : symbolsFor(document); +}); +connection.onDefinition(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? undefined : definitionFor(document, params.position, workspaceSymbols); +}); +connection.onReferences(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? [] : referencesFor(document, params.position, params.context.includeDeclaration, workspaceSymbols); +}); +connection.onCompletion(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? [] : completionsFor(document, workspaceSymbols); +}); +connection.onHover(params => { + const document = documents.get(params.textDocument.uri); + return document === undefined ? undefined : hoverFor(document, params.position, workspaceSymbols); +}); +connection.onShutdown(() => undefined); + +documents.listen(connection); +connection.listen(); diff --git a/packages/language-server/src/settings.ts b/packages/language-server/src/settings.ts new file mode 100644 index 0000000..4538eee --- /dev/null +++ b/packages/language-server/src/settings.ts @@ -0,0 +1,64 @@ +import { ServerSettings } from './features'; +import { FormattingOptions } from 'vscode-languageserver/node'; + +function asRecord(candidate: unknown): Record { + return typeof candidate === 'object' && candidate !== null ? candidate as Record : {}; +} + +function numberValue(candidate: unknown): number | undefined { + return typeof candidate === 'number' ? candidate : undefined; +} + +function booleanValue(candidate: unknown): boolean | undefined { + return typeof candidate === 'boolean' ? candidate : undefined; +} + +function stringValue(candidate: unknown): string | undefined { + return typeof candidate === 'string' ? candidate : undefined; +} + +function severityValue(candidate: unknown): 'off' | 'hint' | 'information' | 'warning' | 'error' | undefined { + const value = stringValue(candidate)?.toLowerCase(); + return value !== undefined && ['off', 'hint', 'information', 'warning', 'error'].includes(value) + ? value as 'off' | 'hint' | 'information' | 'warning' | 'error' + : undefined; +} + +export function readSettings(value: unknown): ServerSettings { + const root = asRecord(value); + const vbi = root.VBI === undefined ? root : asRecord(root.VBI); + const formatter = asRecord(vbi.formatter); + const emptyLine = asRecord(formatter.EmptyLine); + const block = asRecord(formatter.BC); + const region = asRecord(formatter.Region); + const misc = asRecord(formatter.Misc); + const diagnostics = asRecord(vbi.diagnostics); + const naming = asRecord(diagnostics.naming); + return { + allowedNumberOfEmptyLines: numberValue(emptyLine.allowedNumberOfEmptyLines), + removeEmptyLines: booleanValue(emptyLine.RemoveEmptyLines), + removeEmptyLinesInComments: booleanValue(emptyLine.EmptyLinesAlsoInComment), + blockCodeBegin: stringValue(block.BlockCodeBegin), + blockCodeEnd: stringValue(block.BlockCodeEnd), + blockCodeExclude: stringValue(block.BlockCodeExclude), + regionBlockCodeBegin: stringValue(region.BlockCodeBegin), + regionBlockCodeEnd: stringValue(region.BlockCodeEnd), + regionBlockCodeExclude: stringValue(region.BlockCodeExclude), + insertSpaces: booleanValue(misc.ReplaceTabToSpaces), + indentSize: numberValue(misc.IndentSize), + qualityDiagnostics: { + nonAsciiIdentifiers: severityValue(naming.nonAsciiIdentifiers), + windowWhitespace: severityValue(naming.windowWhitespace), + windowNonAscii: severityValue(naming.windowNonAscii), + }, + }; +} + +/** Keep explicit extension formatter settings authoritative over generic editor tab settings. */ +export function formattingSettings(settings: ServerSettings, options: FormattingOptions): ServerSettings { + return { + ...settings, + insertSpaces: settings.insertSpaces ?? options.insertSpaces, + indentSize: settings.indentSize ?? options.tabSize, + }; +} diff --git a/packages/language-server/src/workspaceFunctions.ts b/packages/language-server/src/workspaceFunctions.ts new file mode 100644 index 0000000..2235c2c --- /dev/null +++ b/packages/language-server/src/workspaceFunctions.ts @@ -0,0 +1,8 @@ +export { WorkspaceFunctionIndex, WorkspaceSymbolIndex, workspaceDocumentKey } from './workspaceSymbols'; +export type { + WorkspaceDocumentEntry, + WorkspaceDocumentSource, + WorkspaceReference, + WorkspaceSymbol, + WorkspaceSymbolKind, +} from './workspaceSymbols'; diff --git a/packages/language-server/src/workspaceSymbols.ts b/packages/language-server/src/workspaceSymbols.ts new file mode 100644 index 0000000..5bcc8f3 --- /dev/null +++ b/packages/language-server/src/workspaceSymbols.ts @@ -0,0 +1,262 @@ +import { + CoreDiagnostic, + Position, + QuickReference, + QuickScriptDocumentMetadata, + Range, + analyzeQuickScript, +} from '@intouch-language/core'; +import * as path from 'node:path'; +import { TextDocument } from 'vscode-languageserver-textdocument'; + +export type WorkspaceSymbolKind = + | 'QuickFunction' + | 'Window' + | 'WindowEvent' + | 'ApplicationScript' + | 'DataChangeScript' + | 'ConditionScript' + | 'KeyScript'; + +export interface WorkspaceDocumentSource { + uri: string; + text: string; +} + +export interface WorkspaceSymbol { + name: string; + kind: WorkspaceSymbolKind; + callable: boolean; + uri: string; + definitionRange: Range; + metadata: QuickScriptDocumentMetadata; +} + +export interface WorkspaceReference { + name: string; + kind: 'declaration' | 'call'; + uri: string; + range: Range; +} + +export interface WorkspaceDocumentEntry { + uri: string; + metadata: QuickScriptDocumentMetadata; + calls: QuickReference[]; + symbols: WorkspaceSymbol[]; +} + +/** Stable identity key for one physical document across equivalent URI spellings. */ +export function workspaceDocumentKey(uri: string): string { + try { + const parsed = new URL(uri); + if (parsed.protocol !== 'file:') return parsed.toString(); + + const decodedPath = decodeURIComponent(parsed.pathname); + if (/^\/[A-Za-z]:(?:\/|$)/.test(decodedPath)) { + const windowsPath = path.win32.normalize(decodedPath.slice(1).replace(/\//g, '\\')); + return `file-win:${windowsPath.toLowerCase()}`; + } + if (parsed.hostname !== '') { + const windowsPath = path.win32.normalize(`\\\\${parsed.hostname}${decodedPath.replace(/\//g, '\\')}`); + return `file-win:${windowsPath.toLowerCase()}`; + } + return `file-posix:${path.posix.normalize(decodedPath)}`; + } catch { + if (/^[A-Za-z]:[\\/]/.test(uri)) return `file-win:${path.win32.normalize(uri).toLowerCase()}`; + return uri; + } +} + +function contains(range: Range, position: Position): boolean { + return (position.line > range.start.line || (position.line === range.start.line && position.character >= range.start.character)) + && (position.line < range.end.line || (position.line === range.end.line && position.character < range.end.character)); +} + +function zeroRange(): Range { + return { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } }; +} + +export function documentFileName(uri: string): string | undefined { + try { + const parsed = new URL(uri); + const segments = parsed.pathname.split('/'); + return decodeURIComponent(segments[segments.length - 1] || '') || undefined; + } catch { + const segments = uri.split(/[\\/]/); + return segments[segments.length - 1] || undefined; + } +} + +function documentSymbols(uri: string, metadata: QuickScriptDocumentMetadata): WorkspaceSymbol[] { + const name = metadata.name ?? metadata.trigger; + const definitionRange = metadata.nameRange ?? metadata.triggerRange ?? zeroRange(); + if (metadata.scriptType === 'QuickFunction' && name !== undefined) { + return [{ name, kind: 'QuickFunction', callable: true, uri, definitionRange, metadata }]; + } + if (metadata.scriptType === 'Window' && metadata.name !== undefined) { + const symbols: WorkspaceSymbol[] = [{ + name: metadata.name, + kind: 'Window', + callable: false, + uri, + definitionRange, + metadata, + }]; + if (metadata.event !== undefined) { + symbols.push({ + name: `${metadata.name}.${metadata.event}`, + kind: 'WindowEvent', + callable: false, + uri, + definitionRange: metadata.eventRange ?? definitionRange, + metadata, + }); + } + return symbols; + } + if (metadata.scriptType === 'Application') { + return [{ name: name ?? 'Application', kind: 'ApplicationScript', callable: false, uri, definitionRange, metadata }]; + } + if (metadata.scriptType === 'DataChange') { + return [{ name: name ?? 'DataChange', kind: 'DataChangeScript', callable: false, uri, definitionRange, metadata }]; + } + if (metadata.scriptType === 'Condition') { + return [{ name: name ?? 'Condition', kind: 'ConditionScript', callable: false, uri, definitionRange, metadata }]; + } + if (metadata.scriptType === 'KeyScript') { + return [{ name: name ?? metadata.shortcut ?? 'KeyScript', kind: 'KeyScript', callable: false, uri, definitionRange, metadata }]; + } + return []; +} + +function indexDocument(source: WorkspaceDocumentSource): WorkspaceDocumentEntry { + const model = analyzeQuickScript(source.text, { fileName: documentFileName(source.uri) }); + return { + uri: source.uri, + metadata: model.metadata, + calls: model.references.filter(reference => reference.kind === 'call'), + symbols: documentSymbols(source.uri, model.metadata), + }; +} + +/** URI-aware incremental index for callable and non-callable QuickScript workspace symbols. */ +export class WorkspaceSymbolIndex { + private readonly workspaceDocuments = new Map(); + private readonly openDocuments = new Map(); + + public replaceWorkspaceDocuments(sources: Iterable): void { + this.workspaceDocuments.clear(); + for (const source of sources) this.workspaceDocuments.set(workspaceDocumentKey(source.uri), indexDocument(source)); + } + + public updateWorkspaceDocument(source: WorkspaceDocumentSource): void { + this.workspaceDocuments.set(workspaceDocumentKey(source.uri), indexDocument(source)); + } + + public removeWorkspaceDocument(uri: string): void { + this.workspaceDocuments.delete(workspaceDocumentKey(uri)); + } + + public updateDocument(document: TextDocument): void { + this.openDocuments.set(workspaceDocumentKey(document.uri), indexDocument({ uri: document.uri, text: document.getText() })); + } + + public removeDocument(uri: string): void { + this.openDocuments.delete(workspaceDocumentKey(uri)); + } + + public entries(): WorkspaceDocumentEntry[] { + const documents = new Map(this.workspaceDocuments); + for (const [key, entry] of this.openDocuments) documents.set(key, entry); + return [...documents.values()].sort((left, right) => left.uri.localeCompare(right.uri, 'en')); + } + + public entry(uri: string): WorkspaceDocumentEntry | undefined { + const key = workspaceDocumentKey(uri); + return this.openDocuments.get(key) ?? this.workspaceDocuments.get(key); + } + + public symbols(): WorkspaceSymbol[] { + return this.entries().flatMap(entry => entry.symbols); + } + + public quickFunctions(name?: string): WorkspaceSymbol[] { + const normalized = name?.toUpperCase(); + return this.symbols().filter(symbol => symbol.kind === 'QuickFunction' + && (normalized === undefined || symbol.name.toUpperCase() === normalized)); + } + + public knownFunctionNames(): string[] { + const names = new Map(); + for (const symbol of this.quickFunctions()) names.set(symbol.name.toUpperCase(), symbol.name); + return [...names.values()].sort((left, right) => left.localeCompare(right, 'en', { sensitivity: 'base' })); + } + + public uniqueQuickFunction(name: string): WorkspaceSymbol | undefined { + const candidates = this.quickFunctions(name); + return candidates.length === 1 ? candidates[0] : undefined; + } + + public symbolAt(uri: string, position: Position): WorkspaceSymbol | undefined { + return this.entry(uri)?.symbols.find(symbol => contains(symbol.definitionRange, position)); + } + + public symbolNameAt(uri: string, position: Position): string | undefined { + const entry = this.entry(uri); + const declaration = this.symbolAt(uri, position); + if (declaration?.kind !== 'QuickFunction') return entry?.calls.find(reference => contains(reference.range, position))?.name; + if (declaration !== undefined) return declaration.name; + return entry?.calls.find(reference => contains(reference.range, position))?.name; + } + + public references(name: string, includeDeclaration: boolean): WorkspaceReference[] { + const normalized = name.toUpperCase(); + const declarations = includeDeclaration + ? this.quickFunctions(name).map(symbol => ({ + name: symbol.name, + kind: 'declaration' as const, + uri: symbol.uri, + range: symbol.definitionRange, + })) + : []; + const calls = this.entries().flatMap(entry => entry.calls + .filter(reference => reference.name.toUpperCase() === normalized) + .map(reference => ({ name: reference.name, kind: 'call' as const, uri: entry.uri, range: reference.range }))); + return [...declarations, ...calls].sort((left, right) => left.uri.localeCompare(right.uri, 'en') + || left.range.start.line - right.range.start.line + || left.range.start.character - right.range.start.character); + } + + public diagnostics(uri: string): CoreDiagnostic[] { + const entry = this.entry(uri); + if (entry === undefined) return []; + const diagnostics: CoreDiagnostic[] = []; + for (const symbol of entry.symbols.filter(candidate => candidate.kind === 'QuickFunction')) { + if (this.quickFunctions(symbol.name).length > 1) { + diagnostics.push({ + code: 'duplicate-quickfunction', + message: `QuickFunction '${symbol.name}' has multiple workspace definitions.`, + severity: 'warning', + range: symbol.definitionRange, + source: 'intouch-metadata', + }); + } + } + for (const call of entry.calls) { + if (this.quickFunctions(call.name).length > 1) { + diagnostics.push({ + code: 'ambiguous-quickfunction', + message: `QuickFunction call '${call.name}' has multiple workspace definitions.`, + severity: 'warning', + range: call.range, + source: 'intouch-metadata', + }); + } + } + return diagnostics; + } +} + +/** Backward-compatible class name for callers migrating from the former name-only index. */ +export { WorkspaceSymbolIndex as WorkspaceFunctionIndex }; diff --git a/packages/language-server/test/features.test.ts b/packages/language-server/test/features.test.ts new file mode 100644 index 0000000..8d7cabb --- /dev/null +++ b/packages/language-server/test/features.test.ts @@ -0,0 +1,534 @@ +import * as assert from 'assert'; + +import * as fs from 'fs'; +import * as path from 'path'; + +import { DiagnosticSeverity } from 'vscode-languageserver/node'; +import { TextDocument } from 'vscode-languageserver-textdocument'; + +import { KNOWN_FUNCTIONS } from '@intouch-language/core'; + +import { + completionsFor, + definitionFor, + diagnosticsFor, + formattingEdits, + hoverFor, + referencesFor, + serverCapabilities, + symbolsFor, +} from '../src/features'; +import { formattingSettings, readSettings } from '../src/settings'; +import { WorkspaceFunctionIndex, WorkspaceSymbolIndex, workspaceDocumentKey } from '../src/workspaceFunctions'; + +function formattedText(document: TextDocument, settings = {}): string { + const [edit] = formattingEdits(document, settings); + return edit === undefined ? document.getText() : edit.newText; +} + +suite('QuickScript language server features', () => { + const document = TextDocument.create( + 'file:///sample.vbi', + 'intouch', + 1, + 'DIM Counter AS INTEGER;\nIF Counter>0 THEN\nCALL LogMessage("ok");\nENDIF;', + ); + + test('advertises the required protocol capabilities', () => { + const capabilities = serverCapabilities().capabilities; + + assert.strictEqual(capabilities.documentFormattingProvider, true); + assert.strictEqual(capabilities.documentSymbolProvider, true); + assert.strictEqual(capabilities.definitionProvider, true); + assert.strictEqual(capabilities.referencesProvider, true); + assert.strictEqual(capabilities.hoverProvider, true); + assert.ok(capabilities.completionProvider); + }); + + test('serves formatting, symbols, navigation, completion, hover, and diagnostics', () => { + assert.strictEqual(formattingEdits(document, { indentSize: 2 }).length, 1); + assert.ok(symbolsFor(document).some(symbol => symbol.name === 'Counter')); + assert.strictEqual(definitionFor(document, { line: 1, character: 4 })?.uri, document.uri); + assert.ok(referencesFor(document, { line: 0, character: 5 }, true).length >= 2); + assert.ok(completionsFor(document).some(item => item.label === 'LogMessage')); + assert.ok(hoverFor(document, { line: 2, character: 8 })); + assert.deepStrictEqual(diagnosticsFor(document), []); + }); + + test('publishes parser and semantic diagnostics', () => { + const broken = TextDocument.create('file:///broken.vi', 'intouch', 1, 'DIM A AS Bogus;\nDIM a AS REAL;\nIF A THEN'); + const codes = diagnosticsFor(broken).map(item => item.code); + + assert.ok(codes.includes('unknown-datatype')); + assert.ok(codes.includes('duplicate-local')); + assert.ok(codes.includes('missing-endif')); + }); + + test('maps nested VS Code formatter settings to core options', () => { + const settings = readSettings({ VBI: { + formatter: { + EmptyLine: { allowedNumberOfEmptyLines: 2, RemoveEmptyLines: true, EmptyLinesAlsoInComment: true }, + BC: { BlockCodeBegin: '{begin', BlockCodeEnd: '{end', BlockCodeExclude: '{back' }, + Region: { BlockCodeBegin: '{r', BlockCodeEnd: '{/r', BlockCodeExclude: '{rb' }, + Misc: { ReplaceTabToSpaces: false, IndentSize: 3 }, + }, + diagnostics: { naming: { + nonAsciiIdentifiers: 'information', + windowWhitespace: 'off', + windowNonAscii: 'error', + } }, + } }); + + assert.deepStrictEqual(settings, { + allowedNumberOfEmptyLines: 2, + removeEmptyLines: true, + removeEmptyLinesInComments: true, + blockCodeBegin: '{begin', + blockCodeEnd: '{end', + blockCodeExclude: '{back', + regionBlockCodeBegin: '{r', + regionBlockCodeEnd: '{/r', + regionBlockCodeExclude: '{rb', + insertSpaces: false, + indentSize: 3, + qualityDiagnostics: { + nonAsciiIdentifiers: 'information', + windowWhitespace: 'off', + windowNonAscii: 'error', + }, + }); + assert.deepStrictEqual(formattingSettings(settings, { insertSpaces: true, tabSize: 8 }), settings); + }); + + test('maps quality settings to LSP severity and source without changing syntax validity', () => { + const source = [ + 'DIM Größe AS INTEGER;', + 'Show "Anlage Übersicht";', + 'StatusMessage = "Störung Lüftung";', + ].join('\n'); + const document = TextDocument.create('file:///quality.vbi', 'intouch', 1, source); + const defaults = diagnosticsFor(document); + + assert.deepStrictEqual(defaults.map(item => [item.code, item.severity, item.source]), [ + ['quickscript.naming.nonAsciiIdentifier', DiagnosticSeverity.Warning, 'intouch-quality'], + ['quickscript.naming.windowWhitespace', DiagnosticSeverity.Warning, 'intouch-quality'], + ['quickscript.naming.windowNonAscii', DiagnosticSeverity.Warning, 'intouch-quality'], + ]); + assert.ok(!defaults.some(item => item.range.start.line === 2)); + + for (const [setting, severity] of [ + ['hint', DiagnosticSeverity.Hint], + ['information', DiagnosticSeverity.Information], + ['warning', DiagnosticSeverity.Warning], + ['error', DiagnosticSeverity.Error], + ] as const) { + const diagnostics = diagnosticsFor(document, undefined, { + qualityDiagnostics: { + nonAsciiIdentifiers: setting, + windowWhitespace: 'off', + windowNonAscii: 'off', + }, + }); + assert.deepStrictEqual(diagnostics.map(item => item.severity), [severity]); + } + assert.deepStrictEqual(diagnosticsFor(document, undefined, { + qualityDiagnostics: { + nonAsciiIdentifiers: 'off', + windowWhitespace: 'off', + windowNonAscii: 'off', + }, + }), []); + }); + + test('formats the established comment nesting fixture through the language-server formatter entrypoint', () => { + const fixtureDirectory = path.resolve(__dirname, '../../../src/test/suite/testfiles'); + const source = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.test.vbi'), 'utf8'); + const expected = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.tobe.vbi'), 'utf8'); + const document = TextDocument.create('file:///nesting.vbi', 'intouch', 1, source); + const settings = { indentSize: 4, insertSpaces: true }; + + const once = formattedText(document, settings); + const twice = formattedText(TextDocument.create(document.uri, 'intouch', 2, once), settings); + + assert.strictEqual(once, expected); + assert.strictEqual(twice, expected); + }); + + test('formats a multiline metadata comment across blank lines through the language-server entrypoint', () => { + const source = [ + '{>', + 'Script:', + '', + 'Type: QuickFunction', + '', + 'Name: GetFullTopic', + '', + 'Parameters:', + '', + 'Message Topic', + '', + 'Usage:', + '', + 'CALL GetFullTopic( ... );', + '', + '{<}', + ].join('\r\n'); + const expected = [ + '{>', + ' Script:', + '', + ' Type: QuickFunction', + '', + ' Name: GetFullTopic', + '', + ' Parameters:', + '', + ' Message Topic', + '', + ' Usage:', + '', + ' CALL GetFullTopic( ... );', + '', + '{<}', + ].join('\r\n'); + const document = TextDocument.create('file:///hil-nesting.vbi', 'intouch', 1, source); + + const once = formattedText(document, { indentSize: 4, insertSpaces: true }); + const twice = formattedText(TextDocument.create(document.uri, 'intouch', 2, once), { indentSize: 4, insertSpaces: true }); + + assert.strictEqual(once, expected); + assert.strictEqual(twice, expected); + }); + + test('isolates the exact real QuickFunction headers through the LSP diagnostic pipeline', () => { + const source = [ + '{>', + ' Script:', + ' Type: QuickFunction', + ' Name: WorkspaceFunctionA', + '', + ' Parameters:', + ' No formal parameters.', + '', + ' Usage:', + ' CALL WorkspaceFunctionA( );', + '{<}', + '', + '{>', + ' Version history:', + ' V2.0.0 16.10.2020 ViRu Irgend etwas passt da vorn und Hinten nicht!', + ' V2.1.0 03.02.2022 ViRu Typ (typ + 10 = ohne PLS --> PLSActive AS Memory Discrete --> Als Globale Variable festlegen!)', + ' V2.2.0 30.10.2024 ViRu debug with workspace function', + '{<}', + ].join('\r\n'); + const document = TextDocument.create('file:///WorkspaceFunctionA.vbi', 'intouch', 1, source); + + assert.deepStrictEqual(diagnosticsFor(document), []); + }); + + test('keeps LSP diagnostics active between same-line-closed nesting markers', () => { + const source = [ + '{> following code shall be nested}', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + '{<-------------------------------------------}', + ].join('\n'); + const document = TextDocument.create('file:///nested-code.vbi', 'intouch', 1, source); + + assert.deepStrictEqual(diagnosticsFor(document).map(item => item.code), ['unknown-datatype', 'unknown-function']); + }); + + test('diagnoses unresolved CALL and expression functions while resolving catalogs and QuickFunctions', () => { + const source = [ + 'CALL UnknownFunctionA(Funkt + " ", 40);', + 'a = StringLaft(Test, 4);', + 'a = StringLeft(Test, StringInString(Test, ".", 1, 0) - 1);', + 'CALL UnknownFunctionB(Funkt, 40);', + '{>', + 'Type: QuickFunction', + 'Name: GetFullTopic', + '{<}', + 'CALL GetFullTopic();', + 'CALL GetFullTopica();', + ].join('\n'); + const document = TextDocument.create('file:///functions.vbi', 'intouch', 1, source); + const diagnostics = diagnosticsFor(document); + const unknown = diagnostics.filter(diagnostic => diagnostic.code === 'unknown-function'); + + assert.deepStrictEqual(unknown.map(diagnostic => [diagnostic.range.start.line, diagnostic.range.start.character]), [ + [0, 5], + [1, 4], + [3, 5], + [9, 5], + ]); + assert.ok(unknown.every(diagnostic => diagnostic.severity === 2)); + }); + + test('isolates code diagnostics from brace, apostrophe, and metadata comments', () => { + const source = [ + '{', + 'Version history:', + 'DIM X AS FALSCH;', + 'CALL NichtVorhanden();', + 'FR I = 1 TO 10', + 'IF X THEN;', + 'TABINDEX + TABINDEX + 1;', + '}', + "' DIM Y AS FALSCH; CALL AuchNichtVorhanden();", + '{> Version Name Usage CALL DIM MetaNichtVorhanden()}', + ].join('\n'); + const commented = TextDocument.create('file:///comment-diagnostics.vbi', 'intouch', 1, source); + + assert.deepStrictEqual(diagnosticsFor(commented), []); + }); + + test('publishes only semantic diagnostics for syntactically valid CALL expressions', () => { + const source = [ + 'TAB_HandF.Reference = CALL StringRight(tTopic, 1);', + 'tTopic = StringLower(CALL StringLeft(TAB_AAFF.Reference, 1));', + 'Value = CALL StringLeftX(Source, 1);', + ].join('\n'); + const calls = TextDocument.create('file:///call-expressions.vbi', 'intouch', 1, source); + + assert.deepStrictEqual(diagnosticsFor(calls).map(item => [item.code, item.range.start]), [ + ['unknown-function', { line: 2, character: 13 }], + ]); + assert.ok(hoverFor(calls, { line: 1, character: 34 })); + assert.ok(completionsFor(calls).some(item => item.label === 'StringLeft')); + }); + + test('uses existing definition and references for CALL expression targets', () => { + const source = [ + 'DIM LocalCallable AS INTEGER;', + 'Value = CALL LocalCallable();', + ].join('\n'); + const calls = TextDocument.create('file:///call-expression-navigation.vbi', 'intouch', 1, source); + + assert.deepStrictEqual(definitionFor(calls, { line: 1, character: 15 })?.range.start, { line: 0, character: 4 }); + assert.strictEqual(referencesFor(calls, { line: 1, character: 15 }, true).length, 2); + }); + + test('resolves project functions only when the workspace declares them', () => { + const definitions = TextDocument.create('file:///definitions.vi', 'intouch', 1, '{>\nType: QuickFunction\nName: WorkspaceFunction\n{<}'); + const caller = TextDocument.create('file:///caller.vbi', 'intouch', 1, 'CALL workspacefunction();\nCALL WorkspaceFunctio();'); + const workspace = new WorkspaceFunctionIndex(); + const isolated = diagnosticsFor(caller).filter(diagnostic => diagnostic.code === 'unknown-function'); + workspace.updateDocument(definitions); + + const diagnostics = diagnosticsFor(caller, workspace.knownFunctionNames()).filter(diagnostic => diagnostic.code === 'unknown-function'); + assert.deepStrictEqual(isolated.map(diagnostic => diagnostic.range.start), [ + { line: 0, character: 5 }, + { line: 1, character: 5 }, + ]); + assert.deepStrictEqual(diagnostics.map(diagnostic => diagnostic.range.start), [{ line: 1, character: 5 }]); + }); + + test('resolves metadata QuickFunctions across files without a QF filename prefix', () => { + const definition = TextDocument.create('file:///SomethingCompletelyDifferent.vbi', 'intouch', 1, [ + '{>', + '@ScriptType QuickFunction', + '@Name MyFunction', + '@Description Test function.', + '@Param Source MESSAGE Source value.', + '@Returns MESSAGE', + '{<}', + ].join('\n')); + const caller = TextDocument.create('file:///caller.vbi', 'intouch', 1, 'CALL MyFunction(Value);'); + const nestedCaller = TextDocument.create('file:///nested-caller.vi', 'intouch', 1, 'X = Wrapper(CALL MyFunction(Value));'); + const workspace = new WorkspaceSymbolIndex(); + workspace.updateDocument(definition); + workspace.updateDocument(caller); + workspace.updateDocument(nestedCaller); + + assert.ok(!diagnosticsFor(caller, workspace).some(diagnostic => diagnostic.code === 'unknown-function')); + assert.deepStrictEqual(definitionFor(caller, { line: 0, character: 7 }, workspace), { + uri: definition.uri, + range: { start: { line: 2, character: 6 }, end: { line: 2, character: 16 } }, + }); + assert.deepStrictEqual( + referencesFor(caller, { line: 0, character: 7 }, true, workspace).map(location => location.uri).sort(), + [definition.uri, caller.uri, nestedCaller.uri].sort(), + ); + assert.match(String((hoverFor(caller, { line: 0, character: 7 }, workspace)?.contents as { value: string }).value), /MyFunction\(Source: MESSAGE\): MESSAGE/); + assert.match(completionsFor(caller, workspace).find(item => item.label === 'MyFunction')?.detail ?? '', /Test function/); + }); + + test('classifies Window events as non-callable document symbols', () => { + const workspace = new WorkspaceSymbolIndex(); + for (const event of ['OnShow', 'WhileRunning', 'OnClose']) { + const document = TextDocument.create(`file:///MainWindow-${event}.vbi`, 'intouch', 1, [ + '{>', + '@ScriptType Window', + '@Name MainWindow', + `@Event ${event}`, + '{<}', + ].join('\n')); + workspace.updateDocument(document); + const symbols = symbolsFor(document); + assert.strictEqual(symbols[0].name, 'MainWindow'); + assert.strictEqual(symbols[0]?.children?.[0]?.name, event); + assert.match(JSON.stringify(hoverFor(document, { line: 2, character: 8 }, workspace)?.contents), /Window/); + } + const caller = TextDocument.create('file:///window-caller.vbi', 'intouch', 1, 'CALL MainWindow();'); + workspace.updateDocument(caller); + + assert.ok(diagnosticsFor(caller, workspace).some(diagnostic => diagnostic.code === 'unknown-function')); + assert.ok(!workspace.knownFunctionNames().includes('MainWindow')); + assert.ok(!completionsFor(caller, workspace).some(item => item.label === 'MainWindow')); + assert.deepStrictEqual(workspace.symbols().filter(symbol => symbol.kind === 'WindowEvent').map(symbol => symbol.metadata.event), [ + 'OnClose', 'OnShow', 'WhileRunning', + ]); + }); + + test('indexes Application, DataChange, Condition, and KeyScript documents without making them callable', () => { + const workspace = new WorkspaceSymbolIndex(); + const sources = [ + ['application.vbi', 'Type: ApplicationScript\nName: APP_Application_on_startup', 'ApplicationScript'], + ['datachange.vbi', 'Type: datachange\nTagname[.field]: SomeTag', 'DataChangeScript'], + ['condition.vbi', 'Type: ConditionalScript\nName: ReadyCondition\nCondition: Ready\nCondition Type: OnTrue', 'ConditionScript'], + ['key.vbi', 'Type: KeyScript\nName: KEY_Ctrl_D\nShortcut: Ctrl+d', 'KeyScript'], + ] as const; + for (const [file, body] of sources) { + workspace.updateDocument(TextDocument.create(`file:///${file}`, 'intouch', 1, `{>\n${body}\n{<}`)); + } + + assert.deepStrictEqual(workspace.symbols().map(symbol => symbol.kind).sort(), sources.map(([, , kind]) => kind).sort()); + assert.deepStrictEqual(workspace.knownFunctionNames(), []); + }); + + test('diagnoses duplicate QuickFunctions and never chooses an arbitrary definition', () => { + const workspace = new WorkspaceSymbolIndex(); + const source = '{>\n@ScriptType QuickFunction\n@Name DuplicateName\n{<}'; + const first = TextDocument.create('file:///first.vbi', 'intouch', 1, source); + const second = TextDocument.create('file:///second.vbi', 'intouch', 1, source); + const caller = TextDocument.create('file:///duplicate-caller.vbi', 'intouch', 1, 'CALL DuplicateName();'); + for (const document of [first, second, caller]) workspace.updateDocument(document); + + assert.ok(diagnosticsFor(first, workspace).some(diagnostic => diagnostic.code === 'duplicate-quickfunction')); + assert.ok(diagnosticsFor(caller, workspace).some(diagnostic => diagnostic.code === 'ambiguous-quickfunction')); + assert.strictEqual(definitionFor(caller, { line: 0, character: 7 }, workspace), undefined); + assert.strictEqual(referencesFor(caller, { line: 0, character: 7 }, true, workspace).length, 3); + }); + + test('replaces one physical Windows QuickFunction across scan and open-document lifecycle', () => { + const scanUri = 'file:///C:/HIL/QF_WorkspaceFunctionB_1.0.1.vbi'; + const openUri = 'file:///c:/HIL/QF_WorkspaceFunctionB_1.0.1.vbi'; + const source = '{>\n@ScriptType QuickFunction\n@Name WorkspaceFunctionB\n{<}'; + const caller = TextDocument.create('file:///C:/HIL/caller.vbi', 'intouch', 1, 'CALL WorkspaceFunctionB();'); + const workspace = new WorkspaceSymbolIndex(); + const assertPhase = (expectedUri: string): void => { + assert.strictEqual(workspace.quickFunctions('WorkspaceFunctionB').length, 1); + assert.strictEqual( + workspace.diagnostics(expectedUri).filter(diagnostic => diagnostic.code === 'duplicate-quickfunction').length, + 0, + ); + assert.strictEqual(definitionFor(caller, { line: 0, character: 7 }, workspace)?.uri, expectedUri); + }; + + assert.strictEqual(workspaceDocumentKey(scanUri), workspaceDocumentKey(openUri)); + workspace.replaceWorkspaceDocuments([{ uri: scanUri, text: source }]); + workspace.updateDocument(caller); + assertPhase(scanUri); + + workspace.updateDocument(TextDocument.create(openUri, 'intouch', 1, source)); + assertPhase(openUri); + workspace.updateDocument(TextDocument.create(openUri, 'intouch', 2, `${source}\n`)); + assertPhase(openUri); + workspace.removeDocument(openUri); + assertPhase(scanUri); + workspace.updateDocument(TextDocument.create(openUri, 'intouch', 3, source)); + assertPhase(openUri); + }); + + test('uses QF filenames only when structured metadata is absent', () => { + const workspace = new WorkspaceSymbolIndex(); + workspace.updateDocument(TextDocument.create('file:///QF_FallbackOnly_1.0.0.vbi', 'intouch', 1, '')); + workspace.updateDocument(TextDocument.create('file:///QF_WrongName_1.0.0.vbi', 'intouch', 1, '{>\n@ScriptType QuickFunction\n@Name CanonicalName\n{<}')); + + assert.deepStrictEqual(workspace.knownFunctionNames(), ['CanonicalName', 'FallbackOnly']); + }); + + test('keeps workspace QuickFunctions out of static definition counts', () => { + const workspace = new WorkspaceSymbolIndex(); + const definition = TextDocument.create('file:///WorkspaceFunctionC.vbi', 'intouch', 1, [ + '{>', + '@ScriptType QuickFunction', + '@Name WorkspaceFunctionC', + '@Description Workspace implementation.', + '{<}', + ].join('\n')); + const caller = TextDocument.create('file:///workspace-caller.vbi', 'intouch', 1, 'CALL WorkspaceFunctionC();'); + workspace.updateDocument(definition); + workspace.updateDocument(caller); + + assert.strictEqual(KNOWN_FUNCTIONS.filter(entry => entry.name.toUpperCase() === 'WORKSPACEFUNCTIONC').length, 0); + assert.strictEqual(workspace.quickFunctions('WorkspaceFunctionC').length, 1); + assert.ok(!diagnosticsFor(definition, workspace).some(diagnostic => diagnostic.code === 'duplicate-quickfunction')); + assert.strictEqual(definitionFor(caller, { line: 0, character: 7 }, workspace)?.uri, definition.uri); + assert.match(JSON.stringify(hoverFor(caller, { line: 0, character: 7 }, workspace)?.contents), /Workspace implementation/); + assert.match(completionsFor(caller, workspace).find(item => item.label === 'WorkspaceFunctionC')?.detail ?? '', /Workspace implementation/); + }); + + test('keeps the positive HIL datatype and function diagnostics', () => { + const document = TextDocument.create('file:///hil-positive.vbi', 'intouch', 1, [ + 'DIM ENDE AS DISCRET;', + 'Value = StringLang(Source);', + 'Value = StraingMid(Source, 1, 2);', + ].join('\n')); + const diagnostics = diagnosticsFor(document); + + assert.deepStrictEqual( + diagnostics.filter(item => item.code === 'unknown-datatype').map(item => item.range.start), + [{ line: 0, character: 12 }], + ); + assert.deepStrictEqual( + diagnostics.filter(item => item.code === 'unknown-function').map(item => item.range.start), + [{ line: 1, character: 8 }, { line: 2, character: 8 }], + ); + const unmatchedNext = TextDocument.create('file:///hil-next.vbi', 'intouch', 1, 'NEXT;'); + assert.ok(diagnosticsFor(unmatchedNext).some(item => item.code === 'invalid-nesting')); + }); + + test('reports focused statement diagnostics without cascading from FR to NEXT', () => { + const document = TextDocument.create('file:///hil-statements.vbi', 'intouch', 1, [ + 'DIM TEXT6 AS MESSAGE', + 'DIM TEXT6 AS MESSAGE;', + 'DI TEXT9 AS MESSAGE;', + 'FR TABINDEX = 1 TO StringLen(TEXT9)', + 'NEXT;', + ].join('\n')); + const diagnostics = diagnosticsFor(document); + + assert.deepStrictEqual( + diagnostics.filter(item => item.code === 'missing-semicolon').map(item => item.range.start), + [{ line: 0, character: 20 }], + ); + assert.deepStrictEqual( + diagnostics.filter(item => item.code === 'invalid-statement').map(item => item.range.start), + [{ line: 2, character: 0 }, { line: 3, character: 0 }], + ); + assert.ok(!diagnostics.some(item => item.code === 'invalid-nesting' && item.range.start.line === 4)); + }); + + test('publishes the grammar-derived HIL round 3 diagnostics at primary tokens', () => { + const document = TextDocument.create('file:///hil-round-3.vbi', 'intouch', 1, [ + 'TABINDEX = TABINDEX + 1', + 'IF Ready THEN;', + 'ENDIF;', + 'FOR TABINDEX == TABINDEX TO StringLen(TEXT9)', + 'NEXT;', + 'TABINDEX + TABINDEX + 1;', + ].join('\n')); + const diagnostics = diagnosticsFor(document); + + assert.deepStrictEqual( + diagnostics.map(item => [item.code, item.range.start]), + [ + ['missing-semicolon', { line: 0, character: 23 }], + ['unexpected-semicolon', { line: 1, character: 13 }], + ['expected-equals', { line: 3, character: 13 }], + ['expected-assignment', { line: 5, character: 0 }], + ], + ); + }); +}); diff --git a/packages/language-server/test/protocol.test.ts b/packages/language-server/test/protocol.test.ts new file mode 100644 index 0000000..0d2bcb8 --- /dev/null +++ b/packages/language-server/test/protocol.test.ts @@ -0,0 +1,271 @@ +import * as assert from 'assert'; +import { ChildProcessWithoutNullStreams, spawn } from 'child_process'; +import * as fs from 'fs'; +import * as path from 'path'; +import { pathToFileURL } from 'url'; + +import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from 'vscode-jsonrpc/node'; +import { CompletionItem, Diagnostic, DiagnosticSeverity, Hover, InitializeResult, Location, TextEdit } from 'vscode-languageserver/node'; + +function applyFormattingEdits(source: string, edits: readonly TextEdit[]): string { + if (edits.length === 0) { + return source; + } + assert.strictEqual(edits.length, 1); + assert.deepStrictEqual(edits[0].range.start, { line: 0, character: 0 }); + return edits[0].newText; +} + +suite('QuickScript language server protocol', () => { + test('handles lifecycle, synchronization, and representative requests without VS Code', async function () { + this.timeout(10_000); + const localTemporaryRoot = path.resolve(process.cwd(), '.pio'); + fs.mkdirSync(localTemporaryRoot, { recursive: true }); + const workspacePath = fs.mkdtempSync(path.join(localTemporaryRoot, 'metadata-protocol-')); + const definitionPath = path.join(workspacePath, 'SomethingCompletelyDifferent.vbi'); + const callerPath = path.join(workspacePath, 'caller.vbi'); + const nestedCallerPath = path.join(workspacePath, 'nested-caller.vi'); + const definitionSource = [ + '{>', + '@ScriptType QuickFunction', + '@Name MyFunction', + '@Description Test function.', + '@Param Source MESSAGE Source value.', + '@Returns MESSAGE', + '{<}', + ].join('\n'); + const callerSource = 'CALL MyFunction(Value);'; + fs.writeFileSync(definitionPath, definitionSource, 'utf8'); + fs.writeFileSync(callerPath, callerSource, 'utf8'); + fs.writeFileSync(nestedCallerPath, 'X = Wrapper(CALL MyFunction(Value));', 'utf8'); + const workspaceUri = pathToFileURL(workspacePath).toString(); + const definitionUri = pathToFileURL(definitionPath).toString(); + const callerUri = pathToFileURL(callerPath).toString(); + const nestedCallerUri = pathToFileURL(nestedCallerPath).toString(); + const serverPath = path.resolve(__dirname, '../src/server.js'); + const environment = { ...process.env }; + delete environment.ELECTRON_RUN_AS_NODE; + const child: ChildProcessWithoutNullStreams = spawn(process.execPath, [serverPath, '--stdio'], { + env: environment, + stdio: ['pipe', 'pipe', 'pipe'], + }); + let stderr = ''; + child.stderr.on('data', chunk => { stderr += chunk.toString(); }); + const connection = createMessageConnection(new StreamMessageReader(child.stdout), new StreamMessageWriter(child.stdin)); + const diagnosticWaiters: Array<{ + uri: string; + predicate: (diagnostics: Diagnostic[]) => boolean; + resolve: (diagnostics: Diagnostic[]) => void; + }> = []; + const nextDiagnostics = ( + uri: string, + predicate: (diagnostics: Diagnostic[]) => boolean = () => true, + ): Promise => new Promise(resolve => { + diagnosticWaiters.push({ uri, predicate, resolve }); + }); + connection.onNotification('textDocument/publishDiagnostics', params => { + const published = params as { uri: string; diagnostics: Diagnostic[] }; + const index = diagnosticWaiters.findIndex(waiter => + waiter.uri === published.uri && waiter.predicate(published.diagnostics)); + if (index < 0) return; + const [waiter] = diagnosticWaiters.splice(index, 1); + waiter.resolve(published.diagnostics); + }); + let configurationRequested: (() => void) | undefined; + const configurationRequest = new Promise(resolve => { configurationRequested = resolve; }); + connection.onRequest('workspace/configuration', () => { + configurationRequested?.(); + return [{ + formatter: { + BC: { BlockCodeBegin: '{>', BlockCodeEnd: '{<', BlockCodeExclude: '{#' }, + Region: { BlockCodeBegin: '{region', BlockCodeEnd: '{endregion', BlockCodeExclude: '{#' }, + Misc: { ReplaceTabToSpaces: true, IndentSize: 4 }, + }, + diagnostics: { naming: { + nonAsciiIdentifiers: 'information', + windowWhitespace: 'information', + windowNonAscii: 'information', + } }, + }]; + }); + connection.listen(); + + try { + const initialize = await connection.sendRequest('initialize', { + processId: null, + rootUri: workspaceUri, + capabilities: { workspace: { configuration: true } }, + workspaceFolders: [{ uri: workspaceUri, name: 'metadata-protocol' }], + }); + assert.strictEqual((initialize as InitializeResult).capabilities.documentFormattingProvider, true); + connection.sendNotification('initialized', {}); + await configurationRequest; + connection.sendNotification('workspace/didChangeConfiguration', { settings: { VBI: { + formatter: { + BC: { BlockCodeBegin: '{>', BlockCodeEnd: '{<', BlockCodeExclude: '{#' }, + Region: { BlockCodeBegin: '{region', BlockCodeEnd: '{endregion', BlockCodeExclude: '{#' }, + Misc: { ReplaceTabToSpaces: true, IndentSize: 4 }, + }, + diagnostics: { naming: { + nonAsciiIdentifiers: 'information', + windowWhitespace: 'information', + windowNonAscii: 'information', + } }, + } } }); + + const metadataDiagnosticWaiter = nextDiagnostics(callerUri, diagnostics => + !diagnostics.some(diagnostic => diagnostic.code === 'unknown-function')); + connection.sendNotification('textDocument/didOpen', { + textDocument: { + uri: callerUri, + languageId: 'intouch', + version: 1, + text: callerSource, + }, + }); + const metadataDiagnostics = await metadataDiagnosticWaiter; + assert.ok(!metadataDiagnostics.some(diagnostic => diagnostic.code === 'unknown-function')); + + const crossFileDefinition = await connection.sendRequest('textDocument/definition', { + textDocument: { uri: callerUri }, + position: { line: 0, character: 7 }, + }); + assert.strictEqual(crossFileDefinition?.uri, definitionUri); + assert.deepStrictEqual(crossFileDefinition?.range.start, { line: 2, character: 6 }); + + const crossFileReferences = await connection.sendRequest('textDocument/references', { + textDocument: { uri: callerUri }, + position: { line: 0, character: 7 }, + context: { includeDeclaration: true }, + }); + assert.deepStrictEqual(crossFileReferences.map(location => location.uri).sort(), [definitionUri, callerUri, nestedCallerUri].sort()); + + const metadataHover = await connection.sendRequest('textDocument/hover', { + textDocument: { uri: callerUri }, + position: { line: 0, character: 7 }, + }); + assert.match(JSON.stringify(metadataHover?.contents), /MyFunction\(Source: MESSAGE\): MESSAGE/); + + const metadataCompletion = await connection.sendRequest('textDocument/completion', { + textDocument: { uri: callerUri }, + position: { line: 0, character: 5 }, + }); + assert.match(metadataCompletion.find(item => item.label === 'MyFunction')?.detail ?? '', /Test function/); + + const uri = 'file:///protocol-smoke.vbi'; + connection.sendNotification('textDocument/didOpen', { + textDocument: { + uri, + languageId: 'intouch', + version: 1, + text: 'DIM Counter AS INTEGER;\nIF Counter>0 THEN\nCALL LogMessage("ok");\nENDIF;', + }, + }); + connection.sendNotification('textDocument/didChange', { + textDocument: { uri, version: 2 }, + contentChanges: [{ + text: 'DIM Counter AS INTEGER;\nDIM Updated AS REAL;\nIF Counter>0 THEN\nCALL LogMessage("ok");\nENDIF;', + }], + }); + + const qualityUri = 'file:///protocol-quality.vbi'; + const initialQualityDiagnostics = nextDiagnostics(qualityUri); + connection.sendNotification('textDocument/didOpen', { + textDocument: { + uri: qualityUri, + languageId: 'intouch', + version: 1, + text: 'DIM Größe AS INTEGER;\nShow "Übersicht Anlage";\nStatusMessage = "Übersicht Anlage";', + }, + }); + const qualityDiagnostics = await initialQualityDiagnostics; + assert.deepStrictEqual(qualityDiagnostics.map(item => [item.code, item.severity, item.source]), [ + ['quickscript.naming.nonAsciiIdentifier', DiagnosticSeverity.Information, 'intouch-quality'], + ['quickscript.naming.windowWhitespace', DiagnosticSeverity.Information, 'intouch-quality'], + ['quickscript.naming.windowNonAscii', DiagnosticSeverity.Information, 'intouch-quality'], + ]); + + const disabledQualityDiagnostics = nextDiagnostics(qualityUri, diagnostics => diagnostics.length === 0); + connection.sendNotification('workspace/didChangeConfiguration', { settings: { VBI: { + formatter: { + BC: { BlockCodeBegin: '{>', BlockCodeEnd: '{<', BlockCodeExclude: '{#' }, + Region: { BlockCodeBegin: '{region', BlockCodeEnd: '{endregion', BlockCodeExclude: '{#' }, + Misc: { ReplaceTabToSpaces: true, IndentSize: 4 }, + }, + diagnostics: { naming: { + nonAsciiIdentifiers: 'off', + windowWhitespace: 'off', + windowNonAscii: 'off', + } }, + } } }); + assert.deepStrictEqual(await disabledQualityDiagnostics, []); + + const edits = await connection.sendRequest('textDocument/formatting', { + textDocument: { uri }, + options: { tabSize: 4, insertSpaces: true }, + }); + assert.ok(Array.isArray(edits) && edits.length === 1); + + const fixtureDirectory = path.resolve(__dirname, '../../../src/test/suite/testfiles'); + const nestingSource = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.test.vbi'), 'utf8'); + const nestingExpected = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.tobe.vbi'), 'utf8'); + const nestingUri = 'file:///protocol-nesting.vbi'; + connection.sendNotification('textDocument/didOpen', { + textDocument: { + uri: nestingUri, + languageId: 'intouch', + version: 1, + text: nestingSource, + }, + }); + const nestingEdits = await connection.sendRequest('textDocument/formatting', { + textDocument: { uri: nestingUri }, + options: { tabSize: 8, insertSpaces: true }, + }); + const nestingOnce = applyFormattingEdits(nestingSource, nestingEdits); + assert.strictEqual(nestingOnce, nestingExpected); + + connection.sendNotification('textDocument/didChange', { + textDocument: { uri: nestingUri, version: 2 }, + contentChanges: [{ text: nestingOnce }], + }); + const nestingSecondEdits = await connection.sendRequest('textDocument/formatting', { + textDocument: { uri: nestingUri }, + options: { tabSize: 8, insertSpaces: true }, + }); + assert.strictEqual(applyFormattingEdits(nestingOnce, nestingSecondEdits), nestingOnce); + + const completion = await connection.sendRequest('textDocument/completion', { + textDocument: { uri }, + position: { line: 3, character: 6 }, + }); + assert.ok(Array.isArray(completion) && (completion as CompletionItem[]).some(item => item.label === 'LogMessage')); + assert.ok(Array.isArray(completion) && (completion as CompletionItem[]).some(item => item.label === 'Updated')); + + const hover = await connection.sendRequest('textDocument/hover', { + textDocument: { uri }, + position: { line: 3, character: 8 }, + }); + assert.ok(hover); + + await connection.sendRequest('shutdown'); + connection.sendNotification('exit'); + await new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error(`Language server did not exit. ${stderr}`)), 3_000); + child.once('exit', code => { + clearTimeout(timeout); + if (code === 0) resolve(); + else reject(new Error(`Language server exited with ${code}. ${stderr}`)); + }); + }); + } finally { + connection.dispose(); + if (!child.killed && child.exitCode === null) { + child.kill(); + } + const resolvedWorkspace = path.resolve(workspacePath); + assert.ok(resolvedWorkspace.startsWith(`${localTemporaryRoot}${path.sep}`)); + fs.rmSync(resolvedWorkspace, { recursive: true, force: true }); + } + }); +}); diff --git a/packages/language-server/tsconfig.json b/packages/language-server/tsconfig.json new file mode 100644 index 0000000..ec44c41 --- /dev/null +++ b/packages/language-server/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "declaration": true, + "lib": ["es2021"], + "module": "Node16", + "moduleResolution": "Node16", + "outDir": "../../out/language-server", + "rootDir": ".", + "sourceMap": true, + "strict": true, + "target": "es2021", + "types": ["mocha", "node"] + }, + "include": ["src/**/*.ts", "test/**/*.ts"] +} diff --git a/scripts/generate-language-data.js b/scripts/generate-language-data.js new file mode 100644 index 0000000..5313eef --- /dev/null +++ b/scripts/generate-language-data.js @@ -0,0 +1,58 @@ +const fs = require('fs'); +const path = require('path'); + +const projectRoot = path.resolve(__dirname, '..'); +const grammarPath = path.join(projectRoot, 'syntaxes', 'intouch.tmLanguage.json'); +const outputPath = path.join(projectRoot, 'packages', 'core', 'src', 'generatedFunctionCatalog.ts'); +const grammar = JSON.parse(fs.readFileSync(grammarPath, 'utf8')); + +function namesFromPattern(pattern) { + const expression = pattern.match; + if (typeof expression !== 'string') { + return []; + } + const start = expression.indexOf('\\b('); + const end = start < 0 ? -1 : expression.indexOf(')\\b', start + 3); + if (start < 0 || end < 0) { + return []; + } + return expression.slice(start + 3, end).split('|').filter(name => /^[A-Za-z_$#][A-Za-z0-9_$#-]*$/.test(name)); +} + +const rows = new Map(); +for (const [repositoryName, repository] of Object.entries(grammar.repository ?? {})) { + for (const pattern of repository.patterns ?? []) { + const sourceComment = typeof pattern.comment === 'string' ? pattern.comment : ''; + const isFunction = /function/i.test(pattern.name ?? '') || /function/i.test(sourceComment) + || repositoryName === 'HermesKeywords'; + if (!isFunction) { + continue; + } + const category = repositoryName === 'HermesKeywords' ? 'Hermes helper' : sourceComment || 'InTouch function'; + for (const name of namesFromPattern(pattern)) { + const key = name.toUpperCase(); + if (!rows.has(key)) { + rows.set(key, { name, category, sourceComment }); + } + } + } +} + +const functions = [...rows.values()].sort((left, right) => left.name.localeCompare(right.name, 'en', { sensitivity: 'base' })); +const generated = [ + '// Generated from syntaxes/intouch.tmLanguage.json by scripts/generate-language-data.js.', + '// Do not edit this file manually.', + '', + "export interface KnownFunction {", + "\tname: string;", + "\tcategory: string;", + "\tsourceComment: string;", + "}", + '', + `export const KNOWN_FUNCTIONS: readonly KnownFunction[] = ${JSON.stringify(functions, null, '\t')} as const;`, + '', +].join('\n'); + +if (!fs.existsSync(outputPath) || fs.readFileSync(outputPath, 'utf8') !== generated) { + fs.writeFileSync(outputPath, generated, 'utf8'); +} diff --git a/scripts/update-fixtures.js b/scripts/update-fixtures.js index ce0f3e8..719f79f 100644 --- a/scripts/update-fixtures.js +++ b/scripts/update-fixtures.js @@ -5,13 +5,13 @@ const path = require("path"); // Use pure pipeline from compiled sources (no vscode dependency) let pure; try { - pure = require('../out/formatCore'); + pure = require('@intouch-language/core'); } catch (e) { console.error('Could not load out/formatCore.js. Run npm run compile first.', e); process.exit(1); } -function getConfigFallback() { return { allowedNumberOfEmptyLines:1, RemoveEmptyLines:true, EmptyLinesAlsoInComment:false, BlockCodeBegin:'{>', BlockCodeEnd:'{<', BlockCodeExclude:'{#', RegionBlockCodeBegin:'{region', RegionBlockCodeEnd:'{endregion', RegionBlockCodeExclude:'{#', FormatAlsoInComment:false }; } +function getConfigFallback() { return { allowedNumberOfEmptyLines:1, removeEmptyLines:true, removeEmptyLinesInComments:false, blockCodeBegin:'{>', blockCodeEnd:'{<', blockCodeExclude:'{#', regionBlockCodeBegin:'{region', regionBlockCodeEnd:'{endregion', regionBlockCodeExclude:'{#', insertSpaces:true, indentSize:4 }; } (function main() { try { const config = getConfigFallback(); @@ -26,19 +26,7 @@ function getConfigFallback() { return { allowedNumberOfEmptyLines:1, RemoveEmpty const testPath = path.join(baseDir, testFile); const expectedPath = path.join(baseDir, testFile.replace('.test.vbi', '.tobe.vbi')); const input = fs.readFileSync(testPath, 'utf8'); - // full pipeline (mirror formats.fixtures.test.ts) - let stage2 = pure.pureFormatPipeline(input, config); - const nEL = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - let regex; - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - stage2 = stage2.replace(regex, '\r\n'); - } + const stage2 = pure.formatQuickScript(input, config).text; if (fs.existsSync(expectedPath)) { const old = fs.readFileSync(expectedPath, 'utf8'); if (old !== stage2) { @@ -59,4 +47,4 @@ function getConfigFallback() { return { allowedNumberOfEmptyLines:1, RemoveEmpty process.exit(1); } })(); -//# sourceMappingURL=update-fixtures.js.map \ No newline at end of file +//# sourceMappingURL=update-fixtures.js.map diff --git a/scripts/update-fixtures.ts b/scripts/update-fixtures.ts index e71f62a..5a6bb2a 100644 --- a/scripts/update-fixtures.ts +++ b/scripts/update-fixtures.ts @@ -1,46 +1,38 @@ import * as fs from 'fs'; import * as path from 'path'; -const fo = require('../src/formats'); -const functions = require('../src/functions'); -(async function main(){ - const config = functions.getConfig(); - const baseDir = path.join(__dirname,'..','src','test','suite','testfiles'); - if(!fs.existsSync(baseDir)){ - console.error('testfiles directory not found:', baseDir); - process.exit(1); - } - const entries = fs.readdirSync(baseDir).filter(f=>f.endsWith('.test.vbi')); - let changed = 0; - for(const testFile of entries){ - const testPath = path.join(baseDir,testFile); - const expectedPath = path.join(baseDir,testFile.replace('.test.vbi','.tobe.vbi')); - const input = fs.readFileSync(testPath,'utf8'); - // full pipeline (mirror formats.fixtures.test.ts) - let stage1 = fo.forFormat(input, config); - let stage2 = fo.formatNestings(stage1, config); - const nEL: number = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - let regex: RegExp; - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - stage2 = stage2.replace(regex, '\r\n'); - } - if(fs.existsSync(expectedPath)){ - const old = fs.readFileSync(expectedPath,'utf8'); - if(old !== stage2){ - fs.writeFileSync(expectedPath, stage2, 'utf8'); - console.log('Updated fixture:', path.basename(expectedPath)); - changed++; - } - }else{ - fs.writeFileSync(expectedPath, stage2, 'utf8'); - console.log('Created missing fixture:', path.basename(expectedPath)); - changed++; - } - } - console.log(`Fixture update complete. Changed: ${changed}`); +import { FormatOptions, formatQuickScript } from '@intouch-language/core'; + +const config: FormatOptions = { + allowedNumberOfEmptyLines: 1, + removeEmptyLines: true, + removeEmptyLinesInComments: false, + blockCodeBegin: '{>', + blockCodeEnd: '{<', + blockCodeExclude: '{#', + regionBlockCodeBegin: '{region', + regionBlockCodeEnd: '{endregion', + regionBlockCodeExclude: '{#', + insertSpaces: true, + indentSize: 4, +}; + +(function main(): void { + const baseDir = path.join(__dirname, '..', 'src', 'test', 'suite', 'testfiles'); + if (!fs.existsSync(baseDir)) { + throw new Error(`testfiles directory not found: ${baseDir}`); + } + const entries = fs.readdirSync(baseDir).filter(file => file.endsWith('.test.vbi')); + let changed = 0; + for (const testFile of entries) { + const testPath = path.join(baseDir, testFile); + const expectedPath = path.join(baseDir, testFile.replace('.test.vbi', '.tobe.vbi')); + const formatted = formatQuickScript(fs.readFileSync(testPath, 'utf8'), config).text; + if (!fs.existsSync(expectedPath) || fs.readFileSync(expectedPath, 'utf8') !== formatted) { + fs.writeFileSync(expectedPath, formatted, 'utf8'); + console.log(`${fs.existsSync(expectedPath) ? 'Updated' : 'Created'} fixture:`, path.basename(expectedPath)); + changed += 1; + } + } + console.log(`Fixture update complete. Changed: ${changed}`); })(); diff --git a/src/const.ts b/src/const.ts deleted file mode 100644 index 2f1a3ab..0000000 --- a/src/const.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Character Constants -export const TAB = "\t"; -export const CR = "\r"; -export const LF = "\n"; -export const CRLF = "\r\n"; -export const DQUOTE = '\"'; -export const SQUOTE = "\'"; -export const BACKSLASH = "\\"; - - -export const FORMATS: string[] = [TAB, CR, LF, CRLF, DQUOTE, SQUOTE, BACKSLASH]; -export const SINGLE_OPERATORS: string[] = ['=', '+', '-', '<', '>', '*', '/', '%', '!', '~', '|']; -// export const SINGLE_OPERATORS: string[] = ['=', '+', '<', '>', '*', '/', '%', '!', '~', '|'];//23.01.2022 remove - as single Operator, because it can be used in variables -// BUGFIX 2025-09-25: '=>" was mistakenly defined instead of '>=' which caused -// the formatter to produce '> =' (separating '>' and '='). Corrected to '>='. -export const DOUBLE_OPERATORS: string[] = ['==', '<>', '<=', '>=']; -export const NO_SPACE_ITEMS: string[] = ['(', ')', '[', ']', ';']; -export const TRENNER: string[] = [';', ' ']; - - -export const KEYWORDS: string[] = [ - "NULL", "EOF", "AS", "IF", "ENDIF", "ELSE", "WHILE", "FOR", "next", "DIM", "THEN", - "EXIT", "EACH", "STEP", "IN", "RETURN", "CALL", "MOD", "AND", "NOT", "IS", - "OR", "XOR", "Abs", "TO", "SHL", "SHR", "discrete", "integer", "real", "message", - // Added math / intrinsic style functions for uppercasing in formatter 2025-09-25 - "sqr", "sin", "cos", "tan", "atn", "exp", "log", "int", "frac", "round", "rnd", "sqrt" -]; - -/* Misk keywords from .json - MOD|AND|NOT|IS|OR|XOR|Abs|TO|SHL|SHR - IF|ENDIF|ELSE|WHILE|FOR|NEXT|DIM|THEN|EXIT|EACH|STEP|IN|RETURN|CALL - NULL|EOF|AS|True|False - discrete|integer|real|message -*/ - -const gm_TAB_NOT_IN_COMMENT = new RegExp(/(?![^{]*})\t/, 'gm'); -const gm_MOR_1_WSP = new RegExp(/\s{1,}/, 'gm'); //more then one whitespace -const gm_MOR_2_WSP = new RegExp(/\s{2,}/, 'gm'); //more then two whitespace -const gm_MOR_2_WSP_NO_TAB = new RegExp(/\s{2,}(?\/\?\s]+)/, 'gm'); -const gm_GET_ALL_Numbers = new RegExp(/-?\d*\d/, 'gm'); - -export const REGEX = { - gm_TAB_NOT_IN_COMMENT, - gm_MOR_1_WSP, - gm_MOR_2_WSP, - g_CHECK_OPEN_COMMENT, - g_CHECK_CLOSE_COMMENT, - gm_GET_NESTING, - gm_GET_STRING, - gm_GET_WSP_IN_STRING, - gm_MOR_2_WSP_NO_TAB, - gm_GET_ALL_WORDS, - gm_GET_ALL_Numbers -}; \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index 54e5419..ecefcfc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,32 +1,44 @@ 'use strict'; +import * as path from 'path'; import * as vscode from 'vscode'; -import { formatTE } from './functions'; +import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node'; -export function activate(context: vscode.ExtensionContext) { - vscode.commands.registerCommand('vbi-format', () => { - const { activeTextEditor } = vscode.window; - if (activeTextEditor) { - //&& activeTextEditor.document.languageId === 'intouch' - const { document } = activeTextEditor; - let start = new vscode.Position(0, 0); - let end = new vscode.Position(document.lineCount - 1, document.lineAt(document.lineCount - 1).text.length); - let r = new vscode.Range(start, end); - return formatTE(r); - } - }); +let client: LanguageClient | undefined; - //https://vscode-docs.readthedocs.io/en/latest/extensionAPI/vscode-api/ - vscode.languages.registerDocumentFormattingEditProvider({ scheme: 'file', language: 'intouch' }, { - provideDocumentFormattingEdits(document: vscode.TextDocument): vscode.TextEdit[] { - const { activeTextEditor } = vscode.window; - let start = new vscode.Position(0, 0); - let end = new vscode.Position(document.lineCount - 1, document.lineAt(document.lineCount - 1).text.length); - let r = new vscode.Range(start, end); - return formatTE(r); - } - }); +export async function activate(context: vscode.ExtensionContext): Promise { + const serverModule = context.asAbsolutePath(path.join('dist', 'server.js')); + const serverOptions: ServerOptions = { + run: { module: serverModule, transport: TransportKind.ipc }, + debug: { module: serverModule, transport: TransportKind.ipc }, + }; + const clientOptions: LanguageClientOptions = { + documentSelector: [ + { scheme: 'file', language: 'intouch' }, + { scheme: 'untitled', language: 'intouch' }, + ], + synchronize: { + configurationSection: 'VBI', + fileEvents: vscode.workspace.createFileSystemWatcher('**/*.{vbi,vi}'), + }, + }; + + client = new LanguageClient( + 'intouchLanguageServer', + 'InTouch QuickScript Language Server', + serverOptions, + clientOptions, + ); + context.subscriptions.push(client); + context.subscriptions.push(vscode.commands.registerCommand('vbi-format', async () => { + await vscode.commands.executeCommand('editor.action.formatDocument'); + })); + await client.start(); } -//It will be invoked on deactivation -export function deactivate() { } +export async function deactivate(): Promise { + if (client !== undefined) { + await client.stop(); + client = undefined; + } +} diff --git a/src/formatCore.ts b/src/formatCore.ts deleted file mode 100644 index 849849a..0000000 --- a/src/formatCore.ts +++ /dev/null @@ -1,530 +0,0 @@ -// Pure formatting core extracted from formats.ts for test fixture generation without vscode dependency -import { CRLF, TAB, KEYWORDS, SINGLE_OPERATORS, DOUBLE_OPERATORS, TRENNER, FORMATS, NO_SPACE_ITEMS, REGEX } from './const'; -import { EXCLUDE_KEYWORDS, NESTINGS } from './nestingdef'; - -export interface FormatterConfig { - allowedNumberOfEmptyLines?: number; - RemoveEmptyLines?: boolean; - EmptyLinesAlsoInComment?: boolean; - BlockCodeBegin?: string; - BlockCodeEnd?: string; - BlockCodeExclude?: string; - RegionBlockCodeBegin?: string; - RegionBlockCodeEnd?: string; - RegionBlockCodeExclude?: string; - ReplaceTabToSpaces?: boolean; - IndentSize?: number; -} - -export function preFormat(text: string, config: FormatterConfig): string { // formerly forFormat (renamed to proper English) - // Normalize all line endings to CRLF up front while preserving intent of single blank lines. - // Replace any lone CR or LF with CRLF for internal processing. - text = text.replace(/\r\n|\n|\r/g, '\r\n'); - let txt = text.split(""); - let buf: string = ""; - let modified: number = 0; - let LineCount = 1; - let ColumnCount = 0; - let inComment = false; - let inString = false; - - for (let i = 0; i <= txt.length - 1; i++) { - ColumnCount++; - if (modified > 0) { - modified--; - } else { - modified = 0; - if (inString && txt[i] === '"') { - inString = false; - } else if (!inComment && txt[i] === '"') { - inString = true; - } - if (txt[i] === '\n') { - if (inString) { - return text; // abort on multi-line string error - } - LineCount++; ColumnCount = 0; - } - if (!inComment && txt[i] === '}') { - return text; // malformed comment closure - } else if (txt[i] === '{') { - inComment = true; - } else if (inComment && txt[i] === '}') { - inComment = false; - } - if (!inString) { - if (!(modified > 0) && (!inComment || (config as any).KeywordUppercaseAlsoInComment)) { - // Keywords: replace slice with uppercase version WITHOUT consuming the following char ("after"). - // The previous implementation appended the following char and set modified accordingly, which could - // duplicate CR characters or interfere with blank line handling when the next char was a line break. - for (let kw of KEYWORDS) { - const slice = text.substr(i, kw.length); - const before = text[i - 1]; - const after = text[i + kw.length]; - if (slice.toLowerCase() === kw.toLowerCase()) { - if (CheckCRLForWhitespace(before) && CheckCRLForWhitespace(after)) { - buf += kw.toUpperCase(); - modified = kw.length - 1; // we consumed only the keyword characters - break; - } - } - } - // Double operators - if (!(modified > 0)) { - for (let op of DOUBLE_OPERATORS) { - const slice = text.substr(i, op.length); - if (slice === op) { - if (text[i - 1] !== ' ') buf += ' '; - buf += op; - if (text[i + op.length] !== ' ') buf += ' '; - modified = op.length - 1; - break; - } - } - } - // Single operators (improved spacing rules) - if (!(modified > 0)) { - const isIdentChar = (c: any) => /[A-Za-z0-9_$]/.test(c || ''); - const isVarStart = (c: any) => /[A-Za-z]/.test(c || ''); - const isVarBody = (c: any) => /[A-Za-z0-9$-]/.test(c || ''); - for (let op of SINGLE_OPERATORS) { - if (txt[i] !== op) continue; - - // Detect multi-segment dashed identifier (e.g. new12-issue-dashed-variable) and keep dashes untouched. - // Clarified rule: even simple letter-dash-letter (a-b) or e-f is a valid variable token and must remain unspaced. - if (op === '-') { - const prevCh = text[i - 1]; - const nextCh = text[i + 1]; - // Determine if dash sits inside a variable token according to rule: - // Variable token pattern: [A-Za-z][A-Za-z0-9$-]* (segments after first letter may start with digits or $) - if (isVarBody(prevCh) && isVarBody(nextCh)) { - let start = i - 1; - while (start >= 0 && isVarBody(text[start])) start--; - start++; - let end = i + 1; - while (end < text.length && isVarBody(text[end])) end++; - const token = text.slice(start, end); - if (isVarStart(text[start])) { - // Treat every dash inside such a token as part of variable (including single letter-dash-letter) - buf += '-'; - modified = -1; - break; - } - } - } - - // Determine unary minus (attach to number) => previous non-space char is an operator boundary - let unaryMinus = false; - if (op === '-') { - // look backwards for first non-space char already emitted in buf - let k = buf.length - 1; - while (k >= 0 && /[ \t]/.test(buf[k])) k--; - const prev = k >= 0 ? buf[k] : undefined; - const nextChar = text[i + 1]; - if ((prev === undefined || /[=+\-*/,(;{}]/.test(prev) || prev === '\n' || prev === '\r') && /[0-9]/.test(nextChar)) { - unaryMinus = true; - } - } - - // NEW rule: minus between identifiers (letters/underscore) must always be spaced as binary - let isBinary = !(op === '-' && unaryMinus); - - // Space before (binary only) - if (isBinary && buf.length > 0 && !/[ \t\r\n]/.test(buf[buf.length - 1])) { - buf += ' '; - } - - // Emit operator - buf += op; - - // Space after (binary; plus always binary; keep unary minus tight with number) - if (isBinary) { - const next = text[i + 1]; - if (next && !/[ \t\r\n]/.test(next)) { - buf += ' '; - } - } - - modified = -1; - break; - } - } - } - } - if (modified === 0) { - buf += txt[i]; - } - } - } - // normalize spaces before semicolon + trim line tails - // Sanitize any duplicated or stray carriage returns that may have been produced by earlier logic - // Examples seen in tests: lines ending with an embedded "\r" (content + \r + CRLF) resulting from prior keyword logic. - buf = buf - .replace(/\r\r\n/g, CRLF) // collapse CRCRLF -> CRLF - .replace(/\r(?!\n)/g, ''); // remove lone CR not followed by LF - let lines = buf.split(CRLF).map(l => l.replace(/\s+$/g, '')); - // Preserve single blank lines: collapse only runs >1 here (final pipeline still may apply config rules). - const newLines: string[] = []; - let emptyRun = 0; - for (const line of lines) { - if (line === '') { - emptyRun++; - if (emptyRun === 1) newLines.push(''); // keep exactly one - continue; - } else { - emptyRun = 0; - newLines.push(line); - } - } - let normalized = newLines.join(CRLF); - // Post-processing normalizations: - // 1. Ensure binary minus has space after when pattern like 'f -g' (but keep dashed identifiers like a-b-c) - // 2. Collapse accidental double (or more) spaces between '=' and '>' in malformed '= >' sequences - // Apply targeted spacing fix outside of quoted strings only. - normalized = (() => { - let out = ''; - let inStr = false; - let inComment = false; - let inIfDepth = 0; // >0 while inside IF (...) - const isIdentStart = (c: string) => /[A-Za-z]/.test(c); - for (let i = 0; i < normalized.length; i++) { - let ch = normalized[i]; - if (ch === '"') { inStr = !inStr; out += ch; continue; } - if (!inStr) { - // Track simple single-line comment braces { ... } - if (ch === '{') { inComment = true; out += ch; continue; } - if (ch === '}' && inComment) { inComment = false; /* fall through to spacing rule below */ } - - // IF keyword normalization (only when not in comment) patterns: if( / if ( - if (!inComment && (ch === 'i' || ch === 'I') && (normalized[i+1] === 'f' || normalized[i+1] === 'F')) { - // Normalize IF keyword followed by '(': style 'IF (a ... ) THEN' - let j = i + 2; // after 'if' - while (j < normalized.length && normalized[j] === ' ') j++; - if (normalized[j] === '(') { - out += 'IF ('; - // skip any spaces after '(' - let k = j + 1; - while (k < normalized.length && normalized[k] === ' ') k++; - inIfDepth = 1; - i = k - 1; // continue from first non-space after '(' - continue; - } - } - // After ')' followed by THEN (case-insensitive, maybe without space) - if (!inComment && ch === ')') { - // If we're closing IF (...), remove any trailing spaces before ')' - if (inIfDepth > 0) { - while (out.length > 0 && out[out.length - 1] === ' ') out = out.slice(0, -1); - inIfDepth = 0; - } - out += ')'; - // Handle THEN following - let j = i + 1; while (j < normalized.length && normalized[j] === ' ') j++; - const ahead = normalized.slice(j, j + 4).toLowerCase(); - if (ahead === 'then') { out += ' THEN'; i = j + 3; continue; } - // generic: ensure space after ')' if next is identifier - let next = normalized[i+1]; - if (next && isIdentStart(next)) { out += ' '; } - continue; - } - // Ensure space before inline comment brace directly after THEN (THEN{ -> THEN {) - if (!inComment && (ch === 'T' || ch === 't') && normalized.slice(i, i+4).toLowerCase() === 'then') { - let j = i + 4; while (j < normalized.length && normalized[j] === ' ') j++; - if (normalized[j] === '{') { - out += 'THEN '; - i = i + 3; // consumed THEN - continue; - } - } - // Rule: ensure single space after semicolon if next char (non newline) is not space - if (!inComment && ch === ';') { - const next = normalized[i+1]; - if (next && next !== ' ' && next !== '\r' && next !== '\n') { out += '; '; continue; } - } - // Rule: ensure space after closing '}' of a comment if next non-space is identifier - if (ch === '}' ) { - let j = i + 1; while (j < normalized.length && normalized[j] === ' ') j++; - if (j < normalized.length && isIdentStart(normalized[j]) && normalized[i+1] !== ' ') { out += '} '; continue; } - } - // Ensure space after pattern X -Y (but not inside dashed identifiers) => convert 'X -Y' to 'X - Y' - if (!inComment && /[A-Za-z0-9_]/.test(ch) && normalized[i+1] === ' ' && normalized[i+2] === '-' && /[A-Za-z_]/.test(normalized[i+3])) { - // Check that this is not inside a multi-dash variable: look backwards to start of run and forwards to end - let back = out.length - 1; while (back >= 0 && /[A-Za-z0-9$-]/.test(out[back])) back--; - let forward = i + 3; while (forward < normalized.length && /[A-Za-z0-9$-]/.test(normalized[forward])) forward++; - const run = (out.slice(back + 1) + normalized.slice(i, forward)); - if (!/^[A-Za-z][A-Za-z0-9$-]*-[A-Za-z0-9$-]*-[A-Za-z0-9$-]*$/.test(run)) { out += ch + ' - ' + normalized[i+3]; i += 3; continue; } - } - // Comma spacing in argument lists: remove preceding spaces, enforce single space after unless next is ) or EOL - if (!inComment && ch === ',') { - while (out.length > 0 && out[out.length - 1] === ' ') out = out.slice(0, -1); - out += ','; - let next = normalized[i+1]; - if (next && next !== ' ' && next !== ')' && next !== '\r' && next !== '\n') { out += ' '; } - continue; - } - } - out += ch; - } - return out.replace(/= {2,}>/g, '= >'); - })(); - // Final sanitation: remove any spaces directly before semicolons outside strings/comments (strings already preserved above) - // Remove spaces before semicolons only outside of string literals AND outside brace comments - normalized = normalized.split(CRLF).map(line => { - // Entire line is a single-line brace comment -> leave unchanged - if (/^\s*\{[^{}]*\}\s*$/.test(line)) return line; - // Split code part and trailing brace comment (if any) - const braceIndex = line.indexOf('{'); - let codePart = line; - let commentPart = ''; - if (braceIndex !== -1) { - codePart = line.slice(0, braceIndex); - commentPart = line.slice(braceIndex); // keep as-is - } - // Within codePart, protect strings, then remove spaces before semicolons - const rebuilt = codePart.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).map(seg => { - if (seg.startsWith('"') && seg.endsWith('"')) return seg; // string literal - return seg.replace(/(\S)\s+;/g, '$1;'); - }).join(''); - return rebuilt + commentPart; - }).join(CRLF); - return normalized; -} - -export function formatNestings(text: string, config: FormatterConfig): string { - let buf = ""; - let codeFragments: string[] = []; - let regex = ""; - let nestingCounter = 0; - let nestingCounterPrevious = 0; - // Simple nesting only; multiline IF experimental logic removed - let multilineComment = false; - let thisLineBack = false; - // Multiline IF expression handling state - let multiIfActive = false; - let multiIfBaseDepth = 0; - let regexCB = `^${config.BlockCodeBegin}`; - let regexCEx = `^${config.BlockCodeExclude}`; - let regexCE = `^${config.BlockCodeEnd}`; - let regexRegionCB = `^${config.RegionBlockCodeBegin}`; - let regexRegionCEx = `^${config.RegionBlockCodeExclude}`; - let regexRegionCE = `^${config.RegionBlockCodeEnd}`; - const hadFinalCRLF = text.endsWith(CRLF); - codeFragments = text.split(CRLF); - for (let i = 0; i < codeFragments.length; i++) { - const prevMultilineState = multilineComment; // remember state entering this line - let isEmptyLine = false; - codeFragments[i] = codeFragments[i].replace(/\s+$/g, ""); - if (codeFragments[i] === "") isEmptyLine = true; - if (codeFragments[i].search(REGEX.g_CHECK_OPEN_COMMENT) !== -1) multilineComment = true; - if (codeFragments[i].search(REGEX.g_CHECK_CLOSE_COMMENT) !== -1) multilineComment = false; - let str = codeFragments[i].match(REGEX.gm_GET_STRING); - if (str) { - // Protect ALL string literals on the line by masking spaces/tabs/semicolons - let protectedLine = codeFragments[i]; - for (const item of str) { - let strw = item.replace(/\s(? { - regex = `((?![^{]*})(${item}))`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) exclude = true; - }); - if (!multiIfActive) { - if (inlineIf) { - // no nesting change - } else if (continuationTrigger) { - multiIfActive = true; - multiIfBaseDepth = nestingCounterPrevious; // visual base - } else { - for (let n of NESTINGS) { - if (!exclude) { - regex = `((?![^{]*})(\\b${n.keyword})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { nestingCounter++; } - } - if (n.multiline !== '') { - regex = `((?![^{]*})(\\b${n.multiline})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { } - } - if (n.middle !== '') { - regex = `((?![^{]*})(\\b${n.middle})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { thisLineBack = true; break; } - } - regex = `((?![^{]*})(\\b${n.end})\\b)`; - if (codeFragments[i].search(new RegExp(regex, 'i')) !== -1) { nestingCounter--; if (nestingCounter < 0) nestingCounter = 0; thisLineBack = true; break; } - } - } - } else { - // multiIfActive - if (hasTHEN) { - nestingCounter++; // start IF body after this line - thisLineBack = true; // keep THEN at expression level - multiIfActive = false; - } - } - } - } - if (!isEmptyLine) { - // If we are inside a multi-line brace comment block OR this is the closing line - // (previous line(s) were multiline comment and this one ends with a closing brace) - // then we preserve indentation exactly as-is (no added / removed indent). - const closesMultiline = prevMultilineState && codeFragments[i].includes('}'); - if (multilineComment || closesMultiline || prevMultilineState) { - // Restore original line (with its original indentation) because we may have trimmed earlier logic - codeFragments[i] = originalLine; - multiIfActive = false; // reset multi-IF state when traversing comment blocks - if (nestingCounterPrevious !== nestingCounter) nestingCounterPrevious = nestingCounter; - continue; - } - - // Determine visual depth for real code lines - let visualDepth = nestingCounterPrevious; - if (multiIfActive) { - // lines after initial IF (continuation lines) show baseDepth+2 now (user request) - const initialLine = /\bIF\b/i.test(codeFragments[i]) && !/\bTHEN\b/i.test(codeFragments[i]); - if (!initialLine) visualDepth = multiIfBaseDepth + 2; - } else if (thisLineBack && /\bTHEN\b/i.test(codeFragments[i])) { - // THEN closing expression line: show continuation depth (base+2) and do NOT drop back - visualDepth = (multiIfBaseDepth + 2); - thisLineBack = false; // keep indentation level, prevent getNesting from skipping one level - } - const prefix = getNesting(visualDepth, thisLineBack, config); - codeFragments[i] = prefix + codeFragments[i]; - if (nestingCounterPrevious !== nestingCounter) nestingCounterPrevious = nestingCounter; - thisLineBack = false; - } - } - // Final trailing whitespace cleanup - codeFragments = codeFragments.map(l => l.replace(/[ \t]+$/g, '')); - for (let i = 0; i < codeFragments.length; i++) { - const isLast = i === codeFragments.length - 1; - if (!isLast) buf += codeFragments[i] + CRLF; else { - if (codeFragments[i] !== '') { buf += codeFragments[i]; if (hadFinalCRLF) buf += CRLF; } - } - } - // Collapse multiple inner spaces (not leading indentation) outside of strings and outside single-line brace comments - const collapsed = buf.split(CRLF).map(line => { - if (line.trim() === '') return line; - // Mask single-line brace comments { ... } to preserve interior spacing - const comments = line.match(/\{[^{}\r\n]*\}/g) || []; - const commentTokens: string[] = []; - let masked = line; - comments.forEach((c, idx) => { - const token = `@@C${idx}@@`; - commentTokens.push(c); - masked = masked.replace(c, token); - }); - // Split by string literals (simple non-escaped quote handling) - const segments = masked.split(/("[^"\\]*(?:\\.[^"\\]*)*"?)/g).filter(s => s !== ''); - let rebuilt = ''; - segments.forEach(seg => { - if (seg.startsWith('"') && seg.endsWith('"')) { - rebuilt += seg; // keep string literal - } else { - const m = seg.match(/^(\s*)(.*)$/); - if (m) { - const ind = m[1]; - const rest = m[2].replace(/ {2,}/g, ' '); - rebuilt += ind + rest; - } else { - rebuilt += seg.replace(/ {2,}/g, ' '); - } - } - }); - // Restore comments - commentTokens.forEach((c, idx) => { - rebuilt = rebuilt.replace(`@@C${idx}@@`, c); - }); - return rebuilt; - }).join(CRLF); - return collapsed; -} - -function getNesting(n: number, thisLineBack: boolean, config: FormatterConfig): string { - let temp = ""; - if (n !== 0) { - // Determine indent unit based on configuration - const useSpaces = (config.ReplaceTabToSpaces !== false); // default true - const indentSize = (typeof config.IndentSize === 'number' && config.IndentSize >= 1 && config.IndentSize <= 10) ? config.IndentSize : 4; - const indentUnit = useSpaces ? ' '.repeat(indentSize) : '\t'; - for (let i = 0; i < n; i++) { - if (thisLineBack) { thisLineBack = false; } else { temp += indentUnit; } - } - } - return temp; -} - -function CheckCRLForWhitespace(s: string): boolean { - if (s === undefined || s === '' || s === '\n' || s === '\r') return true; // line/file start boundaries - return FORMATS.concat(SINGLE_OPERATORS, DOUBLE_OPERATORS, TRENNER).some(item => s === item); -} - -export function pureFormatPipeline(text: string, config: FormatterConfig) { - let formatted = preFormat(text, config); - formatted = formatNestings(formatted, config); - const nEL = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - let regex: RegExp; - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - formatted = formatted.replace(regex, CRLF); - } - // Indentation normalization: replace leading tabs with spaces if configured - const useSpaces = (config.ReplaceTabToSpaces !== false); // default true - const indentSize = (typeof config.IndentSize === 'number' && config.IndentSize >= 1 && config.IndentSize <= 10) ? config.IndentSize : 4; - if (useSpaces) { - const tabRegex = /^\t+/gm; - formatted = formatted.replace(tabRegex, (m) => ' '.repeat(m.length * indentSize)); - } - return formatted; -} - diff --git a/src/formats.ts b/src/formats.ts deleted file mode 100644 index 53065df..0000000 --- a/src/formats.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Delegation wrapper only – real formatting logic lives in formatCore.ts -// Single Source of Truth: modify formatting rules in formatCore.ts -// This file provides stable export names for the rest of the extension. - -import { preFormat as corePreFormat, formatNestings as coreFormatNestings, pureFormatPipeline } from './formatCore'; - -export function preFormat(text: string, config: any) { - return corePreFormat(text, config); -} - -export function formatNestings(text: string, config: any) { - return coreFormatNestings(text, config); -} - -export function fullFormatPipeline(text: string, config: any) { - return pureFormatPipeline(text, config); -} - -// Note: If VSCode-specific logging or telemetry is needed later, inject it here -// without duplicating core logic. diff --git a/src/functions.ts b/src/functions.ts deleted file mode 100644 index 108729a..0000000 --- a/src/functions.ts +++ /dev/null @@ -1,191 +0,0 @@ - -import * as vscode from 'vscode'; -import { workspace, window } from 'vscode'; -import { preFormat, formatNestings } from './formats'; -import { CRLF } from "./const"; - -export let config: any = {}; - -export function formatTE(range: vscode.Range): vscode.TextEdit[] { - config = getConfig(); - let document = window.activeTextEditor.document; - - const newText = format(range, document, config); - return [vscode.TextEdit.replace(range, newText)]; -} - -function format(range: vscode.Range, document: vscode.TextDocument, config: any): string { - // PURE IMPLEMENTATION (Refactor 2025-09-14): No direct editor side-effects anymore. - let regex: RegExp; - let formatted: string = document.getText(range); - - // 1. Keyword / Operator Formatting - formatted = preFormat(formatted, config); - // 2. Nestings - formatted = formatNestings(formatted, config); - - // 3. Remove EmptyLines - const nEL: number = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - formatted = formatted.replace(regex, CRLF); - } - - return formatted; -} - -//---------------------------------------------------------------- -//---------------------------------------------------------------- - -export function getConfig() { - //https://code.visualstudio.com/api/references/contribution-points - //debug - config.debug = false; //workspace.getConfiguration().get('VBI.formatter.debug.active'); - config.debugToChannel = true; //workspace.getConfiguration().get('VBI.formatter.debug.debugToChannel'); - - //Live empty Lines - config.allowedNumberOfEmptyLines = workspace.getConfiguration().get('VBI.formatter.EmptyLine.allowedNumberOfEmptyLines'); - if (config.allowedNumberOfEmptyLines < 0 || config.allowedNumberOfEmptyLines > 50) { - config.allowedNumberOfEmptyLines = 1; - } - - config.RemoveEmptyLines = workspace.getConfiguration().get('VBI.formatter.EmptyLine.RemoveEmptyLines'); - config.EmptyLinesAlsoInComment = workspace.getConfiguration().get('VBI.formatter.EmptyLine.EmptyLinesAlsoInComment'); - - //codeblock-Nesting settings - config.BlockCodeBegin = workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeBegin'); - config.BlockCodeEnd = workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeEnd'); - config.BlockCodeExclude = workspace.getConfiguration().get('VBI.formatter.BC.BlockCodeExclude'); - - - //Region codeblock-Nesting settings - config.RegionBlockCodeBegin = workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeBegin'); - config.RegionBlockCodeEnd = workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeEnd'); - config.RegionBlockCodeExclude = workspace.getConfiguration().get('VBI.formatter.Region.BlockCodeExclude'); - - - //misc - config.ReplaceTabToSpaces = workspace.getConfiguration().get('VBI.formatter.Misc.ReplaceTabToSpaces'); - config.IndentSize = workspace.getConfiguration().get('VBI.formatter.Misc.IndentSize'); - if (typeof config.IndentSize !== 'number' || config.IndentSize < 1 || config.IndentSize > 10) { - config.IndentSize = 4; - } - if (typeof config.ReplaceTabToSpaces !== 'boolean') { - config.ReplaceTabToSpaces = true; // fallback to default from package.json - } - //config.AllowInlineIFClause = workspace.getConfiguration().get('VBI.formatter.AllowInlineIFClause'); - - //log this - console.log('getConfig():', config); - return config; -} - -/** - * @param cat Type String --> define Category [info,warn,error] - * @param o Rest Parameter, Type Any --> Data to Log - */ -export let info = vscode.window.createOutputChannel("VBI-Info"); -export function log(cat: string, ...o: any) { - - function mapObject(obj: any) { - - switch (typeof obj) { - case 'undefined': - return 'undefined'; - - case 'object': - let ret: string = ''; - for (const [key, value] of Object.entries(obj)) { - ret += (`${key}: ${value}\n`); - } - return ret; - - default: - return obj; //function,symbol,boolean - - } - - } - - if (config.debug) { - if (config.debugToChannel) { - switch (cat.toLowerCase()) { - case 'info': - - //info.appendLine('INFO:'); - o.map((args: any) => { - info.appendLine('INFO:' + mapObject(args)); - }); - info.show(); - return; - - case 'warn': - //info.appendLine('WARN:'); - o.map((args: any) => { - info.appendLine('WARN:' + mapObject(args)); - }); - info.show(); - return; - - case 'error': - let err: string = ''; - //info.appendLine('ERROR: '); - //err += mapObject(cat) + ": \r\n"; - o.map((args: any) => { - err += mapObject(args); - }); - info.appendLine(err); - vscode.window.showErrorMessage(err); //.replace(/(\r\n|\n|\r)/gm,"") - info.show(); - return; - - default: - - //info.appendLine('INFO-Other:'); - //info.appendLine('INFO-Other:' + mapObject(cat)); - o.map((args: any) => { - info.appendLine('INFO-Other:' + mapObject(args)); - }); - info.show(); - return; - } - - } - else { - switch (cat.toLowerCase()) { - case 'info': - console.log('INFO:', o); - return; - case 'warn': - console.log('WARNING:', o); - return; - case 'error': - console.error('ERROR:', o); - return; - default: - console.log('log:', cat, o); - return; - } - } - } - else if (cat.toLowerCase() === 'error') { // show Error in vc, and log it to console - - let err: string = ''; - o.map((args: any) => { - err += mapObject(args); - }); - console.error('ERROR:',o); - vscode.window.showErrorMessage(err); //.replace(/(\r\n|\n|\r)/gm,"") - return; - } - - -} - -export function cloneArray(arr){ - return [...arr] -} \ No newline at end of file diff --git a/src/nestingdef.ts b/src/nestingdef.ts deleted file mode 100644 index eaba680..0000000 --- a/src/nestingdef.ts +++ /dev/null @@ -1,29 +0,0 @@ -interface NestingInterface { - keyword: string; //begin of the Nesting (IF) - middle: string; //eg else in if-then-else-endif (ELSE) - end: string; //end of this Nesting (ENDIF) - multiline: string; //can contain Multiline Keyword (THEN) -} - -export const EXCLUDE_KEYWORDS: string[] = ["EXIT FOR"]; - -export const NESTINGS: NestingInterface[] = [ - { - keyword: "if", - middle: "else", - end: "endif", - multiline: "then", - }, - { - keyword: "for", - middle: "", - end: "next", - multiline: "", - }, - { - keyword: "while", - middle: "", - end: "next", - multiline: "", - } -]; diff --git a/src/test/runTest.ts b/src/test/runTest.ts index 6ba2c6b..47d0370 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -4,6 +4,10 @@ import { runTests } from '@vscode/test-electron'; async function main() { try { + // Codex and VS Code extension hosts set this for their own child processes. + // The test runner must launch Code as Electron, not as a Node.js process. + delete process.env.ELECTRON_RUN_AS_NODE; + // The folder containing the Extension Manifest package.json // Passed to `--extensionDevelopmentPath` const extensionDevelopmentPath = path.resolve(__dirname, '../../'); @@ -18,7 +22,7 @@ async function main() { extensionDevelopmentPath, extensionTestsPath, }); - } catch (err) { + } catch { console.error('Failed to run tests'); process.exit(1); } diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index 7584151..b8fd86f 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -1,6 +1,35 @@ import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; import * as vscode from 'vscode'; +async function waitForDiagnostics( + uri: vscode.Uri, + predicate: (diagnostics: readonly vscode.Diagnostic[]) => boolean, + description: string, +): Promise { + const current = vscode.languages.getDiagnostics(uri); + if (predicate(current)) return current; + return new Promise((resolve, reject) => { + let subscription: vscode.Disposable | undefined; + const timeout = setTimeout(() => { + subscription?.dispose(); + reject(new Error(`Timed out waiting for diagnostics: ${description}.`)); + }, 10000); + subscription = vscode.languages.onDidChangeDiagnostics(event => { + if (!event.uris.some(changed => changed.toString() === uri.toString())) return; + const diagnostics = vscode.languages.getDiagnostics(uri); + if (!predicate(diagnostics)) return; + clearTimeout(timeout); + subscription?.dispose(); + resolve(diagnostics); + }); + }); +} + +async function waitForDiagnosticCode(uri: vscode.Uri, code: string): Promise { + return waitForDiagnostics(uri, diagnostics => diagnostics.some(diagnostic => diagnostic.code === code), code); +} suite('Extension Test Suite', () => { vscode.window.showInformationMessage('Start all tests.'); @@ -9,4 +38,206 @@ suite('Extension Test Suite', () => { assert.strictEqual([1, 2, 3].indexOf(5), -1); assert.strictEqual([1, 2, 3].indexOf(0), -1); }); + + test('registers the formatter command through the language client', async () => { + const extension = vscode.extensions.getExtension('Vitaly-ruhl.intouch-language'); + assert.ok(extension); + await extension.activate(); + assert.ok((await vscode.commands.getCommands(true)).includes('vbi-format')); + }); + + test('routes document formatting through the language server', async () => { + const document = await vscode.workspace.openTextDocument({ + language: 'intouch', + content: 'if Ready>0 then\ncall LogMessage("ok");\nendif;', + }); + const edits = await vscode.commands.executeCommand( + 'vscode.executeFormatDocumentProvider', + document.uri, + { insertSpaces: true, tabSize: 4 }, + ); + + assert.ok(edits); + assert.ok(edits.length > 0); + const workspaceEdit = new vscode.WorkspaceEdit(); + workspaceEdit.set(document.uri, edits); + assert.strictEqual(await vscode.workspace.applyEdit(workspaceEdit), true); + assert.match(document.getText(), /^IF Ready > 0 THEN\r?\n {4}CALL LogMessage\("ok"\);\r?\nENDIF;$/); + }); + + test('formats the comment nesting fixture exactly and idempotently through the production provider', async () => { + const fixtureDirectory = path.resolve(__dirname, '../../../src/test/suite/testfiles'); + const source = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.test.vbi'), 'utf8'); + const expected = fs.readFileSync(path.join(fixtureDirectory, '05.comment_rules.nesting.tobe.vbi'), 'utf8'); + const document = await vscode.workspace.openTextDocument({ language: 'intouch', content: source }); + const options = { insertSpaces: true, tabSize: 8 }; + + const firstEdits = await vscode.commands.executeCommand( + 'vscode.executeFormatDocumentProvider', + document.uri, + options, + ); + assert.ok(firstEdits); + const firstWorkspaceEdit = new vscode.WorkspaceEdit(); + firstWorkspaceEdit.set(document.uri, firstEdits); + assert.strictEqual(await vscode.workspace.applyEdit(firstWorkspaceEdit), true); + assert.strictEqual(document.getText(), expected); + + const secondEdits = await vscode.commands.executeCommand( + 'vscode.executeFormatDocumentProvider', + document.uri, + options, + ); + assert.ok(secondEdits === undefined || secondEdits.length === 0); + assert.strictEqual(document.getText(), expected); + }); + + test('isolates a real multiline metadata header through the production language client', async () => { + const extension = vscode.extensions.getExtension('Vitaly-ruhl.intouch-language'); + assert.ok(extension); + await extension.activate(); + const source = [ + '{>', + ' Script:', + ' Type: QuickFunction', + ' Name: TABHER012EA', + '', + ' Parameters:', + ' No formal parameters.', + '', + ' Usage:', + ' CALL TABHER012EA( );', + '{<}', + 'DIM X AS FALSCH;', + ].join('\n'); + const document = await vscode.workspace.openTextDocument({ language: 'intouch', content: source }); + const diagnostics = await waitForDiagnosticCode(document.uri, 'unknown-datatype'); + + assert.deepStrictEqual(diagnostics.map(diagnostic => [diagnostic.code, diagnostic.range.start.line]), [ + ['unknown-datatype', 11], + ]); + }); + + test('resolves metadata QuickFunctions across files through the production language client', async () => { + const extension = vscode.extensions.getExtension('Vitaly-ruhl.intouch-language'); + assert.ok(extension); + await extension.activate(); + const localTemporaryRoot = path.resolve(extension.extensionPath, '.pio'); + const workspacePath = path.join(localTemporaryRoot, `metadata-host-${process.pid}-${Date.now()}`); + fs.mkdirSync(workspacePath, { recursive: true }); + const definitionPath = path.join(workspacePath, 'SomethingCompletelyDifferent.vbi'); + const callerPath = path.join(workspacePath, 'caller.vbi'); + const nestedCallerPath = path.join(workspacePath, 'nested-caller.vi'); + const definitionSource = [ + '{>', + '@ScriptType QuickFunction', + '@Name HostFunction', + '@Description Production host function.', + '@Param Source MESSAGE Source value.', + '@Returns MESSAGE', + '{<}', + ].join('\n'); + const callerSource = 'CALL HostFunction(Value);'; + fs.writeFileSync(definitionPath, definitionSource, 'utf8'); + fs.writeFileSync(callerPath, callerSource, 'utf8'); + fs.writeFileSync(nestedCallerPath, 'X = Wrapper(CALL HostFunction(Value));', 'utf8'); + + try { + const definitionDocument = await vscode.workspace.openTextDocument(definitionPath); + const callerDocument = await vscode.workspace.openTextDocument(callerPath); + await vscode.workspace.openTextDocument(nestedCallerPath); + const callPosition = new vscode.Position(0, 7); + let definitions: vscode.Location[] | undefined; + const deadline = Date.now() + 10_000; + do { + definitions = await vscode.commands.executeCommand( + 'vscode.executeDefinitionProvider', callerDocument.uri, callPosition, + ); + if ((definitions?.length ?? 0) > 0) break; + await new Promise(resolve => setTimeout(resolve, 100)); + } while (Date.now() < deadline); + + assert.strictEqual(definitions?.length, 1); + assert.strictEqual(definitions?.[0].uri.toString(), definitionDocument.uri.toString()); + assert.deepStrictEqual(definitions?.[0].range.start, new vscode.Position(2, 6)); + + const references = await vscode.commands.executeCommand( + 'vscode.executeReferenceProvider', callerDocument.uri, callPosition, + ); + assert.strictEqual(references?.length, 3); + const hovers = await vscode.commands.executeCommand( + 'vscode.executeHoverProvider', callerDocument.uri, callPosition, + ); + const hoverText = hovers?.flatMap(hover => hover.contents) + .map(content => typeof content === 'string' ? content : content.value) + .join('\n') ?? ''; + assert.match(hoverText, /HostFunction\(Source: MESSAGE\): MESSAGE/); + const completion = await vscode.commands.executeCommand( + 'vscode.executeCompletionItemProvider', callerDocument.uri, new vscode.Position(0, 5), + ); + assert.match(completion?.items.find(item => item.label === 'HostFunction')?.detail ?? '', /Production host function/); + assert.ok(!vscode.languages.getDiagnostics(callerDocument.uri).some(diagnostic => diagnostic.code === 'unknown-function')); + } finally { + const resolvedWorkspace = path.resolve(workspacePath); + assert.ok(resolvedWorkspace.startsWith(`${localTemporaryRoot}${path.sep}`)); + fs.rmSync(resolvedWorkspace, { recursive: true, force: true }); + } + }); + + test('routes naming quality settings and window context through the production language client', async () => { + const extension = vscode.extensions.getExtension('Vitaly-ruhl.intouch-language'); + assert.ok(extension); + await extension.activate(); + const configuration = vscode.workspace.getConfiguration('VBI'); + const keys = [ + 'diagnostics.naming.nonAsciiIdentifiers', + 'diagnostics.naming.windowWhitespace', + 'diagnostics.naming.windowNonAscii', + ] as const; + const previous = new Map(keys.map(key => [key, configuration.inspect(key)?.globalValue])); + + try { + for (const key of keys) await configuration.update(key, 'warning', vscode.ConfigurationTarget.Global); + const source = [ + 'DIM Größe AS INTEGER;', + 'Show "Übersicht Anlage";', + 'StatusMessage = "Übersicht Anlage";', + ].join('\n'); + const document = await vscode.workspace.openTextDocument({ language: 'intouch', content: source }); + const initial = await waitForDiagnostics(document.uri, diagnostics => + diagnostics.filter(item => item.source === 'intouch-quality').length === 3, + 'initial quality warnings'); + assert.deepStrictEqual(initial.filter(item => item.source === 'intouch-quality').map(item => [item.code, item.severity, item.range.start.line]), [ + ['quickscript.naming.nonAsciiIdentifier', vscode.DiagnosticSeverity.Warning, 0], + ['quickscript.naming.windowWhitespace', vscode.DiagnosticSeverity.Warning, 1], + ['quickscript.naming.windowNonAscii', vscode.DiagnosticSeverity.Warning, 1], + ]); + + for (const [setting, severity] of [ + ['information', vscode.DiagnosticSeverity.Information], + ['warning', vscode.DiagnosticSeverity.Warning], + ['error', vscode.DiagnosticSeverity.Error], + ] as const) { + const changed = waitForDiagnostics(document.uri, diagnostics => diagnostics.some(item => + item.code === 'quickscript.naming.nonAsciiIdentifier' && item.severity === severity), setting); + await configuration.update(keys[0], setting, vscode.ConfigurationTarget.Global); + await changed; + } + + const identifierDisabled = waitForDiagnostics(document.uri, diagnostics => + !diagnostics.some(item => item.code === 'quickscript.naming.nonAsciiIdentifier'), 'non-ASCII identifier off'); + await configuration.update(keys[0], 'off', vscode.ConfigurationTarget.Global); + await identifierDisabled; + + const allDisabled = waitForDiagnostics(document.uri, diagnostics => + !diagnostics.some(item => item.source === 'intouch-quality'), 'all naming quality diagnostics off'); + await configuration.update(keys[1], 'off', vscode.ConfigurationTarget.Global); + await configuration.update(keys[2], 'off', vscode.ConfigurationTarget.Global); + assert.deepStrictEqual(await allDisabled, []); + } finally { + for (const key of keys) { + await configuration.update(key, previous.get(key), vscode.ConfigurationTarget.Global); + } + } + }); }); diff --git a/src/test/suite/formats.comments.test.ts b/src/test/suite/formats.comments.test.ts index a0515e7..acd68c4 100644 --- a/src/test/suite/formats.comments.test.ts +++ b/src/test/suite/formats.comments.test.ts @@ -1,8 +1,8 @@ import * as assert from "assert"; // import * as vscode from "vscode"; -const fo = require("../../formats") -const functions = require("../../functions") +const fo = require('./formatterTestSupport') +const functions = require('./formatterTestSupport') let config = functions.getConfig() diff --git a/src/test/suite/formats.eof.test.ts b/src/test/suite/formats.eof.test.ts index cc0bb06..0db3619 100644 --- a/src/test/suite/formats.eof.test.ts +++ b/src/test/suite/formats.eof.test.ts @@ -1,7 +1,7 @@ import * as assert from 'assert'; -const fo = require('../../formats'); -const functions = require('../../functions'); +const fo = require('./formatterTestSupport'); +const functions = require('./formatterTestSupport'); let config = functions.getConfig(); diff --git a/src/test/suite/formats.fixtures.test.ts b/src/test/suite/formats.fixtures.test.ts index 2b2a14f..fd0f547 100644 --- a/src/test/suite/formats.fixtures.test.ts +++ b/src/test/suite/formats.fixtures.test.ts @@ -1,9 +1,9 @@ import * as assert from 'assert'; import * as fs from 'fs'; import * as path from 'path'; -// Use the same formatting pipeline as the real editor command: preFormat -> formatNestings -> empty line normalization. -const fo = require('../../formats'); -const functions = require('../../functions'); +// Use the same editor-independent formatting pipeline as the language server. +const fo = require('./formatterTestSupport'); +const functions = require('./formatterTestSupport'); let config = functions.getConfig(); // Automatically validate every pair *.test.vbi -> *.tobe.vbi in testfiles folder. @@ -43,21 +43,7 @@ suite('formatter fixture pairs (*.test.vbi -> *.tobe.vbi)', () => { const input = fs.readFileSync(testPath, 'utf8'); const expected = fs.readFileSync(expectedPath, 'utf8'); - // Stage 1: keyword/operator spacing & semicolon/trailing whitespace normalization - let stage1 = fo.preFormat(input, config); - // Stage 2: nesting / indentation logic - let stage2 = fo.formatNestings(stage1, config); - // Stage 3: replicate empty line reduction exactly like functions.format() - const nEL: number = (config.allowedNumberOfEmptyLines || 1) + 1.0; - if (config.RemoveEmptyLines) { - let regex: RegExp; - if (config.EmptyLinesAlsoInComment) { - regex = new RegExp(`(?![^{]*})(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } else { - regex = new RegExp(`(^[\t]*$\r?\n){${nEL},}`, 'gm'); - } - stage2 = stage2.replace(regex, '\r\n'); - } + const stage2 = fo.fullFormatPipeline(input, config); // Normalize both sides to CRLF + trim potential trailing spaces (fixtures canonicalized with CRLF) const normalize = (s: string) => s diff --git a/src/test/suite/formats.idempotent.test.ts b/src/test/suite/formats.idempotent.test.ts index 03dac58..cf9ce33 100644 --- a/src/test/suite/formats.idempotent.test.ts +++ b/src/test/suite/formats.idempotent.test.ts @@ -1,8 +1,8 @@ import * as assert from 'assert'; import * as fs from 'fs'; import * as path from 'path'; -const fo = require('../../formats'); -const functions = require('../../functions'); +const fo = require('./formatterTestSupport'); +const functions = require('./formatterTestSupport'); const config = functions.getConfig(); /* diff --git a/src/test/suite/formats.misc.test.ts b/src/test/suite/formats.misc.test.ts index b651cc1..904c451 100644 --- a/src/test/suite/formats.misc.test.ts +++ b/src/test/suite/formats.misc.test.ts @@ -1,8 +1,8 @@ import * as assert from "assert"; // import * as vscode from "vscode"; -const fo = require("../../formats") -const functions = require("../../functions") +const fo = require('./formatterTestSupport') +const functions = require('./formatterTestSupport') let config = functions.getConfig() diff --git a/src/test/suite/formats.operators.test.ts b/src/test/suite/formats.operators.test.ts index 6b7ee82..438a8bc 100644 --- a/src/test/suite/formats.operators.test.ts +++ b/src/test/suite/formats.operators.test.ts @@ -1,6 +1,6 @@ import * as assert from 'assert'; -const fo = require('../../formats'); -const functions = require('../../functions'); +const fo = require('./formatterTestSupport'); +const functions = require('./formatterTestSupport'); let config = functions.getConfig(); suite('test formats.ts - double operators spacing', () => { diff --git a/src/test/suite/formatterTestSupport.ts b/src/test/suite/formatterTestSupport.ts new file mode 100644 index 0000000..3e18514 --- /dev/null +++ b/src/test/suite/formatterTestSupport.ts @@ -0,0 +1,36 @@ +import { + FormatOptions, + formatQuickScript, + formatQuickScriptLexically, + formatQuickScriptStructure, +} from '@intouch-language/core'; + +export const config: FormatOptions = { + allowedNumberOfEmptyLines: 1, + removeEmptyLines: true, + removeEmptyLinesInComments: false, + blockCodeBegin: '{>', + blockCodeEnd: '{<', + blockCodeExclude: '{#', + regionBlockCodeBegin: '{region', + regionBlockCodeEnd: '{endregion', + regionBlockCodeExclude: '{#', + insertSpaces: true, + indentSize: 4, +}; + +export function getConfig(): FormatOptions { + return { ...config }; +} + +export function preFormat(text: string, options: FormatOptions = config): string { + return formatQuickScriptLexically(text, options).text; +} + +export function formatNestings(text: string, options: FormatOptions = config): string { + return formatQuickScriptStructure(text, options).text; +} + +export function fullFormatPipeline(text: string, options: FormatOptions = config): string { + return formatQuickScript(text, options).text; +} diff --git a/src/test/suite/functions.test.ts b/src/test/suite/functions.test.ts deleted file mode 100644 index 8e09d30..0000000 --- a/src/test/suite/functions.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as assert from "assert"; -import * as vscode from "vscode"; - -const fu = require("../../functions"); -// import {cloneArray} from "../functions" - -suite("test functions.ts", () => { - vscode.window.showInformationMessage("Start all functions.ts tests."); - - test("test clone array", () => { - const arr = [1, 2, 3]; - assert.deepEqual(fu.cloneArray(arr), arr); - assert.notEqual(fu.cloneArray(arr), arr); - }); -}); diff --git a/src/test/suite/index.ts b/src/test/suite/index.ts index 68f9a6a..227975b 100644 --- a/src/test/suite/index.ts +++ b/src/test/suite/index.ts @@ -1,12 +1,13 @@ import * as path from 'path'; -import * as Mocha from 'mocha'; +import Mocha = require('mocha'); import { glob } from 'glob'; export function run(): Promise { // Create the mocha test const mocha = new Mocha({ ui: 'tdd', - reporter: 'list' + reporter: 'list', + timeout: 10000, }); // mocha.useColors(true); //ui: 'tdd', diff --git a/src/test/suite/keywords.uppercase.test.ts b/src/test/suite/keywords.uppercase.test.ts index ce8449d..846ed48 100644 --- a/src/test/suite/keywords.uppercase.test.ts +++ b/src/test/suite/keywords.uppercase.test.ts @@ -1,6 +1,6 @@ import * as assert from 'assert'; -import { preFormat } from '../../formats'; -const functions = require('../../functions'); +import { preFormat } from './formatterTestSupport'; +const functions = require('./formatterTestSupport'); const config = functions.getConfig(); const KEYWORDS = [ diff --git a/src/test/suite/language.behavior-baseline.test.ts b/src/test/suite/language.behavior-baseline.test.ts new file mode 100644 index 0000000..731bbe2 --- /dev/null +++ b/src/test/suite/language.behavior-baseline.test.ts @@ -0,0 +1,63 @@ +import * as assert from 'assert'; + +import { formatNestings, getConfig, preFormat } from './formatterTestSupport'; + +const config = getConfig(); + +suite('QuickScript formatter behavior baseline', () => { + test('preserves representative language constructs while formatting code', () => { + const input = [ + 'dim MessageText as message;', + 'dim Index as integer;', + 'if Index>=1 then', + 'LogMessage("if {not a comment} >= 1");', + 'else', + "{ call FakeFunction(1); inside a comment }", + 'for Index=1 to 2 step 1', + 'call xGatawaySettings();', + 'next;', + 'endif;', + ].join('\n'); + + const formatted = formatNestings(preFormat(input, config), config); + + assert.match(formatted, /DIM MessageText AS MESSAGE;/); + assert.match(formatted, /DIM Index AS INTEGER;/); + assert.match(formatted, /IF Index >= 1 THEN/); + assert.match(formatted, /LogMessage\("if \{not a comment\} >= 1"\);/); + assert.match(formatted, /ELSE/); + assert.match(formatted, /\{ call FakeFunction\(1\); inside a comment \}/); + assert.match(formatted, /FOR Index = 1 TO 2 STEP 1/); + assert.match(formatted, /CALL xGatawaySettings\(\);/); + assert.match(formatted, /NEXT;/); + assert.match(formatted, /ENDIF;/); + }); + + test('treats keywords case-insensitively without changing identifiers', () => { + const input = 'iF ifValue == 1 tHeN\nendifValue = ifValue;\neNdIf;'; + const formatted = preFormat(input, config); + + assert.match(formatted, /^IF ifValue == 1 THEN/m); + assert.match(formatted, /^endifValue = ifValue;/m); + assert.match(formatted, /^ENDIF;/m); + }); + + test('keeps strings and brace comments byte-for-byte intact', () => { + const string = '"if a==b then {comment-like};"'; + const comment = '{ if a==b then "string-like"; }'; + const formatted = preFormat(`MessageText=${string};\n${comment}`, config); + + assert.ok(formatted.includes(string)); + assert.ok(formatted.includes(comment)); + }); + + test('does not throw or drop an incomplete final statement', () => { + const input = 'if Reading >'; + let formatted = ''; + + assert.doesNotThrow(() => { + formatted = formatNestings(preFormat(input, config), config); + }); + assert.match(formatted, /IF Reading >\s*$/); + }); +}); diff --git a/src/test/suite/testfiles/03.spacing.other.tobe.vbi b/src/test/suite/testfiles/03.spacing.other.tobe.vbi index fcf3b7a..d73a13e 100644 --- a/src/test/suite/testfiles/03.spacing.other.tobe.vbi +++ b/src/test/suite/testfiles/03.spacing.other.tobe.vbi @@ -18,6 +18,7 @@ a = b; { comment } c = d; a = 1; ENDIF; + test for removing extra empty lines in comment blocks (this line should be moved up) } diff --git a/src/test/suite/testfiles/04.indentation.basic.nesting.tobe.vbi b/src/test/suite/testfiles/04.indentation.basic.nesting.tobe.vbi index 5a256b0..628aa3d 100644 --- a/src/test/suite/testfiles/04.indentation.basic.nesting.tobe.vbi +++ b/src/test/suite/testfiles/04.indentation.basic.nesting.tobe.vbi @@ -10,7 +10,7 @@ FOR i = 1 TO j a = StringTrim(b, 3); wcAddItem("text", a); - LogMessage("DEBUG: " + StringLeft(abc, 4)+ "\. /abc\def; oha:;" + aa); + LogMessage("DEBUG: " + StringLeft(abc, 4) + "\. /abc\def; oha:;" + aa); IF StringLeft(SYS_TopicTemp, 4) == SYS_S7CPU_anlagenteil THEN WU_AuswahlTemp = SYS_S7CPU_name; ENDIF; @@ -73,10 +73,10 @@ FOR i = 1 TO StringLen(inS) STEP 2 IF Splitt == iIndex THEN {comment close after then} {test much brackets in the next line} - IF Sys_Debug_info > 0 THEN LogMessage(Funkt + "True Splitt(" + text(Splitt, "#")+ ")/i:(" + text(i, "#")+ "):[" + Temp_Return + "]"); ENDIF; + IF Sys_Debug_info > 0 THEN LogMessage(Funkt + "True Splitt(" + text(Splitt, "#") + ")/i:(" + text(i, "#") + "):[" + Temp_Return + "]"); ENDIF; EXIT FOR; {remember do not change nesting on exit for} ELSE - IF Sys_Debug_info > 0 THEN LogMessage(Funkt + " Splitt(" + text(i, "#")+ "):[" + Temp_Return + "]"); ENDIF; + IF Sys_Debug_info > 0 THEN LogMessage(Funkt + " Splitt(" + text(i, "#") + "):[" + Temp_Return + "]"); ENDIF; Temp_Return = ""; ENDIF; ELSE diff --git a/src/test/suite/testfiles/05.comment_rules.nesting.tobe.vbi b/src/test/suite/testfiles/05.comment_rules.nesting.tobe.vbi index 2e423fe..562539d 100644 --- a/src/test/suite/testfiles/05.comment_rules.nesting.tobe.vbi +++ b/src/test/suite/testfiles/05.comment_rules.nesting.tobe.vbi @@ -7,7 +7,7 @@ ANLAGE = StringTrim(SYS_S7CPU_name, 3); wcAddItem("WUAuswahl", ANLAGE); - LogMessage("DEBUG: " + StringLeft(SYS_TopicTemp, 4)+ " / " + SYS_S7CPU_anlagenteil); + LogMessage("DEBUG: " + StringLeft(SYS_TopicTemp, 4) + " / " + SYS_S7CPU_anlagenteil); IF StringLeft(SYS_TopicTemp, 4) == SYS_S7CPU_anlagenteil THEN WU_AuswahlTemp = SYS_S7CPU_name; ENDIF; diff --git a/src/test/suite/testfiles/all.tobe.vbi b/src/test/suite/testfiles/all.tobe.vbi index 2a2381d..d6c83a2 100644 --- a/src/test/suite/testfiles/all.tobe.vbi +++ b/src/test/suite/testfiles/all.tobe.vbi @@ -38,11 +38,11 @@ Changelog: {>------------------------------------------------------------------------------} {Test wrong Nesting and inline if - then and Spacings on +/-/<> and other Keywords un strings} - IF sys_Debug_info > 0 THEN LogMessage(eof Funkt + "if one of the keywords is big, and spacing or tab is removed, then its Wrong! | [" + Text(iErsteMA, "#")"]"); ENDIF; - IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#")"]"); ENDIF; + IF sys_Debug_info > 0 THEN LogMessage(EOF Funkt + "if one of the keywords is big, and spacing or tab is removed, then its Wrong! | [" + Text(iErsteMA, "#") "]"); ENDIF; + IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#") "]"); ENDIF; {# Test codeblock backline} - IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#")"]"); ENDIF; - IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#")"]"); ENDIF; + IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#") "]"); ENDIF; + IF sys_Debug_info > 0 THEN LogMessage(Funkt + "eof if one of eof is big -> its Wrong! | [" + Text(iErsteMA, "#") "]"); ENDIF; {<------------------------------------------------------------------------------} {------------------------------------------------------------------------------} diff --git a/syntaxes/intouch.tmLanguage.json b/syntaxes/intouch.tmLanguage.json index 17363cf..8381824 100644 --- a/syntaxes/intouch.tmLanguage.json +++ b/syntaxes/intouch.tmLanguage.json @@ -11,7 +11,7 @@ { "include": "#keywords" }, { "include": "#dotfields" }, { "include": "#strings" }, - { "include": "#HermesKeywords" }, + { "include": "#systemVariables" }, { "include": "#variables" }, { "include": "#var_declaration" }, { "include": "#numbers_simple" }, @@ -19,7 +19,6 @@ ], "repository": { "Ground-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": {}, - "keywords": { "patterns": [ { @@ -121,23 +120,12 @@ ] }, - "HermesKeywords": { + "systemVariables": { "patterns": [ { "match": "(?i:\\b(SYS_|MA_|SMEL_|HER_)\\w*)", "name": "variable.other", - "comment": "Systemvariablen (Hermes - OWN)" - }, - - { - "match": "(?i:\\s*\\b(GetSplittByIndex|HerGATEWAYanzeigeAktualisieren|HerGATEWAYtriggerFreigabe|HerGATEWAYueberwachen|SetReferenceBool|SetReferenceByte|SetReferenceDINT|SetReferenceDINTs|SetReferenceMerkerByte|SetReferenceReal|SetReferenceString|SetReferenceWord|SetVarInputBoolsch|SetVarToggleBoolsch|BDEDatenLesen|BDEDatenSpeichern|BDEDatenSuchen|BDESchichtSchreiben|BDESchichtwerteDatenOK|BDESchichtwerteZuweisen|BDETageswerteDatenOK|BDETageswerteSchreiben|BDETageswerteZuweisen|BZBetriebsstunden|BZZaehlerAbfragen|ExterneModuleUeberwachen|FUWerte|GetSplittByIndex|HerBACKUP|HerProViewStart|HideAllPLS|KonfigLesen|KonfigSpeichern|QFFilter|QFFilterRegler15Schritt|QFLuftwerte|QFRinne|SessionUserInfoAkt|Sollwertaenderung|StatusExtApp|StatusleistenInfofelder|SWReal|wwalmdbtrigger|xAnlagenConfig|xBZVZSettings|xGatawaySettings|xHerGATEWAYSettings|xLoggingConfig|xSetDateiPfade|xSetSQLConfig|xSetTSStation|xSetUhrzeitserver)\\b\\s*)", - "name": "keyword.other", - "comment": "Hermes Own functions 1" - }, - { - "match": "(?i:\\s*\\b(xSTATION9BiosName|xSTATION8BiosName|xSTATION7BiosName|xSTATION6BiosName|xSTATION5BiosName|xSTATION4BiosName|xSTATION3BiosName|xSTATION2BiosName|xSTATION1BiosName)\\b\\s*)", - "name": "support.function", - "comment": "Hermes Own functions 2" + "comment": "Known QuickScript system-variable prefixes" } ] }, diff --git a/tsconfig.json b/tsconfig.json index 2ec04bf..006de62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { - "module": "commonjs", + "module": "Node16", + "moduleResolution": "Node16", "target": "es2021", "outDir": "out", "lib": [ @@ -15,5 +16,8 @@ "temp", ".vscode-test", "scripts" + ], + "include": [ + "src/**/*.ts" ] }