mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-09-07 05:14:42 +02:00
22 lines
44 KiB
JavaScript
22 lines
44 KiB
JavaScript
"use strict";
|
|
/*
|
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
* This devtool is neither made for production nor for readable output files.
|
|
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
* or disable the default devtool with "devtool: false".
|
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
*/
|
|
(self["webpackChunkmonanco_wpack"] = self["webpackChunkmonanco_wpack"] || []).push([["vendors-node_modules_monaco-editor_esm_vs_language_typescript_tsMode_js"],{
|
|
|
|
/***/ "./node_modules/monaco-editor/esm/vs/language/typescript/tsMode.js":
|
|
/*!*************************************************************************!*\
|
|
!*** ./node_modules/monaco-editor/esm/vs/language/typescript/tsMode.js ***!
|
|
\*************************************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Adapter\": () => (/* binding */ Adapter),\n/* harmony export */ \"CodeActionAdaptor\": () => (/* binding */ CodeActionAdaptor),\n/* harmony export */ \"DefinitionAdapter\": () => (/* binding */ DefinitionAdapter),\n/* harmony export */ \"DiagnosticsAdapter\": () => (/* binding */ DiagnosticsAdapter),\n/* harmony export */ \"FormatAdapter\": () => (/* binding */ FormatAdapter),\n/* harmony export */ \"FormatHelper\": () => (/* binding */ FormatHelper),\n/* harmony export */ \"FormatOnTypeAdapter\": () => (/* binding */ FormatOnTypeAdapter),\n/* harmony export */ \"InlayHintsAdapter\": () => (/* binding */ InlayHintsAdapter),\n/* harmony export */ \"Kind\": () => (/* binding */ Kind),\n/* harmony export */ \"LibFiles\": () => (/* binding */ LibFiles),\n/* harmony export */ \"OccurrencesAdapter\": () => (/* binding */ OccurrencesAdapter),\n/* harmony export */ \"OutlineAdapter\": () => (/* binding */ OutlineAdapter),\n/* harmony export */ \"QuickInfoAdapter\": () => (/* binding */ QuickInfoAdapter),\n/* harmony export */ \"ReferenceAdapter\": () => (/* binding */ ReferenceAdapter),\n/* harmony export */ \"RenameAdapter\": () => (/* binding */ RenameAdapter),\n/* harmony export */ \"SignatureHelpAdapter\": () => (/* binding */ SignatureHelpAdapter),\n/* harmony export */ \"SuggestAdapter\": () => (/* binding */ SuggestAdapter),\n/* harmony export */ \"WorkerManager\": () => (/* binding */ WorkerManager),\n/* harmony export */ \"flattenDiagnosticMessageText\": () => (/* binding */ flattenDiagnosticMessageText),\n/* harmony export */ \"getJavaScriptWorker\": () => (/* binding */ getJavaScriptWorker),\n/* harmony export */ \"getTypeScriptWorker\": () => (/* binding */ getTypeScriptWorker),\n/* harmony export */ \"setupJavaScript\": () => (/* binding */ setupJavaScript),\n/* harmony export */ \"setupTypeScript\": () => (/* binding */ setupTypeScript)\n/* harmony export */ });\n/* harmony import */ var _editor_editor_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../editor/editor.api.js */ \"./node_modules/monaco-editor/esm/vs/editor/editor.api.js\");\n/* harmony import */ var _monaco_contribution_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./monaco.contribution.js */ \"./node_modules/monaco-editor/esm/vs/language/typescript/monaco.contribution.js\");\n/*!-----------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Version: 0.33.0(4b1abad427e58dbedc1215d99a0902ffc885fcd4)\n * Released under the MIT license\n * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt\n *-----------------------------------------------------------------------------*/\n\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __reExport = (target, module, copyDefault, desc) => {\n if (module && typeof module === \"object\" || typeof module === \"function\") {\n for (let key of __getOwnPropNames(module))\n if (!__hasOwnProp.call(target, key) && (copyDefault || key !== \"default\"))\n __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });\n }\n return target;\n};\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\n// src/fillers/monaco-editor-core.ts\nvar monaco_editor_core_exports = {};\n__reExport(monaco_editor_core_exports, _editor_editor_api_js__WEBPACK_IMPORTED_MODULE_0__);\n\n\n// src/language/typescript/workerManager.ts\nvar WorkerManager = class {\n _modeId;\n _defaults;\n _configChangeListener;\n _updateExtraLibsToken;\n _extraLibsChangeListener;\n _worker;\n _client;\n constructor(modeId, defaults) {\n this._modeId = modeId;\n this._defaults = defaults;\n this._worker = null;\n this._client = null;\n this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());\n this._updateExtraLibsToken = 0;\n this._extraLibsChangeListener = this._defaults.onDidExtraLibsChange(() => this._updateExtraLibs());\n }\n _stopWorker() {\n if (this._worker) {\n this._worker.dispose();\n this._worker = null;\n }\n this._client = null;\n }\n dispose() {\n this._configChangeListener.dispose();\n this._extraLibsChangeListener.dispose();\n this._stopWorker();\n }\n async _updateExtraLibs() {\n if (!this._worker) {\n return;\n }\n const myToken = ++this._updateExtraLibsToken;\n const proxy = await this._worker.getProxy();\n if (this._updateExtraLibsToken !== myToken) {\n return;\n }\n proxy.updateExtraLibs(this._defaults.getExtraLibs());\n }\n _getClient() {\n if (!this._client) {\n this._worker = monaco_editor_core_exports.editor.createWebWorker({\n moduleId: \"vs/language/typescript/tsWorker\",\n label: this._modeId,\n keepIdleModels: true,\n createData: {\n compilerOptions: this._defaults.getCompilerOptions(),\n extraLibs: this._defaults.getExtraLibs(),\n customWorkerPath: this._defaults.workerOptions.customWorkerPath,\n inlayHintsOptions: this._defaults.inlayHintsOptions\n }\n });\n let p = this._worker.getProxy();\n if (this._defaults.getEagerModelSync()) {\n p = p.then((worker) => {\n if (this._worker) {\n return this._worker.withSyncedResources(monaco_editor_core_exports.editor.getModels().filter((model) => model.getLanguageId() === this._modeId).map((model) => model.uri));\n }\n return worker;\n });\n }\n this._client = p;\n }\n return this._client;\n }\n getLanguageServiceWorker(...resources) {\n let _client;\n return this._getClient().then((client) => {\n _client = client;\n }).then((_) => {\n if (this._worker) {\n return this._worker.withSyncedResources(resources);\n }\n }).then((_) => _client);\n }\n};\n\n// src/language/typescript/languageFeatures.ts\n\n\n// src/language/typescript/lib/lib.index.ts\nvar libFileSet = {};\nlibFileSet[\"lib.d.ts\"] = true;\nlibFileSet[\"lib.dom.d.ts\"] = true;\nlibFileSet[\"lib.dom.iterable.d.ts\"] = true;\nlibFileSet[\"lib.es2015.collection.d.ts\"] = true;\nlibFileSet[\"lib.es2015.core.d.ts\"] = true;\nlibFileSet[\"lib.es2015.d.ts\"] = true;\nlibFileSet[\"lib.es2015.generator.d.ts\"] = true;\nlibFileSet[\"lib.es2015.iterable.d.ts\"] = true;\nlibFileSet[\"lib.es2015.promise.d.ts\"] = true;\nlibFileSet[\"lib.es2015.proxy.d.ts\"] = true;\nlibFileSet[\"lib.es2015.reflect.d.ts\"] = true;\nlibFileSet[\"lib.es2015.symbol.d.ts\"] = true;\nlibFileSet[\"lib.es2015.symbol.wellknown.d.ts\"] = true;\nlibFileSet[\"lib.es2016.array.include.d.ts\"] = true;\nlibFileSet[\"lib.es2016.d.ts\"] = true;\nlibFileSet[\"lib.es2016.full.d.ts\"] = true;\nlibFileSet[\"lib.es2017.d.ts\"] = true;\nlibFileSet[\"lib.es2017.full.d.ts\"] = true;\nlibFileSet[\"lib.es2017.intl.d.ts\"] = true;\nlibFileSet[\"lib.es2017.object.d.ts\"] = true;\nlibFileSet[\"lib.es2017.sharedmemory.d.ts\"] = true;\nlibFileSet[\"lib.es2017.string.d.ts\"] = true;\nlibFileSet[\"lib.es2017.typedarrays.d.ts\"] = true;\nlibFileSet[\"lib.es2018.asyncgenerator.d.ts\"] = true;\nlibFileSet[\"lib.es2018.asynciterable.d.ts\"] = true;\nlibFileSet[\"lib.es2018.d.ts\"] = true;\nlibFileSet[\"lib.es2018.full.d.ts\"] = true;\nlibFileSet[\"lib.es2018.intl.d.ts\"] = true;\nlibFileSet[\"lib.es2018.promise.d.ts\"] = true;\nlibFileSet[\"lib.es2018.regexp.d.ts\"] = true;\nlibFileSet[\"lib.es2019.array.d.ts\"] = true;\nlibFileSet[\"lib.es2019.d.ts\"] = true;\nlibFileSet[\"lib.es2019.full.d.ts\"] = true;\nlibFileSet[\"lib.es2019.object.d.ts\"] = true;\nlibFileSet[\"lib.es2019.string.d.ts\"] = true;\nlibFileSet[\"lib.es2019.symbol.d.ts\"] = true;\nlibFileSet[\"lib.es2020.bigint.d.ts\"] = true;\nlibFileSet[\"lib.es2020.d.ts\"] = true;\nlibFileSet[\"lib.es2020.full.d.ts\"] = true;\nlibFileSet[\"lib.es2020.intl.d.ts\"] = true;\nlibFileSet[\"lib.es2020.promise.d.ts\"] = true;\nlibFileSet[\"lib.es2020.sharedmemory.d.ts\"] = true;\nlibFileSet[\"lib.es2020.string.d.ts\"] = true;\nlibFileSet[\"lib.es2020.symbol.wellknown.d.ts\"] = true;\nlibFileSet[\"lib.es2021.d.ts\"] = true;\nlibFileSet[\"lib.es2021.full.d.ts\"] = true;\nlibFileSet[\"lib.es2021.intl.d.ts\"] = true;\nlibFileSet[\"lib.es2021.promise.d.ts\"] = true;\nlibFileSet[\"lib.es2021.string.d.ts\"] = true;\nlibFileSet[\"lib.es2021.weakref.d.ts\"] = true;\nlibFileSet[\"lib.es5.d.ts\"] = true;\nlibFileSet[\"lib.es6.d.ts\"] = true;\nlibFileSet[\"lib.esnext.d.ts\"] = true;\nlibFileSet[\"lib.esnext.full.d.ts\"] = true;\nlibFileSet[\"lib.esnext.intl.d.ts\"] = true;\nlibFileSet[\"lib.esnext.promise.d.ts\"] = true;\nlibFileSet[\"lib.esnext.string.d.ts\"] = true;\nlibFileSet[\"lib.esnext.weakref.d.ts\"] = true;\nlibFileSet[\"lib.scripthost.d.ts\"] = true;\nlibFileSet[\"lib.webworker.d.ts\"] = true;\nlibFileSet[\"lib.webworker.importscripts.d.ts\"] = true;\nlibFileSet[\"lib.webworker.iterable.d.ts\"] = true;\n\n// src/language/typescript/languageFeatures.ts\nfunction flattenDiagnosticMessageText(diag, newLine, indent = 0) {\n if (typeof diag === \"string\") {\n return diag;\n } else if (diag === void 0) {\n return \"\";\n }\n let result = \"\";\n if (indent) {\n result += newLine;\n for (let i = 0; i < indent; i++) {\n result += \" \";\n }\n }\n result += diag.messageText;\n indent++;\n if (diag.next) {\n for (const kid of diag.next) {\n result += flattenDiagnosticMessageText(kid, newLine, indent);\n }\n }\n return result;\n}\nfunction displayPartsToString(displayParts) {\n if (displayParts) {\n return displayParts.map((displayPart) => displayPart.text).join(\"\");\n }\n return \"\";\n}\nvar Adapter = class {\n constructor(_worker) {\n this._worker = _worker;\n }\n _textSpanToRange(model, span) {\n let p1 = model.getPositionAt(span.start);\n let p2 = model.getPositionAt(span.start + span.length);\n let { lineNumber: startLineNumber, column: startColumn } = p1;\n let { lineNumber: endLineNumber, column: endColumn } = p2;\n return { startLineNumber, startColumn, endLineNumber, endColumn };\n }\n};\nvar LibFiles = class {\n constructor(_worker) {\n this._worker = _worker;\n this._libFiles = {};\n this._hasFetchedLibFiles = false;\n this._fetchLibFilesPromise = null;\n }\n _libFiles;\n _hasFetchedLibFiles;\n _fetchLibFilesPromise;\n isLibFile(uri) {\n if (!uri) {\n return false;\n }\n if (uri.path.indexOf(\"/lib.\") === 0) {\n return !!libFileSet[uri.path.slice(1)];\n }\n return false;\n }\n getOrCreateModel(fileName) {\n const uri = monaco_editor_core_exports.Uri.parse(fileName);\n const model = monaco_editor_core_exports.editor.getModel(uri);\n if (model) {\n return model;\n }\n if (this.isLibFile(uri) && this._hasFetchedLibFiles) {\n return monaco_editor_core_exports.editor.createModel(this._libFiles[uri.path.slice(1)], \"typescript\", uri);\n }\n const matchedLibFile = _monaco_contribution_js__WEBPACK_IMPORTED_MODULE_1__.typescriptDefaults.getExtraLibs()[fileName];\n if (matchedLibFile) {\n return monaco_editor_core_exports.editor.createModel(matchedLibFile.content, \"typescript\", uri);\n }\n return null;\n }\n _containsLibFile(uris) {\n for (let uri of uris) {\n if (this.isLibFile(uri)) {\n return true;\n }\n }\n return false;\n }\n async fetchLibFilesIfNecessary(uris) {\n if (!this._containsLibFile(uris)) {\n return;\n }\n await this._fetchLibFiles();\n }\n _fetchLibFiles() {\n if (!this._fetchLibFilesPromise) {\n this._fetchLibFilesPromise = this._worker().then((w) => w.getLibFiles()).then((libFiles) => {\n this._hasFetchedLibFiles = true;\n this._libFiles = libFiles;\n });\n }\n return this._fetchLibFilesPromise;\n }\n};\nvar DiagnosticsAdapter = class extends Adapter {\n constructor(_libFiles, _defaults, _selector, worker) {\n super(worker);\n this._libFiles = _libFiles;\n this._defaults = _defaults;\n this._selector = _selector;\n const onModelAdd = (model) => {\n if (model.getLanguageId() !== _selector) {\n return;\n }\n const maybeValidate = () => {\n const { onlyVisible } = this._defaults.getDiagnosticsOptions();\n if (onlyVisible) {\n if (model.isAttachedToEditor()) {\n this._doValidate(model);\n }\n } else {\n this._doValidate(model);\n }\n };\n let handle;\n const changeSubscription = model.onDidChangeContent(() => {\n clearTimeout(handle);\n handle = window.setTimeout(maybeValidate, 500);\n });\n const visibleSubscription = model.onDidChangeAttached(() => {\n const { onlyVisible } = this._defaults.getDiagnosticsOptions();\n if (onlyVisible) {\n if (model.isAttachedToEditor()) {\n maybeValidate();\n } else {\n monaco_editor_core_exports.editor.setModelMarkers(model, this._selector, []);\n }\n }\n });\n this._listener[model.uri.toString()] = {\n dispose() {\n changeSubscription.dispose();\n visibleSubscription.dispose();\n clearTimeout(handle);\n }\n };\n maybeValidate();\n };\n const onModelRemoved = (model) => {\n monaco_editor_core_exports.editor.setModelMarkers(model, this._selector, []);\n const key = model.uri.toString();\n if (this._listener[key]) {\n this._listener[key].dispose();\n delete this._listener[key];\n }\n };\n this._disposables.push(monaco_editor_core_exports.editor.onDidCreateModel((model) => onModelAdd(model)));\n this._disposables.push(monaco_editor_core_exports.editor.onWillDisposeModel(onModelRemoved));\n this._disposables.push(monaco_editor_core_exports.editor.onDidChangeModelLanguage((event) => {\n onModelRemoved(event.model);\n onModelAdd(event.model);\n }));\n this._disposables.push({\n dispose() {\n for (const model of monaco_editor_core_exports.editor.getModels()) {\n onModelRemoved(model);\n }\n }\n });\n const recomputeDiagostics = () => {\n for (const model of monaco_editor_core_exports.editor.getModels()) {\n onModelRemoved(model);\n onModelAdd(model);\n }\n };\n this._disposables.push(this._defaults.onDidChange(recomputeDiagostics));\n this._disposables.push(this._defaults.onDidExtraLibsChange(recomputeDiagostics));\n monaco_editor_core_exports.editor.getModels().forEach((model) => onModelAdd(model));\n }\n _disposables = [];\n _listener = /* @__PURE__ */ Object.create(null);\n dispose() {\n this._disposables.forEach((d) => d && d.dispose());\n this._disposables = [];\n }\n async _doValidate(model) {\n const worker = await this._worker(model.uri);\n if (model.isDisposed()) {\n return;\n }\n const promises = [];\n const { noSyntaxValidation, noSemanticValidation, noSuggestionDiagnostics } = this._defaults.getDiagnosticsOptions();\n if (!noSyntaxValidation) {\n promises.push(worker.getSyntacticDiagnostics(model.uri.toString()));\n }\n if (!noSemanticValidation) {\n promises.push(worker.getSemanticDiagnostics(model.uri.toString()));\n }\n if (!noSuggestionDiagnostics) {\n promises.push(worker.getSuggestionDiagnostics(model.uri.toString()));\n }\n const allDiagnostics = await Promise.all(promises);\n if (!allDiagnostics || model.isDisposed()) {\n return;\n }\n const diagnostics = allDiagnostics.reduce((p, c) => c.concat(p), []).filter((d) => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) === -1);\n const relatedUris = diagnostics.map((d) => d.relatedInformation || []).reduce((p, c) => c.concat(p), []).map((relatedInformation) => relatedInformation.file ? monaco_editor_core_exports.Uri.parse(relatedInformation.file.fileName) : null);\n await this._libFiles.fetchLibFilesIfNecessary(relatedUris);\n if (model.isDisposed()) {\n return;\n }\n monaco_editor_core_exports.editor.setModelMarkers(model, this._selector, diagnostics.map((d) => this._convertDiagnostics(model, d)));\n }\n _convertDiagnostics(model, diag) {\n const diagStart = diag.start || 0;\n const diagLength = diag.length || 1;\n const { lineNumber: startLineNumber, column: startColumn } = model.getPositionAt(diagStart);\n const { lineNumber: endLineNumber, column: endColumn } = model.getPositionAt(diagStart + diagLength);\n const tags = [];\n if (diag.reportsUnnecessary) {\n tags.push(monaco_editor_core_exports.MarkerTag.Unnecessary);\n }\n if (diag.reportsDeprecated) {\n tags.push(monaco_editor_core_exports.MarkerTag.Deprecated);\n }\n return {\n severity: this._tsDiagnosticCategoryToMarkerSeverity(diag.category),\n startLineNumber,\n startColumn,\n endLineNumber,\n endColumn,\n message: flattenDiagnosticMessageText(diag.messageText, \"\\n\"),\n code: diag.code.toString(),\n tags,\n relatedInformation: this._convertRelatedInformation(model, diag.relatedInformation)\n };\n }\n _convertRelatedInformation(model, relatedInformation) {\n if (!relatedInformation) {\n return [];\n }\n const result = [];\n relatedInformation.forEach((info) => {\n let relatedResource = model;\n if (info.file) {\n relatedResource = this._libFiles.getOrCreateModel(info.file.fileName);\n }\n if (!relatedResource) {\n return;\n }\n const infoStart = info.start || 0;\n const infoLength = info.length || 1;\n const { lineNumber: startLineNumber, column: startColumn } = relatedResource.getPositionAt(infoStart);\n const { lineNumber: endLineNumber, column: endColumn } = relatedResource.getPositionAt(infoStart + infoLength);\n result.push({\n resource: relatedResource.uri,\n startLineNumber,\n startColumn,\n endLineNumber,\n endColumn,\n message: flattenDiagnosticMessageText(info.messageText, \"\\n\")\n });\n });\n return result;\n }\n _tsDiagnosticCategoryToMarkerSeverity(category) {\n switch (category) {\n case 1 /* Error */:\n return monaco_editor_core_exports.MarkerSeverity.Error;\n case 3 /* Message */:\n return monaco_editor_core_exports.MarkerSeverity.Info;\n case 0 /* Warning */:\n return monaco_editor_core_exports.MarkerSeverity.Warning;\n case 2 /* Suggestion */:\n return monaco_editor_core_exports.MarkerSeverity.Hint;\n }\n return monaco_editor_core_exports.MarkerSeverity.Info;\n }\n};\nvar SuggestAdapter = class extends Adapter {\n get triggerCharacters() {\n return [\".\"];\n }\n async provideCompletionItems(model, position, _context, token) {\n const wordInfo = model.getWordUntilPosition(position);\n const wordRange = new monaco_editor_core_exports.Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const info = await worker.getCompletionsAtPosition(resource.toString(), offset);\n if (!info || model.isDisposed()) {\n return;\n }\n const suggestions = info.entries.map((entry) => {\n let range = wordRange;\n if (entry.replacementSpan) {\n const p1 = model.getPositionAt(entry.replacementSpan.start);\n const p2 = model.getPositionAt(entry.replacementSpan.start + entry.replacementSpan.length);\n range = new monaco_editor_core_exports.Range(p1.lineNumber, p1.column, p2.lineNumber, p2.column);\n }\n const tags = [];\n if (entry.kindModifiers?.indexOf(\"deprecated\") !== -1) {\n tags.push(monaco_editor_core_exports.languages.CompletionItemTag.Deprecated);\n }\n return {\n uri: resource,\n position,\n offset,\n range,\n label: entry.name,\n insertText: entry.name,\n sortText: entry.sortText,\n kind: SuggestAdapter.convertKind(entry.kind),\n tags\n };\n });\n return {\n suggestions\n };\n }\n async resolveCompletionItem(item, token) {\n const myItem = item;\n const resource = myItem.uri;\n const position = myItem.position;\n const offset = myItem.offset;\n const worker = await this._worker(resource);\n const details = await worker.getCompletionEntryDetails(resource.toString(), offset, myItem.label);\n if (!details) {\n return myItem;\n }\n return {\n uri: resource,\n position,\n label: details.name,\n kind: SuggestAdapter.convertKind(details.kind),\n detail: displayPartsToString(details.displayParts),\n documentation: {\n value: SuggestAdapter.createDocumentationString(details)\n }\n };\n }\n static convertKind(kind) {\n switch (kind) {\n case Kind.primitiveType:\n case Kind.keyword:\n return monaco_editor_core_exports.languages.CompletionItemKind.Keyword;\n case Kind.variable:\n case Kind.localVariable:\n return monaco_editor_core_exports.languages.CompletionItemKind.Variable;\n case Kind.memberVariable:\n case Kind.memberGetAccessor:\n case Kind.memberSetAccessor:\n return monaco_editor_core_exports.languages.CompletionItemKind.Field;\n case Kind.function:\n case Kind.memberFunction:\n case Kind.constructSignature:\n case Kind.callSignature:\n case Kind.indexSignature:\n return monaco_editor_core_exports.languages.CompletionItemKind.Function;\n case Kind.enum:\n return monaco_editor_core_exports.languages.CompletionItemKind.Enum;\n case Kind.module:\n return monaco_editor_core_exports.languages.CompletionItemKind.Module;\n case Kind.class:\n return monaco_editor_core_exports.languages.CompletionItemKind.Class;\n case Kind.interface:\n return monaco_editor_core_exports.languages.CompletionItemKind.Interface;\n case Kind.warning:\n return monaco_editor_core_exports.languages.CompletionItemKind.File;\n }\n return monaco_editor_core_exports.languages.CompletionItemKind.Property;\n }\n static createDocumentationString(details) {\n let documentationString = displayPartsToString(details.documentation);\n if (details.tags) {\n for (const tag of details.tags) {\n documentationString += `\n\n${tagToString(tag)}`;\n }\n }\n return documentationString;\n }\n};\nfunction tagToString(tag) {\n let tagLabel = `*@${tag.name}*`;\n if (tag.name === \"param\" && tag.text) {\n const [paramName, ...rest] = tag.text;\n tagLabel += `\\`${paramName.text}\\``;\n if (rest.length > 0)\n tagLabel += ` \\u2014 ${rest.map((r) => r.text).join(\" \")}`;\n } else if (Array.isArray(tag.text)) {\n tagLabel += ` \\u2014 ${tag.text.map((r) => r.text).join(\" \")}`;\n } else if (tag.text) {\n tagLabel += ` \\u2014 ${tag.text}`;\n }\n return tagLabel;\n}\nvar SignatureHelpAdapter = class extends Adapter {\n signatureHelpTriggerCharacters = [\"(\", \",\"];\n static _toSignatureHelpTriggerReason(context) {\n switch (context.triggerKind) {\n case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.TriggerCharacter:\n if (context.triggerCharacter) {\n if (context.isRetrigger) {\n return { kind: \"retrigger\", triggerCharacter: context.triggerCharacter };\n } else {\n return { kind: \"characterTyped\", triggerCharacter: context.triggerCharacter };\n }\n } else {\n return { kind: \"invoked\" };\n }\n case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.ContentChange:\n return context.isRetrigger ? { kind: \"retrigger\" } : { kind: \"invoked\" };\n case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.Invoke:\n default:\n return { kind: \"invoked\" };\n }\n }\n async provideSignatureHelp(model, position, token, context) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const info = await worker.getSignatureHelpItems(resource.toString(), offset, {\n triggerReason: SignatureHelpAdapter._toSignatureHelpTriggerReason(context)\n });\n if (!info || model.isDisposed()) {\n return;\n }\n const ret = {\n activeSignature: info.selectedItemIndex,\n activeParameter: info.argumentIndex,\n signatures: []\n };\n info.items.forEach((item) => {\n const signature = {\n label: \"\",\n parameters: []\n };\n signature.documentation = {\n value: displayPartsToString(item.documentation)\n };\n signature.label += displayPartsToString(item.prefixDisplayParts);\n item.parameters.forEach((p, i, a) => {\n const label = displayPartsToString(p.displayParts);\n const parameter = {\n label,\n documentation: {\n value: displayPartsToString(p.documentation)\n }\n };\n signature.label += label;\n signature.parameters.push(parameter);\n if (i < a.length - 1) {\n signature.label += displayPartsToString(item.separatorDisplayParts);\n }\n });\n signature.label += displayPartsToString(item.suffixDisplayParts);\n ret.signatures.push(signature);\n });\n return {\n value: ret,\n dispose() {\n }\n };\n }\n};\nvar QuickInfoAdapter = class extends Adapter {\n async provideHover(model, position, token) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const info = await worker.getQuickInfoAtPosition(resource.toString(), offset);\n if (!info || model.isDisposed()) {\n return;\n }\n const documentation = displayPartsToString(info.documentation);\n const tags = info.tags ? info.tags.map((tag) => tagToString(tag)).join(\" \\n\\n\") : \"\";\n const contents = displayPartsToString(info.displayParts);\n return {\n range: this._textSpanToRange(model, info.textSpan),\n contents: [\n {\n value: \"```typescript\\n\" + contents + \"\\n```\\n\"\n },\n {\n value: documentation + (tags ? \"\\n\\n\" + tags : \"\")\n }\n ]\n };\n }\n};\nvar OccurrencesAdapter = class extends Adapter {\n async provideDocumentHighlights(model, position, token) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const entries = await worker.getOccurrencesAtPosition(resource.toString(), offset);\n if (!entries || model.isDisposed()) {\n return;\n }\n return entries.map((entry) => {\n return {\n range: this._textSpanToRange(model, entry.textSpan),\n kind: entry.isWriteAccess ? monaco_editor_core_exports.languages.DocumentHighlightKind.Write : monaco_editor_core_exports.languages.DocumentHighlightKind.Text\n };\n });\n }\n};\nvar DefinitionAdapter = class extends Adapter {\n constructor(_libFiles, worker) {\n super(worker);\n this._libFiles = _libFiles;\n }\n async provideDefinition(model, position, token) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const entries = await worker.getDefinitionAtPosition(resource.toString(), offset);\n if (!entries || model.isDisposed()) {\n return;\n }\n await this._libFiles.fetchLibFilesIfNecessary(entries.map((entry) => monaco_editor_core_exports.Uri.parse(entry.fileName)));\n if (model.isDisposed()) {\n return;\n }\n const result = [];\n for (let entry of entries) {\n const refModel = this._libFiles.getOrCreateModel(entry.fileName);\n if (refModel) {\n result.push({\n uri: refModel.uri,\n range: this._textSpanToRange(refModel, entry.textSpan)\n });\n }\n }\n return result;\n }\n};\nvar ReferenceAdapter = class extends Adapter {\n constructor(_libFiles, worker) {\n super(worker);\n this._libFiles = _libFiles;\n }\n async provideReferences(model, position, context, token) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const entries = await worker.getReferencesAtPosition(resource.toString(), offset);\n if (!entries || model.isDisposed()) {\n return;\n }\n await this._libFiles.fetchLibFilesIfNecessary(entries.map((entry) => monaco_editor_core_exports.Uri.parse(entry.fileName)));\n if (model.isDisposed()) {\n return;\n }\n const result = [];\n for (let entry of entries) {\n const refModel = this._libFiles.getOrCreateModel(entry.fileName);\n if (refModel) {\n result.push({\n uri: refModel.uri,\n range: this._textSpanToRange(refModel, entry.textSpan)\n });\n }\n }\n return result;\n }\n};\nvar OutlineAdapter = class extends Adapter {\n async provideDocumentSymbols(model, token) {\n const resource = model.uri;\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const items = await worker.getNavigationBarItems(resource.toString());\n if (!items || model.isDisposed()) {\n return;\n }\n const convert = (bucket, item, containerLabel) => {\n let result2 = {\n name: item.text,\n detail: \"\",\n kind: outlineTypeTable[item.kind] || monaco_editor_core_exports.languages.SymbolKind.Variable,\n range: this._textSpanToRange(model, item.spans[0]),\n selectionRange: this._textSpanToRange(model, item.spans[0]),\n tags: []\n };\n if (containerLabel)\n result2.containerName = containerLabel;\n if (item.childItems && item.childItems.length > 0) {\n for (let child of item.childItems) {\n convert(bucket, child, result2.name);\n }\n }\n bucket.push(result2);\n };\n let result = [];\n items.forEach((item) => convert(result, item));\n return result;\n }\n};\nvar Kind = class {\n};\n__publicField(Kind, \"unknown\", \"\");\n__publicField(Kind, \"keyword\", \"keyword\");\n__publicField(Kind, \"script\", \"script\");\n__publicField(Kind, \"module\", \"module\");\n__publicField(Kind, \"class\", \"class\");\n__publicField(Kind, \"interface\", \"interface\");\n__publicField(Kind, \"type\", \"type\");\n__publicField(Kind, \"enum\", \"enum\");\n__publicField(Kind, \"variable\", \"var\");\n__publicField(Kind, \"localVariable\", \"local var\");\n__publicField(Kind, \"function\", \"function\");\n__publicField(Kind, \"localFunction\", \"local function\");\n__publicField(Kind, \"memberFunction\", \"method\");\n__publicField(Kind, \"memberGetAccessor\", \"getter\");\n__publicField(Kind, \"memberSetAccessor\", \"setter\");\n__publicField(Kind, \"memberVariable\", \"property\");\n__publicField(Kind, \"constructorImplementation\", \"constructor\");\n__publicField(Kind, \"callSignature\", \"call\");\n__publicField(Kind, \"indexSignature\", \"index\");\n__publicField(Kind, \"constructSignature\", \"construct\");\n__publicField(Kind, \"parameter\", \"parameter\");\n__publicField(Kind, \"typeParameter\", \"type parameter\");\n__publicField(Kind, \"primitiveType\", \"primitive type\");\n__publicField(Kind, \"label\", \"label\");\n__publicField(Kind, \"alias\", \"alias\");\n__publicField(Kind, \"const\", \"const\");\n__publicField(Kind, \"let\", \"let\");\n__publicField(Kind, \"warning\", \"warning\");\nvar outlineTypeTable = /* @__PURE__ */ Object.create(null);\noutlineTypeTable[Kind.module] = monaco_editor_core_exports.languages.SymbolKind.Module;\noutlineTypeTable[Kind.class] = monaco_editor_core_exports.languages.SymbolKind.Class;\noutlineTypeTable[Kind.enum] = monaco_editor_core_exports.languages.SymbolKind.Enum;\noutlineTypeTable[Kind.interface] = monaco_editor_core_exports.languages.SymbolKind.Interface;\noutlineTypeTable[Kind.memberFunction] = monaco_editor_core_exports.languages.SymbolKind.Method;\noutlineTypeTable[Kind.memberVariable] = monaco_editor_core_exports.languages.SymbolKind.Property;\noutlineTypeTable[Kind.memberGetAccessor] = monaco_editor_core_exports.languages.SymbolKind.Property;\noutlineTypeTable[Kind.memberSetAccessor] = monaco_editor_core_exports.languages.SymbolKind.Property;\noutlineTypeTable[Kind.variable] = monaco_editor_core_exports.languages.SymbolKind.Variable;\noutlineTypeTable[Kind.const] = monaco_editor_core_exports.languages.SymbolKind.Variable;\noutlineTypeTable[Kind.localVariable] = monaco_editor_core_exports.languages.SymbolKind.Variable;\noutlineTypeTable[Kind.variable] = monaco_editor_core_exports.languages.SymbolKind.Variable;\noutlineTypeTable[Kind.function] = monaco_editor_core_exports.languages.SymbolKind.Function;\noutlineTypeTable[Kind.localFunction] = monaco_editor_core_exports.languages.SymbolKind.Function;\nvar FormatHelper = class extends Adapter {\n static _convertOptions(options) {\n return {\n ConvertTabsToSpaces: options.insertSpaces,\n TabSize: options.tabSize,\n IndentSize: options.tabSize,\n IndentStyle: 2 /* Smart */,\n NewLineCharacter: \"\\n\",\n InsertSpaceAfterCommaDelimiter: true,\n InsertSpaceAfterSemicolonInForStatements: true,\n InsertSpaceBeforeAndAfterBinaryOperators: true,\n InsertSpaceAfterKeywordsInControlFlowStatements: true,\n InsertSpaceAfterFunctionKeywordForAnonymousFunctions: true,\n InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,\n InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,\n InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,\n PlaceOpenBraceOnNewLineForControlBlocks: false,\n PlaceOpenBraceOnNewLineForFunctions: false\n };\n }\n _convertTextChanges(model, change) {\n return {\n text: change.newText,\n range: this._textSpanToRange(model, change.span)\n };\n }\n};\nvar FormatAdapter = class extends FormatHelper {\n async provideDocumentRangeFormattingEdits(model, range, options, token) {\n const resource = model.uri;\n const startOffset = model.getOffsetAt({\n lineNumber: range.startLineNumber,\n column: range.startColumn\n });\n const endOffset = model.getOffsetAt({\n lineNumber: range.endLineNumber,\n column: range.endColumn\n });\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const edits = await worker.getFormattingEditsForRange(resource.toString(), startOffset, endOffset, FormatHelper._convertOptions(options));\n if (!edits || model.isDisposed()) {\n return;\n }\n return edits.map((edit) => this._convertTextChanges(model, edit));\n }\n};\nvar FormatOnTypeAdapter = class extends FormatHelper {\n get autoFormatTriggerCharacters() {\n return [\";\", \"}\", \"\\n\"];\n }\n async provideOnTypeFormattingEdits(model, position, ch, options, token) {\n const resource = model.uri;\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const edits = await worker.getFormattingEditsAfterKeystroke(resource.toString(), offset, ch, FormatHelper._convertOptions(options));\n if (!edits || model.isDisposed()) {\n return;\n }\n return edits.map((edit) => this._convertTextChanges(model, edit));\n }\n};\nvar CodeActionAdaptor = class extends FormatHelper {\n async provideCodeActions(model, range, context, token) {\n const resource = model.uri;\n const start = model.getOffsetAt({\n lineNumber: range.startLineNumber,\n column: range.startColumn\n });\n const end = model.getOffsetAt({\n lineNumber: range.endLineNumber,\n column: range.endColumn\n });\n const formatOptions = FormatHelper._convertOptions(model.getOptions());\n const errorCodes = context.markers.filter((m) => m.code).map((m) => m.code).map(Number);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const codeFixes = await worker.getCodeFixesAtPosition(resource.toString(), start, end, errorCodes, formatOptions);\n if (!codeFixes || model.isDisposed()) {\n return { actions: [], dispose: () => {\n } };\n }\n const actions = codeFixes.filter((fix) => {\n return fix.changes.filter((change) => change.isNewFile).length === 0;\n }).map((fix) => {\n return this._tsCodeFixActionToMonacoCodeAction(model, context, fix);\n });\n return {\n actions,\n dispose: () => {\n }\n };\n }\n _tsCodeFixActionToMonacoCodeAction(model, context, codeFix) {\n const edits = [];\n for (const change of codeFix.changes) {\n for (const textChange of change.textChanges) {\n edits.push({\n resource: model.uri,\n edit: {\n range: this._textSpanToRange(model, textChange.span),\n text: textChange.newText\n }\n });\n }\n }\n const action = {\n title: codeFix.description,\n edit: { edits },\n diagnostics: context.markers,\n kind: \"quickfix\"\n };\n return action;\n }\n};\nvar RenameAdapter = class extends Adapter {\n constructor(_libFiles, worker) {\n super(worker);\n this._libFiles = _libFiles;\n }\n async provideRenameEdits(model, position, newName, token) {\n const resource = model.uri;\n const fileName = resource.toString();\n const offset = model.getOffsetAt(position);\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return;\n }\n const renameInfo = await worker.getRenameInfo(fileName, offset, {\n allowRenameOfImportPath: false\n });\n if (renameInfo.canRename === false) {\n return {\n edits: [],\n rejectReason: renameInfo.localizedErrorMessage\n };\n }\n if (renameInfo.fileToRename !== void 0) {\n throw new Error(\"Renaming files is not supported.\");\n }\n const renameLocations = await worker.findRenameLocations(fileName, offset, false, false, false);\n if (!renameLocations || model.isDisposed()) {\n return;\n }\n const edits = [];\n for (const renameLocation of renameLocations) {\n const model2 = this._libFiles.getOrCreateModel(renameLocation.fileName);\n if (model2) {\n edits.push({\n resource: model2.uri,\n edit: {\n range: this._textSpanToRange(model2, renameLocation.textSpan),\n text: newName\n }\n });\n } else {\n throw new Error(`Unknown file ${renameLocation.fileName}.`);\n }\n }\n return { edits };\n }\n};\nvar InlayHintsAdapter = class extends Adapter {\n async provideInlayHints(model, range, token) {\n const resource = model.uri;\n const fileName = resource.toString();\n const start = model.getOffsetAt({\n lineNumber: range.startLineNumber,\n column: range.startColumn\n });\n const end = model.getOffsetAt({\n lineNumber: range.endLineNumber,\n column: range.endColumn\n });\n const worker = await this._worker(resource);\n if (model.isDisposed()) {\n return null;\n }\n const tsHints = await worker.provideInlayHints(fileName, start, end);\n const hints = tsHints.map((hint) => {\n return {\n ...hint,\n label: hint.text,\n position: model.getPositionAt(hint.position),\n kind: this._convertHintKind(hint.kind)\n };\n });\n return { hints, dispose: () => {\n } };\n }\n _convertHintKind(kind) {\n switch (kind) {\n case \"Parameter\":\n return monaco_editor_core_exports.languages.InlayHintKind.Parameter;\n case \"Type\":\n return monaco_editor_core_exports.languages.InlayHintKind.Type;\n default:\n return monaco_editor_core_exports.languages.InlayHintKind.Type;\n }\n }\n};\n\n// src/language/typescript/tsMode.ts\nvar javaScriptWorker;\nvar typeScriptWorker;\nfunction setupTypeScript(defaults) {\n typeScriptWorker = setupMode(defaults, \"typescript\");\n}\nfunction setupJavaScript(defaults) {\n javaScriptWorker = setupMode(defaults, \"javascript\");\n}\nfunction getJavaScriptWorker() {\n return new Promise((resolve, reject) => {\n if (!javaScriptWorker) {\n return reject(\"JavaScript not registered!\");\n }\n resolve(javaScriptWorker);\n });\n}\nfunction getTypeScriptWorker() {\n return new Promise((resolve, reject) => {\n if (!typeScriptWorker) {\n return reject(\"TypeScript not registered!\");\n }\n resolve(typeScriptWorker);\n });\n}\nfunction setupMode(defaults, modeId) {\n const client = new WorkerManager(modeId, defaults);\n const worker = (...uris) => {\n return client.getLanguageServiceWorker(...uris);\n };\n const libFiles = new LibFiles(worker);\n monaco_editor_core_exports.languages.registerCompletionItemProvider(modeId, new SuggestAdapter(worker));\n monaco_editor_core_exports.languages.registerSignatureHelpProvider(modeId, new SignatureHelpAdapter(worker));\n monaco_editor_core_exports.languages.registerHoverProvider(modeId, new QuickInfoAdapter(worker));\n monaco_editor_core_exports.languages.registerDocumentHighlightProvider(modeId, new OccurrencesAdapter(worker));\n monaco_editor_core_exports.languages.registerDefinitionProvider(modeId, new DefinitionAdapter(libFiles, worker));\n monaco_editor_core_exports.languages.registerReferenceProvider(modeId, new ReferenceAdapter(libFiles, worker));\n monaco_editor_core_exports.languages.registerDocumentSymbolProvider(modeId, new OutlineAdapter(worker));\n monaco_editor_core_exports.languages.registerDocumentRangeFormattingEditProvider(modeId, new FormatAdapter(worker));\n monaco_editor_core_exports.languages.registerOnTypeFormattingEditProvider(modeId, new FormatOnTypeAdapter(worker));\n monaco_editor_core_exports.languages.registerCodeActionProvider(modeId, new CodeActionAdaptor(worker));\n monaco_editor_core_exports.languages.registerRenameProvider(modeId, new RenameAdapter(libFiles, worker));\n monaco_editor_core_exports.languages.registerInlayHintsProvider(modeId, new InlayHintsAdapter(worker));\n new DiagnosticsAdapter(libFiles, defaults, modeId, worker);\n return worker;\n}\n\n\n\n//# sourceURL=webpack://monanco_wpack/./node_modules/monaco-editor/esm/vs/language/typescript/tsMode.js?");
|
|
|
|
/***/ })
|
|
|
|
}]); |