12 lines
22 KiB
JavaScript
12 lines
22 KiB
JavaScript
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["vendors-node_modules_monaco-editor_esm_vs_language_typescript_tsMode_js"],{"./node_modules/monaco-editor/esm/vs/language/typescript/tsMode.js":function(ue,O,v){var f;v.r(O),v.d(O,{Adapter:function(){return _},CodeActionAdaptor:function(){return $},DefinitionAdapter:function(){return W},DiagnosticsAdapter:function(){return M},DocumentHighlightAdapter:function(){return H},FormatAdapter:function(){return B},FormatHelper:function(){return w},FormatOnTypeAdapter:function(){return U},InlayHintsAdapter:function(){return J},Kind:function(){return p},LibFiles:function(){return I},OutlineAdapter:function(){return V},QuickInfoAdapter:function(){return E},ReferenceAdapter:function(){return j},RenameAdapter:function(){return z},SignatureHelpAdapter:function(){return K},SuggestAdapter:function(){return N},WorkerManager:function(){return L},flattenDiagnosticMessageText:function(){return x},getJavaScriptWorker:function(){return ae},getTypeScriptWorker:function(){return oe},setupJavaScript:function(){return ne},setupTypeScript:function(){return ie}});var Y=v("include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.api.js"),Z=v("./node_modules/monaco-editor/esm/vs/language/typescript/monaco.contribution.js");var q=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,te=Object.getOwnPropertyNames,se=Object.prototype.hasOwnProperty,P=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of te(t))!se.call(e,c)&&c!==o&&q(e,c,{get:()=>t[c],enumerable:!(s=ee(t,c))||s.enumerable});return e},re=(e,t,o)=>(P(e,t,"default"),o&&P(o,t,"default")),i={};re(i,Y);var L=class{constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;const e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||(this._client=(async()=>(this._worker=i.editor.createWebWorker({moduleId:"vs/language/typescript/tsWorker",label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(i.editor.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):await this._worker.getProxy()))()),this._client}async getLanguageServiceWorker(...e){const t=await this._getClient();return this._worker&&await this._worker.withSyncedResources(e),t}},r={};r["lib.d.ts"]=!0,r["lib.decorators.d.ts"]=!0,r["lib.decorators.legacy.d.ts"]=!0,r["lib.dom.d.ts"]=!0,r["lib.dom.iterable.d.ts"]=!0,r["lib.es2015.collection.d.ts"]=!0,r["lib.es2015.core.d.ts"]=!0,r["lib.es2015.d.ts"]=!0,r["lib.es2015.generator.d.ts"]=!0,r["lib.es2015.iterable.d.ts"]=!0,r["lib.es2015.promise.d.ts"]=!0,r["lib.es2015.proxy.d.ts"]=!0,r["lib.es2015.reflect.d.ts"]=!0,r["lib.es2015.symbol.d.ts"]=!0,r["lib.es2015.symbol.wellknown.d.ts"]=!0,r["lib.es2016.array.include.d.ts"]=!0,r["lib.es2016.d.ts"]=!0,r["lib.es2016.full.d.ts"]=!0,r["lib.es2017.d.ts"]=!0,r["lib.es2017.full.d.ts"]=!0,r["lib.es2017.intl.d.ts"]=!0,r["lib.es2017.object.d.ts"]=!0,r["lib.es2017.sharedmemory.d.ts"]=!0,r["lib.es2017.string.d.ts"]=!0,r["lib.es2017.typedarrays.d.ts"]=!0,r["lib.es2018.asyncgenerator.d.ts"]=!0,r["lib.es2018.asynciterable.d.ts"]=!0,r["lib.es2018.d.ts"]=!0,r["lib.es2018.full.d.ts"]=!0,r["lib.es2018.intl.d.ts"]=!0,r["lib.es2018.promise.d.ts"]=!0,r["lib.es2018.regexp.d.ts"]=!0,r["lib.es2019.array.d.ts"]=!0,r[
|
||
|
`),code:t.code.toString(),tags:n,relatedInformation:this._convertRelatedInformation(e,t.relatedInformation)}}_convertRelatedInformation(e,t){if(!t)return[];const o=[];return t.forEach(s=>{let c=e;if(s.file&&(c=this._libFiles.getOrCreateModel(s.file.fileName)),!c)return;const u=s.start||0,l=s.length||1,{lineNumber:a,column:n}=c.getPositionAt(u),{lineNumber:g,column:d}=c.getPositionAt(u+l);o.push({resource:c.uri,startLineNumber:a,startColumn:n,endLineNumber:g,endColumn:d,message:x(s.messageText,`
|
||
|
`)})}),o}_tsDiagnosticCategoryToMarkerSeverity(e){switch(e){case 1:return i.MarkerSeverity.Error;case 3:return i.MarkerSeverity.Info;case 0:return i.MarkerSeverity.Warning;case 2:return i.MarkerSeverity.Hint}return i.MarkerSeverity.Info}},N=class D extends _{get triggerCharacters(){return["."]}async provideCompletionItems(t,o,s,c){const u=t.getWordUntilPosition(o),l=new i.Range(o.lineNumber,u.startColumn,o.lineNumber,u.endColumn),a=t.uri,n=t.getOffsetAt(o),g=await this._worker(a);if(t.isDisposed())return;const d=await g.getCompletionsAtPosition(a.toString(),n);return!d||t.isDisposed()?void 0:{suggestions:d.entries.map(h=>{let S=l;if(h.replacementSpan){const k=t.getPositionAt(h.replacementSpan.start),C=t.getPositionAt(h.replacementSpan.start+h.replacementSpan.length);S=new i.Range(k.lineNumber,k.column,C.lineNumber,C.column)}const A=[];return h.kindModifiers!==void 0&&h.kindModifiers.indexOf("deprecated")!==-1&&A.push(i.languages.CompletionItemTag.Deprecated),{uri:a,position:o,offset:n,range:S,label:h.name,insertText:h.name,sortText:h.sortText,kind:D.convertKind(h.kind),tags:A}})}}async resolveCompletionItem(t,o){const s=t,c=s.uri,u=s.position,l=s.offset,n=await(await this._worker(c)).getCompletionEntryDetails(c.toString(),l,s.label);return n?{uri:c,position:u,label:n.name,kind:D.convertKind(n.kind),detail:y(n.displayParts),documentation:{value:D.createDocumentationString(n)}}:s}static convertKind(t){switch(t){case p.primitiveType:case p.keyword:return i.languages.CompletionItemKind.Keyword;case p.variable:case p.localVariable:return i.languages.CompletionItemKind.Variable;case p.memberVariable:case p.memberGetAccessor:case p.memberSetAccessor:return i.languages.CompletionItemKind.Field;case p.function:case p.memberFunction:case p.constructSignature:case p.callSignature:case p.indexSignature:return i.languages.CompletionItemKind.Function;case p.enum:return i.languages.CompletionItemKind.Enum;case p.module:return i.languages.CompletionItemKind.Module;case p.class:return i.languages.CompletionItemKind.Class;case p.interface:return i.languages.CompletionItemKind.Interface;case p.warning:return i.languages.CompletionItemKind.File}return i.languages.CompletionItemKind.Property}static createDocumentationString(t){let o=y(t.documentation);if(t.tags)for(const s of t.tags)o+=`
|
||
|
|
||
|
${R(s)}`;return o}};function R(e){let t=`*@${e.name}*`;if(e.name==="param"&&e.text){const[o,...s]=e.text;t+=`\`${o.text}\``,s.length>0&&(t+=` \u2014 ${s.map(c=>c.text).join(" ")}`)}else Array.isArray(e.text)?t+=` \u2014 ${e.text.map(o=>o.text).join(" ")}`:e.text&&(t+=` \u2014 ${e.text}`);return t}var K=class X extends _{constructor(){super(...arguments),this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(t){switch(t.triggerKind){case i.languages.SignatureHelpTriggerKind.TriggerCharacter:return t.triggerCharacter?t.isRetrigger?{kind:"retrigger",triggerCharacter:t.triggerCharacter}:{kind:"characterTyped",triggerCharacter:t.triggerCharacter}:{kind:"invoked"};case i.languages.SignatureHelpTriggerKind.ContentChange:return t.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};case i.languages.SignatureHelpTriggerKind.Invoke:default:return{kind:"invoked"}}}async provideSignatureHelp(t,o,s,c){const u=t.uri,l=t.getOffsetAt(o),a=await this._worker(u);if(t.isDisposed())return;const n=await a.getSignatureHelpItems(u.toString(),l,{triggerReason:X._toSignatureHelpTriggerReason(c)});if(!n||t.isDisposed())return;const g={activeSignature:n.selectedItemIndex,activeParameter:n.argumentIndex,signatures:[]};return n.items.forEach(d=>{const m={label:"",parameters:[]};m.documentation={value:y(d.documentation)},m.label+=y(d.prefixDisplayParts),d.parameters.forEach((h,S,A)=>{const k=y(h.displayParts),C={label:k,documentation:{value:y(h.documentation)}};m.label+=k,m.parameters.push(C),S<A.length-1&&(m.label+=y(d.separatorDisplayParts))}),m.label+=y(d.suffixDisplayParts),g.signatures.push(m)}),{value:g,dispose(){}}}},E=class extends _{async provideHover(e,t,o){const s=e.uri,c=e.getOffsetAt(t),u=await this._worker(s);if(e.isDisposed())return;const l=await u.getQuickInfoAtPosition(s.toString(),c);if(!l||e.isDisposed())return;const a=y(l.documentation),n=l.tags?l.tags.map(d=>R(d)).join(`
|
||
|
|
||
|
`):"",g=y(l.displayParts);return{range:this._textSpanToRange(e,l.textSpan),contents:[{value:"```typescript\n"+g+"\n```\n"},{value:a+(n?`
|
||
|
|
||
|
`+n:"")}]}}},H=class extends _{async provideDocumentHighlights(e,t,o){const s=e.uri,c=e.getOffsetAt(t),u=await this._worker(s);if(e.isDisposed())return;const l=await u.getDocumentHighlights(s.toString(),c,[s.toString()]);if(!(!l||e.isDisposed()))return l.flatMap(a=>a.highlightSpans.map(n=>({range:this._textSpanToRange(e,n.textSpan),kind:n.kind==="writtenReference"?i.languages.DocumentHighlightKind.Write:i.languages.DocumentHighlightKind.Text})))}},W=class extends _{constructor(e,t){super(t),this._libFiles=e}async provideDefinition(e,t,o){const s=e.uri,c=e.getOffsetAt(t),u=await this._worker(s);if(e.isDisposed())return;const l=await u.getDefinitionAtPosition(s.toString(),c);if(!l||e.isDisposed()||(await this._libFiles.fetchLibFilesIfNecessary(l.map(n=>i.Uri.parse(n.fileName))),e.isDisposed()))return;const a=[];for(let n of l){const g=this._libFiles.getOrCreateModel(n.fileName);g&&a.push({uri:g.uri,range:this._textSpanToRange(g,n.textSpan)})}return a}},j=class extends _{constructor(e,t){super(t),this._libFiles=e}async provideReferences(e,t,o,s){const c=e.uri,u=e.getOffsetAt(t),l=await this._worker(c);if(e.isDisposed())return;const a=await l.getReferencesAtPosition(c.toString(),u);if(!a||e.isDisposed()||(await this._libFiles.fetchLibFilesIfNecessary(a.map(g=>i.Uri.parse(g.fileName))),e.isDisposed()))return;const n=[];for(let g of a){const d=this._libFiles.getOrCreateModel(g.fileName);d&&n.push({uri:d.uri,range:this._textSpanToRange(d,g.textSpan)})}return n}},V=class extends _{async provideDocumentSymbols(e,t){const o=e.uri,s=await this._worker(o);if(e.isDisposed())return;const c=await s.getNavigationTree(o.toString());if(!c||e.isDisposed())return;const u=(a,n)=>({name:a.text,detail:"",kind:b[a.kind]||i.languages.SymbolKind.Variable,range:this._textSpanToRange(e,a.spans[0]),selectionRange:this._textSpanToRange(e,a.spans[0]),tags:[],children:a.childItems?.map(d=>u(d,a.text)),containerName:n});return c.childItems?c.childItems.map(a=>u(a)):[]}},p=(f=class{},f.unknown="",f.keyword="keyword",f.script="script",f.module="module",f.class="class",f.interface="interface",f.type="type",f.enum="enum",f.variable="var",f.localVariable="local var",f.function="function",f.localFunction="local function",f.memberFunction="method",f.memberGetAccessor="getter",f.memberSetAccessor="setter",f.memberVariable="property",f.constructorImplementation="constructor",f.callSignature="call",f.indexSignature="index",f.constructSignature="construct",f.parameter="parameter",f.typeParameter="type parameter",f.primitiveType="primitive type",f.label="label",f.alias="alias",f.const="const",f.let="let",f.warning="warning",f),b=Object.create(null);b[p.module]=i.languages.SymbolKind.Module,b[p.class]=i.languages.SymbolKind.Class,b[p.enum]=i.languages.SymbolKind.Enum,b[p.interface]=i.languages.SymbolKind.Interface,b[p.memberFunction]=i.languages.SymbolKind.Method,b[p.memberVariable]=i.languages.SymbolKind.Property,b[p.memberGetAccessor]=i.languages.SymbolKind.Property,b[p.memberSetAccessor]=i.languages.SymbolKind.Property,b[p.variable]=i.languages.SymbolKind.Variable,b[p.const]=i.languages.SymbolKind.Variable,b[p.localVariable]=i.languages.SymbolKind.Variable,b[p.variable]=i.languages.SymbolKind.Variable,b[p.function]=i.languages.SymbolKind.Function,b[p.localFunction]=i.languages.SymbolKind.Function;var w=class extends _{static _convertOptions(e){return{ConvertTabsToSpaces:e.insertSpaces,TabSize:e.tabSize,IndentSize:e.tabSize,IndentStyle:2,NewLineCharacter:`
|
||
|
`,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(e,t){return{text:t.newText,range:this._textSpanToRange(e,t.span)}}},B=class extends w{constructor(){super(...arguments),this.canFormatMultipleRanges=!1}async provideDocumentRangeFormattingEdits(e,t,o,s){const c=e.uri,u=e.getOffsetAt({lineNumber:t.startLineNumber,column:t.startColumn}),l=e.getOffsetAt({lineNumber:t.endLineNumber,column:t.endColumn}),a=await this._worker(c);if(e.isDisposed())return;const n=await a.getFormattingEditsForRange(c.toString(),u,l,w._convertOptions(o));if(!(!n||e.isDisposed()))return n.map(g=>this._convertTextChanges(e,g))}},U=class extends w{get autoFormatTriggerCharacters(){return[";","}",`
|
||
|
`]}async provideOnTypeFormattingEdits(e,t,o,s,c){const u=e.uri,l=e.getOffsetAt(t),a=await this._worker(u);if(e.isDisposed())return;const n=await a.getFormattingEditsAfterKeystroke(u.toString(),l,o,w._convertOptions(s));if(!(!n||e.isDisposed()))return n.map(g=>this._convertTextChanges(e,g))}},$=class extends w{async provideCodeActions(e,t,o,s){const c=e.uri,u=e.getOffsetAt({lineNumber:t.startLineNumber,column:t.startColumn}),l=e.getOffsetAt({lineNumber:t.endLineNumber,column:t.endColumn}),a=w._convertOptions(e.getOptions()),n=o.markers.filter(h=>h.code).map(h=>h.code).map(Number),g=await this._worker(c);if(e.isDisposed())return;const d=await g.getCodeFixesAtPosition(c.toString(),u,l,n,a);return!d||e.isDisposed()?{actions:[],dispose:()=>{}}:{actions:d.filter(h=>h.changes.filter(S=>S.isNewFile).length===0).map(h=>this._tsCodeFixActionToMonacoCodeAction(e,o,h)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(e,t,o){const s=[];for(const u of o.changes)for(const l of u.textChanges)s.push({resource:e.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(e,l.span),text:l.newText}});return{title:o.description,edit:{edits:s},diagnostics:t.markers,kind:"quickfix"}}},z=class extends _{constructor(e,t){super(t),this._libFiles=e}async provideRenameEdits(e,t,o,s){const c=e.uri,u=c.toString(),l=e.getOffsetAt(t),a=await this._worker(c);if(e.isDisposed())return;const n=await a.getRenameInfo(u,l,{allowRenameOfImportPath:!1});if(n.canRename===!1)return{edits:[],rejectReason:n.localizedErrorMessage};if(n.fileToRename!==void 0)throw new Error("Renaming files is not supported.");const g=await a.findRenameLocations(u,l,!1,!1,!1);if(!g||e.isDisposed())return;const d=[];for(const m of g){const h=this._libFiles.getOrCreateModel(m.fileName);if(h)d.push({resource:h.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(h,m.textSpan),text:o}});else throw new Error(`Unknown file ${m.fileName}.`)}return{edits:d}}},J=class extends _{async provideInlayHints(e,t,o){const s=e.uri,c=s.toString(),u=e.getOffsetAt({lineNumber:t.startLineNumber,column:t.startColumn}),l=e.getOffsetAt({lineNumber:t.endLineNumber,column:t.endColumn}),a=await this._worker(s);return e.isDisposed()?null:{hints:(await a.provideInlayHints(c,u,l)).map(d=>({...d,label:d.text,position:e.getPositionAt(d.position),kind:this._convertHintKind(d.kind)})),dispose:()=>{}}}_convertHintKind(e){switch(e){case"Parameter":return i.languages.InlayHintKind.Parameter;case"Type":return i.languages.InlayHintKind.Type;default:return i.languages.InlayHintKind.Type}}},F,T;function ie(e){T=G(e,"typescript")}function ne(e){F=G(e,"javascript")}function ae(){return new Promise((e,t)=>{if(!F)return t("JavaScript not registered!");e(F)})}function oe(){return new Promise((e,t)=>{if(!T)return t("TypeScript not registered!");e(T)})}function G(e,t){const o=[],s=[],c=new L(t,e);o.push(c);const u=(...n)=>c.getLanguageServiceWorker(...n),l=new I(u);function a(){const{modeConfiguration:n}=e;Q(s),n.completionItems&&s.push(i.languages.registerCompletionItemProvider(t,new N(u))),n.signatureHelp&&s.push(i.languages.registerSignatureHelpProvider(t,new K(u))),n.hovers&&s.push(i.languages.registerHoverProvider(t,new E(u))),n.documentHighlights&&s.push(i.languages.registerDocumentHighlightProvider(t,new H(u))),n.definitions&&s.push(i.languages.registerDefinitionProvider(t,new W(l,u))),n.references&&s.push(i.languages.registerReferenceProvider(t,new j(l,u))),n.documentSymbols&&s.push(i.languages.registerDocumentSymbolProvider(t,new V(u))),n.rename&&s.push(i.languages.registerRenameProvider(t,new z(l,u))),n.documentRangeFormattingEdits&&s.push(i.languages.registerDocumentRangeFormattingEditProvider(t,new B(u))),n.onTypeFormattingEdits&&s.push(i.languages.registerOnTypeFormattingEditProvider(t,new U(u))),n.codeActions&&s.push(i.languages.registerCodeActionProvider(t,new $(u))),n.inlayHints&&s.push(i.languages.registerInlayHintsProvider(t,new J(u))),n.diagnostics&&s.push(new M(l,e,t,u))}return a(),o.push(ce(s)),u}function ce(e){return{dispose:()=>Q(e)}}function Q(e){for(;e.length;)e.pop().dispose()}}}]);
|