UNPKG

yanzi-monaco-editorbb

Version:

这是一个基于微软的monaco和vue封装的一个代码编辑器,浏览器可运行。主要功能有:html、javascript、css代码编辑,高亮显示,语法错误提示等,可以帮您的项目很快的拥有一个web端的代码编辑器

1,561 lines (1,201 loc) 112 kB
((typeof self !== 'undefined' ? self : this)["webpackJsonpyanziMonacoEditor"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpyanziMonacoEditor"] || []).push([[81],{ /***/ "47b9": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionAdapter", function() { return CompletionAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefinitionAdapter", function() { return DefinitionAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticsAdapter", function() { return DiagnosticsAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentColorAdapter", function() { return DocumentColorAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentFormattingEditProvider", function() { return DocumentFormattingEditProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightAdapter", function() { return DocumentHighlightAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLinkAdapter", function() { return DocumentLinkAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentRangeFormattingEditProvider", function() { return DocumentRangeFormattingEditProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbolAdapter", function() { return DocumentSymbolAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeAdapter", function() { return FoldingRangeAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HoverAdapter", function() { return HoverAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReferenceAdapter", function() { return ReferenceAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameAdapter", function() { return RenameAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRangeAdapter", function() { return SelectionRangeAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkerManager", function() { return WorkerManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromPosition", function() { return fromPosition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromRange", function() { return fromRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupMode", function() { return setupMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRange", function() { return toRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toTextEdit", function() { return toTextEdit; }); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("262e"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("2caf"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("d4ec"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("bee2"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("ade3"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("b85c"); /* harmony import */ var _Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_typeof_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("53ca"); /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("e439"); /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var core_js_modules_es_object_get_own_property_names_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("7039"); /* harmony import */ var core_js_modules_es_object_get_own_property_names_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_names_js__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("a9e3"); /* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("d9e2"); /* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("ac1f"); /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("5319"); /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_12__); /* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("a4d3"); /* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_13__); /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("e01a"); /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_14__); /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("d3b7"); /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_15__); /* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("a434"); /* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_16__); /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("25f0"); /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_17__); /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("159b"); /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_18__); /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("b64b"); /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_19__); /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("b0c0"); /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20__); /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("fb6a"); /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_21__); /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__("d81d"); /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_22__); /* harmony import */ var _editor_editor_api_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__("f33e"); /* harmony import */ var _editor_editor_api_js__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_editor_editor_api_js__WEBPACK_IMPORTED_MODULE_23__); /*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.32.1(29a273516805a852aa8edc5e05059f119b13eff0) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt *-----------------------------------------------------------------------------*/ var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __reExport = function __reExport(target, module, copyDefault, desc) { if (module && Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_typeof_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(module) === "object" || typeof module === "function") { var _iterator = Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(__getOwnPropNames(module)), _step; try { var _loop = function _loop() { var key = _step.value; if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) __defProp(target, key, { get: function get() { return module[key]; }, enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); }; for (_iterator.s(); !(_step = _iterator.n()).done;) { _loop(); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } } return target; }; // src/fillers/monaco-editor-core.ts var monaco_editor_core_exports = {}; __reExport(monaco_editor_core_exports, _editor_editor_api_js__WEBPACK_IMPORTED_MODULE_23__); // src/language/json/workerManager.ts var STOP_WHEN_IDLE_FOR = 2 * 60 * 1e3; var WorkerManager = /*#__PURE__*/function () { function WorkerManager(defaults) { var _this2 = this; Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(this, WorkerManager); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_defaults", void 0); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_idleCheckInterval", void 0); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_lastUsedTime", void 0); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_configChangeListener", void 0); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_worker", void 0); Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, "_client", void 0); this._defaults = defaults; this._worker = null; this._client = null; this._idleCheckInterval = window.setInterval(function () { return _this2._checkIfIdle(); }, 30 * 1e3); this._lastUsedTime = 0; this._configChangeListener = this._defaults.onDidChange(function () { return _this2._stopWorker(); }); } Object(_Users_hexiaochao_Downloads_yanzi_moncao_master_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(WorkerManager, [{ key: "_stopWorker", value: function _stopWorker() { if (this._worker) { this._worker.dispose(); this._worker = null; } this._client = null; } }, { key: "dispose", value: function dispose() { clearInterval(this._idleCheckInterval); this._configChangeListener.dispose(); this._stopWorker(); } }, { key: "_checkIfIdle", value: function _checkIfIdle() { if (!this._worker) { return; } var timePassedSinceLastUsed = Date.now() - this._lastUsedTime; if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) { this._stopWorker(); } } }, { key: "_getClient", value: function _getClient() { this._lastUsedTime = Date.now(); if (!this._client) { this._worker = monaco_editor_core_exports.editor.createWebWorker({ moduleId: "vs/language/json/jsonWorker", label: this._defaults.languageId, createData: { languageSettings: this._defaults.diagnosticsOptions, languageId: this._defaults.languageId, enableSchemaRequest: this._defaults.diagnosticsOptions.enableSchemaRequest } }); this._client = this._worker.getProxy(); } return this._client; } }, { key: "getLanguageServiceWorker", value: function getLanguageServiceWorker() { var _this3 = this; for (var _len = arguments.length, resources = new Array(_len), _key = 0; _key < _len; _key++) { resources[_key] = arguments[_key]; } var _client; return this._getClient().then(function (client) { _client = client; }).then(function (_) { if (_this3._worker) { return _this3._worker.withSyncedResources(resources); } }).then(function (_) { return _client; }); } }]); return WorkerManager; }(); // node_modules/vscode-languageserver-types/lib/esm/main.js var integer; (function (integer2) { integer2.MIN_VALUE = -2147483648; integer2.MAX_VALUE = 2147483647; })(integer || (integer = {})); var uinteger; (function (uinteger2) { uinteger2.MIN_VALUE = 0; uinteger2.MAX_VALUE = 2147483647; })(uinteger || (uinteger = {})); var Position; (function (Position3) { function create(line, character) { if (line === Number.MAX_VALUE) { line = uinteger.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger.MAX_VALUE; } return { line: line, character: character }; } Position3.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); } Position3.is = is; })(Position || (Position = {})); var Range; (function (Range3) { function create(one, two, three, four) { if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { return { start: Position.create(one, two), end: Position.create(three, four) }; } else if (Position.is(one) && Position.is(two)) { return { start: one, end: two }; } else { throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); } } Range3.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); } Range3.is = is; })(Range || (Range = {})); var Location; (function (Location2) { function create(uri, range) { return { uri: uri, range: range }; } Location2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); } Location2.is = is; })(Location || (Location = {})); var LocationLink; (function (LocationLink2) { function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange }; } LocationLink2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); } LocationLink2.is = is; })(LocationLink || (LocationLink = {})); var Color; (function (Color2) { function create(red, green, blue, alpha) { return { red: red, green: green, blue: blue, alpha: alpha }; } Color2.create = create; function is(value) { var candidate = value; return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); } Color2.is = is; })(Color || (Color = {})); var ColorInformation; (function (ColorInformation2) { function create(range, color) { return { range: range, color: color }; } ColorInformation2.create = create; function is(value) { var candidate = value; return Range.is(candidate.range) && Color.is(candidate.color); } ColorInformation2.is = is; })(ColorInformation || (ColorInformation = {})); var ColorPresentation; (function (ColorPresentation2) { function create(label, textEdit, additionalTextEdits) { return { label: label, textEdit: textEdit, additionalTextEdits: additionalTextEdits }; } ColorPresentation2.create = create; function is(value) { var candidate = value; return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); } ColorPresentation2.is = is; })(ColorPresentation || (ColorPresentation = {})); var FoldingRangeKind; (function (FoldingRangeKind2) { FoldingRangeKind2["Comment"] = "comment"; FoldingRangeKind2["Imports"] = "imports"; FoldingRangeKind2["Region"] = "region"; })(FoldingRangeKind || (FoldingRangeKind = {})); var FoldingRange; (function (FoldingRange2) { function create(startLine, endLine, startCharacter, endCharacter, kind) { var result = { startLine: startLine, endLine: endLine }; if (Is.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is.defined(kind)) { result.kind = kind; } return result; } FoldingRange2.create = create; function is(value) { var candidate = value; return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); } FoldingRange2.is = is; })(FoldingRange || (FoldingRange = {})); var DiagnosticRelatedInformation; (function (DiagnosticRelatedInformation2) { function create(location, message) { return { location: location, message: message }; } DiagnosticRelatedInformation2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); } DiagnosticRelatedInformation2.is = is; })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); var DiagnosticSeverity; (function (DiagnosticSeverity2) { DiagnosticSeverity2.Error = 1; DiagnosticSeverity2.Warning = 2; DiagnosticSeverity2.Information = 3; DiagnosticSeverity2.Hint = 4; })(DiagnosticSeverity || (DiagnosticSeverity = {})); var DiagnosticTag; (function (DiagnosticTag2) { DiagnosticTag2.Unnecessary = 1; DiagnosticTag2.Deprecated = 2; })(DiagnosticTag || (DiagnosticTag = {})); var CodeDescription; (function (CodeDescription2) { function is(value) { var candidate = value; return candidate !== void 0 && candidate !== null && Is.string(candidate.href); } CodeDescription2.is = is; })(CodeDescription || (CodeDescription = {})); var Diagnostic; (function (Diagnostic2) { function create(range, message, severity, code, source, relatedInformation) { var result = { range: range, message: message }; if (Is.defined(severity)) { result.severity = severity; } if (Is.defined(code)) { result.code = code; } if (Is.defined(source)) { result.source = source; } if (Is.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic2.create = create; function is(value) { var _a; var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); } Diagnostic2.is = is; })(Diagnostic || (Diagnostic = {})); var Command; (function (Command2) { function create(title, command) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var result = { title: title, command: command }; if (Is.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); } Command2.is = is; })(Command || (Command = {})); var TextEdit; (function (TextEdit2) { function replace(range, newText) { return { range: range, newText: newText }; } TextEdit2.replace = replace; function insert(position, newText) { return { range: { start: position, end: position }, newText: newText }; } TextEdit2.insert = insert; function del(range) { return { range: range, newText: "" }; } TextEdit2.del = del; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); } TextEdit2.is = is; })(TextEdit || (TextEdit = {})); var ChangeAnnotation; (function (ChangeAnnotation2) { function create(label, needsConfirmation, description) { var result = { label: label }; if (needsConfirmation !== void 0) { result.needsConfirmation = needsConfirmation; } if (description !== void 0) { result.description = description; } return result; } ChangeAnnotation2.create = create; function is(value) { var candidate = value; return candidate !== void 0 && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } ChangeAnnotation2.is = is; })(ChangeAnnotation || (ChangeAnnotation = {})); var ChangeAnnotationIdentifier; (function (ChangeAnnotationIdentifier2) { function is(value) { var candidate = value; return typeof candidate === "string"; } ChangeAnnotationIdentifier2.is = is; })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); var AnnotatedTextEdit; (function (AnnotatedTextEdit2) { function replace(range, newText, annotation) { return { range: range, newText: newText, annotationId: annotation }; } AnnotatedTextEdit2.replace = replace; function insert(position, newText, annotation) { return { range: { start: position, end: position }, newText: newText, annotationId: annotation }; } AnnotatedTextEdit2.insert = insert; function del(range, annotation) { return { range: range, newText: "", annotationId: annotation }; } AnnotatedTextEdit2.del = del; function is(value) { var candidate = value; return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); } AnnotatedTextEdit2.is = is; })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); var TextDocumentEdit; (function (TextDocumentEdit2) { function create(textDocument, edits) { return { textDocument: textDocument, edits: edits }; } TextDocumentEdit2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit2.is = is; })(TextDocumentEdit || (TextDocumentEdit = {})); var CreateFile; (function (CreateFile2) { function create(uri, options, annotation) { var result = { kind: "create", uri: uri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } CreateFile2.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } CreateFile2.is = is; })(CreateFile || (CreateFile = {})); var RenameFile; (function (RenameFile2) { function create(oldUri, newUri, options, annotation) { var result = { kind: "rename", oldUri: oldUri, newUri: newUri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } RenameFile2.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } RenameFile2.is = is; })(RenameFile || (RenameFile = {})); var DeleteFile; (function (DeleteFile2) { function create(uri, options, annotation) { var result = { kind: "delete", uri: uri }; if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } DeleteFile2.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } DeleteFile2.is = is; })(DeleteFile || (DeleteFile = {})); var WorkspaceEdit; (function (WorkspaceEdit2) { function is(value) { var candidate = value; return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) { if (Is.string(change.kind)) { return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); } else { return TextDocumentEdit.is(change); } })); } WorkspaceEdit2.is = is; })(WorkspaceEdit || (WorkspaceEdit = {})); var TextEditChangeImpl = function () { function TextEditChangeImpl2(edits, changeAnnotations) { this.edits = edits; this.changeAnnotations = changeAnnotations; } TextEditChangeImpl2.prototype.insert = function (position, newText, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.insert(position, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.insert(position, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.insert(position, newText, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.replace = function (range, newText, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.replace(range, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.replace(range, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.replace(range, newText, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.delete = function (range, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.del(range); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.del(range, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.del(range, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.add = function (edit) { this.edits.push(edit); }; TextEditChangeImpl2.prototype.all = function () { return this.edits; }; TextEditChangeImpl2.prototype.clear = function () { this.edits.splice(0, this.edits.length); }; TextEditChangeImpl2.prototype.assertChangeAnnotations = function (value) { if (value === void 0) { throw new Error("Text edit change is not configured to manage change annotations."); } }; return TextEditChangeImpl2; }(); var ChangeAnnotations = function () { function ChangeAnnotations2(annotations) { this._annotations = annotations === void 0 ? /* @__PURE__ */Object.create(null) : annotations; this._counter = 0; this._size = 0; } ChangeAnnotations2.prototype.all = function () { return this._annotations; }; Object.defineProperty(ChangeAnnotations2.prototype, "size", { get: function get() { return this._size; }, enumerable: false, configurable: true }); ChangeAnnotations2.prototype.manage = function (idOrAnnotation, annotation) { var id; if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { id = idOrAnnotation; } else { id = this.nextId(); annotation = idOrAnnotation; } if (this._annotations[id] !== void 0) { throw new Error("Id " + id + " is already in use."); } if (annotation === void 0) { throw new Error("No annotation provided for id " + id); } this._annotations[id] = annotation; this._size++; return id; }; ChangeAnnotations2.prototype.nextId = function () { this._counter++; return this._counter.toString(); }; return ChangeAnnotations2; }(); var WorkspaceChange = function () { function WorkspaceChange2(workspaceEdit) { var _this = this; this._textEditChanges = /* @__PURE__ */Object.create(null); if (workspaceEdit !== void 0) { this._workspaceEdit = workspaceEdit; if (workspaceEdit.documentChanges) { this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); workspaceEdit.changeAnnotations = this._changeAnnotations.all(); workspaceEdit.documentChanges.forEach(function (change) { if (TextDocumentEdit.is(change)) { var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); _this._textEditChanges[change.textDocument.uri] = textEditChange; } }); } else if (workspaceEdit.changes) { Object.keys(workspaceEdit.changes).forEach(function (key) { var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); _this._textEditChanges[key] = textEditChange; }); } } else { this._workspaceEdit = {}; } } Object.defineProperty(WorkspaceChange2.prototype, "edit", { get: function get() { this.initDocumentChanges(); if (this._changeAnnotations !== void 0) { if (this._changeAnnotations.size === 0) { this._workspaceEdit.changeAnnotations = void 0; } else { this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } return this._workspaceEdit; }, enumerable: false, configurable: true }); WorkspaceChange2.prototype.getTextEditChange = function (key) { if (OptionalVersionedTextDocumentIdentifier.is(key)) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var textDocument = { uri: key.uri, version: key.version }; var result = this._textEditChanges[textDocument.uri]; if (!result) { var edits = []; var textDocumentEdit = { textDocument: textDocument, edits: edits }; this._workspaceEdit.documentChanges.push(textDocumentEdit); result = new TextEditChangeImpl(edits, this._changeAnnotations); this._textEditChanges[textDocument.uri] = result; } return result; } else { this.initChanges(); if (this._workspaceEdit.changes === void 0) { throw new Error("Workspace edit is not configured for normal text edit changes."); } var result = this._textEditChanges[key]; if (!result) { var edits = []; this._workspaceEdit.changes[key] = edits; result = new TextEditChangeImpl(edits); this._textEditChanges[key] = result; } return result; } }; WorkspaceChange2.prototype.initDocumentChanges = function () { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._changeAnnotations = new ChangeAnnotations(); this._workspaceEdit.documentChanges = []; this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } }; WorkspaceChange2.prototype.initChanges = function () { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._workspaceEdit.changes = /* @__PURE__ */Object.create(null); } }; WorkspaceChange2.prototype.createFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = CreateFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = CreateFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; WorkspaceChange2.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = RenameFile.create(oldUri, newUri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = RenameFile.create(oldUri, newUri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; WorkspaceChange2.prototype.deleteFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = DeleteFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = DeleteFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; return WorkspaceChange2; }(); var TextDocumentIdentifier; (function (TextDocumentIdentifier2) { function create(uri) { return { uri: uri }; } TextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri); } TextDocumentIdentifier2.is = is; })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); var VersionedTextDocumentIdentifier; (function (VersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri: uri, version: version }; } VersionedTextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); } VersionedTextDocumentIdentifier2.is = is; })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); var OptionalVersionedTextDocumentIdentifier; (function (OptionalVersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri: uri, version: version }; } OptionalVersionedTextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier2.is = is; })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); var TextDocumentItem; (function (TextDocumentItem2) { function create(uri, languageId, version, text) { return { uri: uri, languageId: languageId, version: version, text: text }; } TextDocumentItem2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); } TextDocumentItem2.is = is; })(TextDocumentItem || (TextDocumentItem = {})); var MarkupKind; (function (MarkupKind2) { MarkupKind2.PlainText = "plaintext"; MarkupKind2.Markdown = "markdown"; })(MarkupKind || (MarkupKind = {})); (function (MarkupKind2) { function is(value) { var candidate = value; return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; } MarkupKind2.is = is; })(MarkupKind || (MarkupKind = {})); var MarkupContent; (function (MarkupContent2) { function is(value) { var candidate = value; return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); } MarkupContent2.is = is; })(MarkupContent || (MarkupContent = {})); var CompletionItemKind; (function (CompletionItemKind2) { CompletionItemKind2.Text = 1; CompletionItemKind2.Method = 2; CompletionItemKind2.Function = 3; CompletionItemKind2.Constructor = 4; CompletionItemKind2.Field = 5; CompletionItemKind2.Variable = 6; CompletionItemKind2.Class = 7; CompletionItemKind2.Interface = 8; CompletionItemKind2.Module = 9; CompletionItemKind2.Property = 10; CompletionItemKind2.Unit = 11; CompletionItemKind2.Value = 12; CompletionItemKind2.Enum = 13; CompletionItemKind2.Keyword = 14; CompletionItemKind2.Snippet = 15; CompletionItemKind2.Color = 16; CompletionItemKind2.File = 17; CompletionItemKind2.Reference = 18; CompletionItemKind2.Folder = 19; CompletionItemKind2.EnumMember = 20; CompletionItemKind2.Constant = 21; CompletionItemKind2.Struct = 22; CompletionItemKind2.Event = 23; CompletionItemKind2.Operator = 24; CompletionItemKind2.TypeParameter = 25; })(CompletionItemKind || (CompletionItemKind = {})); var InsertTextFormat; (function (InsertTextFormat2) { InsertTextFormat2.PlainText = 1; InsertTextFormat2.Snippet = 2; })(InsertTextFormat || (InsertTextFormat = {})); var CompletionItemTag; (function (CompletionItemTag2) { CompletionItemTag2.Deprecated = 1; })(CompletionItemTag || (CompletionItemTag = {})); var InsertReplaceEdit; (function (InsertReplaceEdit2) { function create(newText, insert, replace) { return { newText: newText, insert: insert, replace: replace }; } InsertReplaceEdit2.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); } InsertReplaceEdit2.is = is; })(InsertReplaceEdit || (InsertReplaceEdit = {})); var InsertTextMode; (function (InsertTextMode2) { InsertTextMode2.asIs = 1; InsertTextMode2.adjustIndentation = 2; })(InsertTextMode || (InsertTextMode = {})); var CompletionItem; (function (CompletionItem2) { function create(label) { return { label: label }; } CompletionItem2.create = create; })(CompletionItem || (CompletionItem = {})); var CompletionList; (function (CompletionList2) { function create(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList2.create = create; })(CompletionList || (CompletionList = {})); var MarkedString; (function (MarkedString2) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); } MarkedString2.fromPlainText = fromPlainText; function is(value) { var candidate = value; return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); } MarkedString2.is = is; })(MarkedString || (MarkedString = {})); var Hover; (function (Hover2) { function is(value) { var candidate = value; return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); } Hover2.is = is; })(Hover || (Hover = {})); var ParameterInformation; (function (ParameterInformation2) { function create(label, documentation) { return documentation ? { label: label, documentation: documentation } : { label: label }; } ParameterInformation2.create = create; })(ParameterInformation || (ParameterInformation = {})); var SignatureInformation; (function (SignatureInformation2) { function create(label, documentation) { var parameters = []; for (var _i = 2; _i < arguments.length; _i++) { parameters[_i - 2] = arguments[_i]; } var result = { label: label }; if (Is.defined(documentation)) { result.documentation = documentation; } if (Is.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation2.create = create; })(SignatureInformation || (SignatureInformation = {})); var DocumentHighlightKind; (function (DocumentHighlightKind2) { DocumentHighlightKind2.Text = 1; DocumentHighlightKind2.Read = 2; DocumentHighlightKind2.Write = 3; })(DocumentHighlightKind || (DocumentHighlightKind = {})); var DocumentHighlight; (function (DocumentHighlight2) { function create(range, kind) { var result = { range: range }; if (Is.number(kind)) { result.kind = kind; } return result; } DocumentHighlight2.create = create; })(DocumentHighlight || (DocumentHighlight = {})); var SymbolKind; (function (SymbolKind2) { SymbolKind2.File = 1; SymbolKind2.Module = 2; SymbolKind2.Namespace = 3; SymbolKind2.Package = 4; SymbolKind2.Class = 5; SymbolKind2.Method = 6; SymbolKind2.Property = 7; SymbolKind2.Field = 8; SymbolKind2.Constructor = 9; SymbolKind2.Enum = 10; SymbolKind2.Interface = 11; SymbolKind2.Function = 12; SymbolKind2.Variable = 13; SymbolKind2.Constant = 14; SymbolKind2.String = 15; SymbolKind2.Number = 16; SymbolKind2.Boolean = 17; SymbolKind2.Array = 18; SymbolKind2.Object = 19; SymbolKind2.Key = 20; SymbolKind2.Null = 21; SymbolKind2.EnumMember = 22; SymbolKind2.Struct = 23; SymbolKind2.Event = 24; SymbolKind2.Operator = 25; SymbolKind2.TypeParameter = 26; })(SymbolKind || (SymbolKind = {})); var SymbolTag; (function (SymbolTag2) { SymbolTag2.Deprecated = 1; })(SymbolTag || (SymbolTag = {})); var SymbolInformation; (function (SymbolInformation2) { function create(name, kind, range, uri, containerName) { var result = { name: name, kind: kind, location: { uri: uri, range: range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation2.create = create; })(SymbolInformation || (SymbolInformation = {})); var DocumentSymbol; (function (DocumentSymbol2) { function create(name, detail, kind, range, selectionRange, children) { var result = {