+++ /dev/null
-(function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
-/******/ (() => { // webpackBootstrap
-/******/ var __webpack_modules__ = ([
-/* 0 */
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.activate = void 0;
-const coc_nvim_1 = __webpack_require__(1);
-const vscode_languageserver_protocol_1 = __webpack_require__(2);
-const configCacheHandler_1 = __importDefault(__webpack_require__(32));
-const errorHandler_1 = __webpack_require__(34);
-const ignoreFileHandler_1 = __importDefault(__webpack_require__(35));
-const PrettierEditProvider_1 = __importStar(__webpack_require__(85));
-const utils_1 = __webpack_require__(37);
-let formatterHandler;
-let rangeFormatterHandler;
-/**
- * Dispose formatters
- */
-function disposeHandlers() {
- if (formatterHandler) {
- formatterHandler.dispose();
- }
- if (rangeFormatterHandler) {
- rangeFormatterHandler.dispose();
- }
- formatterHandler = undefined;
- rangeFormatterHandler = undefined;
-}
-/**
- * Build formatter selectors
- */
-function selectors(prettierInstance) {
- let languageSelector = utils_1.enabledLanguages(prettierInstance).reduce((curr, language) => {
- return curr.concat([
- { language, scheme: 'file' },
- { language, scheme: 'untitled' },
- ]);
- }, []);
- let rangeLanguageSelector = utils_1.rangeLanguages().reduce((curr, language) => {
- return curr.concat([
- { language, scheme: 'file' },
- { language, scheme: 'untitled' },
- ]);
- }, []);
- return {
- languageSelector,
- rangeLanguageSelector,
- };
-}
-function wait(ms) {
- return new Promise(resolve => {
- setTimeout(() => {
- resolve();
- }, ms);
- });
-}
-function activate(context) {
- return __awaiter(this, void 0, void 0, function* () {
- context.subscriptions.push(errorHandler_1.setupErrorHandler());
- const { fileIsIgnored } = ignoreFileHandler_1.default(context.subscriptions);
- const editProvider = new PrettierEditProvider_1.default(fileIsIgnored);
- const statusItem = coc_nvim_1.workspace.createStatusBarItem(0);
- context.subscriptions.push(statusItem);
- const config = coc_nvim_1.workspace.getConfiguration('prettier');
- statusItem.text = config.get('statusItemText', 'Prettier');
- let priority = config.get('formatterPriority', 1);
- const prettierInstance = yield utils_1.getPrettierInstance();
- if (!prettierInstance)
- return;
- function checkDocument() {
- return __awaiter(this, void 0, void 0, function* () {
- yield wait(30);
- let doc = coc_nvim_1.workspace.getDocument(coc_nvim_1.workspace.bufnr);
- let languageIds = utils_1.enabledLanguages(prettierInstance);
- if (doc && languageIds.indexOf(doc.filetype) !== -1) {
- statusItem.show();
- }
- else {
- statusItem.hide();
- }
- });
- }
- function registerFormatter() {
- disposeHandlers();
- const { languageSelector, rangeLanguageSelector } = selectors(prettierInstance);
- rangeFormatterHandler = coc_nvim_1.languages.registerDocumentRangeFormatProvider(rangeLanguageSelector, editProvider, priority);
- formatterHandler = coc_nvim_1.languages.registerDocumentFormatProvider(languageSelector, editProvider, priority);
- }
- registerFormatter();
- checkDocument().catch(_e => {
- // noop
- });
- coc_nvim_1.events.on('BufEnter', () => __awaiter(this, void 0, void 0, function* () {
- yield checkDocument();
- }), null, context.subscriptions);
- context.subscriptions.push(configCacheHandler_1.default());
- context.subscriptions.push(coc_nvim_1.commands.registerCommand('prettier.formatFile', () => __awaiter(this, void 0, void 0, function* () {
- let document = yield coc_nvim_1.workspace.document;
- let prettierConfig = coc_nvim_1.workspace.getConfiguration('prettier', document.uri);
- let onlyUseLocalVersion = prettierConfig.get('onlyUseLocalVersion', false);
- if (onlyUseLocalVersion &&
- (!utils_1.hasLocalPrettierInstalled(coc_nvim_1.Uri.parse(document.uri).fsPath) ||
- document.schema != 'file')) {
- coc_nvim_1.workspace.showMessage(`Flag prettier.onlyUseLocalVersion is set, but prettier is not installed locally. No operation will be made.`, 'warning');
- return;
- }
- let edits = yield PrettierEditProvider_1.format(document.content, document.textDocument, {}).then(code => {
- if (code == null)
- return null;
- return [vscode_languageserver_protocol_1.TextEdit.replace(PrettierEditProvider_1.fullDocumentRange(document.textDocument), code),];
- });
- if (edits && edits.length) {
- yield document.applyEdits(edits);
- }
- })));
- });
-}
-exports.activate = activate;
-
-
-/***/ }),
-/* 1 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("coc.nvim");;
-
-/***/ }),
-/* 2 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-function __export(m) {\r
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
-}\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
-exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
-exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
-exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
-exports.Disposable = vscode_jsonrpc_1.Disposable;\r
-exports.Event = vscode_jsonrpc_1.Event;\r
-exports.Emitter = vscode_jsonrpc_1.Emitter;\r
-exports.Trace = vscode_jsonrpc_1.Trace;\r
-exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
-exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
-exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
-exports.RequestType = vscode_jsonrpc_1.RequestType;\r
-exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
-exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
-exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
-exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
-exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
-exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
-exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
-exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
-exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
-exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
-exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
-exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
-exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
-exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
-exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
-exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
-__export(__webpack_require__(17));\r
-__export(__webpack_require__(18));\r
-const callHierarchy = __webpack_require__(30);\r
-const st = __webpack_require__(31);\r
-var Proposed;\r
-(function (Proposed) {\r
- let CallHierarchyPrepareRequest;\r
- (function (CallHierarchyPrepareRequest) {\r
- CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
- CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
- })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
- let CallHierarchyIncomingCallsRequest;\r
- (function (CallHierarchyIncomingCallsRequest) {\r
- CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
- CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
- })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
- let CallHierarchyOutgoingCallsRequest;\r
- (function (CallHierarchyOutgoingCallsRequest) {\r
- CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
- CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
- })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
- Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
- Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
- Proposed.SemanticTokens = st.SemanticTokens;\r
- let SemanticTokensRequest;\r
- (function (SemanticTokensRequest) {\r
- SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
- SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
- })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
- let SemanticTokensEditsRequest;\r
- (function (SemanticTokensEditsRequest) {\r
- SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
- SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
- })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
- let SemanticTokensRangeRequest;\r
- (function (SemanticTokensRangeRequest) {\r
- SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
- SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
- })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
-})(Proposed = exports.Proposed || (exports.Proposed = {}));\r
-function createProtocolConnection(reader, writer, logger, strategy) {\r
- return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
-}\r
-exports.createProtocolConnection = createProtocolConnection;\r
-
-
-/***/ }),
-/* 3 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-/// <reference path="../typings/thenable.d.ts" />\r
-\r
-function __export(m) {\r
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
-}\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const Is = __webpack_require__(4);\r
-const messages_1 = __webpack_require__(5);\r
-exports.RequestType = messages_1.RequestType;\r
-exports.RequestType0 = messages_1.RequestType0;\r
-exports.RequestType1 = messages_1.RequestType1;\r
-exports.RequestType2 = messages_1.RequestType2;\r
-exports.RequestType3 = messages_1.RequestType3;\r
-exports.RequestType4 = messages_1.RequestType4;\r
-exports.RequestType5 = messages_1.RequestType5;\r
-exports.RequestType6 = messages_1.RequestType6;\r
-exports.RequestType7 = messages_1.RequestType7;\r
-exports.RequestType8 = messages_1.RequestType8;\r
-exports.RequestType9 = messages_1.RequestType9;\r
-exports.ResponseError = messages_1.ResponseError;\r
-exports.ErrorCodes = messages_1.ErrorCodes;\r
-exports.NotificationType = messages_1.NotificationType;\r
-exports.NotificationType0 = messages_1.NotificationType0;\r
-exports.NotificationType1 = messages_1.NotificationType1;\r
-exports.NotificationType2 = messages_1.NotificationType2;\r
-exports.NotificationType3 = messages_1.NotificationType3;\r
-exports.NotificationType4 = messages_1.NotificationType4;\r
-exports.NotificationType5 = messages_1.NotificationType5;\r
-exports.NotificationType6 = messages_1.NotificationType6;\r
-exports.NotificationType7 = messages_1.NotificationType7;\r
-exports.NotificationType8 = messages_1.NotificationType8;\r
-exports.NotificationType9 = messages_1.NotificationType9;\r
-const messageReader_1 = __webpack_require__(6);\r
-exports.MessageReader = messageReader_1.MessageReader;\r
-exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
-exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
-exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
-const messageWriter_1 = __webpack_require__(8);\r
-exports.MessageWriter = messageWriter_1.MessageWriter;\r
-exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
-exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
-exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
-const events_1 = __webpack_require__(7);\r
-exports.Disposable = events_1.Disposable;\r
-exports.Event = events_1.Event;\r
-exports.Emitter = events_1.Emitter;\r
-const cancellation_1 = __webpack_require__(9);\r
-exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
-exports.CancellationToken = cancellation_1.CancellationToken;\r
-const linkedMap_1 = __webpack_require__(10);\r
-__export(__webpack_require__(11));\r
-__export(__webpack_require__(16));\r
-var CancelNotification;\r
-(function (CancelNotification) {\r
- CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
-})(CancelNotification || (CancelNotification = {}));\r
-var ProgressNotification;\r
-(function (ProgressNotification) {\r
- ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
-})(ProgressNotification || (ProgressNotification = {}));\r
-class ProgressType {\r
- constructor() {\r
- }\r
-}\r
-exports.ProgressType = ProgressType;\r
-exports.NullLogger = Object.freeze({\r
- error: () => { },\r
- warn: () => { },\r
- info: () => { },\r
- log: () => { }\r
-});\r
-var Trace;\r
-(function (Trace) {\r
- Trace[Trace["Off"] = 0] = "Off";\r
- Trace[Trace["Messages"] = 1] = "Messages";\r
- Trace[Trace["Verbose"] = 2] = "Verbose";\r
-})(Trace = exports.Trace || (exports.Trace = {}));\r
-(function (Trace) {\r
- function fromString(value) {\r
- if (!Is.string(value)) {\r
- return Trace.Off;\r
- }\r
- value = value.toLowerCase();\r
- switch (value) {\r
- case 'off':\r
- return Trace.Off;\r
- case 'messages':\r
- return Trace.Messages;\r
- case 'verbose':\r
- return Trace.Verbose;\r
- default:\r
- return Trace.Off;\r
- }\r
- }\r
- Trace.fromString = fromString;\r
- function toString(value) {\r
- switch (value) {\r
- case Trace.Off:\r
- return 'off';\r
- case Trace.Messages:\r
- return 'messages';\r
- case Trace.Verbose:\r
- return 'verbose';\r
- default:\r
- return 'off';\r
- }\r
- }\r
- Trace.toString = toString;\r
-})(Trace = exports.Trace || (exports.Trace = {}));\r
-var TraceFormat;\r
-(function (TraceFormat) {\r
- TraceFormat["Text"] = "text";\r
- TraceFormat["JSON"] = "json";\r
-})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
-(function (TraceFormat) {\r
- function fromString(value) {\r
- value = value.toLowerCase();\r
- if (value === 'json') {\r
- return TraceFormat.JSON;\r
- }\r
- else {\r
- return TraceFormat.Text;\r
- }\r
- }\r
- TraceFormat.fromString = fromString;\r
-})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
-var SetTraceNotification;\r
-(function (SetTraceNotification) {\r
- SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
-})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
-var LogTraceNotification;\r
-(function (LogTraceNotification) {\r
- LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
-})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
-var ConnectionErrors;\r
-(function (ConnectionErrors) {\r
- /**\r
- * The connection is closed.\r
- */\r
- ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
- /**\r
- * The connection got disposed.\r
- */\r
- ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
- /**\r
- * The connection is already in listening mode.\r
- */\r
- ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
-})(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
-class ConnectionError extends Error {\r
- constructor(code, message) {\r
- super(message);\r
- this.code = code;\r
- Object.setPrototypeOf(this, ConnectionError.prototype);\r
- }\r
-}\r
-exports.ConnectionError = ConnectionError;\r
-var ConnectionStrategy;\r
-(function (ConnectionStrategy) {\r
- function is(value) {\r
- let candidate = value;\r
- return candidate && Is.func(candidate.cancelUndispatched);\r
- }\r
- ConnectionStrategy.is = is;\r
-})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
-var ConnectionState;\r
-(function (ConnectionState) {\r
- ConnectionState[ConnectionState["New"] = 1] = "New";\r
- ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
- ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
- ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
-})(ConnectionState || (ConnectionState = {}));\r
-function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
- let sequenceNumber = 0;\r
- let notificationSquenceNumber = 0;\r
- let unknownResponseSquenceNumber = 0;\r
- const version = '2.0';\r
- let starRequestHandler = undefined;\r
- let requestHandlers = Object.create(null);\r
- let starNotificationHandler = undefined;\r
- let notificationHandlers = Object.create(null);\r
- let progressHandlers = new Map();\r
- let timer;\r
- let messageQueue = new linkedMap_1.LinkedMap();\r
- let responsePromises = Object.create(null);\r
- let requestTokens = Object.create(null);\r
- let trace = Trace.Off;\r
- let traceFormat = TraceFormat.Text;\r
- let tracer;\r
- let state = ConnectionState.New;\r
- let errorEmitter = new events_1.Emitter();\r
- let closeEmitter = new events_1.Emitter();\r
- let unhandledNotificationEmitter = new events_1.Emitter();\r
- let unhandledProgressEmitter = new events_1.Emitter();\r
- let disposeEmitter = new events_1.Emitter();\r
- function createRequestQueueKey(id) {\r
- return 'req-' + id.toString();\r
- }\r
- function createResponseQueueKey(id) {\r
- if (id === null) {\r
- return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
- }\r
- else {\r
- return 'res-' + id.toString();\r
- }\r
- }\r
- function createNotificationQueueKey() {\r
- return 'not-' + (++notificationSquenceNumber).toString();\r
- }\r
- function addMessageToQueue(queue, message) {\r
- if (messages_1.isRequestMessage(message)) {\r
- queue.set(createRequestQueueKey(message.id), message);\r
- }\r
- else if (messages_1.isResponseMessage(message)) {\r
- queue.set(createResponseQueueKey(message.id), message);\r
- }\r
- else {\r
- queue.set(createNotificationQueueKey(), message);\r
- }\r
- }\r
- function cancelUndispatched(_message) {\r
- return undefined;\r
- }\r
- function isListening() {\r
- return state === ConnectionState.Listening;\r
- }\r
- function isClosed() {\r
- return state === ConnectionState.Closed;\r
- }\r
- function isDisposed() {\r
- return state === ConnectionState.Disposed;\r
- }\r
- function closeHandler() {\r
- if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
- state = ConnectionState.Closed;\r
- closeEmitter.fire(undefined);\r
- }\r
- // If the connection is disposed don't sent close events.\r
- }\r
- function readErrorHandler(error) {\r
- errorEmitter.fire([error, undefined, undefined]);\r
- }\r
- function writeErrorHandler(data) {\r
- errorEmitter.fire(data);\r
- }\r
- messageReader.onClose(closeHandler);\r
- messageReader.onError(readErrorHandler);\r
- messageWriter.onClose(closeHandler);\r
- messageWriter.onError(writeErrorHandler);\r
- function triggerMessageQueue() {\r
- if (timer || messageQueue.size === 0) {\r
- return;\r
- }\r
- timer = setImmediate(() => {\r
- timer = undefined;\r
- processMessageQueue();\r
- });\r
- }\r
- function processMessageQueue() {\r
- if (messageQueue.size === 0) {\r
- return;\r
- }\r
- let message = messageQueue.shift();\r
- try {\r
- if (messages_1.isRequestMessage(message)) {\r
- handleRequest(message);\r
- }\r
- else if (messages_1.isNotificationMessage(message)) {\r
- handleNotification(message);\r
- }\r
- else if (messages_1.isResponseMessage(message)) {\r
- handleResponse(message);\r
- }\r
- else {\r
- handleInvalidMessage(message);\r
- }\r
- }\r
- finally {\r
- triggerMessageQueue();\r
- }\r
- }\r
- let callback = (message) => {\r
- try {\r
- // We have received a cancellation message. Check if the message is still in the queue\r
- // and cancel it if allowed to do so.\r
- if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
- let key = createRequestQueueKey(message.params.id);\r
- let toCancel = messageQueue.get(key);\r
- if (messages_1.isRequestMessage(toCancel)) {\r
- let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
- if (response && (response.error !== void 0 || response.result !== void 0)) {\r
- messageQueue.delete(key);\r
- response.id = toCancel.id;\r
- traceSendingResponse(response, message.method, Date.now());\r
- messageWriter.write(response);\r
- return;\r
- }\r
- }\r
- }\r
- addMessageToQueue(messageQueue, message);\r
- }\r
- finally {\r
- triggerMessageQueue();\r
- }\r
- };\r
- function handleRequest(requestMessage) {\r
- if (isDisposed()) {\r
- // we return here silently since we fired an event when the\r
- // connection got disposed.\r
- return;\r
- }\r
- function reply(resultOrError, method, startTime) {\r
- let message = {\r
- jsonrpc: version,\r
- id: requestMessage.id\r
- };\r
- if (resultOrError instanceof messages_1.ResponseError) {\r
- message.error = resultOrError.toJson();\r
- }\r
- else {\r
- message.result = resultOrError === void 0 ? null : resultOrError;\r
- }\r
- traceSendingResponse(message, method, startTime);\r
- messageWriter.write(message);\r
- }\r
- function replyError(error, method, startTime) {\r
- let message = {\r
- jsonrpc: version,\r
- id: requestMessage.id,\r
- error: error.toJson()\r
- };\r
- traceSendingResponse(message, method, startTime);\r
- messageWriter.write(message);\r
- }\r
- function replySuccess(result, method, startTime) {\r
- // The JSON RPC defines that a response must either have a result or an error\r
- // So we can't treat undefined as a valid response result.\r
- if (result === void 0) {\r
- result = null;\r
- }\r
- let message = {\r
- jsonrpc: version,\r
- id: requestMessage.id,\r
- result: result\r
- };\r
- traceSendingResponse(message, method, startTime);\r
- messageWriter.write(message);\r
- }\r
- traceReceivedRequest(requestMessage);\r
- let element = requestHandlers[requestMessage.method];\r
- let type;\r
- let requestHandler;\r
- if (element) {\r
- type = element.type;\r
- requestHandler = element.handler;\r
- }\r
- let startTime = Date.now();\r
- if (requestHandler || starRequestHandler) {\r
- let cancellationSource = new cancellation_1.CancellationTokenSource();\r
- let tokenKey = String(requestMessage.id);\r
- requestTokens[tokenKey] = cancellationSource;\r
- try {\r
- let handlerResult;\r
- if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
- handlerResult = requestHandler\r
- ? requestHandler(cancellationSource.token)\r
- : starRequestHandler(requestMessage.method, cancellationSource.token);\r
- }\r
- else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
- handlerResult = requestHandler\r
- ? requestHandler(...requestMessage.params, cancellationSource.token)\r
- : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
- }\r
- else {\r
- handlerResult = requestHandler\r
- ? requestHandler(requestMessage.params, cancellationSource.token)\r
- : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
- }\r
- let promise = handlerResult;\r
- if (!handlerResult) {\r
- delete requestTokens[tokenKey];\r
- replySuccess(handlerResult, requestMessage.method, startTime);\r
- }\r
- else if (promise.then) {\r
- promise.then((resultOrError) => {\r
- delete requestTokens[tokenKey];\r
- reply(resultOrError, requestMessage.method, startTime);\r
- }, error => {\r
- delete requestTokens[tokenKey];\r
- if (error instanceof messages_1.ResponseError) {\r
- replyError(error, requestMessage.method, startTime);\r
- }\r
- else if (error && Is.string(error.message)) {\r
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
- }\r
- else {\r
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
- }\r
- });\r
- }\r
- else {\r
- delete requestTokens[tokenKey];\r
- reply(handlerResult, requestMessage.method, startTime);\r
- }\r
- }\r
- catch (error) {\r
- delete requestTokens[tokenKey];\r
- if (error instanceof messages_1.ResponseError) {\r
- reply(error, requestMessage.method, startTime);\r
- }\r
- else if (error && Is.string(error.message)) {\r
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
- }\r
- else {\r
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
- }\r
- }\r
- }\r
- else {\r
- replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
- }\r
- }\r
- function handleResponse(responseMessage) {\r
- if (isDisposed()) {\r
- // See handle request.\r
- return;\r
- }\r
- if (responseMessage.id === null) {\r
- if (responseMessage.error) {\r
- logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
- }\r
- else {\r
- logger.error(`Received response message without id. No further error information provided.`);\r
- }\r
- }\r
- else {\r
- let key = String(responseMessage.id);\r
- let responsePromise = responsePromises[key];\r
- traceReceivedResponse(responseMessage, responsePromise);\r
- if (responsePromise) {\r
- delete responsePromises[key];\r
- try {\r
- if (responseMessage.error) {\r
- let error = responseMessage.error;\r
- responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
- }\r
- else if (responseMessage.result !== void 0) {\r
- responsePromise.resolve(responseMessage.result);\r
- }\r
- else {\r
- throw new Error('Should never happen.');\r
- }\r
- }\r
- catch (error) {\r
- if (error.message) {\r
- logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
- }\r
- else {\r
- logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- function handleNotification(message) {\r
- if (isDisposed()) {\r
- // See handle request.\r
- return;\r
- }\r
- let type = undefined;\r
- let notificationHandler;\r
- if (message.method === CancelNotification.type.method) {\r
- notificationHandler = (params) => {\r
- let id = params.id;\r
- let source = requestTokens[String(id)];\r
- if (source) {\r
- source.cancel();\r
- }\r
- };\r
- }\r
- else {\r
- let element = notificationHandlers[message.method];\r
- if (element) {\r
- notificationHandler = element.handler;\r
- type = element.type;\r
- }\r
- }\r
- if (notificationHandler || starNotificationHandler) {\r
- try {\r
- traceReceivedNotification(message);\r
- if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
- notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
- }\r
- else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
- notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
- }\r
- else {\r
- notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
- }\r
- }\r
- catch (error) {\r
- if (error.message) {\r
- logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
- }\r
- else {\r
- logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
- }\r
- }\r
- }\r
- else {\r
- unhandledNotificationEmitter.fire(message);\r
- }\r
- }\r
- function handleInvalidMessage(message) {\r
- if (!message) {\r
- logger.error('Received empty message.');\r
- return;\r
- }\r
- logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
- // Test whether we find an id to reject the promise\r
- let responseMessage = message;\r
- if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
- let key = String(responseMessage.id);\r
- let responseHandler = responsePromises[key];\r
- if (responseHandler) {\r
- responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
- }\r
- }\r
- }\r
- function traceSendingRequest(message) {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose && message.params) {\r
- data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
- }\r
- tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
- }\r
- else {\r
- logLSPMessage('send-request', message);\r
- }\r
- }\r
- function traceSendingNotification(message) {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose) {\r
- if (message.params) {\r
- data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
- }\r
- else {\r
- data = 'No parameters provided.\n\n';\r
- }\r
- }\r
- tracer.log(`Sending notification '${message.method}'.`, data);\r
- }\r
- else {\r
- logLSPMessage('send-notification', message);\r
- }\r
- }\r
- function traceSendingResponse(message, method, startTime) {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose) {\r
- if (message.error && message.error.data) {\r
- data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
- }\r
- else {\r
- if (message.result) {\r
- data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
- }\r
- else if (message.error === void 0) {\r
- data = 'No result returned.\n\n';\r
- }\r
- }\r
- }\r
- tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
- }\r
- else {\r
- logLSPMessage('send-response', message);\r
- }\r
- }\r
- function traceReceivedRequest(message) {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose && message.params) {\r
- data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
- }\r
- tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
- }\r
- else {\r
- logLSPMessage('receive-request', message);\r
- }\r
- }\r
- function traceReceivedNotification(message) {\r
- if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose) {\r
- if (message.params) {\r
- data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
- }\r
- else {\r
- data = 'No parameters provided.\n\n';\r
- }\r
- }\r
- tracer.log(`Received notification '${message.method}'.`, data);\r
- }\r
- else {\r
- logLSPMessage('receive-notification', message);\r
- }\r
- }\r
- function traceReceivedResponse(message, responsePromise) {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- if (traceFormat === TraceFormat.Text) {\r
- let data = undefined;\r
- if (trace === Trace.Verbose) {\r
- if (message.error && message.error.data) {\r
- data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
- }\r
- else {\r
- if (message.result) {\r
- data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
- }\r
- else if (message.error === void 0) {\r
- data = 'No result returned.\n\n';\r
- }\r
- }\r
- }\r
- if (responsePromise) {\r
- let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
- tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
- }\r
- else {\r
- tracer.log(`Received response ${message.id} without active response promise.`, data);\r
- }\r
- }\r
- else {\r
- logLSPMessage('receive-response', message);\r
- }\r
- }\r
- function logLSPMessage(type, message) {\r
- if (!tracer || trace === Trace.Off) {\r
- return;\r
- }\r
- const lspMessage = {\r
- isLSPMessage: true,\r
- type,\r
- message,\r
- timestamp: Date.now()\r
- };\r
- tracer.log(lspMessage);\r
- }\r
- function throwIfClosedOrDisposed() {\r
- if (isClosed()) {\r
- throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
- }\r
- if (isDisposed()) {\r
- throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
- }\r
- }\r
- function throwIfListening() {\r
- if (isListening()) {\r
- throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
- }\r
- }\r
- function throwIfNotListening() {\r
- if (!isListening()) {\r
- throw new Error('Call listen() first.');\r
- }\r
- }\r
- function undefinedToNull(param) {\r
- if (param === void 0) {\r
- return null;\r
- }\r
- else {\r
- return param;\r
- }\r
- }\r
- function computeMessageParams(type, params) {\r
- let result;\r
- let numberOfParams = type.numberOfParams;\r
- switch (numberOfParams) {\r
- case 0:\r
- result = null;\r
- break;\r
- case 1:\r
- result = undefinedToNull(params[0]);\r
- break;\r
- default:\r
- result = [];\r
- for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
- result.push(undefinedToNull(params[i]));\r
- }\r
- if (params.length < numberOfParams) {\r
- for (let i = params.length; i < numberOfParams; i++) {\r
- result.push(null);\r
- }\r
- }\r
- break;\r
- }\r
- return result;\r
- }\r
- let connection = {\r
- sendNotification: (type, ...params) => {\r
- throwIfClosedOrDisposed();\r
- let method;\r
- let messageParams;\r
- if (Is.string(type)) {\r
- method = type;\r
- switch (params.length) {\r
- case 0:\r
- messageParams = null;\r
- break;\r
- case 1:\r
- messageParams = params[0];\r
- break;\r
- default:\r
- messageParams = params;\r
- break;\r
- }\r
- }\r
- else {\r
- method = type.method;\r
- messageParams = computeMessageParams(type, params);\r
- }\r
- let notificationMessage = {\r
- jsonrpc: version,\r
- method: method,\r
- params: messageParams\r
- };\r
- traceSendingNotification(notificationMessage);\r
- messageWriter.write(notificationMessage);\r
- },\r
- onNotification: (type, handler) => {\r
- throwIfClosedOrDisposed();\r
- if (Is.func(type)) {\r
- starNotificationHandler = type;\r
- }\r
- else if (handler) {\r
- if (Is.string(type)) {\r
- notificationHandlers[type] = { type: undefined, handler };\r
- }\r
- else {\r
- notificationHandlers[type.method] = { type, handler };\r
- }\r
- }\r
- },\r
- onProgress: (_type, token, handler) => {\r
- if (progressHandlers.has(token)) {\r
- throw new Error(`Progress handler for token ${token} already registered`);\r
- }\r
- progressHandlers.set(token, handler);\r
- return {\r
- dispose: () => {\r
- progressHandlers.delete(token);\r
- }\r
- };\r
- },\r
- sendProgress: (_type, token, value) => {\r
- connection.sendNotification(ProgressNotification.type, { token, value });\r
- },\r
- onUnhandledProgress: unhandledProgressEmitter.event,\r
- sendRequest: (type, ...params) => {\r
- throwIfClosedOrDisposed();\r
- throwIfNotListening();\r
- let method;\r
- let messageParams;\r
- let token = undefined;\r
- if (Is.string(type)) {\r
- method = type;\r
- switch (params.length) {\r
- case 0:\r
- messageParams = null;\r
- break;\r
- case 1:\r
- // The cancellation token is optional so it can also be undefined.\r
- if (cancellation_1.CancellationToken.is(params[0])) {\r
- messageParams = null;\r
- token = params[0];\r
- }\r
- else {\r
- messageParams = undefinedToNull(params[0]);\r
- }\r
- break;\r
- default:\r
- const last = params.length - 1;\r
- if (cancellation_1.CancellationToken.is(params[last])) {\r
- token = params[last];\r
- if (params.length === 2) {\r
- messageParams = undefinedToNull(params[0]);\r
- }\r
- else {\r
- messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
- }\r
- }\r
- else {\r
- messageParams = params.map(value => undefinedToNull(value));\r
- }\r
- break;\r
- }\r
- }\r
- else {\r
- method = type.method;\r
- messageParams = computeMessageParams(type, params);\r
- let numberOfParams = type.numberOfParams;\r
- token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
- }\r
- let id = sequenceNumber++;\r
- let result = new Promise((resolve, reject) => {\r
- let requestMessage = {\r
- jsonrpc: version,\r
- id: id,\r
- method: method,\r
- params: messageParams\r
- };\r
- let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
- traceSendingRequest(requestMessage);\r
- try {\r
- messageWriter.write(requestMessage);\r
- }\r
- catch (e) {\r
- // Writing the message failed. So we need to reject the promise.\r
- responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
- responsePromise = null;\r
- }\r
- if (responsePromise) {\r
- responsePromises[String(id)] = responsePromise;\r
- }\r
- });\r
- if (token) {\r
- token.onCancellationRequested(() => {\r
- connection.sendNotification(CancelNotification.type, { id });\r
- });\r
- }\r
- return result;\r
- },\r
- onRequest: (type, handler) => {\r
- throwIfClosedOrDisposed();\r
- if (Is.func(type)) {\r
- starRequestHandler = type;\r
- }\r
- else if (handler) {\r
- if (Is.string(type)) {\r
- requestHandlers[type] = { type: undefined, handler };\r
- }\r
- else {\r
- requestHandlers[type.method] = { type, handler };\r
- }\r
- }\r
- },\r
- trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
- let _sendNotification = false;\r
- let _traceFormat = TraceFormat.Text;\r
- if (sendNotificationOrTraceOptions !== void 0) {\r
- if (Is.boolean(sendNotificationOrTraceOptions)) {\r
- _sendNotification = sendNotificationOrTraceOptions;\r
- }\r
- else {\r
- _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
- _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
- }\r
- }\r
- trace = _value;\r
- traceFormat = _traceFormat;\r
- if (trace === Trace.Off) {\r
- tracer = undefined;\r
- }\r
- else {\r
- tracer = _tracer;\r
- }\r
- if (_sendNotification && !isClosed() && !isDisposed()) {\r
- connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
- }\r
- },\r
- onError: errorEmitter.event,\r
- onClose: closeEmitter.event,\r
- onUnhandledNotification: unhandledNotificationEmitter.event,\r
- onDispose: disposeEmitter.event,\r
- dispose: () => {\r
- if (isDisposed()) {\r
- return;\r
- }\r
- state = ConnectionState.Disposed;\r
- disposeEmitter.fire(undefined);\r
- let error = new Error('Connection got disposed.');\r
- Object.keys(responsePromises).forEach((key) => {\r
- responsePromises[key].reject(error);\r
- });\r
- responsePromises = Object.create(null);\r
- requestTokens = Object.create(null);\r
- messageQueue = new linkedMap_1.LinkedMap();\r
- // Test for backwards compatibility\r
- if (Is.func(messageWriter.dispose)) {\r
- messageWriter.dispose();\r
- }\r
- if (Is.func(messageReader.dispose)) {\r
- messageReader.dispose();\r
- }\r
- },\r
- listen: () => {\r
- throwIfClosedOrDisposed();\r
- throwIfListening();\r
- state = ConnectionState.Listening;\r
- messageReader.listen(callback);\r
- },\r
- inspect: () => {\r
- // eslint-disable-next-line no-console\r
- console.log('inspect');\r
- }\r
- };\r
- connection.onNotification(LogTraceNotification.type, (params) => {\r
- if (trace === Trace.Off || !tracer) {\r
- return;\r
- }\r
- tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
- });\r
- connection.onNotification(ProgressNotification.type, (params) => {\r
- const handler = progressHandlers.get(params.token);\r
- if (handler) {\r
- handler(params.value);\r
- }\r
- else {\r
- unhandledProgressEmitter.fire(params);\r
- }\r
- });\r
- return connection;\r
-}\r
-function isMessageReader(value) {\r
- return value.listen !== void 0 && value.read === void 0;\r
-}\r
-function isMessageWriter(value) {\r
- return value.write !== void 0 && value.end === void 0;\r
-}\r
-function createMessageConnection(input, output, logger, strategy) {\r
- if (!logger) {\r
- logger = exports.NullLogger;\r
- }\r
- let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
- let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
- return _createMessageConnection(reader, writer, logger, strategy);\r
-}\r
-exports.createMessageConnection = createMessageConnection;\r
-
-
-/***/ }),
-/* 4 */
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-function boolean(value) {\r
- return value === true || value === false;\r
-}\r
-exports.boolean = boolean;\r
-function string(value) {\r
- return typeof value === 'string' || value instanceof String;\r
-}\r
-exports.string = string;\r
-function number(value) {\r
- return typeof value === 'number' || value instanceof Number;\r
-}\r
-exports.number = number;\r
-function error(value) {\r
- return value instanceof Error;\r
-}\r
-exports.error = error;\r
-function func(value) {\r
- return typeof value === 'function';\r
-}\r
-exports.func = func;\r
-function array(value) {\r
- return Array.isArray(value);\r
-}\r
-exports.array = array;\r
-function stringArray(value) {\r
- return array(value) && value.every(elem => string(elem));\r
-}\r
-exports.stringArray = stringArray;\r
-
-
-/***/ }),
-/* 5 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const is = __webpack_require__(4);\r
-/**\r
- * Predefined error codes.\r
- */\r
-var ErrorCodes;\r
-(function (ErrorCodes) {\r
- // Defined by JSON RPC\r
- ErrorCodes.ParseError = -32700;\r
- ErrorCodes.InvalidRequest = -32600;\r
- ErrorCodes.MethodNotFound = -32601;\r
- ErrorCodes.InvalidParams = -32602;\r
- ErrorCodes.InternalError = -32603;\r
- ErrorCodes.serverErrorStart = -32099;\r
- ErrorCodes.serverErrorEnd = -32000;\r
- ErrorCodes.ServerNotInitialized = -32002;\r
- ErrorCodes.UnknownErrorCode = -32001;\r
- // Defined by the protocol.\r
- ErrorCodes.RequestCancelled = -32800;\r
- ErrorCodes.ContentModified = -32801;\r
- // Defined by VSCode library.\r
- ErrorCodes.MessageWriteError = 1;\r
- ErrorCodes.MessageReadError = 2;\r
-})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
-/**\r
- * An error object return in a response in case a request\r
- * has failed.\r
- */\r
-class ResponseError extends Error {\r
- constructor(code, message, data) {\r
- super(message);\r
- this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
- this.data = data;\r
- Object.setPrototypeOf(this, ResponseError.prototype);\r
- }\r
- toJson() {\r
- return {\r
- code: this.code,\r
- message: this.message,\r
- data: this.data,\r
- };\r
- }\r
-}\r
-exports.ResponseError = ResponseError;\r
-/**\r
- * An abstract implementation of a MessageType.\r
- */\r
-class AbstractMessageType {\r
- constructor(_method, _numberOfParams) {\r
- this._method = _method;\r
- this._numberOfParams = _numberOfParams;\r
- }\r
- get method() {\r
- return this._method;\r
- }\r
- get numberOfParams() {\r
- return this._numberOfParams;\r
- }\r
-}\r
-exports.AbstractMessageType = AbstractMessageType;\r
-/**\r
- * Classes to type request response pairs\r
- *\r
- * The type parameter RO will be removed in the next major version\r
- * of the JSON RPC library since it is a LSP concept and doesn't\r
- * belong here. For now it is tagged as default never.\r
- */\r
-class RequestType0 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 0);\r
- }\r
-}\r
-exports.RequestType0 = RequestType0;\r
-class RequestType extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 1);\r
- }\r
-}\r
-exports.RequestType = RequestType;\r
-class RequestType1 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 1);\r
- }\r
-}\r
-exports.RequestType1 = RequestType1;\r
-class RequestType2 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 2);\r
- }\r
-}\r
-exports.RequestType2 = RequestType2;\r
-class RequestType3 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 3);\r
- }\r
-}\r
-exports.RequestType3 = RequestType3;\r
-class RequestType4 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 4);\r
- }\r
-}\r
-exports.RequestType4 = RequestType4;\r
-class RequestType5 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 5);\r
- }\r
-}\r
-exports.RequestType5 = RequestType5;\r
-class RequestType6 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 6);\r
- }\r
-}\r
-exports.RequestType6 = RequestType6;\r
-class RequestType7 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 7);\r
- }\r
-}\r
-exports.RequestType7 = RequestType7;\r
-class RequestType8 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 8);\r
- }\r
-}\r
-exports.RequestType8 = RequestType8;\r
-class RequestType9 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 9);\r
- }\r
-}\r
-exports.RequestType9 = RequestType9;\r
-/**\r
- * The type parameter RO will be removed in the next major version\r
- * of the JSON RPC library since it is a LSP concept and doesn't\r
- * belong here. For now it is tagged as default never.\r
- */\r
-class NotificationType extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 1);\r
- this._ = undefined;\r
- }\r
-}\r
-exports.NotificationType = NotificationType;\r
-class NotificationType0 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 0);\r
- }\r
-}\r
-exports.NotificationType0 = NotificationType0;\r
-class NotificationType1 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 1);\r
- }\r
-}\r
-exports.NotificationType1 = NotificationType1;\r
-class NotificationType2 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 2);\r
- }\r
-}\r
-exports.NotificationType2 = NotificationType2;\r
-class NotificationType3 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 3);\r
- }\r
-}\r
-exports.NotificationType3 = NotificationType3;\r
-class NotificationType4 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 4);\r
- }\r
-}\r
-exports.NotificationType4 = NotificationType4;\r
-class NotificationType5 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 5);\r
- }\r
-}\r
-exports.NotificationType5 = NotificationType5;\r
-class NotificationType6 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 6);\r
- }\r
-}\r
-exports.NotificationType6 = NotificationType6;\r
-class NotificationType7 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 7);\r
- }\r
-}\r
-exports.NotificationType7 = NotificationType7;\r
-class NotificationType8 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 8);\r
- }\r
-}\r
-exports.NotificationType8 = NotificationType8;\r
-class NotificationType9 extends AbstractMessageType {\r
- constructor(method) {\r
- super(method, 9);\r
- }\r
-}\r
-exports.NotificationType9 = NotificationType9;\r
-/**\r
- * Tests if the given message is a request message\r
- */\r
-function isRequestMessage(message) {\r
- let candidate = message;\r
- return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
-}\r
-exports.isRequestMessage = isRequestMessage;\r
-/**\r
- * Tests if the given message is a notification message\r
- */\r
-function isNotificationMessage(message) {\r
- let candidate = message;\r
- return candidate && is.string(candidate.method) && message.id === void 0;\r
-}\r
-exports.isNotificationMessage = isNotificationMessage;\r
-/**\r
- * Tests if the given message is a response message\r
- */\r
-function isResponseMessage(message) {\r
- let candidate = message;\r
- return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
-}\r
-exports.isResponseMessage = isResponseMessage;\r
-
-
-/***/ }),
-/* 6 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const events_1 = __webpack_require__(7);\r
-const Is = __webpack_require__(4);\r
-let DefaultSize = 8192;\r
-let CR = Buffer.from('\r', 'ascii')[0];\r
-let LF = Buffer.from('\n', 'ascii')[0];\r
-let CRLF = '\r\n';\r
-class MessageBuffer {\r
- constructor(encoding = 'utf8') {\r
- this.encoding = encoding;\r
- this.index = 0;\r
- this.buffer = Buffer.allocUnsafe(DefaultSize);\r
- }\r
- append(chunk) {\r
- var toAppend = chunk;\r
- if (typeof (chunk) === 'string') {\r
- var str = chunk;\r
- var bufferLen = Buffer.byteLength(str, this.encoding);\r
- toAppend = Buffer.allocUnsafe(bufferLen);\r
- toAppend.write(str, 0, bufferLen, this.encoding);\r
- }\r
- if (this.buffer.length - this.index >= toAppend.length) {\r
- toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
- }\r
- else {\r
- var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
- if (this.index === 0) {\r
- this.buffer = Buffer.allocUnsafe(newSize);\r
- toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
- }\r
- else {\r
- this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
- }\r
- }\r
- this.index += toAppend.length;\r
- }\r
- tryReadHeaders() {\r
- let result = undefined;\r
- let current = 0;\r
- while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {\r
- current++;\r
- }\r
- // No header / body separator found (e.g CRLFCRLF)\r
- if (current + 3 >= this.index) {\r
- return result;\r
- }\r
- result = Object.create(null);\r
- let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
- headers.forEach((header) => {\r
- let index = header.indexOf(':');\r
- if (index === -1) {\r
- throw new Error('Message header must separate key and value using :');\r
- }\r
- let key = header.substr(0, index);\r
- let value = header.substr(index + 1).trim();\r
- result[key] = value;\r
- });\r
- let nextStart = current + 4;\r
- this.buffer = this.buffer.slice(nextStart);\r
- this.index = this.index - nextStart;\r
- return result;\r
- }\r
- tryReadContent(length) {\r
- if (this.index < length) {\r
- return null;\r
- }\r
- let result = this.buffer.toString(this.encoding, 0, length);\r
- let nextStart = length;\r
- this.buffer.copy(this.buffer, 0, nextStart);\r
- this.index = this.index - nextStart;\r
- return result;\r
- }\r
- get numberOfBytes() {\r
- return this.index;\r
- }\r
-}\r
-var MessageReader;\r
-(function (MessageReader) {\r
- function is(value) {\r
- let candidate = value;\r
- return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
- Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
- }\r
- MessageReader.is = is;\r
-})(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
-class AbstractMessageReader {\r
- constructor() {\r
- this.errorEmitter = new events_1.Emitter();\r
- this.closeEmitter = new events_1.Emitter();\r
- this.partialMessageEmitter = new events_1.Emitter();\r
- }\r
- dispose() {\r
- this.errorEmitter.dispose();\r
- this.closeEmitter.dispose();\r
- }\r
- get onError() {\r
- return this.errorEmitter.event;\r
- }\r
- fireError(error) {\r
- this.errorEmitter.fire(this.asError(error));\r
- }\r
- get onClose() {\r
- return this.closeEmitter.event;\r
- }\r
- fireClose() {\r
- this.closeEmitter.fire(undefined);\r
- }\r
- get onPartialMessage() {\r
- return this.partialMessageEmitter.event;\r
- }\r
- firePartialMessage(info) {\r
- this.partialMessageEmitter.fire(info);\r
- }\r
- asError(error) {\r
- if (error instanceof Error) {\r
- return error;\r
- }\r
- else {\r
- return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
- }\r
- }\r
-}\r
-exports.AbstractMessageReader = AbstractMessageReader;\r
-class StreamMessageReader extends AbstractMessageReader {\r
- constructor(readable, encoding = 'utf8') {\r
- super();\r
- this.readable = readable;\r
- this.buffer = new MessageBuffer(encoding);\r
- this._partialMessageTimeout = 10000;\r
- }\r
- set partialMessageTimeout(timeout) {\r
- this._partialMessageTimeout = timeout;\r
- }\r
- get partialMessageTimeout() {\r
- return this._partialMessageTimeout;\r
- }\r
- listen(callback) {\r
- this.nextMessageLength = -1;\r
- this.messageToken = 0;\r
- this.partialMessageTimer = undefined;\r
- this.callback = callback;\r
- this.readable.on('data', (data) => {\r
- this.onData(data);\r
- });\r
- this.readable.on('error', (error) => this.fireError(error));\r
- this.readable.on('close', () => this.fireClose());\r
- }\r
- onData(data) {\r
- this.buffer.append(data);\r
- while (true) {\r
- if (this.nextMessageLength === -1) {\r
- let headers = this.buffer.tryReadHeaders();\r
- if (!headers) {\r
- return;\r
- }\r
- let contentLength = headers['Content-Length'];\r
- if (!contentLength) {\r
- throw new Error('Header must provide a Content-Length property.');\r
- }\r
- let length = parseInt(contentLength);\r
- if (isNaN(length)) {\r
- throw new Error('Content-Length value must be a number.');\r
- }\r
- this.nextMessageLength = length;\r
- // Take the encoding form the header. For compatibility\r
- // treat both utf-8 and utf8 as node utf8\r
- }\r
- var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
- if (msg === null) {\r
- /** We haven't received the full message yet. */\r
- this.setPartialMessageTimer();\r
- return;\r
- }\r
- this.clearPartialMessageTimer();\r
- this.nextMessageLength = -1;\r
- this.messageToken++;\r
- var json = JSON.parse(msg);\r
- this.callback(json);\r
- }\r
- }\r
- clearPartialMessageTimer() {\r
- if (this.partialMessageTimer) {\r
- clearTimeout(this.partialMessageTimer);\r
- this.partialMessageTimer = undefined;\r
- }\r
- }\r
- setPartialMessageTimer() {\r
- this.clearPartialMessageTimer();\r
- if (this._partialMessageTimeout <= 0) {\r
- return;\r
- }\r
- this.partialMessageTimer = setTimeout((token, timeout) => {\r
- this.partialMessageTimer = undefined;\r
- if (token === this.messageToken) {\r
- this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
- this.setPartialMessageTimer();\r
- }\r
- }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
- }\r
-}\r
-exports.StreamMessageReader = StreamMessageReader;\r
-class IPCMessageReader extends AbstractMessageReader {\r
- constructor(process) {\r
- super();\r
- this.process = process;\r
- let eventEmitter = this.process;\r
- eventEmitter.on('error', (error) => this.fireError(error));\r
- eventEmitter.on('close', () => this.fireClose());\r
- }\r
- listen(callback) {\r
- this.process.on('message', callback);\r
- }\r
-}\r
-exports.IPCMessageReader = IPCMessageReader;\r
-class SocketMessageReader extends StreamMessageReader {\r
- constructor(socket, encoding = 'utf-8') {\r
- super(socket, encoding);\r
- }\r
-}\r
-exports.SocketMessageReader = SocketMessageReader;\r
-
-
-/***/ }),
-/* 7 */
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-var Disposable;\r
-(function (Disposable) {\r
- function create(func) {\r
- return {\r
- dispose: func\r
- };\r
- }\r
- Disposable.create = create;\r
-})(Disposable = exports.Disposable || (exports.Disposable = {}));\r
-var Event;\r
-(function (Event) {\r
- const _disposable = { dispose() { } };\r
- Event.None = function () { return _disposable; };\r
-})(Event = exports.Event || (exports.Event = {}));\r
-class CallbackList {\r
- add(callback, context = null, bucket) {\r
- if (!this._callbacks) {\r
- this._callbacks = [];\r
- this._contexts = [];\r
- }\r
- this._callbacks.push(callback);\r
- this._contexts.push(context);\r
- if (Array.isArray(bucket)) {\r
- bucket.push({ dispose: () => this.remove(callback, context) });\r
- }\r
- }\r
- remove(callback, context = null) {\r
- if (!this._callbacks) {\r
- return;\r
- }\r
- var foundCallbackWithDifferentContext = false;\r
- for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
- if (this._callbacks[i] === callback) {\r
- if (this._contexts[i] === context) {\r
- // callback & context match => remove it\r
- this._callbacks.splice(i, 1);\r
- this._contexts.splice(i, 1);\r
- return;\r
- }\r
- else {\r
- foundCallbackWithDifferentContext = true;\r
- }\r
- }\r
- }\r
- if (foundCallbackWithDifferentContext) {\r
- throw new Error('When adding a listener with a context, you should remove it with the same context');\r
- }\r
- }\r
- invoke(...args) {\r
- if (!this._callbacks) {\r
- return [];\r
- }\r
- var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
- for (var i = 0, len = callbacks.length; i < len; i++) {\r
- try {\r
- ret.push(callbacks[i].apply(contexts[i], args));\r
- }\r
- catch (e) {\r
- // eslint-disable-next-line no-console\r
- console.error(e);\r
- }\r
- }\r
- return ret;\r
- }\r
- isEmpty() {\r
- return !this._callbacks || this._callbacks.length === 0;\r
- }\r
- dispose() {\r
- this._callbacks = undefined;\r
- this._contexts = undefined;\r
- }\r
-}\r
-class Emitter {\r
- constructor(_options) {\r
- this._options = _options;\r
- }\r
- /**\r
- * For the public to allow to subscribe\r
- * to events from this Emitter\r
- */\r
- get event() {\r
- if (!this._event) {\r
- this._event = (listener, thisArgs, disposables) => {\r
- if (!this._callbacks) {\r
- this._callbacks = new CallbackList();\r
- }\r
- if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
- this._options.onFirstListenerAdd(this);\r
- }\r
- this._callbacks.add(listener, thisArgs);\r
- let result;\r
- result = {\r
- dispose: () => {\r
- this._callbacks.remove(listener, thisArgs);\r
- result.dispose = Emitter._noop;\r
- if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
- this._options.onLastListenerRemove(this);\r
- }\r
- }\r
- };\r
- if (Array.isArray(disposables)) {\r
- disposables.push(result);\r
- }\r
- return result;\r
- };\r
- }\r
- return this._event;\r
- }\r
- /**\r
- * To be kept private to fire an event to\r
- * subscribers\r
- */\r
- fire(event) {\r
- if (this._callbacks) {\r
- this._callbacks.invoke.call(this._callbacks, event);\r
- }\r
- }\r
- dispose() {\r
- if (this._callbacks) {\r
- this._callbacks.dispose();\r
- this._callbacks = undefined;\r
- }\r
- }\r
-}\r
-exports.Emitter = Emitter;\r
-Emitter._noop = function () { };\r
-
-
-/***/ }),
-/* 8 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const events_1 = __webpack_require__(7);\r
-const Is = __webpack_require__(4);\r
-let ContentLength = 'Content-Length: ';\r
-let CRLF = '\r\n';\r
-var MessageWriter;\r
-(function (MessageWriter) {\r
- function is(value) {\r
- let candidate = value;\r
- return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
- Is.func(candidate.onError) && Is.func(candidate.write);\r
- }\r
- MessageWriter.is = is;\r
-})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
-class AbstractMessageWriter {\r
- constructor() {\r
- this.errorEmitter = new events_1.Emitter();\r
- this.closeEmitter = new events_1.Emitter();\r
- }\r
- dispose() {\r
- this.errorEmitter.dispose();\r
- this.closeEmitter.dispose();\r
- }\r
- get onError() {\r
- return this.errorEmitter.event;\r
- }\r
- fireError(error, message, count) {\r
- this.errorEmitter.fire([this.asError(error), message, count]);\r
- }\r
- get onClose() {\r
- return this.closeEmitter.event;\r
- }\r
- fireClose() {\r
- this.closeEmitter.fire(undefined);\r
- }\r
- asError(error) {\r
- if (error instanceof Error) {\r
- return error;\r
- }\r
- else {\r
- return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
- }\r
- }\r
-}\r
-exports.AbstractMessageWriter = AbstractMessageWriter;\r
-class StreamMessageWriter extends AbstractMessageWriter {\r
- constructor(writable, encoding = 'utf8') {\r
- super();\r
- this.writable = writable;\r
- this.encoding = encoding;\r
- this.errorCount = 0;\r
- this.writable.on('error', (error) => this.fireError(error));\r
- this.writable.on('close', () => this.fireClose());\r
- }\r
- write(msg) {\r
- let json = JSON.stringify(msg);\r
- let contentLength = Buffer.byteLength(json, this.encoding);\r
- let headers = [\r
- ContentLength, contentLength.toString(), CRLF,\r
- CRLF\r
- ];\r
- try {\r
- // Header must be written in ASCII encoding\r
- this.writable.write(headers.join(''), 'ascii');\r
- // Now write the content. This can be written in any encoding\r
- this.writable.write(json, this.encoding);\r
- this.errorCount = 0;\r
- }\r
- catch (error) {\r
- this.errorCount++;\r
- this.fireError(error, msg, this.errorCount);\r
- }\r
- }\r
-}\r
-exports.StreamMessageWriter = StreamMessageWriter;\r
-class IPCMessageWriter extends AbstractMessageWriter {\r
- constructor(process) {\r
- super();\r
- this.process = process;\r
- this.errorCount = 0;\r
- this.queue = [];\r
- this.sending = false;\r
- let eventEmitter = this.process;\r
- eventEmitter.on('error', (error) => this.fireError(error));\r
- eventEmitter.on('close', () => this.fireClose);\r
- }\r
- write(msg) {\r
- if (!this.sending && this.queue.length === 0) {\r
- // See https://github.com/nodejs/node/issues/7657\r
- this.doWriteMessage(msg);\r
- }\r
- else {\r
- this.queue.push(msg);\r
- }\r
- }\r
- doWriteMessage(msg) {\r
- try {\r
- if (this.process.send) {\r
- this.sending = true;\r
- this.process.send(msg, undefined, undefined, (error) => {\r
- this.sending = false;\r
- if (error) {\r
- this.errorCount++;\r
- this.fireError(error, msg, this.errorCount);\r
- }\r
- else {\r
- this.errorCount = 0;\r
- }\r
- if (this.queue.length > 0) {\r
- this.doWriteMessage(this.queue.shift());\r
- }\r
- });\r
- }\r
- }\r
- catch (error) {\r
- this.errorCount++;\r
- this.fireError(error, msg, this.errorCount);\r
- }\r
- }\r
-}\r
-exports.IPCMessageWriter = IPCMessageWriter;\r
-class SocketMessageWriter extends AbstractMessageWriter {\r
- constructor(socket, encoding = 'utf8') {\r
- super();\r
- this.socket = socket;\r
- this.queue = [];\r
- this.sending = false;\r
- this.encoding = encoding;\r
- this.errorCount = 0;\r
- this.socket.on('error', (error) => this.fireError(error));\r
- this.socket.on('close', () => this.fireClose());\r
- }\r
- dispose() {\r
- super.dispose();\r
- this.socket.destroy();\r
- }\r
- write(msg) {\r
- if (!this.sending && this.queue.length === 0) {\r
- // See https://github.com/nodejs/node/issues/7657\r
- this.doWriteMessage(msg);\r
- }\r
- else {\r
- this.queue.push(msg);\r
- }\r
- }\r
- doWriteMessage(msg) {\r
- let json = JSON.stringify(msg);\r
- let contentLength = Buffer.byteLength(json, this.encoding);\r
- let headers = [\r
- ContentLength, contentLength.toString(), CRLF,\r
- CRLF\r
- ];\r
- try {\r
- // Header must be written in ASCII encoding\r
- this.sending = true;\r
- this.socket.write(headers.join(''), 'ascii', (error) => {\r
- if (error) {\r
- this.handleError(error, msg);\r
- }\r
- try {\r
- // Now write the content. This can be written in any encoding\r
- this.socket.write(json, this.encoding, (error) => {\r
- this.sending = false;\r
- if (error) {\r
- this.handleError(error, msg);\r
- }\r
- else {\r
- this.errorCount = 0;\r
- }\r
- if (this.queue.length > 0) {\r
- this.doWriteMessage(this.queue.shift());\r
- }\r
- });\r
- }\r
- catch (error) {\r
- this.handleError(error, msg);\r
- }\r
- });\r
- }\r
- catch (error) {\r
- this.handleError(error, msg);\r
- }\r
- }\r
- handleError(error, msg) {\r
- this.errorCount++;\r
- this.fireError(error, msg, this.errorCount);\r
- }\r
-}\r
-exports.SocketMessageWriter = SocketMessageWriter;\r
-
-
-/***/ }),
-/* 9 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/*---------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- *--------------------------------------------------------------------------------------------*/\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const events_1 = __webpack_require__(7);\r
-const Is = __webpack_require__(4);\r
-var CancellationToken;\r
-(function (CancellationToken) {\r
- CancellationToken.None = Object.freeze({\r
- isCancellationRequested: false,\r
- onCancellationRequested: events_1.Event.None\r
- });\r
- CancellationToken.Cancelled = Object.freeze({\r
- isCancellationRequested: true,\r
- onCancellationRequested: events_1.Event.None\r
- });\r
- function is(value) {\r
- let candidate = value;\r
- return candidate && (candidate === CancellationToken.None\r
- || candidate === CancellationToken.Cancelled\r
- || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
- }\r
- CancellationToken.is = is;\r
-})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
-const shortcutEvent = Object.freeze(function (callback, context) {\r
- let handle = setTimeout(callback.bind(context), 0);\r
- return { dispose() { clearTimeout(handle); } };\r
-});\r
-class MutableToken {\r
- constructor() {\r
- this._isCancelled = false;\r
- }\r
- cancel() {\r
- if (!this._isCancelled) {\r
- this._isCancelled = true;\r
- if (this._emitter) {\r
- this._emitter.fire(undefined);\r
- this.dispose();\r
- }\r
- }\r
- }\r
- get isCancellationRequested() {\r
- return this._isCancelled;\r
- }\r
- get onCancellationRequested() {\r
- if (this._isCancelled) {\r
- return shortcutEvent;\r
- }\r
- if (!this._emitter) {\r
- this._emitter = new events_1.Emitter();\r
- }\r
- return this._emitter.event;\r
- }\r
- dispose() {\r
- if (this._emitter) {\r
- this._emitter.dispose();\r
- this._emitter = undefined;\r
- }\r
- }\r
-}\r
-class CancellationTokenSource {\r
- get token() {\r
- if (!this._token) {\r
- // be lazy and create the token only when\r
- // actually needed\r
- this._token = new MutableToken();\r
- }\r
- return this._token;\r
- }\r
- cancel() {\r
- if (!this._token) {\r
- // save an object by returning the default\r
- // cancelled token when cancellation happens\r
- // before someone asks for the token\r
- this._token = CancellationToken.Cancelled;\r
- }\r
- else {\r
- this._token.cancel();\r
- }\r
- }\r
- dispose() {\r
- if (!this._token) {\r
- // ensure to initialize with an empty token if we had none\r
- this._token = CancellationToken.None;\r
- }\r
- else if (this._token instanceof MutableToken) {\r
- // actually dispose\r
- this._token.dispose();\r
- }\r
- }\r
-}\r
-exports.CancellationTokenSource = CancellationTokenSource;\r
-
-
-/***/ }),
-/* 10 */
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-\r
-/*---------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- *--------------------------------------------------------------------------------------------*/\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-var Touch;\r
-(function (Touch) {\r
- Touch.None = 0;\r
- Touch.First = 1;\r
- Touch.Last = 2;\r
-})(Touch = exports.Touch || (exports.Touch = {}));\r
-class LinkedMap {\r
- constructor() {\r
- this._map = new Map();\r
- this._head = undefined;\r
- this._tail = undefined;\r
- this._size = 0;\r
- }\r
- clear() {\r
- this._map.clear();\r
- this._head = undefined;\r
- this._tail = undefined;\r
- this._size = 0;\r
- }\r
- isEmpty() {\r
- return !this._head && !this._tail;\r
- }\r
- get size() {\r
- return this._size;\r
- }\r
- has(key) {\r
- return this._map.has(key);\r
- }\r
- get(key) {\r
- const item = this._map.get(key);\r
- if (!item) {\r
- return undefined;\r
- }\r
- return item.value;\r
- }\r
- set(key, value, touch = Touch.None) {\r
- let item = this._map.get(key);\r
- if (item) {\r
- item.value = value;\r
- if (touch !== Touch.None) {\r
- this.touch(item, touch);\r
- }\r
- }\r
- else {\r
- item = { key, value, next: undefined, previous: undefined };\r
- switch (touch) {\r
- case Touch.None:\r
- this.addItemLast(item);\r
- break;\r
- case Touch.First:\r
- this.addItemFirst(item);\r
- break;\r
- case Touch.Last:\r
- this.addItemLast(item);\r
- break;\r
- default:\r
- this.addItemLast(item);\r
- break;\r
- }\r
- this._map.set(key, item);\r
- this._size++;\r
- }\r
- }\r
- delete(key) {\r
- const item = this._map.get(key);\r
- if (!item) {\r
- return false;\r
- }\r
- this._map.delete(key);\r
- this.removeItem(item);\r
- this._size--;\r
- return true;\r
- }\r
- shift() {\r
- if (!this._head && !this._tail) {\r
- return undefined;\r
- }\r
- if (!this._head || !this._tail) {\r
- throw new Error('Invalid list');\r
- }\r
- const item = this._head;\r
- this._map.delete(item.key);\r
- this.removeItem(item);\r
- this._size--;\r
- return item.value;\r
- }\r
- forEach(callbackfn, thisArg) {\r
- let current = this._head;\r
- while (current) {\r
- if (thisArg) {\r
- callbackfn.bind(thisArg)(current.value, current.key, this);\r
- }\r
- else {\r
- callbackfn(current.value, current.key, this);\r
- }\r
- current = current.next;\r
- }\r
- }\r
- forEachReverse(callbackfn, thisArg) {\r
- let current = this._tail;\r
- while (current) {\r
- if (thisArg) {\r
- callbackfn.bind(thisArg)(current.value, current.key, this);\r
- }\r
- else {\r
- callbackfn(current.value, current.key, this);\r
- }\r
- current = current.previous;\r
- }\r
- }\r
- values() {\r
- let result = [];\r
- let current = this._head;\r
- while (current) {\r
- result.push(current.value);\r
- current = current.next;\r
- }\r
- return result;\r
- }\r
- keys() {\r
- let result = [];\r
- let current = this._head;\r
- while (current) {\r
- result.push(current.key);\r
- current = current.next;\r
- }\r
- return result;\r
- }\r
- /* JSON RPC run on es5 which has no Symbol.iterator\r
- public keys(): IterableIterator<K> {\r
- let current = this._head;\r
- let iterator: IterableIterator<K> = {\r
- [Symbol.iterator]() {\r
- return iterator;\r
- },\r
- next():IteratorResult<K> {\r
- if (current) {\r
- let result = { value: current.key, done: false };\r
- current = current.next;\r
- return result;\r
- } else {\r
- return { value: undefined, done: true };\r
- }\r
- }\r
- };\r
- return iterator;\r
- }\r
-\r
- public values(): IterableIterator<V> {\r
- let current = this._head;\r
- let iterator: IterableIterator<V> = {\r
- [Symbol.iterator]() {\r
- return iterator;\r
- },\r
- next():IteratorResult<V> {\r
- if (current) {\r
- let result = { value: current.value, done: false };\r
- current = current.next;\r
- return result;\r
- } else {\r
- return { value: undefined, done: true };\r
- }\r
- }\r
- };\r
- return iterator;\r
- }\r
- */\r
- addItemFirst(item) {\r
- // First time Insert\r
- if (!this._head && !this._tail) {\r
- this._tail = item;\r
- }\r
- else if (!this._head) {\r
- throw new Error('Invalid list');\r
- }\r
- else {\r
- item.next = this._head;\r
- this._head.previous = item;\r
- }\r
- this._head = item;\r
- }\r
- addItemLast(item) {\r
- // First time Insert\r
- if (!this._head && !this._tail) {\r
- this._head = item;\r
- }\r
- else if (!this._tail) {\r
- throw new Error('Invalid list');\r
- }\r
- else {\r
- item.previous = this._tail;\r
- this._tail.next = item;\r
- }\r
- this._tail = item;\r
- }\r
- removeItem(item) {\r
- if (item === this._head && item === this._tail) {\r
- this._head = undefined;\r
- this._tail = undefined;\r
- }\r
- else if (item === this._head) {\r
- this._head = item.next;\r
- }\r
- else if (item === this._tail) {\r
- this._tail = item.previous;\r
- }\r
- else {\r
- const next = item.next;\r
- const previous = item.previous;\r
- if (!next || !previous) {\r
- throw new Error('Invalid list');\r
- }\r
- next.previous = previous;\r
- previous.next = next;\r
- }\r
- }\r
- touch(item, touch) {\r
- if (!this._head || !this._tail) {\r
- throw new Error('Invalid list');\r
- }\r
- if ((touch !== Touch.First && touch !== Touch.Last)) {\r
- return;\r
- }\r
- if (touch === Touch.First) {\r
- if (item === this._head) {\r
- return;\r
- }\r
- const next = item.next;\r
- const previous = item.previous;\r
- // Unlink the item\r
- if (item === this._tail) {\r
- // previous must be defined since item was not head but is tail\r
- // So there are more than on item in the map\r
- previous.next = undefined;\r
- this._tail = previous;\r
- }\r
- else {\r
- // Both next and previous are not undefined since item was neither head nor tail.\r
- next.previous = previous;\r
- previous.next = next;\r
- }\r
- // Insert the node at head\r
- item.previous = undefined;\r
- item.next = this._head;\r
- this._head.previous = item;\r
- this._head = item;\r
- }\r
- else if (touch === Touch.Last) {\r
- if (item === this._tail) {\r
- return;\r
- }\r
- const next = item.next;\r
- const previous = item.previous;\r
- // Unlink the item.\r
- if (item === this._head) {\r
- // next must be defined since item was not tail but is head\r
- // So there are more than on item in the map\r
- next.previous = undefined;\r
- this._head = next;\r
- }\r
- else {\r
- // Both next and previous are not undefined since item was neither head nor tail.\r
- next.previous = previous;\r
- previous.next = next;\r
- }\r
- item.next = undefined;\r
- item.previous = this._tail;\r
- this._tail.next = item;\r
- this._tail = item;\r
- }\r
- }\r
-}\r
-exports.LinkedMap = LinkedMap;\r
-
-
-/***/ }),
-/* 11 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const path_1 = __webpack_require__(12);\r
-const os_1 = __webpack_require__(13);\r
-const crypto_1 = __webpack_require__(14);\r
-const net_1 = __webpack_require__(15);\r
-const messageReader_1 = __webpack_require__(6);\r
-const messageWriter_1 = __webpack_require__(8);\r
-function generateRandomPipeName() {\r
- const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
- if (process.platform === 'win32') {\r
- return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
- }\r
- else {\r
- // Mac/Unix: use socket file\r
- return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
- }\r
-}\r
-exports.generateRandomPipeName = generateRandomPipeName;\r
-function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
- let connectResolve;\r
- let connected = new Promise((resolve, _reject) => {\r
- connectResolve = resolve;\r
- });\r
- return new Promise((resolve, reject) => {\r
- let server = net_1.createServer((socket) => {\r
- server.close();\r
- connectResolve([\r
- new messageReader_1.SocketMessageReader(socket, encoding),\r
- new messageWriter_1.SocketMessageWriter(socket, encoding)\r
- ]);\r
- });\r
- server.on('error', reject);\r
- server.listen(pipeName, () => {\r
- server.removeListener('error', reject);\r
- resolve({\r
- onConnected: () => { return connected; }\r
- });\r
- });\r
- });\r
-}\r
-exports.createClientPipeTransport = createClientPipeTransport;\r
-function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
- const socket = net_1.createConnection(pipeName);\r
- return [\r
- new messageReader_1.SocketMessageReader(socket, encoding),\r
- new messageWriter_1.SocketMessageWriter(socket, encoding)\r
- ];\r
-}\r
-exports.createServerPipeTransport = createServerPipeTransport;\r
-
-
-/***/ }),
-/* 12 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("path");;
-
-/***/ }),
-/* 13 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("os");;
-
-/***/ }),
-/* 14 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("crypto");;
-
-/***/ }),
-/* 15 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("net");;
-
-/***/ }),
-/* 16 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const net_1 = __webpack_require__(15);\r
-const messageReader_1 = __webpack_require__(6);\r
-const messageWriter_1 = __webpack_require__(8);\r
-function createClientSocketTransport(port, encoding = 'utf-8') {\r
- let connectResolve;\r
- let connected = new Promise((resolve, _reject) => {\r
- connectResolve = resolve;\r
- });\r
- return new Promise((resolve, reject) => {\r
- let server = net_1.createServer((socket) => {\r
- server.close();\r
- connectResolve([\r
- new messageReader_1.SocketMessageReader(socket, encoding),\r
- new messageWriter_1.SocketMessageWriter(socket, encoding)\r
- ]);\r
- });\r
- server.on('error', reject);\r
- server.listen(port, '127.0.0.1', () => {\r
- server.removeListener('error', reject);\r
- resolve({\r
- onConnected: () => { return connected; }\r
- });\r
- });\r
- });\r
-}\r
-exports.createClientSocketTransport = createClientSocketTransport;\r
-function createServerSocketTransport(port, encoding = 'utf-8') {\r
- const socket = net_1.createConnection(port, '127.0.0.1');\r
- return [\r
- new messageReader_1.SocketMessageReader(socket, encoding),\r
- new messageWriter_1.SocketMessageWriter(socket, encoding)\r
- ];\r
-}\r
-exports.createServerSocketTransport = createServerSocketTransport;\r
-
-
-/***/ }),
-/* 17 */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "Position": () => /* binding */ Position,
-/* harmony export */ "Range": () => /* binding */ Range,
-/* harmony export */ "Location": () => /* binding */ Location,
-/* harmony export */ "LocationLink": () => /* binding */ LocationLink,
-/* harmony export */ "Color": () => /* binding */ Color,
-/* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
-/* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
-/* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
-/* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
-/* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
-/* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
-/* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
-/* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
-/* harmony export */ "Command": () => /* binding */ Command,
-/* harmony export */ "TextEdit": () => /* binding */ TextEdit,
-/* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
-/* harmony export */ "CreateFile": () => /* binding */ CreateFile,
-/* harmony export */ "RenameFile": () => /* binding */ RenameFile,
-/* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
-/* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
-/* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
-/* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
-/* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
-/* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
-/* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
-/* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
-/* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
-/* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
-/* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
-/* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
-/* harmony export */ "CompletionList": () => /* binding */ CompletionList,
-/* harmony export */ "MarkedString": () => /* binding */ MarkedString,
-/* harmony export */ "Hover": () => /* binding */ Hover,
-/* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
-/* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
-/* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
-/* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
-/* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
-/* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
-/* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
-/* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
-/* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
-/* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
-/* harmony export */ "CodeAction": () => /* binding */ CodeAction,
-/* harmony export */ "CodeLens": () => /* binding */ CodeLens,
-/* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
-/* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
-/* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
-/* harmony export */ "EOL": () => /* binding */ EOL,
-/* harmony export */ "TextDocument": () => /* binding */ TextDocument
-/* harmony export */ });
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-/**\r
- * The Position namespace provides helper functions to work with\r
- * [Position](#Position) literals.\r
- */\r
-var Position;\r
-(function (Position) {\r
- /**\r
- * Creates a new Position literal from the given line and character.\r
- * @param line The position's line.\r
- * @param character The position's character.\r
- */\r
- function create(line, character) {\r
- return { line: line, character: character };\r
- }\r
- Position.create = create;\r
- /**\r
- * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
- }\r
- Position.is = is;\r
-})(Position || (Position = {}));\r
-/**\r
- * The Range namespace provides helper functions to work with\r
- * [Range](#Range) literals.\r
- */\r
-var Range;\r
-(function (Range) {\r
- function create(one, two, three, four) {\r
- if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
- return { start: Position.create(one, two), end: Position.create(three, four) };\r
- }\r
- else if (Position.is(one) && Position.is(two)) {\r
- return { start: one, end: two };\r
- }\r
- else {\r
- throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
- }\r
- }\r
- Range.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [Range](#Range) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
- }\r
- Range.is = is;\r
-})(Range || (Range = {}));\r
-/**\r
- * The Location namespace provides helper functions to work with\r
- * [Location](#Location) literals.\r
- */\r
-var Location;\r
-(function (Location) {\r
- /**\r
- * Creates a Location literal.\r
- * @param uri The location's uri.\r
- * @param range The location's range.\r
- */\r
- function create(uri, range) {\r
- return { uri: uri, range: range };\r
- }\r
- Location.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [Location](#Location) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
- }\r
- Location.is = is;\r
-})(Location || (Location = {}));\r
-/**\r
- * The LocationLink namespace provides helper functions to work with\r
- * [LocationLink](#LocationLink) literals.\r
- */\r
-var LocationLink;\r
-(function (LocationLink) {\r
- /**\r
- * Creates a LocationLink literal.\r
- * @param targetUri The definition's uri.\r
- * @param targetRange The full range of the definition.\r
- * @param targetSelectionRange The span of the symbol definition at the target.\r
- * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
- */\r
- function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
- return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
- }\r
- LocationLink.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
- && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
- && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
- }\r
- LocationLink.is = is;\r
-})(LocationLink || (LocationLink = {}));\r
-/**\r
- * The Color namespace provides helper functions to work with\r
- * [Color](#Color) literals.\r
- */\r
-var Color;\r
-(function (Color) {\r
- /**\r
- * Creates a new Color literal.\r
- */\r
- function create(red, green, blue, alpha) {\r
- return {\r
- red: red,\r
- green: green,\r
- blue: blue,\r
- alpha: alpha,\r
- };\r
- }\r
- Color.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [Color](#Color) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.number(candidate.red)\r
- && Is.number(candidate.green)\r
- && Is.number(candidate.blue)\r
- && Is.number(candidate.alpha);\r
- }\r
- Color.is = is;\r
-})(Color || (Color = {}));\r
-/**\r
- * The ColorInformation namespace provides helper functions to work with\r
- * [ColorInformation](#ColorInformation) literals.\r
- */\r
-var ColorInformation;\r
-(function (ColorInformation) {\r
- /**\r
- * Creates a new ColorInformation literal.\r
- */\r
- function create(range, color) {\r
- return {\r
- range: range,\r
- color: color,\r
- };\r
- }\r
- ColorInformation.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Range.is(candidate.range) && Color.is(candidate.color);\r
- }\r
- ColorInformation.is = is;\r
-})(ColorInformation || (ColorInformation = {}));\r
-/**\r
- * The Color namespace provides helper functions to work with\r
- * [ColorPresentation](#ColorPresentation) literals.\r
- */\r
-var ColorPresentation;\r
-(function (ColorPresentation) {\r
- /**\r
- * Creates a new ColorInformation literal.\r
- */\r
- function create(label, textEdit, additionalTextEdits) {\r
- return {\r
- label: label,\r
- textEdit: textEdit,\r
- additionalTextEdits: additionalTextEdits,\r
- };\r
- }\r
- ColorPresentation.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.string(candidate.label)\r
- && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
- && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
- }\r
- ColorPresentation.is = is;\r
-})(ColorPresentation || (ColorPresentation = {}));\r
-/**\r
- * Enum of known range kinds\r
- */\r
-var FoldingRangeKind;\r
-(function (FoldingRangeKind) {\r
- /**\r
- * Folding range for a comment\r
- */\r
- FoldingRangeKind["Comment"] = "comment";\r
- /**\r
- * Folding range for a imports or includes\r
- */\r
- FoldingRangeKind["Imports"] = "imports";\r
- /**\r
- * Folding range for a region (e.g. `#region`)\r
- */\r
- FoldingRangeKind["Region"] = "region";\r
-})(FoldingRangeKind || (FoldingRangeKind = {}));\r
-/**\r
- * The folding range namespace provides helper functions to work with\r
- * [FoldingRange](#FoldingRange) literals.\r
- */\r
-var FoldingRange;\r
-(function (FoldingRange) {\r
- /**\r
- * Creates a new FoldingRange literal.\r
- */\r
- function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
- var result = {\r
- startLine: startLine,\r
- endLine: endLine\r
- };\r
- if (Is.defined(startCharacter)) {\r
- result.startCharacter = startCharacter;\r
- }\r
- if (Is.defined(endCharacter)) {\r
- result.endCharacter = endCharacter;\r
- }\r
- if (Is.defined(kind)) {\r
- result.kind = kind;\r
- }\r
- return result;\r
- }\r
- FoldingRange.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
- && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
- && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
- && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
- }\r
- FoldingRange.is = is;\r
-})(FoldingRange || (FoldingRange = {}));\r
-/**\r
- * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
- * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
- */\r
-var DiagnosticRelatedInformation;\r
-(function (DiagnosticRelatedInformation) {\r
- /**\r
- * Creates a new DiagnosticRelatedInformation literal.\r
- */\r
- function create(location, message) {\r
- return {\r
- location: location,\r
- message: message\r
- };\r
- }\r
- DiagnosticRelatedInformation.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
- }\r
- DiagnosticRelatedInformation.is = is;\r
-})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
-/**\r
- * The diagnostic's severity.\r
- */\r
-var DiagnosticSeverity;\r
-(function (DiagnosticSeverity) {\r
- /**\r
- * Reports an error.\r
- */\r
- DiagnosticSeverity.Error = 1;\r
- /**\r
- * Reports a warning.\r
- */\r
- DiagnosticSeverity.Warning = 2;\r
- /**\r
- * Reports an information.\r
- */\r
- DiagnosticSeverity.Information = 3;\r
- /**\r
- * Reports a hint.\r
- */\r
- DiagnosticSeverity.Hint = 4;\r
-})(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
-/**\r
- * The diagnostic tags.\r
- *\r
- * @since 3.15.0\r
- */\r
-var DiagnosticTag;\r
-(function (DiagnosticTag) {\r
- /**\r
- * Unused or unnecessary code.\r
- *\r
- * Clients are allowed to render diagnostics with this tag faded out instead of having\r
- * an error squiggle.\r
- */\r
- DiagnosticTag.Unnecessary = 1;\r
- /**\r
- * Deprecated or obsolete code.\r
- *\r
- * Clients are allowed to rendered diagnostics with this tag strike through.\r
- */\r
- DiagnosticTag.Deprecated = 2;\r
-})(DiagnosticTag || (DiagnosticTag = {}));\r
-/**\r
- * The Diagnostic namespace provides helper functions to work with\r
- * [Diagnostic](#Diagnostic) literals.\r
- */\r
-var Diagnostic;\r
-(function (Diagnostic) {\r
- /**\r
- * Creates a new Diagnostic literal.\r
- */\r
- function create(range, message, severity, code, source, relatedInformation) {\r
- var result = { range: range, message: message };\r
- if (Is.defined(severity)) {\r
- result.severity = severity;\r
- }\r
- if (Is.defined(code)) {\r
- result.code = code;\r
- }\r
- if (Is.defined(source)) {\r
- result.source = source;\r
- }\r
- if (Is.defined(relatedInformation)) {\r
- result.relatedInformation = relatedInformation;\r
- }\r
- return result;\r
- }\r
- Diagnostic.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate)\r
- && Range.is(candidate.range)\r
- && Is.string(candidate.message)\r
- && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
- && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
- && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
- && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
- }\r
- Diagnostic.is = is;\r
-})(Diagnostic || (Diagnostic = {}));\r
-/**\r
- * The Command namespace provides helper functions to work with\r
- * [Command](#Command) literals.\r
- */\r
-var Command;\r
-(function (Command) {\r
- /**\r
- * Creates a new Command literal.\r
- */\r
- function create(title, command) {\r
- var args = [];\r
- for (var _i = 2; _i < arguments.length; _i++) {\r
- args[_i - 2] = arguments[_i];\r
- }\r
- var result = { title: title, command: command };\r
- if (Is.defined(args) && args.length > 0) {\r
- result.arguments = args;\r
- }\r
- return result;\r
- }\r
- Command.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [Command](#Command) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
- }\r
- Command.is = is;\r
-})(Command || (Command = {}));\r
-/**\r
- * The TextEdit namespace provides helper function to create replace,\r
- * insert and delete edits more easily.\r
- */\r
-var TextEdit;\r
-(function (TextEdit) {\r
- /**\r
- * Creates a replace text edit.\r
- * @param range The range of text to be replaced.\r
- * @param newText The new text.\r
- */\r
- function replace(range, newText) {\r
- return { range: range, newText: newText };\r
- }\r
- TextEdit.replace = replace;\r
- /**\r
- * Creates a insert text edit.\r
- * @param position The position to insert the text at.\r
- * @param newText The text to be inserted.\r
- */\r
- function insert(position, newText) {\r
- return { range: { start: position, end: position }, newText: newText };\r
- }\r
- TextEdit.insert = insert;\r
- /**\r
- * Creates a delete text edit.\r
- * @param range The range of text to be deleted.\r
- */\r
- function del(range) {\r
- return { range: range, newText: '' };\r
- }\r
- TextEdit.del = del;\r
- function is(value) {\r
- var candidate = value;\r
- return Is.objectLiteral(candidate)\r
- && Is.string(candidate.newText)\r
- && Range.is(candidate.range);\r
- }\r
- TextEdit.is = is;\r
-})(TextEdit || (TextEdit = {}));\r
-/**\r
- * The TextDocumentEdit namespace provides helper function to create\r
- * an edit that manipulates a text document.\r
- */\r
-var TextDocumentEdit;\r
-(function (TextDocumentEdit) {\r
- /**\r
- * Creates a new `TextDocumentEdit`\r
- */\r
- function create(textDocument, edits) {\r
- return { textDocument: textDocument, edits: edits };\r
- }\r
- TextDocumentEdit.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate)\r
- && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
- && Array.isArray(candidate.edits);\r
- }\r
- TextDocumentEdit.is = is;\r
-})(TextDocumentEdit || (TextDocumentEdit = {}));\r
-var CreateFile;\r
-(function (CreateFile) {\r
- function create(uri, options) {\r
- var result = {\r
- kind: 'create',\r
- uri: uri\r
- };\r
- if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
- result.options = options;\r
- }\r
- return result;\r
- }\r
- CreateFile.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
- (candidate.options === void 0 ||\r
- ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
- }\r
- CreateFile.is = is;\r
-})(CreateFile || (CreateFile = {}));\r
-var RenameFile;\r
-(function (RenameFile) {\r
- function create(oldUri, newUri, options) {\r
- var result = {\r
- kind: 'rename',\r
- oldUri: oldUri,\r
- newUri: newUri\r
- };\r
- if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
- result.options = options;\r
- }\r
- return result;\r
- }\r
- RenameFile.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
- (candidate.options === void 0 ||\r
- ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
- }\r
- RenameFile.is = is;\r
-})(RenameFile || (RenameFile = {}));\r
-var DeleteFile;\r
-(function (DeleteFile) {\r
- function create(uri, options) {\r
- var result = {\r
- kind: 'delete',\r
- uri: uri\r
- };\r
- if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
- result.options = options;\r
- }\r
- return result;\r
- }\r
- DeleteFile.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
- (candidate.options === void 0 ||\r
- ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
- }\r
- DeleteFile.is = is;\r
-})(DeleteFile || (DeleteFile = {}));\r
-var WorkspaceEdit;\r
-(function (WorkspaceEdit) {\r
- function is(value) {\r
- var candidate = value;\r
- return candidate &&\r
- (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
- (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
- if (Is.string(change.kind)) {\r
- return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
- }\r
- else {\r
- return TextDocumentEdit.is(change);\r
- }\r
- }));\r
- }\r
- WorkspaceEdit.is = is;\r
-})(WorkspaceEdit || (WorkspaceEdit = {}));\r
-var TextEditChangeImpl = /** @class */ (function () {\r
- function TextEditChangeImpl(edits) {\r
- this.edits = edits;\r
- }\r
- TextEditChangeImpl.prototype.insert = function (position, newText) {\r
- this.edits.push(TextEdit.insert(position, newText));\r
- };\r
- TextEditChangeImpl.prototype.replace = function (range, newText) {\r
- this.edits.push(TextEdit.replace(range, newText));\r
- };\r
- TextEditChangeImpl.prototype.delete = function (range) {\r
- this.edits.push(TextEdit.del(range));\r
- };\r
- TextEditChangeImpl.prototype.add = function (edit) {\r
- this.edits.push(edit);\r
- };\r
- TextEditChangeImpl.prototype.all = function () {\r
- return this.edits;\r
- };\r
- TextEditChangeImpl.prototype.clear = function () {\r
- this.edits.splice(0, this.edits.length);\r
- };\r
- return TextEditChangeImpl;\r
-}());\r
-/**\r
- * A workspace change helps constructing changes to a workspace.\r
- */\r
-var WorkspaceChange = /** @class */ (function () {\r
- function WorkspaceChange(workspaceEdit) {\r
- var _this = this;\r
- this._textEditChanges = Object.create(null);\r
- if (workspaceEdit) {\r
- this._workspaceEdit = workspaceEdit;\r
- if (workspaceEdit.documentChanges) {\r
- workspaceEdit.documentChanges.forEach(function (change) {\r
- if (TextDocumentEdit.is(change)) {\r
- var textEditChange = new TextEditChangeImpl(change.edits);\r
- _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
- }\r
- });\r
- }\r
- else if (workspaceEdit.changes) {\r
- Object.keys(workspaceEdit.changes).forEach(function (key) {\r
- var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
- _this._textEditChanges[key] = textEditChange;\r
- });\r
- }\r
- }\r
- }\r
- Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
- /**\r
- * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
- * use to be returned from a workspace edit operation like rename.\r
- */\r
- get: function () {\r
- return this._workspaceEdit;\r
- },\r
- enumerable: true,\r
- configurable: true\r
- });\r
- WorkspaceChange.prototype.getTextEditChange = function (key) {\r
- if (VersionedTextDocumentIdentifier.is(key)) {\r
- if (!this._workspaceEdit) {\r
- this._workspaceEdit = {\r
- documentChanges: []\r
- };\r
- }\r
- if (!this._workspaceEdit.documentChanges) {\r
- throw new Error('Workspace edit is not configured for document changes.');\r
- }\r
- var textDocument = key;\r
- var result = this._textEditChanges[textDocument.uri];\r
- if (!result) {\r
- var edits = [];\r
- var textDocumentEdit = {\r
- textDocument: textDocument,\r
- edits: edits\r
- };\r
- this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
- result = new TextEditChangeImpl(edits);\r
- this._textEditChanges[textDocument.uri] = result;\r
- }\r
- return result;\r
- }\r
- else {\r
- if (!this._workspaceEdit) {\r
- this._workspaceEdit = {\r
- changes: Object.create(null)\r
- };\r
- }\r
- if (!this._workspaceEdit.changes) {\r
- throw new Error('Workspace edit is not configured for normal text edit changes.');\r
- }\r
- var result = this._textEditChanges[key];\r
- if (!result) {\r
- var edits = [];\r
- this._workspaceEdit.changes[key] = edits;\r
- result = new TextEditChangeImpl(edits);\r
- this._textEditChanges[key] = result;\r
- }\r
- return result;\r
- }\r
- };\r
- WorkspaceChange.prototype.createFile = function (uri, options) {\r
- this.checkDocumentChanges();\r
- this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
- };\r
- WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
- this.checkDocumentChanges();\r
- this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
- };\r
- WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
- this.checkDocumentChanges();\r
- this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
- };\r
- WorkspaceChange.prototype.checkDocumentChanges = function () {\r
- if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
- throw new Error('Workspace edit is not configured for document changes.');\r
- }\r
- };\r
- return WorkspaceChange;\r
-}());\r
-\r
-/**\r
- * The TextDocumentIdentifier namespace provides helper functions to work with\r
- * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
- */\r
-var TextDocumentIdentifier;\r
-(function (TextDocumentIdentifier) {\r
- /**\r
- * Creates a new TextDocumentIdentifier literal.\r
- * @param uri The document's uri.\r
- */\r
- function create(uri) {\r
- return { uri: uri };\r
- }\r
- TextDocumentIdentifier.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.string(candidate.uri);\r
- }\r
- TextDocumentIdentifier.is = is;\r
-})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
-/**\r
- * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
- * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
- */\r
-var VersionedTextDocumentIdentifier;\r
-(function (VersionedTextDocumentIdentifier) {\r
- /**\r
- * Creates a new VersionedTextDocumentIdentifier literal.\r
- * @param uri The document's uri.\r
- * @param uri The document's text.\r
- */\r
- function create(uri, version) {\r
- return { uri: uri, version: version };\r
- }\r
- VersionedTextDocumentIdentifier.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
- }\r
- VersionedTextDocumentIdentifier.is = is;\r
-})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
-/**\r
- * The TextDocumentItem namespace provides helper functions to work with\r
- * [TextDocumentItem](#TextDocumentItem) literals.\r
- */\r
-var TextDocumentItem;\r
-(function (TextDocumentItem) {\r
- /**\r
- * Creates a new TextDocumentItem literal.\r
- * @param uri The document's uri.\r
- * @param languageId The document's language identifier.\r
- * @param version The document's version number.\r
- * @param text The document's text.\r
- */\r
- function create(uri, languageId, version, text) {\r
- return { uri: uri, languageId: languageId, version: version, text: text };\r
- }\r
- TextDocumentItem.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
- }\r
- TextDocumentItem.is = is;\r
-})(TextDocumentItem || (TextDocumentItem = {}));\r
-/**\r
- * Describes the content type that a client supports in various\r
- * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
- *\r
- * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
- * are reserved for internal usage.\r
- */\r
-var MarkupKind;\r
-(function (MarkupKind) {\r
- /**\r
- * Plain text is supported as a content format\r
- */\r
- MarkupKind.PlainText = 'plaintext';\r
- /**\r
- * Markdown is supported as a content format\r
- */\r
- MarkupKind.Markdown = 'markdown';\r
-})(MarkupKind || (MarkupKind = {}));\r
-(function (MarkupKind) {\r
- /**\r
- * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
- }\r
- MarkupKind.is = is;\r
-})(MarkupKind || (MarkupKind = {}));\r
-var MarkupContent;\r
-(function (MarkupContent) {\r
- /**\r
- * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
- }\r
- MarkupContent.is = is;\r
-})(MarkupContent || (MarkupContent = {}));\r
-/**\r
- * The kind of a completion entry.\r
- */\r
-var CompletionItemKind;\r
-(function (CompletionItemKind) {\r
- CompletionItemKind.Text = 1;\r
- CompletionItemKind.Method = 2;\r
- CompletionItemKind.Function = 3;\r
- CompletionItemKind.Constructor = 4;\r
- CompletionItemKind.Field = 5;\r
- CompletionItemKind.Variable = 6;\r
- CompletionItemKind.Class = 7;\r
- CompletionItemKind.Interface = 8;\r
- CompletionItemKind.Module = 9;\r
- CompletionItemKind.Property = 10;\r
- CompletionItemKind.Unit = 11;\r
- CompletionItemKind.Value = 12;\r
- CompletionItemKind.Enum = 13;\r
- CompletionItemKind.Keyword = 14;\r
- CompletionItemKind.Snippet = 15;\r
- CompletionItemKind.Color = 16;\r
- CompletionItemKind.File = 17;\r
- CompletionItemKind.Reference = 18;\r
- CompletionItemKind.Folder = 19;\r
- CompletionItemKind.EnumMember = 20;\r
- CompletionItemKind.Constant = 21;\r
- CompletionItemKind.Struct = 22;\r
- CompletionItemKind.Event = 23;\r
- CompletionItemKind.Operator = 24;\r
- CompletionItemKind.TypeParameter = 25;\r
-})(CompletionItemKind || (CompletionItemKind = {}));\r
-/**\r
- * Defines whether the insert text in a completion item should be interpreted as\r
- * plain text or a snippet.\r
- */\r
-var InsertTextFormat;\r
-(function (InsertTextFormat) {\r
- /**\r
- * The primary text to be inserted is treated as a plain string.\r
- */\r
- InsertTextFormat.PlainText = 1;\r
- /**\r
- * The primary text to be inserted is treated as a snippet.\r
- *\r
- * A snippet can define tab stops and placeholders with `$1`, `$2`\r
- * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
- * the end of the snippet. Placeholders with equal identifiers are linked,\r
- * that is typing in one will update others too.\r
- *\r
- * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
- */\r
- InsertTextFormat.Snippet = 2;\r
-})(InsertTextFormat || (InsertTextFormat = {}));\r
-/**\r
- * Completion item tags are extra annotations that tweak the rendering of a completion\r
- * item.\r
- *\r
- * @since 3.15.0\r
- */\r
-var CompletionItemTag;\r
-(function (CompletionItemTag) {\r
- /**\r
- * Render a completion as obsolete, usually using a strike-out.\r
- */\r
- CompletionItemTag.Deprecated = 1;\r
-})(CompletionItemTag || (CompletionItemTag = {}));\r
-/**\r
- * The CompletionItem namespace provides functions to deal with\r
- * completion items.\r
- */\r
-var CompletionItem;\r
-(function (CompletionItem) {\r
- /**\r
- * Create a completion item and seed it with a label.\r
- * @param label The completion item's label\r
- */\r
- function create(label) {\r
- return { label: label };\r
- }\r
- CompletionItem.create = create;\r
-})(CompletionItem || (CompletionItem = {}));\r
-/**\r
- * The CompletionList namespace provides functions to deal with\r
- * completion lists.\r
- */\r
-var CompletionList;\r
-(function (CompletionList) {\r
- /**\r
- * Creates a new completion list.\r
- *\r
- * @param items The completion items.\r
- * @param isIncomplete The list is not complete.\r
- */\r
- function create(items, isIncomplete) {\r
- return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
- }\r
- CompletionList.create = create;\r
-})(CompletionList || (CompletionList = {}));\r
-var MarkedString;\r
-(function (MarkedString) {\r
- /**\r
- * Creates a marked string from plain text.\r
- *\r
- * @param plainText The plain text.\r
- */\r
- function fromPlainText(plainText) {\r
- return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
- }\r
- MarkedString.fromPlainText = fromPlainText;\r
- /**\r
- * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
- }\r
- MarkedString.is = is;\r
-})(MarkedString || (MarkedString = {}));\r
-var Hover;\r
-(function (Hover) {\r
- /**\r
- * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
- MarkedString.is(candidate.contents) ||\r
- Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
- }\r
- Hover.is = is;\r
-})(Hover || (Hover = {}));\r
-/**\r
- * The ParameterInformation namespace provides helper functions to work with\r
- * [ParameterInformation](#ParameterInformation) literals.\r
- */\r
-var ParameterInformation;\r
-(function (ParameterInformation) {\r
- /**\r
- * Creates a new parameter information literal.\r
- *\r
- * @param label A label string.\r
- * @param documentation A doc string.\r
- */\r
- function create(label, documentation) {\r
- return documentation ? { label: label, documentation: documentation } : { label: label };\r
- }\r
- ParameterInformation.create = create;\r
-})(ParameterInformation || (ParameterInformation = {}));\r
-/**\r
- * The SignatureInformation namespace provides helper functions to work with\r
- * [SignatureInformation](#SignatureInformation) literals.\r
- */\r
-var SignatureInformation;\r
-(function (SignatureInformation) {\r
- function create(label, documentation) {\r
- var parameters = [];\r
- for (var _i = 2; _i < arguments.length; _i++) {\r
- parameters[_i - 2] = arguments[_i];\r
- }\r
- var result = { label: label };\r
- if (Is.defined(documentation)) {\r
- result.documentation = documentation;\r
- }\r
- if (Is.defined(parameters)) {\r
- result.parameters = parameters;\r
- }\r
- else {\r
- result.parameters = [];\r
- }\r
- return result;\r
- }\r
- SignatureInformation.create = create;\r
-})(SignatureInformation || (SignatureInformation = {}));\r
-/**\r
- * A document highlight kind.\r
- */\r
-var DocumentHighlightKind;\r
-(function (DocumentHighlightKind) {\r
- /**\r
- * A textual occurrence.\r
- */\r
- DocumentHighlightKind.Text = 1;\r
- /**\r
- * Read-access of a symbol, like reading a variable.\r
- */\r
- DocumentHighlightKind.Read = 2;\r
- /**\r
- * Write-access of a symbol, like writing to a variable.\r
- */\r
- DocumentHighlightKind.Write = 3;\r
-})(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
-/**\r
- * DocumentHighlight namespace to provide helper functions to work with\r
- * [DocumentHighlight](#DocumentHighlight) literals.\r
- */\r
-var DocumentHighlight;\r
-(function (DocumentHighlight) {\r
- /**\r
- * Create a DocumentHighlight object.\r
- * @param range The range the highlight applies to.\r
- */\r
- function create(range, kind) {\r
- var result = { range: range };\r
- if (Is.number(kind)) {\r
- result.kind = kind;\r
- }\r
- return result;\r
- }\r
- DocumentHighlight.create = create;\r
-})(DocumentHighlight || (DocumentHighlight = {}));\r
-/**\r
- * A symbol kind.\r
- */\r
-var SymbolKind;\r
-(function (SymbolKind) {\r
- SymbolKind.File = 1;\r
- SymbolKind.Module = 2;\r
- SymbolKind.Namespace = 3;\r
- SymbolKind.Package = 4;\r
- SymbolKind.Class = 5;\r
- SymbolKind.Method = 6;\r
- SymbolKind.Property = 7;\r
- SymbolKind.Field = 8;\r
- SymbolKind.Constructor = 9;\r
- SymbolKind.Enum = 10;\r
- SymbolKind.Interface = 11;\r
- SymbolKind.Function = 12;\r
- SymbolKind.Variable = 13;\r
- SymbolKind.Constant = 14;\r
- SymbolKind.String = 15;\r
- SymbolKind.Number = 16;\r
- SymbolKind.Boolean = 17;\r
- SymbolKind.Array = 18;\r
- SymbolKind.Object = 19;\r
- SymbolKind.Key = 20;\r
- SymbolKind.Null = 21;\r
- SymbolKind.EnumMember = 22;\r
- SymbolKind.Struct = 23;\r
- SymbolKind.Event = 24;\r
- SymbolKind.Operator = 25;\r
- SymbolKind.TypeParameter = 26;\r
-})(SymbolKind || (SymbolKind = {}));\r
-/**\r
- * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
- * @since 3.15\r
- */\r
-var SymbolTag;\r
-(function (SymbolTag) {\r
- /**\r
- * Render a symbol as obsolete, usually using a strike-out.\r
- */\r
- SymbolTag.Deprecated = 1;\r
-})(SymbolTag || (SymbolTag = {}));\r
-var SymbolInformation;\r
-(function (SymbolInformation) {\r
- /**\r
- * Creates a new symbol information literal.\r
- *\r
- * @param name The name of the symbol.\r
- * @param kind The kind of the symbol.\r
- * @param range The range of the location of the symbol.\r
- * @param uri The resource of the location of symbol, defaults to the current document.\r
- * @param containerName The name of the symbol containing the symbol.\r
- */\r
- function create(name, kind, range, uri, containerName) {\r
- var result = {\r
- name: name,\r
- kind: kind,\r
- location: { uri: uri, range: range }\r
- };\r
- if (containerName) {\r
- result.containerName = containerName;\r
- }\r
- return result;\r
- }\r
- SymbolInformation.create = create;\r
-})(SymbolInformation || (SymbolInformation = {}));\r
-var DocumentSymbol;\r
-(function (DocumentSymbol) {\r
- /**\r
- * Creates a new symbol information literal.\r
- *\r
- * @param name The name of the symbol.\r
- * @param detail The detail of the symbol.\r
- * @param kind The kind of the symbol.\r
- * @param range The range of the symbol.\r
- * @param selectionRange The selectionRange of the symbol.\r
- * @param children Children of the symbol.\r
- */\r
- function create(name, detail, kind, range, selectionRange, children) {\r
- var result = {\r
- name: name,\r
- detail: detail,\r
- kind: kind,\r
- range: range,\r
- selectionRange: selectionRange\r
- };\r
- if (children !== void 0) {\r
- result.children = children;\r
- }\r
- return result;\r
- }\r
- DocumentSymbol.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return candidate &&\r
- Is.string(candidate.name) && Is.number(candidate.kind) &&\r
- Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
- (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
- (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
- (candidate.children === void 0 || Array.isArray(candidate.children));\r
- }\r
- DocumentSymbol.is = is;\r
-})(DocumentSymbol || (DocumentSymbol = {}));\r
-/**\r
- * A set of predefined code action kinds\r
- */\r
-var CodeActionKind;\r
-(function (CodeActionKind) {\r
- /**\r
- * Empty kind.\r
- */\r
- CodeActionKind.Empty = '';\r
- /**\r
- * Base kind for quickfix actions: 'quickfix'\r
- */\r
- CodeActionKind.QuickFix = 'quickfix';\r
- /**\r
- * Base kind for refactoring actions: 'refactor'\r
- */\r
- CodeActionKind.Refactor = 'refactor';\r
- /**\r
- * Base kind for refactoring extraction actions: 'refactor.extract'\r
- *\r
- * Example extract actions:\r
- *\r
- * - Extract method\r
- * - Extract function\r
- * - Extract variable\r
- * - Extract interface from class\r
- * - ...\r
- */\r
- CodeActionKind.RefactorExtract = 'refactor.extract';\r
- /**\r
- * Base kind for refactoring inline actions: 'refactor.inline'\r
- *\r
- * Example inline actions:\r
- *\r
- * - Inline function\r
- * - Inline variable\r
- * - Inline constant\r
- * - ...\r
- */\r
- CodeActionKind.RefactorInline = 'refactor.inline';\r
- /**\r
- * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
- *\r
- * Example rewrite actions:\r
- *\r
- * - Convert JavaScript function to class\r
- * - Add or remove parameter\r
- * - Encapsulate field\r
- * - Make method static\r
- * - Move method to base class\r
- * - ...\r
- */\r
- CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
- /**\r
- * Base kind for source actions: `source`\r
- *\r
- * Source code actions apply to the entire file.\r
- */\r
- CodeActionKind.Source = 'source';\r
- /**\r
- * Base kind for an organize imports source action: `source.organizeImports`\r
- */\r
- CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
- /**\r
- * Base kind for auto-fix source actions: `source.fixAll`.\r
- *\r
- * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
- * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
- *\r
- * @since 3.15.0\r
- */\r
- CodeActionKind.SourceFixAll = 'source.fixAll';\r
-})(CodeActionKind || (CodeActionKind = {}));\r
-/**\r
- * The CodeActionContext namespace provides helper functions to work with\r
- * [CodeActionContext](#CodeActionContext) literals.\r
- */\r
-var CodeActionContext;\r
-(function (CodeActionContext) {\r
- /**\r
- * Creates a new CodeActionContext literal.\r
- */\r
- function create(diagnostics, only) {\r
- var result = { diagnostics: diagnostics };\r
- if (only !== void 0 && only !== null) {\r
- result.only = only;\r
- }\r
- return result;\r
- }\r
- CodeActionContext.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
- }\r
- CodeActionContext.is = is;\r
-})(CodeActionContext || (CodeActionContext = {}));\r
-var CodeAction;\r
-(function (CodeAction) {\r
- function create(title, commandOrEdit, kind) {\r
- var result = { title: title };\r
- if (Command.is(commandOrEdit)) {\r
- result.command = commandOrEdit;\r
- }\r
- else {\r
- result.edit = commandOrEdit;\r
- }\r
- if (kind !== void 0) {\r
- result.kind = kind;\r
- }\r
- return result;\r
- }\r
- CodeAction.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return candidate && Is.string(candidate.title) &&\r
- (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
- (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
- (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
- (candidate.command === void 0 || Command.is(candidate.command)) &&\r
- (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
- (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
- }\r
- CodeAction.is = is;\r
-})(CodeAction || (CodeAction = {}));\r
-/**\r
- * The CodeLens namespace provides helper functions to work with\r
- * [CodeLens](#CodeLens) literals.\r
- */\r
-var CodeLens;\r
-(function (CodeLens) {\r
- /**\r
- * Creates a new CodeLens literal.\r
- */\r
- function create(range, data) {\r
- var result = { range: range };\r
- if (Is.defined(data)) {\r
- result.data = data;\r
- }\r
- return result;\r
- }\r
- CodeLens.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
- }\r
- CodeLens.is = is;\r
-})(CodeLens || (CodeLens = {}));\r
-/**\r
- * The FormattingOptions namespace provides helper functions to work with\r
- * [FormattingOptions](#FormattingOptions) literals.\r
- */\r
-var FormattingOptions;\r
-(function (FormattingOptions) {\r
- /**\r
- * Creates a new FormattingOptions literal.\r
- */\r
- function create(tabSize, insertSpaces) {\r
- return { tabSize: tabSize, insertSpaces: insertSpaces };\r
- }\r
- FormattingOptions.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
- }\r
- FormattingOptions.is = is;\r
-})(FormattingOptions || (FormattingOptions = {}));\r
-/**\r
- * The DocumentLink namespace provides helper functions to work with\r
- * [DocumentLink](#DocumentLink) literals.\r
- */\r
-var DocumentLink;\r
-(function (DocumentLink) {\r
- /**\r
- * Creates a new DocumentLink literal.\r
- */\r
- function create(range, target, data) {\r
- return { range: range, target: target, data: data };\r
- }\r
- DocumentLink.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
- }\r
- DocumentLink.is = is;\r
-})(DocumentLink || (DocumentLink = {}));\r
-/**\r
- * The SelectionRange namespace provides helper function to work with\r
- * SelectionRange literals.\r
- */\r
-var SelectionRange;\r
-(function (SelectionRange) {\r
- /**\r
- * Creates a new SelectionRange\r
- * @param range the range.\r
- * @param parent an optional parent.\r
- */\r
- function create(range, parent) {\r
- return { range: range, parent: parent };\r
- }\r
- SelectionRange.create = create;\r
- function is(value) {\r
- var candidate = value;\r
- return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
- }\r
- SelectionRange.is = is;\r
-})(SelectionRange || (SelectionRange = {}));\r
-var EOL = ['\n', '\r\n', '\r'];\r
-/**\r
- * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
- */\r
-var TextDocument;\r
-(function (TextDocument) {\r
- /**\r
- * Creates a new ITextDocument literal from the given uri and content.\r
- * @param uri The document's uri.\r
- * @param languageId The document's language Id.\r
- * @param content The document's content.\r
- */\r
- function create(uri, languageId, version, content) {\r
- return new FullTextDocument(uri, languageId, version, content);\r
- }\r
- TextDocument.create = create;\r
- /**\r
- * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
- */\r
- function is(value) {\r
- var candidate = value;\r
- return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
- && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
- }\r
- TextDocument.is = is;\r
- function applyEdits(document, edits) {\r
- var text = document.getText();\r
- var sortedEdits = mergeSort(edits, function (a, b) {\r
- var diff = a.range.start.line - b.range.start.line;\r
- if (diff === 0) {\r
- return a.range.start.character - b.range.start.character;\r
- }\r
- return diff;\r
- });\r
- var lastModifiedOffset = text.length;\r
- for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
- var e = sortedEdits[i];\r
- var startOffset = document.offsetAt(e.range.start);\r
- var endOffset = document.offsetAt(e.range.end);\r
- if (endOffset <= lastModifiedOffset) {\r
- text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
- }\r
- else {\r
- throw new Error('Overlapping edit');\r
- }\r
- lastModifiedOffset = startOffset;\r
- }\r
- return text;\r
- }\r
- TextDocument.applyEdits = applyEdits;\r
- function mergeSort(data, compare) {\r
- if (data.length <= 1) {\r
- // sorted\r
- return data;\r
- }\r
- var p = (data.length / 2) | 0;\r
- var left = data.slice(0, p);\r
- var right = data.slice(p);\r
- mergeSort(left, compare);\r
- mergeSort(right, compare);\r
- var leftIdx = 0;\r
- var rightIdx = 0;\r
- var i = 0;\r
- while (leftIdx < left.length && rightIdx < right.length) {\r
- var ret = compare(left[leftIdx], right[rightIdx]);\r
- if (ret <= 0) {\r
- // smaller_equal -> take left to preserve order\r
- data[i++] = left[leftIdx++];\r
- }\r
- else {\r
- // greater -> take right\r
- data[i++] = right[rightIdx++];\r
- }\r
- }\r
- while (leftIdx < left.length) {\r
- data[i++] = left[leftIdx++];\r
- }\r
- while (rightIdx < right.length) {\r
- data[i++] = right[rightIdx++];\r
- }\r
- return data;\r
- }\r
-})(TextDocument || (TextDocument = {}));\r
-var FullTextDocument = /** @class */ (function () {\r
- function FullTextDocument(uri, languageId, version, content) {\r
- this._uri = uri;\r
- this._languageId = languageId;\r
- this._version = version;\r
- this._content = content;\r
- this._lineOffsets = undefined;\r
- }\r
- Object.defineProperty(FullTextDocument.prototype, "uri", {\r
- get: function () {\r
- return this._uri;\r
- },\r
- enumerable: true,\r
- configurable: true\r
- });\r
- Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
- get: function () {\r
- return this._languageId;\r
- },\r
- enumerable: true,\r
- configurable: true\r
- });\r
- Object.defineProperty(FullTextDocument.prototype, "version", {\r
- get: function () {\r
- return this._version;\r
- },\r
- enumerable: true,\r
- configurable: true\r
- });\r
- FullTextDocument.prototype.getText = function (range) {\r
- if (range) {\r
- var start = this.offsetAt(range.start);\r
- var end = this.offsetAt(range.end);\r
- return this._content.substring(start, end);\r
- }\r
- return this._content;\r
- };\r
- FullTextDocument.prototype.update = function (event, version) {\r
- this._content = event.text;\r
- this._version = version;\r
- this._lineOffsets = undefined;\r
- };\r
- FullTextDocument.prototype.getLineOffsets = function () {\r
- if (this._lineOffsets === undefined) {\r
- var lineOffsets = [];\r
- var text = this._content;\r
- var isLineStart = true;\r
- for (var i = 0; i < text.length; i++) {\r
- if (isLineStart) {\r
- lineOffsets.push(i);\r
- isLineStart = false;\r
- }\r
- var ch = text.charAt(i);\r
- isLineStart = (ch === '\r' || ch === '\n');\r
- if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
- i++;\r
- }\r
- }\r
- if (isLineStart && text.length > 0) {\r
- lineOffsets.push(text.length);\r
- }\r
- this._lineOffsets = lineOffsets;\r
- }\r
- return this._lineOffsets;\r
- };\r
- FullTextDocument.prototype.positionAt = function (offset) {\r
- offset = Math.max(Math.min(offset, this._content.length), 0);\r
- var lineOffsets = this.getLineOffsets();\r
- var low = 0, high = lineOffsets.length;\r
- if (high === 0) {\r
- return Position.create(0, offset);\r
- }\r
- while (low < high) {\r
- var mid = Math.floor((low + high) / 2);\r
- if (lineOffsets[mid] > offset) {\r
- high = mid;\r
- }\r
- else {\r
- low = mid + 1;\r
- }\r
- }\r
- // low is the least x for which the line offset is larger than the current offset\r
- // or array.length if no line offset is larger than the current offset\r
- var line = low - 1;\r
- return Position.create(line, offset - lineOffsets[line]);\r
- };\r
- FullTextDocument.prototype.offsetAt = function (position) {\r
- var lineOffsets = this.getLineOffsets();\r
- if (position.line >= lineOffsets.length) {\r
- return this._content.length;\r
- }\r
- else if (position.line < 0) {\r
- return 0;\r
- }\r
- var lineOffset = lineOffsets[position.line];\r
- var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
- return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
- };\r
- Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
- get: function () {\r
- return this.getLineOffsets().length;\r
- },\r
- enumerable: true,\r
- configurable: true\r
- });\r
- return FullTextDocument;\r
-}());\r
-var Is;\r
-(function (Is) {\r
- var toString = Object.prototype.toString;\r
- function defined(value) {\r
- return typeof value !== 'undefined';\r
- }\r
- Is.defined = defined;\r
- function undefined(value) {\r
- return typeof value === 'undefined';\r
- }\r
- Is.undefined = undefined;\r
- function boolean(value) {\r
- return value === true || value === false;\r
- }\r
- Is.boolean = boolean;\r
- function string(value) {\r
- return toString.call(value) === '[object String]';\r
- }\r
- Is.string = string;\r
- function number(value) {\r
- return toString.call(value) === '[object Number]';\r
- }\r
- Is.number = number;\r
- function func(value) {\r
- return toString.call(value) === '[object Function]';\r
- }\r
- Is.func = func;\r
- function objectLiteral(value) {\r
- // Strictly speaking class instances pass this check as well. Since the LSP\r
- // doesn't use classes we ignore this for now. If we do we need to add something\r
- // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
- return value !== null && typeof value === 'object';\r
- }\r
- Is.objectLiteral = objectLiteral;\r
- function typedArray(value, check) {\r
- return Array.isArray(value) && value.every(check);\r
- }\r
- Is.typedArray = typedArray;\r
-})(Is || (Is = {}));\r
-
-
-/***/ }),
-/* 18 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const Is = __webpack_require__(19);\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-const protocol_implementation_1 = __webpack_require__(21);\r
-exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
-const protocol_typeDefinition_1 = __webpack_require__(22);\r
-exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
-const protocol_workspaceFolders_1 = __webpack_require__(23);\r
-exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
-exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
-const protocol_configuration_1 = __webpack_require__(24);\r
-exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
-const protocol_colorProvider_1 = __webpack_require__(25);\r
-exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
-exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
-const protocol_foldingRange_1 = __webpack_require__(26);\r
-exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
-const protocol_declaration_1 = __webpack_require__(27);\r
-exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
-const protocol_selectionRange_1 = __webpack_require__(28);\r
-exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
-const protocol_progress_1 = __webpack_require__(29);\r
-exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
-exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
-exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
-// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
-let __noDynamicImport;\r
-/**\r
- * The DocumentFilter namespace provides helper functions to work with\r
- * [DocumentFilter](#DocumentFilter) literals.\r
- */\r
-var DocumentFilter;\r
-(function (DocumentFilter) {\r
- function is(value) {\r
- const candidate = value;\r
- return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
- }\r
- DocumentFilter.is = is;\r
-})(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
-/**\r
- * The DocumentSelector namespace provides helper functions to work with\r
- * [DocumentSelector](#DocumentSelector)s.\r
- */\r
-var DocumentSelector;\r
-(function (DocumentSelector) {\r
- function is(value) {\r
- if (!Array.isArray(value)) {\r
- return false;\r
- }\r
- for (let elem of value) {\r
- if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
- DocumentSelector.is = is;\r
-})(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
-/**\r
- * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
- * handler on the client side.\r
- */\r
-var RegistrationRequest;\r
-(function (RegistrationRequest) {\r
- RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
-})(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
-/**\r
- * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
- * handler on the client side.\r
- */\r
-var UnregistrationRequest;\r
-(function (UnregistrationRequest) {\r
- UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
-})(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
-var ResourceOperationKind;\r
-(function (ResourceOperationKind) {\r
- /**\r
- * Supports creating new files and folders.\r
- */\r
- ResourceOperationKind.Create = 'create';\r
- /**\r
- * Supports renaming existing files and folders.\r
- */\r
- ResourceOperationKind.Rename = 'rename';\r
- /**\r
- * Supports deleting existing files and folders.\r
- */\r
- ResourceOperationKind.Delete = 'delete';\r
-})(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
-var FailureHandlingKind;\r
-(function (FailureHandlingKind) {\r
- /**\r
- * Applying the workspace change is simply aborted if one of the changes provided\r
- * fails. All operations executed before the failing operation stay executed.\r
- */\r
- FailureHandlingKind.Abort = 'abort';\r
- /**\r
- * All operations are executed transactional. That means they either all\r
- * succeed or no changes at all are applied to the workspace.\r
- */\r
- FailureHandlingKind.Transactional = 'transactional';\r
- /**\r
- * If the workspace edit contains only textual file changes they are executed transactional.\r
- * If resource changes (create, rename or delete file) are part of the change the failure\r
- * handling startegy is abort.\r
- */\r
- FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
- /**\r
- * The client tries to undo the operations already executed. But there is no\r
- * guarantee that this is succeeding.\r
- */\r
- FailureHandlingKind.Undo = 'undo';\r
-})(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
-/**\r
- * The StaticRegistrationOptions namespace provides helper functions to work with\r
- * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
- */\r
-var StaticRegistrationOptions;\r
-(function (StaticRegistrationOptions) {\r
- function hasId(value) {\r
- const candidate = value;\r
- return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
- }\r
- StaticRegistrationOptions.hasId = hasId;\r
-})(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
-/**\r
- * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
- * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
- */\r
-var TextDocumentRegistrationOptions;\r
-(function (TextDocumentRegistrationOptions) {\r
- function is(value) {\r
- const candidate = value;\r
- return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
- }\r
- TextDocumentRegistrationOptions.is = is;\r
-})(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
-/**\r
- * The WorkDoneProgressOptions namespace provides helper functions to work with\r
- * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
- */\r
-var WorkDoneProgressOptions;\r
-(function (WorkDoneProgressOptions) {\r
- function is(value) {\r
- const candidate = value;\r
- return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
- }\r
- WorkDoneProgressOptions.is = is;\r
- function hasWorkDoneProgress(value) {\r
- const candidate = value;\r
- return candidate && Is.boolean(candidate.workDoneProgress);\r
- }\r
- WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
-})(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
-/**\r
- * The initialize request is sent from the client to the server.\r
- * It is sent once as the request after starting up the server.\r
- * The requests parameter is of type [InitializeParams](#InitializeParams)\r
- * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
- * resolves to such.\r
- */\r
-var InitializeRequest;\r
-(function (InitializeRequest) {\r
- InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
-})(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
-/**\r
- * Known error codes for an `InitializeError`;\r
- */\r
-var InitializeError;\r
-(function (InitializeError) {\r
- /**\r
- * If the protocol version provided by the client can't be handled by the server.\r
- * @deprecated This initialize error got replaced by client capabilities. There is\r
- * no version handshake in version 3.0x\r
- */\r
- InitializeError.unknownProtocolVersion = 1;\r
-})(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
-/**\r
- * The intialized notification is sent from the client to the\r
- * server after the client is fully initialized and the server\r
- * is allowed to send requests from the server to the client.\r
- */\r
-var InitializedNotification;\r
-(function (InitializedNotification) {\r
- InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
-})(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
-//---- Shutdown Method ----\r
-/**\r
- * A shutdown request is sent from the client to the server.\r
- * It is sent once when the client decides to shutdown the\r
- * server. The only notification that is sent after a shutdown request\r
- * is the exit event.\r
- */\r
-var ShutdownRequest;\r
-(function (ShutdownRequest) {\r
- ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
-})(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
-//---- Exit Notification ----\r
-/**\r
- * The exit event is sent from the client to the server to\r
- * ask the server to exit its process.\r
- */\r
-var ExitNotification;\r
-(function (ExitNotification) {\r
- ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
-})(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
-/**\r
- * The configuration change notification is sent from the client to the server\r
- * when the client's configuration has changed. The notification contains\r
- * the changed configuration as defined by the language client.\r
- */\r
-var DidChangeConfigurationNotification;\r
-(function (DidChangeConfigurationNotification) {\r
- DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
-})(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
-//---- Message show and log notifications ----\r
-/**\r
- * The message type\r
- */\r
-var MessageType;\r
-(function (MessageType) {\r
- /**\r
- * An error message.\r
- */\r
- MessageType.Error = 1;\r
- /**\r
- * A warning message.\r
- */\r
- MessageType.Warning = 2;\r
- /**\r
- * An information message.\r
- */\r
- MessageType.Info = 3;\r
- /**\r
- * A log message.\r
- */\r
- MessageType.Log = 4;\r
-})(MessageType = exports.MessageType || (exports.MessageType = {}));\r
-/**\r
- * The show message notification is sent from a server to a client to ask\r
- * the client to display a particular message in the user interface.\r
- */\r
-var ShowMessageNotification;\r
-(function (ShowMessageNotification) {\r
- ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
-})(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
-/**\r
- * The show message request is sent from the server to the client to show a message\r
- * and a set of options actions to the user.\r
- */\r
-var ShowMessageRequest;\r
-(function (ShowMessageRequest) {\r
- ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
-})(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
-/**\r
- * The log message notification is sent from the server to the client to ask\r
- * the client to log a particular message.\r
- */\r
-var LogMessageNotification;\r
-(function (LogMessageNotification) {\r
- LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
-})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
-//---- Telemetry notification\r
-/**\r
- * The telemetry event notification is sent from the server to the client to ask\r
- * the client to log telemetry data.\r
- */\r
-var TelemetryEventNotification;\r
-(function (TelemetryEventNotification) {\r
- TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
-})(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
-/**\r
- * Defines how the host (editor) should sync\r
- * document changes to the language server.\r
- */\r
-var TextDocumentSyncKind;\r
-(function (TextDocumentSyncKind) {\r
- /**\r
- * Documents should not be synced at all.\r
- */\r
- TextDocumentSyncKind.None = 0;\r
- /**\r
- * Documents are synced by always sending the full content\r
- * of the document.\r
- */\r
- TextDocumentSyncKind.Full = 1;\r
- /**\r
- * Documents are synced by sending the full content on open.\r
- * After that only incremental updates to the document are\r
- * send.\r
- */\r
- TextDocumentSyncKind.Incremental = 2;\r
-})(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
-/**\r
- * The document open notification is sent from the client to the server to signal\r
- * newly opened text documents. The document's truth is now managed by the client\r
- * and the server must not try to read the document's truth using the document's\r
- * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
- * mean that its content is presented in an editor. An open notification must not\r
- * be sent more than once without a corresponding close notification send before.\r
- * This means open and close notification must be balanced and the max open count\r
- * is one.\r
- */\r
-var DidOpenTextDocumentNotification;\r
-(function (DidOpenTextDocumentNotification) {\r
- DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
- DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
-})(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
-/**\r
- * The document change notification is sent from the client to the server to signal\r
- * changes to a text document.\r
- */\r
-var DidChangeTextDocumentNotification;\r
-(function (DidChangeTextDocumentNotification) {\r
- DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
- DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
-})(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
-/**\r
- * The document close notification is sent from the client to the server when\r
- * the document got closed in the client. The document's truth now exists where\r
- * the document's uri points to (e.g. if the document's uri is a file uri the\r
- * truth now exists on disk). As with the open notification the close notification\r
- * is about managing the document's content. Receiving a close notification\r
- * doesn't mean that the document was open in an editor before. A close\r
- * notification requires a previous open notification to be sent.\r
- */\r
-var DidCloseTextDocumentNotification;\r
-(function (DidCloseTextDocumentNotification) {\r
- DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
- DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
-})(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
-/**\r
- * The document save notification is sent from the client to the server when\r
- * the document got saved in the client.\r
- */\r
-var DidSaveTextDocumentNotification;\r
-(function (DidSaveTextDocumentNotification) {\r
- DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
- DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
-})(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
-/**\r
- * Represents reasons why a text document is saved.\r
- */\r
-var TextDocumentSaveReason;\r
-(function (TextDocumentSaveReason) {\r
- /**\r
- * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
- * or by an API call.\r
- */\r
- TextDocumentSaveReason.Manual = 1;\r
- /**\r
- * Automatic after a delay.\r
- */\r
- TextDocumentSaveReason.AfterDelay = 2;\r
- /**\r
- * When the editor lost focus.\r
- */\r
- TextDocumentSaveReason.FocusOut = 3;\r
-})(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
-/**\r
- * A document will save notification is sent from the client to the server before\r
- * the document is actually saved.\r
- */\r
-var WillSaveTextDocumentNotification;\r
-(function (WillSaveTextDocumentNotification) {\r
- WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
- WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
-})(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
-/**\r
- * A document will save request is sent from the client to the server before\r
- * the document is actually saved. The request can return an array of TextEdits\r
- * which will be applied to the text document before it is saved. Please note that\r
- * clients might drop results if computing the text edits took too long or if a\r
- * server constantly fails on this request. This is done to keep the save fast and\r
- * reliable.\r
- */\r
-var WillSaveTextDocumentWaitUntilRequest;\r
-(function (WillSaveTextDocumentWaitUntilRequest) {\r
- WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
- WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
-})(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
-/**\r
- * The watched files notification is sent from the client to the server when\r
- * the client detects changes to file watched by the language client.\r
- */\r
-var DidChangeWatchedFilesNotification;\r
-(function (DidChangeWatchedFilesNotification) {\r
- DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
-})(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
-/**\r
- * The file event type\r
- */\r
-var FileChangeType;\r
-(function (FileChangeType) {\r
- /**\r
- * The file got created.\r
- */\r
- FileChangeType.Created = 1;\r
- /**\r
- * The file got changed.\r
- */\r
- FileChangeType.Changed = 2;\r
- /**\r
- * The file got deleted.\r
- */\r
- FileChangeType.Deleted = 3;\r
-})(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
-var WatchKind;\r
-(function (WatchKind) {\r
- /**\r
- * Interested in create events.\r
- */\r
- WatchKind.Create = 1;\r
- /**\r
- * Interested in change events\r
- */\r
- WatchKind.Change = 2;\r
- /**\r
- * Interested in delete events\r
- */\r
- WatchKind.Delete = 4;\r
-})(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
-/**\r
- * Diagnostics notification are sent from the server to the client to signal\r
- * results of validation runs.\r
- */\r
-var PublishDiagnosticsNotification;\r
-(function (PublishDiagnosticsNotification) {\r
- PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
-})(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
-/**\r
- * How a completion was triggered\r
- */\r
-var CompletionTriggerKind;\r
-(function (CompletionTriggerKind) {\r
- /**\r
- * Completion was triggered by typing an identifier (24x7 code\r
- * complete), manual invocation (e.g Ctrl+Space) or via API.\r
- */\r
- CompletionTriggerKind.Invoked = 1;\r
- /**\r
- * Completion was triggered by a trigger character specified by\r
- * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
- */\r
- CompletionTriggerKind.TriggerCharacter = 2;\r
- /**\r
- * Completion was re-triggered as current completion list is incomplete\r
- */\r
- CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
-})(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
-/**\r
- * Request to request completion at a given text document position. The request's\r
- * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
- * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
- * or a Thenable that resolves to such.\r
- *\r
- * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
- * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
- * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
- * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
- */\r
-var CompletionRequest;\r
-(function (CompletionRequest) {\r
- CompletionRequest.method = 'textDocument/completion';\r
- CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
- /** @deprecated Use CompletionRequest.type */\r
- CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
-/**\r
- * Request to resolve additional information for a given completion item.The request's\r
- * parameter is of type [CompletionItem](#CompletionItem) the response\r
- * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
- */\r
-var CompletionResolveRequest;\r
-(function (CompletionResolveRequest) {\r
- CompletionResolveRequest.method = 'completionItem/resolve';\r
- CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
-})(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
-/**\r
- * Request to request hover information at a given text document position. The request's\r
- * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
- * type [Hover](#Hover) or a Thenable that resolves to such.\r
- */\r
-var HoverRequest;\r
-(function (HoverRequest) {\r
- HoverRequest.method = 'textDocument/hover';\r
- HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
-})(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
-/**\r
- * How a signature help was triggered.\r
- *\r
- * @since 3.15.0\r
- */\r
-var SignatureHelpTriggerKind;\r
-(function (SignatureHelpTriggerKind) {\r
- /**\r
- * Signature help was invoked manually by the user or by a command.\r
- */\r
- SignatureHelpTriggerKind.Invoked = 1;\r
- /**\r
- * Signature help was triggered by a trigger character.\r
- */\r
- SignatureHelpTriggerKind.TriggerCharacter = 2;\r
- /**\r
- * Signature help was triggered by the cursor moving or by the document content changing.\r
- */\r
- SignatureHelpTriggerKind.ContentChange = 3;\r
-})(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
-var SignatureHelpRequest;\r
-(function (SignatureHelpRequest) {\r
- SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
- SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
-})(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
-/**\r
- * A request to resolve the definition location of a symbol at a given text\r
- * document position. The request's parameter is of type [TextDocumentPosition]\r
- * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
- * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
- * to such.\r
- */\r
-var DefinitionRequest;\r
-(function (DefinitionRequest) {\r
- DefinitionRequest.method = 'textDocument/definition';\r
- DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
- /** @deprecated Use DefinitionRequest.type */\r
- DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
-/**\r
- * A request to resolve project-wide references for the symbol denoted\r
- * by the given text document position. The request's parameter is of\r
- * type [ReferenceParams](#ReferenceParams) the response is of type\r
- * [Location[]](#Location) or a Thenable that resolves to such.\r
- */\r
-var ReferencesRequest;\r
-(function (ReferencesRequest) {\r
- ReferencesRequest.method = 'textDocument/references';\r
- ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
- /** @deprecated Use ReferencesRequest.type */\r
- ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
-/**\r
- * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
- * text document position. The request's parameter is of type [TextDocumentPosition]\r
- * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
- * (#DocumentHighlight) or a Thenable that resolves to such.\r
- */\r
-var DocumentHighlightRequest;\r
-(function (DocumentHighlightRequest) {\r
- DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
- DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
- /** @deprecated Use DocumentHighlightRequest.type */\r
- DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
-/**\r
- * A request to list all symbols found in a given text document. The request's\r
- * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
- * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
- * that resolves to such.\r
- */\r
-var DocumentSymbolRequest;\r
-(function (DocumentSymbolRequest) {\r
- DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
- DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
- /** @deprecated Use DocumentSymbolRequest.type */\r
- DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
-/**\r
- * A request to provide commands for the given text document and range.\r
- */\r
-var CodeActionRequest;\r
-(function (CodeActionRequest) {\r
- CodeActionRequest.method = 'textDocument/codeAction';\r
- CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
- /** @deprecated Use CodeActionRequest.type */\r
- CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
-/**\r
- * A request to list project-wide symbols matching the query string given\r
- * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
- * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
- * resolves to such.\r
- */\r
-var WorkspaceSymbolRequest;\r
-(function (WorkspaceSymbolRequest) {\r
- WorkspaceSymbolRequest.method = 'workspace/symbol';\r
- WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
- /** @deprecated Use WorkspaceSymbolRequest.type */\r
- WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
-/**\r
- * A request to provide code lens for the given text document.\r
- */\r
-var CodeLensRequest;\r
-(function (CodeLensRequest) {\r
- CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
- /** @deprecated Use CodeLensRequest.type */\r
- CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
-/**\r
- * A request to resolve a command for a given code lens.\r
- */\r
-var CodeLensResolveRequest;\r
-(function (CodeLensResolveRequest) {\r
- CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
-})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
-/**\r
- * A request to provide document links\r
- */\r
-var DocumentLinkRequest;\r
-(function (DocumentLinkRequest) {\r
- DocumentLinkRequest.method = 'textDocument/documentLink';\r
- DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
- /** @deprecated Use DocumentLinkRequest.type */\r
- DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
-/**\r
- * Request to resolve additional information for a given document link. The request's\r
- * parameter is of type [DocumentLink](#DocumentLink) the response\r
- * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
- */\r
-var DocumentLinkResolveRequest;\r
-(function (DocumentLinkResolveRequest) {\r
- DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
-})(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
-/**\r
- * A request to to format a whole document.\r
- */\r
-var DocumentFormattingRequest;\r
-(function (DocumentFormattingRequest) {\r
- DocumentFormattingRequest.method = 'textDocument/formatting';\r
- DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
-})(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
-/**\r
- * A request to to format a range in a document.\r
- */\r
-var DocumentRangeFormattingRequest;\r
-(function (DocumentRangeFormattingRequest) {\r
- DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
- DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
-})(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
-/**\r
- * A request to format a document on type.\r
- */\r
-var DocumentOnTypeFormattingRequest;\r
-(function (DocumentOnTypeFormattingRequest) {\r
- DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
- DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
-})(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
-/**\r
- * A request to rename a symbol.\r
- */\r
-var RenameRequest;\r
-(function (RenameRequest) {\r
- RenameRequest.method = 'textDocument/rename';\r
- RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
-})(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
-/**\r
- * A request to test and perform the setup necessary for a rename.\r
- */\r
-var PrepareRenameRequest;\r
-(function (PrepareRenameRequest) {\r
- PrepareRenameRequest.method = 'textDocument/prepareRename';\r
- PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
-})(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
-/**\r
- * A request send from the client to the server to execute a command. The request might return\r
- * a workspace edit which the client will apply to the workspace.\r
- */\r
-var ExecuteCommandRequest;\r
-(function (ExecuteCommandRequest) {\r
- ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
-})(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
-/**\r
- * A request sent from the server to the client to modified certain resources.\r
- */\r
-var ApplyWorkspaceEditRequest;\r
-(function (ApplyWorkspaceEditRequest) {\r
- ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
-})(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
-
-
-/***/ }),
-/* 19 */
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-function boolean(value) {\r
- return value === true || value === false;\r
-}\r
-exports.boolean = boolean;\r
-function string(value) {\r
- return typeof value === 'string' || value instanceof String;\r
-}\r
-exports.string = string;\r
-function number(value) {\r
- return typeof value === 'number' || value instanceof Number;\r
-}\r
-exports.number = number;\r
-function error(value) {\r
- return value instanceof Error;\r
-}\r
-exports.error = error;\r
-function func(value) {\r
- return typeof value === 'function';\r
-}\r
-exports.func = func;\r
-function array(value) {\r
- return Array.isArray(value);\r
-}\r
-exports.array = array;\r
-function stringArray(value) {\r
- return array(value) && value.every(elem => string(elem));\r
-}\r
-exports.stringArray = stringArray;\r
-function typedArray(value, check) {\r
- return Array.isArray(value) && value.every(check);\r
-}\r
-exports.typedArray = typedArray;\r
-function objectLiteral(value) {\r
- // Strictly speaking class instances pass this check as well. Since the LSP\r
- // doesn't use classes we ignore this for now. If we do we need to add something\r
- // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
- return value !== null && typeof value === 'object';\r
-}\r
-exports.objectLiteral = objectLiteral;\r
-
-
-/***/ }),
-/* 20 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
- constructor(method) {\r
- super(method);\r
- }\r
-}\r
-exports.ProtocolRequestType0 = ProtocolRequestType0;\r
-class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
- constructor(method) {\r
- super(method);\r
- }\r
-}\r
-exports.ProtocolRequestType = ProtocolRequestType;\r
-class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
- constructor(method) {\r
- super(method);\r
- }\r
-}\r
-exports.ProtocolNotificationType = ProtocolNotificationType;\r
-class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
- constructor(method) {\r
- super(method);\r
- }\r
-}\r
-exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
-
-
-/***/ }),
-/* 21 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
-let __noDynamicImport;\r
-/**\r
- * A request to resolve the implementation locations of a symbol at a given text\r
- * document position. The request's parameter is of type [TextDocumentPositioParams]\r
- * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
- * Thenable that resolves to such.\r
- */\r
-var ImplementationRequest;\r
-(function (ImplementationRequest) {\r
- ImplementationRequest.method = 'textDocument/implementation';\r
- ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
- /** @deprecated Use ImplementationRequest.type */\r
- ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
-
-
-/***/ }),
-/* 22 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
-let __noDynamicImport;\r
-/**\r
- * A request to resolve the type definition locations of a symbol at a given text\r
- * document position. The request's parameter is of type [TextDocumentPositioParams]\r
- * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
- * Thenable that resolves to such.\r
- */\r
-var TypeDefinitionRequest;\r
-(function (TypeDefinitionRequest) {\r
- TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
- TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
- /** @deprecated Use TypeDefinitionRequest.type */\r
- TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
-
-
-/***/ }),
-/* 23 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
- */\r
-var WorkspaceFoldersRequest;\r
-(function (WorkspaceFoldersRequest) {\r
- WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
-})(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
-/**\r
- * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
- * folder configuration changes.\r
- */\r
-var DidChangeWorkspaceFoldersNotification;\r
-(function (DidChangeWorkspaceFoldersNotification) {\r
- DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
-})(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
-
-
-/***/ }),
-/* 24 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
- * configuration setting.\r
- *\r
- * This pull model replaces the old push model were the client signaled configuration change via an\r
- * event. If the server still needs to react to configuration changes (since the server caches the\r
- * result of `workspace/configuration` requests) the server should register for an empty configuration\r
- * change event and empty the cache if such an event is received.\r
- */\r
-var ConfigurationRequest;\r
-(function (ConfigurationRequest) {\r
- ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
-})(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
-
-
-/***/ }),
-/* 25 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * A request to list all color symbols found in a given text document. The request's\r
- * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
- * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
- * that resolves to such.\r
- */\r
-var DocumentColorRequest;\r
-(function (DocumentColorRequest) {\r
- DocumentColorRequest.method = 'textDocument/documentColor';\r
- DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
- /** @deprecated Use DocumentColorRequest.type */\r
- DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
-/**\r
- * A request to list all presentation for a color. The request's\r
- * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
- * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
- * that resolves to such.\r
- */\r
-var ColorPresentationRequest;\r
-(function (ColorPresentationRequest) {\r
- ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
-})(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
-
-
-/***/ }),
-/* 26 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-\r
-/*---------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- *--------------------------------------------------------------------------------------------*/\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * Enum of known range kinds\r
- */\r
-var FoldingRangeKind;\r
-(function (FoldingRangeKind) {\r
- /**\r
- * Folding range for a comment\r
- */\r
- FoldingRangeKind["Comment"] = "comment";\r
- /**\r
- * Folding range for a imports or includes\r
- */\r
- FoldingRangeKind["Imports"] = "imports";\r
- /**\r
- * Folding range for a region (e.g. `#region`)\r
- */\r
- FoldingRangeKind["Region"] = "region";\r
-})(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
-/**\r
- * A request to provide folding ranges in a document. The request's\r
- * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
- * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
- * that resolves to such.\r
- */\r
-var FoldingRangeRequest;\r
-(function (FoldingRangeRequest) {\r
- FoldingRangeRequest.method = 'textDocument/foldingRange';\r
- FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
- /** @deprecated Use FoldingRangeRequest.type */\r
- FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
-
-
-/***/ }),
-/* 27 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
-let __noDynamicImport;\r
-/**\r
- * A request to resolve the type definition locations of a symbol at a given text\r
- * document position. The request's parameter is of type [TextDocumentPositioParams]\r
- * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
- * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
- * to such.\r
- */\r
-var DeclarationRequest;\r
-(function (DeclarationRequest) {\r
- DeclarationRequest.method = 'textDocument/declaration';\r
- DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
- /** @deprecated Use DeclarationRequest.type */\r
- DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
-
-
-/***/ }),
-/* 28 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-\r
-/*---------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- *--------------------------------------------------------------------------------------------*/\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * A request to provide selection ranges in a document. The request's\r
- * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
- * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
- * that resolves to such.\r
- */\r
-var SelectionRangeRequest;\r
-(function (SelectionRangeRequest) {\r
- SelectionRangeRequest.method = 'textDocument/selectionRange';\r
- SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
- /** @deprecated Use SelectionRangeRequest.type */\r
- SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
-})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
-
-
-/***/ }),
-/* 29 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const vscode_jsonrpc_1 = __webpack_require__(3);\r
-const messages_1 = __webpack_require__(20);\r
-var WorkDoneProgress;\r
-(function (WorkDoneProgress) {\r
- WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
-})(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
-/**\r
- * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
- * reporting from the server.\r
- */\r
-var WorkDoneProgressCreateRequest;\r
-(function (WorkDoneProgressCreateRequest) {\r
- WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
-})(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
-/**\r
- * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\r
- * initiated on the server side.\r
- */\r
-var WorkDoneProgressCancelNotification;\r
-(function (WorkDoneProgressCancelNotification) {\r
- WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
-})(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
-
-
-/***/ }),
-/* 30 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) TypeFox and others. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * A request to result a `CallHierarchyItem` in a document at a given position.\r
- * Can be used as an input to a incoming or outgoing call hierarchy.\r
- *\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var CallHierarchyPrepareRequest;\r
-(function (CallHierarchyPrepareRequest) {\r
- CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
- CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
-})(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
-/**\r
- * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
- *\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var CallHierarchyIncomingCallsRequest;\r
-(function (CallHierarchyIncomingCallsRequest) {\r
- CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
- CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
-})(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
-/**\r
- * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
- *\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var CallHierarchyOutgoingCallsRequest;\r
-(function (CallHierarchyOutgoingCallsRequest) {\r
- CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
- CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
-})(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
-
-
-/***/ }),
-/* 31 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-/* --------------------------------------------------------------------------------------------\r
- * Copyright (c) Microsoft Corporation. All rights reserved.\r
- * Licensed under the MIT License. See License.txt in the project root for license information.\r
- * ------------------------------------------------------------------------------------------ */\r
-\r
-Object.defineProperty(exports, "__esModule", ({ value: true }));\r
-const messages_1 = __webpack_require__(20);\r
-/**\r
- * A set of predefined token types. This set is not fixed\r
- * an clients can specify additional token types via the\r
- * corresponding client capabilities.\r
- *\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokenTypes;\r
-(function (SemanticTokenTypes) {\r
- SemanticTokenTypes["comment"] = "comment";\r
- SemanticTokenTypes["keyword"] = "keyword";\r
- SemanticTokenTypes["string"] = "string";\r
- SemanticTokenTypes["number"] = "number";\r
- SemanticTokenTypes["regexp"] = "regexp";\r
- SemanticTokenTypes["operator"] = "operator";\r
- SemanticTokenTypes["namespace"] = "namespace";\r
- SemanticTokenTypes["type"] = "type";\r
- SemanticTokenTypes["struct"] = "struct";\r
- SemanticTokenTypes["class"] = "class";\r
- SemanticTokenTypes["interface"] = "interface";\r
- SemanticTokenTypes["enum"] = "enum";\r
- SemanticTokenTypes["typeParameter"] = "typeParameter";\r
- SemanticTokenTypes["function"] = "function";\r
- SemanticTokenTypes["member"] = "member";\r
- SemanticTokenTypes["property"] = "property";\r
- SemanticTokenTypes["macro"] = "macro";\r
- SemanticTokenTypes["variable"] = "variable";\r
- SemanticTokenTypes["parameter"] = "parameter";\r
- SemanticTokenTypes["label"] = "label";\r
-})(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
-/**\r
- * A set of predefined token modifiers. This set is not fixed\r
- * an clients can specify additional token types via the\r
- * corresponding client capabilities.\r
- *\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokenModifiers;\r
-(function (SemanticTokenModifiers) {\r
- SemanticTokenModifiers["documentation"] = "documentation";\r
- SemanticTokenModifiers["declaration"] = "declaration";\r
- SemanticTokenModifiers["definition"] = "definition";\r
- SemanticTokenModifiers["reference"] = "reference";\r
- SemanticTokenModifiers["static"] = "static";\r
- SemanticTokenModifiers["abstract"] = "abstract";\r
- SemanticTokenModifiers["deprecated"] = "deprecated";\r
- SemanticTokenModifiers["async"] = "async";\r
- SemanticTokenModifiers["volatile"] = "volatile";\r
- SemanticTokenModifiers["readonly"] = "readonly";\r
-})(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
-/**\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokens;\r
-(function (SemanticTokens) {\r
- function is(value) {\r
- const candidate = value;\r
- return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
- Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
- }\r
- SemanticTokens.is = is;\r
-})(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
-/**\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokensRequest;\r
-(function (SemanticTokensRequest) {\r
- SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
- SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
-})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
-/**\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokensEditsRequest;\r
-(function (SemanticTokensEditsRequest) {\r
- SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
- SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
-})(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
-/**\r
- * @since 3.16.0 - Proposed state\r
- */\r
-var SemanticTokensRangeRequest;\r
-(function (SemanticTokensRangeRequest) {\r
- SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
- SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
-})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
-
-
-/***/ }),
-/* 32 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const coc_nvim_1 = __webpack_require__(1);
-const prettier = __webpack_require__(33);
-/**
- * Prettier reads configuration from files
- */
-const PRETTIER_CONFIG_FILES = [
- '.prettierrc',
- '.prettierrc.json',
- '.prettierrc.yaml',
- '.prettierrc.yml',
- '.prettierrc.js',
- 'package.json',
- 'prettier.config.js',
-];
-/**
- * Create a file watcher. Clears prettier's configuration cache on
- * file change, create, delete.
- * @returns disposable file system watcher.
- */
-function fileListener() {
- const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(`**/{${PRETTIER_CONFIG_FILES.join(',')}}`);
- fileWatcher.onDidChange(prettier.clearConfigCache);
- fileWatcher.onDidCreate(prettier.clearConfigCache);
- fileWatcher.onDidDelete(prettier.clearConfigCache);
- return fileWatcher;
-}
-exports.default = fileListener;
-
-
-/***/ }),
-/* 33 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("prettier");;
-
-/***/ }),
-/* 34 */
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.setupErrorHandler = exports.safeExecution = exports.addToOutput = void 0;
-const coc_nvim_1 = __webpack_require__(1);
-let outputChannel;
-/**
- * Adds the filepath to the error message
- *
- * @param msg The original error message
- * @param fileName The path to the file
- * @returns {string} enhanced message with the filename
- */
-function addFilePath(msg, fileName) {
- const lines = msg.split('\n');
- if (lines.length > 0) {
- lines[0] = lines[0].replace(/(\d*):(\d*)/g, `${fileName}:$1:$2`);
- return lines.join('\n');
- }
- return msg;
-}
-/**
- * Append messages to the output channel and format it with a title
- *
- * @param message The message to append to the output channel
- */
-function addToOutput(message, type = 'Trace') {
- if (!outputChannel)
- return;
- const title = `${type} - ${new Date().toLocaleString()}:`;
- // Create a sort of title, to differentiate between messages
- outputChannel.appendLine('');
- // Append actual output
- outputChannel.appendLine(`[${title}] ${message}\n`);
-}
-exports.addToOutput = addToOutput;
-/**
- * Execute a callback safely, if it doesn't work, return default and log messages.
- *
- * @param cb The function to be executed,
- * @param defaultText The default value if execution of the cb failed
- * @param fileName The filename of the current document
- * @returns {string} formatted text or defaultText
- */
-function safeExecution(cb, defaultText, fileName) {
- if (cb instanceof Promise) {
- return cb
- .then(returnValue => {
- // updateStatusBar('Prettier: $(check)')
- return returnValue;
- })
- .catch((err) => {
- addToOutput(addFilePath(err.message, fileName), 'Error');
- // updateStatusBar('Prettier: $(x)')
- return defaultText;
- });
- }
- try {
- const returnValue = cb();
- // updateStatusBar('Prettier: $(check)')
- return returnValue;
- }
- catch (err) {
- addToOutput(addFilePath(err.message, fileName), 'Error');
- // updateStatusBar('Prettier: $(x)')
- return defaultText;
- }
-}
-exports.safeExecution = safeExecution;
-/**
- * Setup the output channel and the statusBarItem.
- * Create a command to show the output channel
- *
- * @returns {Disposable} The command to open the output channel
- */
-function setupErrorHandler() {
- // Setup the outputChannel
- outputChannel = coc_nvim_1.workspace.createOutputChannel('prettier');
- return coc_nvim_1.commands.registerCommand('prettier.open-output', () => {
- outputChannel.show();
- });
-}
-exports.setupErrorHandler = setupErrorHandler;
-
-
-/***/ }),
-/* 35 */
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const coc_nvim_1 = __webpack_require__(1);
-const fs_1 = __webpack_require__(36);
-const path = __importStar(__webpack_require__(12));
-const errorHandler_1 = __webpack_require__(34);
-const utils_1 = __webpack_require__(37);
-const ignore = __webpack_require__(84);
-const nullIgnorer = { ignores: () => false };
-/**
- * Create an ignore file handler. Will lazily read ignore files on a per-resource
- * basis, and cache the contents until it changes.
- */
-function ignoreFileHandler(disposables) {
- const ignorers = new Map();
- disposables.push({ dispose: () => ignorers.clear() });
- return {
- fileIsIgnored(filePath) {
- const { ignorer, ignoreFilePath } = getIgnorerForFile(filePath);
- return ignorer.ignores(path.relative(path.dirname(ignoreFilePath), filePath));
- },
- };
- function getIgnorerForFile(fsPath) {
- const absolutePath = getIgnorePathForFile(fsPath, utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath);
- if (!absolutePath) {
- return { ignoreFilePath: '', ignorer: nullIgnorer };
- }
- if (!ignorers.has(absolutePath)) {
- loadIgnorer(coc_nvim_1.Uri.file(absolutePath));
- }
- if (!fs_1.existsSync(absolutePath)) {
- // Don't log default value.
- const ignorePath = utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath;
- if (ignorePath !== '.prettierignore') {
- errorHandler_1.addToOutput(`Wrong prettier.ignorePath provided in your settings. The path (${ignorePath}) does not exist.`, 'Warning');
- }
- return { ignoreFilePath: '', ignorer: nullIgnorer };
- }
- return {
- ignoreFilePath: absolutePath,
- ignorer: ignorers.get(absolutePath),
- };
- }
- function loadIgnorer(ignoreUri) {
- let ignorer = nullIgnorer;
- if (!ignorers.has(ignoreUri.fsPath)) {
- const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(ignoreUri.fsPath);
- disposables.push(fileWatcher);
- fileWatcher.onDidCreate(loadIgnorer, null, disposables);
- fileWatcher.onDidChange(loadIgnorer, null, disposables);
- fileWatcher.onDidDelete(unloadIgnorer, null, disposables);
- }
- if (fs_1.existsSync(ignoreUri.fsPath)) {
- const ignoreFileContents = fs_1.readFileSync(ignoreUri.fsPath, 'utf8');
- ignorer = ignore().add(ignoreFileContents);
- }
- ignorers.set(ignoreUri.fsPath, ignorer);
- }
- function unloadIgnorer(ignoreUri) {
- ignorers.set(ignoreUri.fsPath, nullIgnorer);
- }
-}
-function getIgnorePathForFile(_filePath, ignorePath) {
- // Configuration `prettier.ignorePath` is set to `null`
- if (!ignorePath) {
- return null;
- }
- if (coc_nvim_1.workspace.workspaceFolder) {
- const folder = coc_nvim_1.workspace.workspaceFolder;
- return folder ? getPath(ignorePath, coc_nvim_1.Uri.parse(folder.uri).fsPath) : null;
- }
- return null;
-}
-function getPath(fsPath, relativeTo) {
- return path.isAbsolute(fsPath) ? fsPath : path.join(relativeTo, fsPath);
-}
-exports.default = ignoreFileHandler;
-
-
-/***/ }),
-/* 36 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("fs");;
-
-/***/ }),
-/* 37 */
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.hasLocalPrettierInstalled = exports.getGroup = exports.rangeLanguages = exports.enabledLanguages = exports.allLanguages = exports.getParsersFromLanguageId = exports.getPrettierInstance = exports.getConfig = void 0;
-const coc_nvim_1 = __webpack_require__(1);
-const path_1 = __importStar(__webpack_require__(12));
-const requirePkg_1 = __webpack_require__(38);
-const errorHandler_1 = __webpack_require__(34);
-const semver_1 = __importDefault(__webpack_require__(41));
-function getConfig(uri) {
- return coc_nvim_1.workspace.getConfiguration('prettier', uri ? uri.toString() : undefined);
-}
-exports.getConfig = getConfig;
-function getPrettierInstance() {
- return __awaiter(this, void 0, void 0, function* () {
- const document = yield coc_nvim_1.workspace.document;
- const uri = coc_nvim_1.Uri.parse(document.uri);
- const fileName = uri.fsPath;
- const vscodeConfig = getConfig(uri);
- const localOnly = vscodeConfig.onlyUseLocalVersion;
- const resolvedPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(fileName), 'prettier', { silent: true, ignoreBundled: localOnly }));
- if (!resolvedPrettier) {
- errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
- }
- return resolvedPrettier;
- });
-}
-exports.getPrettierInstance = getPrettierInstance;
-function getParsersFromLanguageId(languageId, prettierInstance, path) {
- const supportedLanguages = getSupportLanguages(prettierInstance);
- const language = supportedLanguages.find(lang => Array.isArray(lang.vscodeLanguageIds) &&
- lang.vscodeLanguageIds.includes(languageId) &&
- // Only for some specific filenames
- (lang.extensions.length > 0 ||
- (path != null &&
- lang.filenames != null &&
- lang.filenames.includes(path_1.basename(path)))));
- if (!language) {
- return [];
- }
- return language.parsers;
-}
-exports.getParsersFromLanguageId = getParsersFromLanguageId;
-function allLanguages(prettierInstance) {
- const supportedLanguages = getSupportLanguages(prettierInstance);
- return supportedLanguages.reduce((ids, language) => [...ids, ...(language.vscodeLanguageIds || [])], []);
-}
-exports.allLanguages = allLanguages;
-function enabledLanguages(prettierInstance) {
- const { disableLanguages } = getConfig();
- const languages = allLanguages(prettierInstance);
- return languages.filter(x => disableLanguages.indexOf(x) == -1);
-}
-exports.enabledLanguages = enabledLanguages;
-function rangeLanguages() {
- const { disableLanguages } = getConfig();
- return [
- 'javascript',
- 'javascriptreact',
- 'typescript',
- 'typescriptreact',
- 'json',
- 'graphql',
- ].filter(x => disableLanguages.indexOf(x) == -1);
-}
-exports.rangeLanguages = rangeLanguages;
-function getGroup(group, prettierInstance) {
- const supportedLanguages = getSupportLanguages(prettierInstance);
- return supportedLanguages.filter(language => language.group === group);
-}
-exports.getGroup = getGroup;
-function getSupportLanguages(prettierInstance) {
- if (semver_1.default.gte(prettierInstance.version, '2.0.0')) {
- return prettierInstance.getSupportInfo({
- showUnreleased: true
- }).languages;
- }
- return prettierInstance.getSupportInfo().languages;
-}
-function hasLocalPrettierInstalled(filePath) {
- const localPrettier = requirePkg_1.requireLocalPkg(filePath, 'prettier', {
- silent: true,
- ignoreBundled: true,
- });
- return localPrettier != null;
-}
-exports.hasLocalPrettierInstalled = hasLocalPrettierInstalled;
-
-
-/***/ }),
-/* 38 */
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.requireLocalPkg = void 0;
-const errorHandler_1 = __webpack_require__(34);
-const resolve_from_1 = __importDefault(__webpack_require__(39));
-const requireFunc = true ? require : 0;
-/**
- * Require package explicitly installed relative to given path.
- * Fallback to bundled one if no package was found bottom up.
- * @param {string} fspath file system path starting point to resolve package
- * @param {string} pkgName package's name to require
- * @returns module
- */
-function requireLocalPkg(fspath, pkgName, options = { silent: true, ignoreBundled: false }) {
- let modulePath = resolve_from_1.default.silent(fspath, pkgName);
- if (modulePath !== void 0) {
- try {
- return requireFunc(modulePath);
- }
- catch (e) {
- if (!options.silent) {
- errorHandler_1.addToOutput(`Failed to load require ${pkgName} from ${modulePath}.${options.ignoreBundled ? `` : ` Using bundled`}`, 'Error');
- }
- }
- }
- return options.ignoreBundled ? null : requireFunc(pkgName);
-}
-exports.requireLocalPkg = requireLocalPkg;
-
-
-/***/ }),
-/* 39 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-"use strict";
-
-const path = __webpack_require__(12);
-const Module = __webpack_require__(40);
-const fs = __webpack_require__(36);
-
-const resolveFrom = (fromDirectory, moduleId, silent) => {
- if (typeof fromDirectory !== 'string') {
- throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
- }
-
- if (typeof moduleId !== 'string') {
- throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
- }
-
- try {
- fromDirectory = fs.realpathSync(fromDirectory);
- } catch (error) {
- if (error.code === 'ENOENT') {
- fromDirectory = path.resolve(fromDirectory);
- } else if (silent) {
- return;
- } else {
- throw error;
- }
- }
-
- const fromFile = path.join(fromDirectory, 'noop.js');
-
- const resolveFileName = () => Module._resolveFilename(moduleId, {
- id: fromFile,
- filename: fromFile,
- paths: Module._nodeModulePaths(fromDirectory)
- });
-
- if (silent) {
- try {
- return resolveFileName();
- } catch (error) {
- return;
- }
- }
-
- return resolveFileName();
-};
-
-module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
-module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);
-
-
-/***/ }),
-/* 40 */
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("module");;
-
-/***/ }),
-/* 41 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-// just pre-load all the stuff that index.js lazily exports
-const internalRe = __webpack_require__(42)
-module.exports = {
- re: internalRe.re,
- src: internalRe.src,
- tokens: internalRe.t,
- SEMVER_SPEC_VERSION: __webpack_require__(43).SEMVER_SPEC_VERSION,
- SemVer: __webpack_require__(45),
- compareIdentifiers: __webpack_require__(46).compareIdentifiers,
- rcompareIdentifiers: __webpack_require__(46).rcompareIdentifiers,
- parse: __webpack_require__(47),
- valid: __webpack_require__(48),
- clean: __webpack_require__(49),
- inc: __webpack_require__(50),
- diff: __webpack_require__(51),
- major: __webpack_require__(54),
- minor: __webpack_require__(55),
- patch: __webpack_require__(56),
- prerelease: __webpack_require__(57),
- compare: __webpack_require__(53),
- rcompare: __webpack_require__(58),
- compareLoose: __webpack_require__(59),
- compareBuild: __webpack_require__(60),
- sort: __webpack_require__(61),
- rsort: __webpack_require__(62),
- gt: __webpack_require__(63),
- lt: __webpack_require__(64),
- eq: __webpack_require__(52),
- neq: __webpack_require__(65),
- gte: __webpack_require__(66),
- lte: __webpack_require__(67),
- cmp: __webpack_require__(68),
- coerce: __webpack_require__(69),
- Comparator: __webpack_require__(70),
- Range: __webpack_require__(71),
- satisfies: __webpack_require__(72),
- toComparators: __webpack_require__(73),
- maxSatisfying: __webpack_require__(74),
- minSatisfying: __webpack_require__(75),
- minVersion: __webpack_require__(76),
- validRange: __webpack_require__(77),
- outside: __webpack_require__(78),
- gtr: __webpack_require__(79),
- ltr: __webpack_require__(80),
- intersects: __webpack_require__(81),
- simplifyRange: __webpack_require__(82),
- subset: __webpack_require__(83),
-}
-
-
-/***/ }),
-/* 42 */
-/***/ ((module, exports, __webpack_require__) => {
-
-const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(43)
-const debug = __webpack_require__(44)
-exports = module.exports = {}
-
-// The actual regexps go on exports.re
-const re = exports.re = []
-const src = exports.src = []
-const t = exports.t = {}
-let R = 0
-
-const createToken = (name, value, isGlobal) => {
- const index = R++
- debug(index, value)
- t[name] = index
- src[index] = value
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
-}
-
-// The following Regular Expressions can be used for tokenizing,
-// validating, and parsing SemVer version strings.
-
-// ## Numeric Identifier
-// A single `0`, or a non-zero digit followed by zero or more digits.
-
-createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
-createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
-
-// ## Non-numeric Identifier
-// Zero or more digits, followed by a letter or hyphen, and then zero or
-// more letters, digits, or hyphens.
-
-createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
-
-// ## Main Version
-// Three dot-separated numeric identifiers.
-
-createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
- `(${src[t.NUMERICIDENTIFIER]})\\.` +
- `(${src[t.NUMERICIDENTIFIER]})`)
-
-createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
- `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
- `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
-
-// ## Pre-release Version Identifier
-// A numeric identifier, or a non-numeric identifier.
-
-createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
-}|${src[t.NONNUMERICIDENTIFIER]})`)
-
-createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
-}|${src[t.NONNUMERICIDENTIFIER]})`)
-
-// ## Pre-release Version
-// Hyphen, followed by one or more dot-separated pre-release version
-// identifiers.
-
-createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
-}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
-
-createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
-}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
-
-// ## Build Metadata Identifier
-// Any combination of digits, letters, or hyphens.
-
-createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
-
-// ## Build Metadata
-// Plus sign, followed by one or more period-separated build metadata
-// identifiers.
-
-createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
-}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
-
-// ## Full Version String
-// A main version, followed optionally by a pre-release version and
-// build metadata.
-
-// Note that the only major, minor, patch, and pre-release sections of
-// the version string are capturing groups. The build metadata is not a
-// capturing group, because it should not ever be used in version
-// comparison.
-
-createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
-}${src[t.PRERELEASE]}?${
- src[t.BUILD]}?`)
-
-createToken('FULL', `^${src[t.FULLPLAIN]}$`)
-
-// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
-// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
-// common in the npm registry.
-createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
-}${src[t.PRERELEASELOOSE]}?${
- src[t.BUILD]}?`)
-
-createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
-
-createToken('GTLT', '((?:<|>)?=?)')
-
-// Something like "2.*" or "1.2.x".
-// Note that "x.x" is a valid xRange identifer, meaning "any version"
-// Only the first item is strictly required.
-createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
-createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
-
-createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
- `(?:${src[t.PRERELEASE]})?${
- src[t.BUILD]}?` +
- `)?)?`)
-
-createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
- `(?:${src[t.PRERELEASELOOSE]})?${
- src[t.BUILD]}?` +
- `)?)?`)
-
-createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
-createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
-
-// Coercion.
-// Extract anything that could conceivably be a part of a valid semver
-createToken('COERCE', `${'(^|[^\\d])' +
- '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
- `(?:$|[^\\d])`)
-createToken('COERCERTL', src[t.COERCE], true)
-
-// Tilde ranges.
-// Meaning is "reasonably at or greater than"
-createToken('LONETILDE', '(?:~>?)')
-
-createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
-exports.tildeTrimReplace = '$1~'
-
-createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
-createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
-
-// Caret ranges.
-// Meaning is "at least and backwards compatible with"
-createToken('LONECARET', '(?:\\^)')
-
-createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
-exports.caretTrimReplace = '$1^'
-
-createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
-createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
-
-// A simple gt/lt/eq thing, or just "" to indicate "any version"
-createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
-createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
-
-// An expression to strip any whitespace between the gtlt and the thing
-// it modifies, so that `> 1.2.3` ==> `>1.2.3`
-createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
-}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
-exports.comparatorTrimReplace = '$1$2$3'
-
-// Something like `1.2.3 - 1.2.4`
-// Note that these all use the loose form, because they'll be
-// checked against either the strict or loose comparator form
-// later.
-createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
- `\\s+-\\s+` +
- `(${src[t.XRANGEPLAIN]})` +
- `\\s*$`)
-
-createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
- `\\s+-\\s+` +
- `(${src[t.XRANGEPLAINLOOSE]})` +
- `\\s*$`)
-
-// Star ranges basically just allow anything at all.
-createToken('STAR', '(<|>)?=?\\s*\\*')
-// >=0.0.0 is like a star
-createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
-createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
-
-
-/***/ }),
-/* 43 */
-/***/ ((module) => {
-
-// Note: this is the semver.org version of the spec that it implements
-// Not necessarily the package version of this code.
-const SEMVER_SPEC_VERSION = '2.0.0'
-
-const MAX_LENGTH = 256
-const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
- /* istanbul ignore next */ 9007199254740991
-
-// Max safe segment length for coercion.
-const MAX_SAFE_COMPONENT_LENGTH = 16
-
-module.exports = {
- SEMVER_SPEC_VERSION,
- MAX_LENGTH,
- MAX_SAFE_INTEGER,
- MAX_SAFE_COMPONENT_LENGTH
-}
-
-
-/***/ }),
-/* 44 */
-/***/ ((module) => {
-
-const debug = (
- typeof process === 'object' &&
- process.env &&
- process.env.NODE_DEBUG &&
- /\bsemver\b/i.test(process.env.NODE_DEBUG)
-) ? (...args) => console.error('SEMVER', ...args)
- : () => {}
-
-module.exports = debug
-
-
-/***/ }),
-/* 45 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const debug = __webpack_require__(44)
-const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(43)
-const { re, t } = __webpack_require__(42)
-
-const { compareIdentifiers } = __webpack_require__(46)
-class SemVer {
- constructor (version, options) {
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- }
- }
- if (version instanceof SemVer) {
- if (version.loose === !!options.loose &&
- version.includePrerelease === !!options.includePrerelease) {
- return version
- } else {
- version = version.version
- }
- } else if (typeof version !== 'string') {
- throw new TypeError(`Invalid Version: ${version}`)
- }
-
- if (version.length > MAX_LENGTH) {
- throw new TypeError(
- `version is longer than ${MAX_LENGTH} characters`
- )
- }
-
- debug('SemVer', version, options)
- this.options = options
- this.loose = !!options.loose
- // this isn't actually relevant for versions, but keep it so that we
- // don't run into trouble passing this.options around.
- this.includePrerelease = !!options.includePrerelease
-
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
-
- if (!m) {
- throw new TypeError(`Invalid Version: ${version}`)
- }
-
- this.raw = version
-
- // these are actually numbers
- this.major = +m[1]
- this.minor = +m[2]
- this.patch = +m[3]
-
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
- throw new TypeError('Invalid major version')
- }
-
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
- throw new TypeError('Invalid minor version')
- }
-
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
- throw new TypeError('Invalid patch version')
- }
-
- // numberify any prerelease numeric ids
- if (!m[4]) {
- this.prerelease = []
- } else {
- this.prerelease = m[4].split('.').map((id) => {
- if (/^[0-9]+$/.test(id)) {
- const num = +id
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
- return num
- }
- }
- return id
- })
- }
-
- this.build = m[5] ? m[5].split('.') : []
- this.format()
- }
-
- format () {
- this.version = `${this.major}.${this.minor}.${this.patch}`
- if (this.prerelease.length) {
- this.version += `-${this.prerelease.join('.')}`
- }
- return this.version
- }
-
- toString () {
- return this.version
- }
-
- compare (other) {
- debug('SemVer.compare', this.version, this.options, other)
- if (!(other instanceof SemVer)) {
- if (typeof other === 'string' && other === this.version) {
- return 0
- }
- other = new SemVer(other, this.options)
- }
-
- if (other.version === this.version) {
- return 0
- }
-
- return this.compareMain(other) || this.comparePre(other)
- }
-
- compareMain (other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options)
- }
-
- return (
- compareIdentifiers(this.major, other.major) ||
- compareIdentifiers(this.minor, other.minor) ||
- compareIdentifiers(this.patch, other.patch)
- )
- }
-
- comparePre (other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options)
- }
-
- // NOT having a prerelease is > having one
- if (this.prerelease.length && !other.prerelease.length) {
- return -1
- } else if (!this.prerelease.length && other.prerelease.length) {
- return 1
- } else if (!this.prerelease.length && !other.prerelease.length) {
- return 0
- }
-
- let i = 0
- do {
- const a = this.prerelease[i]
- const b = other.prerelease[i]
- debug('prerelease compare', i, a, b)
- if (a === undefined && b === undefined) {
- return 0
- } else if (b === undefined) {
- return 1
- } else if (a === undefined) {
- return -1
- } else if (a === b) {
- continue
- } else {
- return compareIdentifiers(a, b)
- }
- } while (++i)
- }
-
- compareBuild (other) {
- if (!(other instanceof SemVer)) {
- other = new SemVer(other, this.options)
- }
-
- let i = 0
- do {
- const a = this.build[i]
- const b = other.build[i]
- debug('prerelease compare', i, a, b)
- if (a === undefined && b === undefined) {
- return 0
- } else if (b === undefined) {
- return 1
- } else if (a === undefined) {
- return -1
- } else if (a === b) {
- continue
- } else {
- return compareIdentifiers(a, b)
- }
- } while (++i)
- }
-
- // preminor will bump the version up to the next minor release, and immediately
- // down to pre-release. premajor and prepatch work the same way.
- inc (release, identifier) {
- switch (release) {
- case 'premajor':
- this.prerelease.length = 0
- this.patch = 0
- this.minor = 0
- this.major++
- this.inc('pre', identifier)
- break
- case 'preminor':
- this.prerelease.length = 0
- this.patch = 0
- this.minor++
- this.inc('pre', identifier)
- break
- case 'prepatch':
- // If this is already a prerelease, it will bump to the next version
- // drop any prereleases that might already exist, since they are not
- // relevant at this point.
- this.prerelease.length = 0
- this.inc('patch', identifier)
- this.inc('pre', identifier)
- break
- // If the input is a non-prerelease version, this acts the same as
- // prepatch.
- case 'prerelease':
- if (this.prerelease.length === 0) {
- this.inc('patch', identifier)
- }
- this.inc('pre', identifier)
- break
-
- case 'major':
- // If this is a pre-major version, bump up to the same major version.
- // Otherwise increment major.
- // 1.0.0-5 bumps to 1.0.0
- // 1.1.0 bumps to 2.0.0
- if (
- this.minor !== 0 ||
- this.patch !== 0 ||
- this.prerelease.length === 0
- ) {
- this.major++
- }
- this.minor = 0
- this.patch = 0
- this.prerelease = []
- break
- case 'minor':
- // If this is a pre-minor version, bump up to the same minor version.
- // Otherwise increment minor.
- // 1.2.0-5 bumps to 1.2.0
- // 1.2.1 bumps to 1.3.0
- if (this.patch !== 0 || this.prerelease.length === 0) {
- this.minor++
- }
- this.patch = 0
- this.prerelease = []
- break
- case 'patch':
- // If this is not a pre-release version, it will increment the patch.
- // If it is a pre-release it will bump up to the same patch version.
- // 1.2.0-5 patches to 1.2.0
- // 1.2.0 patches to 1.2.1
- if (this.prerelease.length === 0) {
- this.patch++
- }
- this.prerelease = []
- break
- // This probably shouldn't be used publicly.
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
- case 'pre':
- if (this.prerelease.length === 0) {
- this.prerelease = [0]
- } else {
- let i = this.prerelease.length
- while (--i >= 0) {
- if (typeof this.prerelease[i] === 'number') {
- this.prerelease[i]++
- i = -2
- }
- }
- if (i === -1) {
- // didn't increment anything
- this.prerelease.push(0)
- }
- }
- if (identifier) {
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
- if (this.prerelease[0] === identifier) {
- if (isNaN(this.prerelease[1])) {
- this.prerelease = [identifier, 0]
- }
- } else {
- this.prerelease = [identifier, 0]
- }
- }
- break
-
- default:
- throw new Error(`invalid increment argument: ${release}`)
- }
- this.format()
- this.raw = this.version
- return this
- }
-}
-
-module.exports = SemVer
-
-
-/***/ }),
-/* 46 */
-/***/ ((module) => {
-
-const numeric = /^[0-9]+$/
-const compareIdentifiers = (a, b) => {
- const anum = numeric.test(a)
- const bnum = numeric.test(b)
-
- if (anum && bnum) {
- a = +a
- b = +b
- }
-
- return a === b ? 0
- : (anum && !bnum) ? -1
- : (bnum && !anum) ? 1
- : a < b ? -1
- : 1
-}
-
-const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
-
-module.exports = {
- compareIdentifiers,
- rcompareIdentifiers
-}
-
-
-/***/ }),
-/* 47 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const {MAX_LENGTH} = __webpack_require__(43)
-const { re, t } = __webpack_require__(42)
-const SemVer = __webpack_require__(45)
-
-const parse = (version, options) => {
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- }
- }
-
- if (version instanceof SemVer) {
- return version
- }
-
- if (typeof version !== 'string') {
- return null
- }
-
- if (version.length > MAX_LENGTH) {
- return null
- }
-
- const r = options.loose ? re[t.LOOSE] : re[t.FULL]
- if (!r.test(version)) {
- return null
- }
-
- try {
- return new SemVer(version, options)
- } catch (er) {
- return null
- }
-}
-
-module.exports = parse
-
-
-/***/ }),
-/* 48 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const parse = __webpack_require__(47)
-const valid = (version, options) => {
- const v = parse(version, options)
- return v ? v.version : null
-}
-module.exports = valid
-
-
-/***/ }),
-/* 49 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const parse = __webpack_require__(47)
-const clean = (version, options) => {
- const s = parse(version.trim().replace(/^[=v]+/, ''), options)
- return s ? s.version : null
-}
-module.exports = clean
-
-
-/***/ }),
-/* 50 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-
-const inc = (version, release, options, identifier) => {
- if (typeof (options) === 'string') {
- identifier = options
- options = undefined
- }
-
- try {
- return new SemVer(version, options).inc(release, identifier).version
- } catch (er) {
- return null
- }
-}
-module.exports = inc
-
-
-/***/ }),
-/* 51 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const parse = __webpack_require__(47)
-const eq = __webpack_require__(52)
-
-const diff = (version1, version2) => {
- if (eq(version1, version2)) {
- return null
- } else {
- const v1 = parse(version1)
- const v2 = parse(version2)
- const hasPre = v1.prerelease.length || v2.prerelease.length
- const prefix = hasPre ? 'pre' : ''
- const defaultResult = hasPre ? 'prerelease' : ''
- for (const key in v1) {
- if (key === 'major' || key === 'minor' || key === 'patch') {
- if (v1[key] !== v2[key]) {
- return prefix + key
- }
- }
- }
- return defaultResult // may be undefined
- }
-}
-module.exports = diff
-
-
-/***/ }),
-/* 52 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const eq = (a, b, loose) => compare(a, b, loose) === 0
-module.exports = eq
-
-
-/***/ }),
-/* 53 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const compare = (a, b, loose) =>
- new SemVer(a, loose).compare(new SemVer(b, loose))
-
-module.exports = compare
-
-
-/***/ }),
-/* 54 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const major = (a, loose) => new SemVer(a, loose).major
-module.exports = major
-
-
-/***/ }),
-/* 55 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const minor = (a, loose) => new SemVer(a, loose).minor
-module.exports = minor
-
-
-/***/ }),
-/* 56 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const patch = (a, loose) => new SemVer(a, loose).patch
-module.exports = patch
-
-
-/***/ }),
-/* 57 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const parse = __webpack_require__(47)
-const prerelease = (version, options) => {
- const parsed = parse(version, options)
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
-}
-module.exports = prerelease
-
-
-/***/ }),
-/* 58 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const rcompare = (a, b, loose) => compare(b, a, loose)
-module.exports = rcompare
-
-
-/***/ }),
-/* 59 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const compareLoose = (a, b) => compare(a, b, true)
-module.exports = compareLoose
-
-
-/***/ }),
-/* 60 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const compareBuild = (a, b, loose) => {
- const versionA = new SemVer(a, loose)
- const versionB = new SemVer(b, loose)
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
-}
-module.exports = compareBuild
-
-
-/***/ }),
-/* 61 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compareBuild = __webpack_require__(60)
-const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
-module.exports = sort
-
-
-/***/ }),
-/* 62 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compareBuild = __webpack_require__(60)
-const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
-module.exports = rsort
-
-
-/***/ }),
-/* 63 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const gt = (a, b, loose) => compare(a, b, loose) > 0
-module.exports = gt
-
-
-/***/ }),
-/* 64 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const lt = (a, b, loose) => compare(a, b, loose) < 0
-module.exports = lt
-
-
-/***/ }),
-/* 65 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const neq = (a, b, loose) => compare(a, b, loose) !== 0
-module.exports = neq
-
-
-/***/ }),
-/* 66 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const gte = (a, b, loose) => compare(a, b, loose) >= 0
-module.exports = gte
-
-
-/***/ }),
-/* 67 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const compare = __webpack_require__(53)
-const lte = (a, b, loose) => compare(a, b, loose) <= 0
-module.exports = lte
-
-
-/***/ }),
-/* 68 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const eq = __webpack_require__(52)
-const neq = __webpack_require__(65)
-const gt = __webpack_require__(63)
-const gte = __webpack_require__(66)
-const lt = __webpack_require__(64)
-const lte = __webpack_require__(67)
-
-const cmp = (a, op, b, loose) => {
- switch (op) {
- case '===':
- if (typeof a === 'object')
- a = a.version
- if (typeof b === 'object')
- b = b.version
- return a === b
-
- case '!==':
- if (typeof a === 'object')
- a = a.version
- if (typeof b === 'object')
- b = b.version
- return a !== b
-
- case '':
- case '=':
- case '==':
- return eq(a, b, loose)
-
- case '!=':
- return neq(a, b, loose)
-
- case '>':
- return gt(a, b, loose)
-
- case '>=':
- return gte(a, b, loose)
-
- case '<':
- return lt(a, b, loose)
-
- case '<=':
- return lte(a, b, loose)
-
- default:
- throw new TypeError(`Invalid operator: ${op}`)
- }
-}
-module.exports = cmp
-
-
-/***/ }),
-/* 69 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const parse = __webpack_require__(47)
-const {re, t} = __webpack_require__(42)
-
-const coerce = (version, options) => {
- if (version instanceof SemVer) {
- return version
- }
-
- if (typeof version === 'number') {
- version = String(version)
- }
-
- if (typeof version !== 'string') {
- return null
- }
-
- options = options || {}
-
- let match = null
- if (!options.rtl) {
- match = version.match(re[t.COERCE])
- } else {
- // Find the right-most coercible string that does not share
- // a terminus with a more left-ward coercible string.
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
- //
- // Walk through the string checking with a /g regexp
- // Manually set the index so as to pick up overlapping matches.
- // Stop when we get a match that ends at the string end, since no
- // coercible string can be more right-ward without the same terminus.
- let next
- while ((next = re[t.COERCERTL].exec(version)) &&
- (!match || match.index + match[0].length !== version.length)
- ) {
- if (!match ||
- next.index + next[0].length !== match.index + match[0].length) {
- match = next
- }
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
- }
- // leave it in a clean state
- re[t.COERCERTL].lastIndex = -1
- }
-
- if (match === null)
- return null
-
- return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
-}
-module.exports = coerce
-
-
-/***/ }),
-/* 70 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const ANY = Symbol('SemVer ANY')
-// hoisted class for cyclic dependency
-class Comparator {
- static get ANY () {
- return ANY
- }
- constructor (comp, options) {
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- }
- }
-
- if (comp instanceof Comparator) {
- if (comp.loose === !!options.loose) {
- return comp
- } else {
- comp = comp.value
- }
- }
-
- debug('comparator', comp, options)
- this.options = options
- this.loose = !!options.loose
- this.parse(comp)
-
- if (this.semver === ANY) {
- this.value = ''
- } else {
- this.value = this.operator + this.semver.version
- }
-
- debug('comp', this)
- }
-
- parse (comp) {
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
- const m = comp.match(r)
-
- if (!m) {
- throw new TypeError(`Invalid comparator: ${comp}`)
- }
-
- this.operator = m[1] !== undefined ? m[1] : ''
- if (this.operator === '=') {
- this.operator = ''
- }
-
- // if it literally is just '>' or '' then allow anything.
- if (!m[2]) {
- this.semver = ANY
- } else {
- this.semver = new SemVer(m[2], this.options.loose)
- }
- }
-
- toString () {
- return this.value
- }
-
- test (version) {
- debug('Comparator.test', version, this.options.loose)
-
- if (this.semver === ANY || version === ANY) {
- return true
- }
-
- if (typeof version === 'string') {
- try {
- version = new SemVer(version, this.options)
- } catch (er) {
- return false
- }
- }
-
- return cmp(version, this.operator, this.semver, this.options)
- }
-
- intersects (comp, options) {
- if (!(comp instanceof Comparator)) {
- throw new TypeError('a Comparator is required')
- }
-
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- }
- }
-
- if (this.operator === '') {
- if (this.value === '') {
- return true
- }
- return new Range(comp.value, options).test(this.value)
- } else if (comp.operator === '') {
- if (comp.value === '') {
- return true
- }
- return new Range(this.value, options).test(comp.semver)
- }
-
- const sameDirectionIncreasing =
- (this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '>=' || comp.operator === '>')
- const sameDirectionDecreasing =
- (this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '<=' || comp.operator === '<')
- const sameSemVer = this.semver.version === comp.semver.version
- const differentDirectionsInclusive =
- (this.operator === '>=' || this.operator === '<=') &&
- (comp.operator === '>=' || comp.operator === '<=')
- const oppositeDirectionsLessThan =
- cmp(this.semver, '<', comp.semver, options) &&
- (this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '<=' || comp.operator === '<')
- const oppositeDirectionsGreaterThan =
- cmp(this.semver, '>', comp.semver, options) &&
- (this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '>=' || comp.operator === '>')
-
- return (
- sameDirectionIncreasing ||
- sameDirectionDecreasing ||
- (sameSemVer && differentDirectionsInclusive) ||
- oppositeDirectionsLessThan ||
- oppositeDirectionsGreaterThan
- )
- }
-}
-
-module.exports = Comparator
-
-const {re, t} = __webpack_require__(42)
-const cmp = __webpack_require__(68)
-const debug = __webpack_require__(44)
-const SemVer = __webpack_require__(45)
-const Range = __webpack_require__(71)
-
-
-/***/ }),
-/* 71 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-// hoisted class for cyclic dependency
-class Range {
- constructor (range, options) {
- if (!options || typeof options !== 'object') {
- options = {
- loose: !!options,
- includePrerelease: false
- }
- }
-
- if (range instanceof Range) {
- if (
- range.loose === !!options.loose &&
- range.includePrerelease === !!options.includePrerelease
- ) {
- return range
- } else {
- return new Range(range.raw, options)
- }
- }
-
- if (range instanceof Comparator) {
- // just put it in the set and return
- this.raw = range.value
- this.set = [[range]]
- this.format()
- return this
- }
-
- this.options = options
- this.loose = !!options.loose
- this.includePrerelease = !!options.includePrerelease
-
- // First, split based on boolean or ||
- this.raw = range
- this.set = range
- .split(/\s*\|\|\s*/)
- // map the range to a 2d array of comparators
- .map(range => this.parseRange(range.trim()))
- // throw out any comparator lists that are empty
- // this generally means that it was not a valid range, which is allowed
- // in loose mode, but will still throw if the WHOLE range is invalid.
- .filter(c => c.length)
-
- if (!this.set.length) {
- throw new TypeError(`Invalid SemVer Range: ${range}`)
- }
-
- this.format()
- }
-
- format () {
- this.range = this.set
- .map((comps) => {
- return comps.join(' ').trim()
- })
- .join('||')
- .trim()
- return this.range
- }
-
- toString () {
- return this.range
- }
-
- parseRange (range) {
- const loose = this.options.loose
- range = range.trim()
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
- debug('hyphen replace', range)
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
- debug('comparator trim', range, re[t.COMPARATORTRIM])
-
- // `~ 1.2.3` => `~1.2.3`
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
-
- // `^ 1.2.3` => `^1.2.3`
- range = range.replace(re[t.CARETTRIM], caretTrimReplace)
-
- // normalize spaces
- range = range.split(/\s+/).join(' ')
-
- // At this point, the range is completely trimmed and
- // ready to be split into comparators.
-
- const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
- return range
- .split(' ')
- .map(comp => parseComparator(comp, this.options))
- .join(' ')
- .split(/\s+/)
- .map(comp => replaceGTE0(comp, this.options))
- // in loose mode, throw out any that are not valid comparators
- .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
- .map(comp => new Comparator(comp, this.options))
- }
-
- intersects (range, options) {
- if (!(range instanceof Range)) {
- throw new TypeError('a Range is required')
- }
-
- return this.set.some((thisComparators) => {
- return (
- isSatisfiable(thisComparators, options) &&
- range.set.some((rangeComparators) => {
- return (
- isSatisfiable(rangeComparators, options) &&
- thisComparators.every((thisComparator) => {
- return rangeComparators.every((rangeComparator) => {
- return thisComparator.intersects(rangeComparator, options)
- })
- })
- )
- })
- )
- })
- }
-
- // if ANY of the sets match ALL of its comparators, then pass
- test (version) {
- if (!version) {
- return false
- }
-
- if (typeof version === 'string') {
- try {
- version = new SemVer(version, this.options)
- } catch (er) {
- return false
- }
- }
-
- for (let i = 0; i < this.set.length; i++) {
- if (testSet(this.set[i], version, this.options)) {
- return true
- }
- }
- return false
- }
-}
-module.exports = Range
-
-const Comparator = __webpack_require__(70)
-const debug = __webpack_require__(44)
-const SemVer = __webpack_require__(45)
-const {
- re,
- t,
- comparatorTrimReplace,
- tildeTrimReplace,
- caretTrimReplace
-} = __webpack_require__(42)
-
-// take a set of comparators and determine whether there
-// exists a version which can satisfy it
-const isSatisfiable = (comparators, options) => {
- let result = true
- const remainingComparators = comparators.slice()
- let testComparator = remainingComparators.pop()
-
- while (result && remainingComparators.length) {
- result = remainingComparators.every((otherComparator) => {
- return testComparator.intersects(otherComparator, options)
- })
-
- testComparator = remainingComparators.pop()
- }
-
- return result
-}
-
-// comprised of xranges, tildes, stars, and gtlt's at this point.
-// already replaced the hyphen ranges
-// turn into a set of JUST comparators.
-const parseComparator = (comp, options) => {
- debug('comp', comp, options)
- comp = replaceCarets(comp, options)
- debug('caret', comp)
- comp = replaceTildes(comp, options)
- debug('tildes', comp)
- comp = replaceXRanges(comp, options)
- debug('xrange', comp)
- comp = replaceStars(comp, options)
- debug('stars', comp)
- return comp
-}
-
-const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
-
-// ~, ~> --> * (any, kinda silly)
-// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
-// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
-// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
-// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
-// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
-const replaceTildes = (comp, options) =>
- comp.trim().split(/\s+/).map((comp) => {
- return replaceTilde(comp, options)
- }).join(' ')
-
-const replaceTilde = (comp, options) => {
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
- return comp.replace(r, (_, M, m, p, pr) => {
- debug('tilde', comp, _, M, m, p, pr)
- let ret
-
- if (isX(M)) {
- ret = ''
- } else if (isX(m)) {
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
- } else if (isX(p)) {
- // ~1.2 == >=1.2.0 <1.3.0-0
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
- } else if (pr) {
- debug('replaceTilde pr', pr)
- ret = `>=${M}.${m}.${p}-${pr
- } <${M}.${+m + 1}.0-0`
- } else {
- // ~1.2.3 == >=1.2.3 <1.3.0-0
- ret = `>=${M}.${m}.${p
- } <${M}.${+m + 1}.0-0`
- }
-
- debug('tilde return', ret)
- return ret
- })
-}
-
-// ^ --> * (any, kinda silly)
-// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
-// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
-// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
-// ^1.2.3 --> >=1.2.3 <2.0.0-0
-// ^1.2.0 --> >=1.2.0 <2.0.0-0
-const replaceCarets = (comp, options) =>
- comp.trim().split(/\s+/).map((comp) => {
- return replaceCaret(comp, options)
- }).join(' ')
-
-const replaceCaret = (comp, options) => {
- debug('caret', comp, options)
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
- const z = options.includePrerelease ? '-0' : ''
- return comp.replace(r, (_, M, m, p, pr) => {
- debug('caret', comp, _, M, m, p, pr)
- let ret
-
- if (isX(M)) {
- ret = ''
- } else if (isX(m)) {
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
- } else if (isX(p)) {
- if (M === '0') {
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
- } else {
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
- }
- } else if (pr) {
- debug('replaceCaret pr', pr)
- if (M === '0') {
- if (m === '0') {
- ret = `>=${M}.${m}.${p}-${pr
- } <${M}.${m}.${+p + 1}-0`
- } else {
- ret = `>=${M}.${m}.${p}-${pr
- } <${M}.${+m + 1}.0-0`
- }
- } else {
- ret = `>=${M}.${m}.${p}-${pr
- } <${+M + 1}.0.0-0`
- }
- } else {
- debug('no pr')
- if (M === '0') {
- if (m === '0') {
- ret = `>=${M}.${m}.${p
- }${z} <${M}.${m}.${+p + 1}-0`
- } else {
- ret = `>=${M}.${m}.${p
- }${z} <${M}.${+m + 1}.0-0`
- }
- } else {
- ret = `>=${M}.${m}.${p
- } <${+M + 1}.0.0-0`
- }
- }
-
- debug('caret return', ret)
- return ret
- })
-}
-
-const replaceXRanges = (comp, options) => {
- debug('replaceXRanges', comp, options)
- return comp.split(/\s+/).map((comp) => {
- return replaceXRange(comp, options)
- }).join(' ')
-}
-
-const replaceXRange = (comp, options) => {
- comp = comp.trim()
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
- debug('xRange', comp, ret, gtlt, M, m, p, pr)
- const xM = isX(M)
- const xm = xM || isX(m)
- const xp = xm || isX(p)
- const anyX = xp
-
- if (gtlt === '=' && anyX) {
- gtlt = ''
- }
-
- // if we're including prereleases in the match, then we need
- // to fix this to -0, the lowest possible prerelease value
- pr = options.includePrerelease ? '-0' : ''
-
- if (xM) {
- if (gtlt === '>' || gtlt === '<') {
- // nothing is allowed
- ret = '<0.0.0-0'
- } else {
- // nothing is forbidden
- ret = '*'
- }
- } else if (gtlt && anyX) {
- // we know patch is an x, because we have any x at all.
- // replace X with 0
- if (xm) {
- m = 0
- }
- p = 0
-
- if (gtlt === '>') {
- // >1 => >=2.0.0
- // >1.2 => >=1.3.0
- gtlt = '>='
- if (xm) {
- M = +M + 1
- m = 0
- p = 0
- } else {
- m = +m + 1
- p = 0
- }
- } else if (gtlt === '<=') {
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
- gtlt = '<'
- if (xm) {
- M = +M + 1
- } else {
- m = +m + 1
- }
- }
-
- if (gtlt === '<')
- pr = '-0'
-
- ret = `${gtlt + M}.${m}.${p}${pr}`
- } else if (xm) {
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
- } else if (xp) {
- ret = `>=${M}.${m}.0${pr
- } <${M}.${+m + 1}.0-0`
- }
-
- debug('xRange return', ret)
-
- return ret
- })
-}
-
-// Because * is AND-ed with everything else in the comparator,
-// and '' means "any version", just remove the *s entirely.
-const replaceStars = (comp, options) => {
- debug('replaceStars', comp, options)
- // Looseness is ignored here. star is always as loose as it gets!
- return comp.trim().replace(re[t.STAR], '')
-}
-
-const replaceGTE0 = (comp, options) => {
- debug('replaceGTE0', comp, options)
- return comp.trim()
- .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
-}
-
-// This function is passed to string.replace(re[t.HYPHENRANGE])
-// M, m, patch, prerelease, build
-// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
-// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
-// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
-const hyphenReplace = incPr => ($0,
- from, fM, fm, fp, fpr, fb,
- to, tM, tm, tp, tpr, tb) => {
- if (isX(fM)) {
- from = ''
- } else if (isX(fm)) {
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`
- } else if (isX(fp)) {
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
- } else if (fpr) {
- from = `>=${from}`
- } else {
- from = `>=${from}${incPr ? '-0' : ''}`
- }
-
- if (isX(tM)) {
- to = ''
- } else if (isX(tm)) {
- to = `<${+tM + 1}.0.0-0`
- } else if (isX(tp)) {
- to = `<${tM}.${+tm + 1}.0-0`
- } else if (tpr) {
- to = `<=${tM}.${tm}.${tp}-${tpr}`
- } else if (incPr) {
- to = `<${tM}.${tm}.${+tp + 1}-0`
- } else {
- to = `<=${to}`
- }
-
- return (`${from} ${to}`).trim()
-}
-
-const testSet = (set, version, options) => {
- for (let i = 0; i < set.length; i++) {
- if (!set[i].test(version)) {
- return false
- }
- }
-
- if (version.prerelease.length && !options.includePrerelease) {
- // Find the set of versions that are allowed to have prereleases
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
- // That should allow `1.2.3-pr.2` to pass.
- // However, `1.2.4-alpha.notready` should NOT be allowed,
- // even though it's within the range set by the comparators.
- for (let i = 0; i < set.length; i++) {
- debug(set[i].semver)
- if (set[i].semver === Comparator.ANY) {
- continue
- }
-
- if (set[i].semver.prerelease.length > 0) {
- const allowed = set[i].semver
- if (allowed.major === version.major &&
- allowed.minor === version.minor &&
- allowed.patch === version.patch) {
- return true
- }
- }
- }
-
- // Version has a -pre, but it's not one of the ones we like.
- return false
- }
-
- return true
-}
-
-
-/***/ }),
-/* 72 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const Range = __webpack_require__(71)
-const satisfies = (version, range, options) => {
- try {
- range = new Range(range, options)
- } catch (er) {
- return false
- }
- return range.test(version)
-}
-module.exports = satisfies
-
-
-/***/ }),
-/* 73 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const Range = __webpack_require__(71)
-
-// Mostly just for testing and legacy API reasons
-const toComparators = (range, options) =>
- new Range(range, options).set
- .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
-
-module.exports = toComparators
-
-
-/***/ }),
-/* 74 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const Range = __webpack_require__(71)
-
-const maxSatisfying = (versions, range, options) => {
- let max = null
- let maxSV = null
- let rangeObj = null
- try {
- rangeObj = new Range(range, options)
- } catch (er) {
- return null
- }
- versions.forEach((v) => {
- if (rangeObj.test(v)) {
- // satisfies(v, range, options)
- if (!max || maxSV.compare(v) === -1) {
- // compare(max, v, true)
- max = v
- maxSV = new SemVer(max, options)
- }
- }
- })
- return max
-}
-module.exports = maxSatisfying
-
-
-/***/ }),
-/* 75 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const Range = __webpack_require__(71)
-const minSatisfying = (versions, range, options) => {
- let min = null
- let minSV = null
- let rangeObj = null
- try {
- rangeObj = new Range(range, options)
- } catch (er) {
- return null
- }
- versions.forEach((v) => {
- if (rangeObj.test(v)) {
- // satisfies(v, range, options)
- if (!min || minSV.compare(v) === 1) {
- // compare(min, v, true)
- min = v
- minSV = new SemVer(min, options)
- }
- }
- })
- return min
-}
-module.exports = minSatisfying
-
-
-/***/ }),
-/* 76 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const Range = __webpack_require__(71)
-const gt = __webpack_require__(63)
-
-const minVersion = (range, loose) => {
- range = new Range(range, loose)
-
- let minver = new SemVer('0.0.0')
- if (range.test(minver)) {
- return minver
- }
-
- minver = new SemVer('0.0.0-0')
- if (range.test(minver)) {
- return minver
- }
-
- minver = null
- for (let i = 0; i < range.set.length; ++i) {
- const comparators = range.set[i]
-
- comparators.forEach((comparator) => {
- // Clone to avoid manipulating the comparator's semver object.
- const compver = new SemVer(comparator.semver.version)
- switch (comparator.operator) {
- case '>':
- if (compver.prerelease.length === 0) {
- compver.patch++
- } else {
- compver.prerelease.push(0)
- }
- compver.raw = compver.format()
- /* fallthrough */
- case '':
- case '>=':
- if (!minver || gt(minver, compver)) {
- minver = compver
- }
- break
- case '<':
- case '<=':
- /* Ignore maximum versions */
- break
- /* istanbul ignore next */
- default:
- throw new Error(`Unexpected operation: ${comparator.operator}`)
- }
- })
- }
-
- if (minver && range.test(minver)) {
- return minver
- }
-
- return null
-}
-module.exports = minVersion
-
-
-/***/ }),
-/* 77 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const Range = __webpack_require__(71)
-const validRange = (range, options) => {
- try {
- // Return '*' instead of '' so that truthiness works.
- // This will throw if it's invalid anyway
- return new Range(range, options).range || '*'
- } catch (er) {
- return null
- }
-}
-module.exports = validRange
-
-
-/***/ }),
-/* 78 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const SemVer = __webpack_require__(45)
-const Comparator = __webpack_require__(70)
-const {ANY} = Comparator
-const Range = __webpack_require__(71)
-const satisfies = __webpack_require__(72)
-const gt = __webpack_require__(63)
-const lt = __webpack_require__(64)
-const lte = __webpack_require__(67)
-const gte = __webpack_require__(66)
-
-const outside = (version, range, hilo, options) => {
- version = new SemVer(version, options)
- range = new Range(range, options)
-
- let gtfn, ltefn, ltfn, comp, ecomp
- switch (hilo) {
- case '>':
- gtfn = gt
- ltefn = lte
- ltfn = lt
- comp = '>'
- ecomp = '>='
- break
- case '<':
- gtfn = lt
- ltefn = gte
- ltfn = gt
- comp = '<'
- ecomp = '<='
- break
- default:
- throw new TypeError('Must provide a hilo val of "<" or ">"')
- }
-
- // If it satisifes the range it is not outside
- if (satisfies(version, range, options)) {
- return false
- }
-
- // From now on, variable terms are as if we're in "gtr" mode.
- // but note that everything is flipped for the "ltr" function.
-
- for (let i = 0; i < range.set.length; ++i) {
- const comparators = range.set[i]
-
- let high = null
- let low = null
-
- comparators.forEach((comparator) => {
- if (comparator.semver === ANY) {
- comparator = new Comparator('>=0.0.0')
- }
- high = high || comparator
- low = low || comparator
- if (gtfn(comparator.semver, high.semver, options)) {
- high = comparator
- } else if (ltfn(comparator.semver, low.semver, options)) {
- low = comparator
- }
- })
-
- // If the edge version comparator has a operator then our version
- // isn't outside it
- if (high.operator === comp || high.operator === ecomp) {
- return false
- }
-
- // If the lowest version comparator has an operator and our version
- // is less than it then it isn't higher than the range
- if ((!low.operator || low.operator === comp) &&
- ltefn(version, low.semver)) {
- return false
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
- return false
- }
- }
- return true
-}
-
-module.exports = outside
-
-
-/***/ }),
-/* 79 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-// Determine if version is greater than all the versions possible in the range.
-const outside = __webpack_require__(78)
-const gtr = (version, range, options) => outside(version, range, '>', options)
-module.exports = gtr
-
-
-/***/ }),
-/* 80 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const outside = __webpack_require__(78)
-// Determine if version is less than all the versions possible in the range
-const ltr = (version, range, options) => outside(version, range, '<', options)
-module.exports = ltr
-
-
-/***/ }),
-/* 81 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const Range = __webpack_require__(71)
-const intersects = (r1, r2, options) => {
- r1 = new Range(r1, options)
- r2 = new Range(r2, options)
- return r1.intersects(r2)
-}
-module.exports = intersects
-
-
-/***/ }),
-/* 82 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-// given a set of versions and a range, create a "simplified" range
-// that includes the same versions that the original range does
-// If the original range is shorter than the simplified one, return that.
-const satisfies = __webpack_require__(72)
-const compare = __webpack_require__(53)
-module.exports = (versions, range, options) => {
- const set = []
- let min = null
- let prev = null
- const v = versions.sort((a, b) => compare(a, b, options))
- for (const version of v) {
- const included = satisfies(version, range, options)
- if (included) {
- prev = version
- if (!min)
- min = version
- } else {
- if (prev) {
- set.push([min, prev])
- }
- prev = null
- min = null
- }
- }
- if (min)
- set.push([min, null])
-
- const ranges = []
- for (const [min, max] of set) {
- if (min === max)
- ranges.push(min)
- else if (!max && min === v[0])
- ranges.push('*')
- else if (!max)
- ranges.push(`>=${min}`)
- else if (min === v[0])
- ranges.push(`<=${max}`)
- else
- ranges.push(`${min} - ${max}`)
- }
- const simplified = ranges.join(' || ')
- const original = typeof range.raw === 'string' ? range.raw : String(range)
- return simplified.length < original.length ? simplified : range
-}
-
-
-/***/ }),
-/* 83 */
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-const Range = __webpack_require__(71)
-const { ANY } = __webpack_require__(70)
-const satisfies = __webpack_require__(72)
-const compare = __webpack_require__(53)
-
-// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
-// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
-//
-// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
-// - If c is only the ANY comparator
-// - If C is only the ANY comparator, return true
-// - Else return false
-// - Let EQ be the set of = comparators in c
-// - If EQ is more than one, return true (null set)
-// - Let GT be the highest > or >= comparator in c
-// - Let LT be the lowest < or <= comparator in c
-// - If GT and LT, and GT.semver > LT.semver, return true (null set)
-// - If EQ
-// - If GT, and EQ does not satisfy GT, return true (null set)
-// - If LT, and EQ does not satisfy LT, return true (null set)
-// - If EQ satisfies every C, return true
-// - Else return false
-// - If GT
-// - If GT is lower than any > or >= comp in C, return false
-// - If GT is >=, and GT.semver does not satisfy every C, return false
-// - If LT
-// - If LT.semver is greater than that of any > comp in C, return false
-// - If LT is <=, and LT.semver does not satisfy every C, return false
-// - If any C is a = range, and GT or LT are set, return false
-// - Else return true
-
-const subset = (sub, dom, options) => {
- sub = new Range(sub, options)
- dom = new Range(dom, options)
- let sawNonNull = false
-
- OUTER: for (const simpleSub of sub.set) {
- for (const simpleDom of dom.set) {
- const isSub = simpleSubset(simpleSub, simpleDom, options)
- sawNonNull = sawNonNull || isSub !== null
- if (isSub)
- continue OUTER
- }
- // the null set is a subset of everything, but null simple ranges in
- // a complex range should be ignored. so if we saw a non-null range,
- // then we know this isn't a subset, but if EVERY simple range was null,
- // then it is a subset.
- if (sawNonNull)
- return false
- }
- return true
-}
-
-const simpleSubset = (sub, dom, options) => {
- if (sub.length === 1 && sub[0].semver === ANY)
- return dom.length === 1 && dom[0].semver === ANY
-
- const eqSet = new Set()
- let gt, lt
- for (const c of sub) {
- if (c.operator === '>' || c.operator === '>=')
- gt = higherGT(gt, c, options)
- else if (c.operator === '<' || c.operator === '<=')
- lt = lowerLT(lt, c, options)
- else
- eqSet.add(c.semver)
- }
-
- if (eqSet.size > 1)
- return null
-
- let gtltComp
- if (gt && lt) {
- gtltComp = compare(gt.semver, lt.semver, options)
- if (gtltComp > 0)
- return null
- else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
- return null
- }
-
- // will iterate one or zero times
- for (const eq of eqSet) {
- if (gt && !satisfies(eq, String(gt), options))
- return null
-
- if (lt && !satisfies(eq, String(lt), options))
- return null
-
- for (const c of dom) {
- if (!satisfies(eq, String(c), options))
- return false
- }
- return true
- }
-
- let higher, lower
- let hasDomLT, hasDomGT
- for (const c of dom) {
- hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
- hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
- if (gt) {
- if (c.operator === '>' || c.operator === '>=') {
- higher = higherGT(gt, c, options)
- if (higher === c)
- return false
- } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
- return false
- }
- if (lt) {
- if (c.operator === '<' || c.operator === '<=') {
- lower = lowerLT(lt, c, options)
- if (lower === c)
- return false
- } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
- return false
- }
- if (!c.operator && (lt || gt) && gtltComp !== 0)
- return false
- }
-
- // if there was a < or >, and nothing in the dom, then must be false
- // UNLESS it was limited by another range in the other direction.
- // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
- if (gt && hasDomLT && !lt && gtltComp !== 0)
- return false
-
- if (lt && hasDomGT && !gt && gtltComp !== 0)
- return false
-
- return true
-}
-
-// >=1.2.3 is lower than >1.2.3
-const higherGT = (a, b, options) => {
- if (!a)
- return b
- const comp = compare(a.semver, b.semver, options)
- return comp > 0 ? a
- : comp < 0 ? b
- : b.operator === '>' && a.operator === '>=' ? b
- : a
-}
-
-// <=1.2.3 is higher than <1.2.3
-const lowerLT = (a, b, options) => {
- if (!a)
- return b
- const comp = compare(a.semver, b.semver, options)
- return comp < 0 ? a
- : comp > 0 ? b
- : b.operator === '<' && a.operator === '<=' ? b
- : a
-}
-
-module.exports = subset
-
-
-/***/ }),
-/* 84 */
-/***/ ((module) => {
-
-// A simple implementation of make-array
-function makeArray (subject) {
- return Array.isArray(subject)
- ? subject
- : [subject]
-}
-
-const EMPTY = ''
-const SPACE = ' '
-const ESCAPE = '\\'
-const REGEX_TEST_BLANK_LINE = /^\s+$/
-const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
-const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
-const REGEX_SPLITALL_CRLF = /\r?\n/g
-// /foo,
-// ./foo,
-// ../foo,
-// .
-// ..
-const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
-
-const SLASH = '/'
-const KEY_IGNORE = typeof Symbol !== 'undefined'
- ? Symbol.for('node-ignore')
- /* istanbul ignore next */
- : 'node-ignore'
-
-const define = (object, key, value) =>
- Object.defineProperty(object, key, {value})
-
-const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
-
-// Sanitize the range of a regular expression
-// The cases are complicated, see test cases for details
-const sanitizeRange = range => range.replace(
- REGEX_REGEXP_RANGE,
- (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
- ? match
- // Invalid range (out of order) which is ok for gitignore rules but
- // fatal for JavaScript regular expression, so eliminate it.
- : EMPTY
-)
-
-// See fixtures #59
-const cleanRangeBackSlash = slashes => {
- const {length} = slashes
- return slashes.slice(0, length - length % 2)
-}
-
-// > If the pattern ends with a slash,
-// > it is removed for the purpose of the following description,
-// > but it would only find a match with a directory.
-// > In other words, foo/ will match a directory foo and paths underneath it,
-// > but will not match a regular file or a symbolic link foo
-// > (this is consistent with the way how pathspec works in general in Git).
-// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
-// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
-// you could use option `mark: true` with `glob`
-
-// '`foo/`' should not continue with the '`..`'
-const REPLACERS = [
-
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
- [
- // (a\ ) -> (a )
- // (a ) -> (a)
- // (a \ ) -> (a )
- /\\?\s+$/,
- match => match.indexOf('\\') === 0
- ? SPACE
- : EMPTY
- ],
-
- // replace (\ ) with ' '
- [
- /\\\s/g,
- () => SPACE
- ],
-
- // Escape metacharacters
- // which is written down by users but means special for regular expressions.
-
- // > There are 12 characters with special meanings:
- // > - the backslash \,
- // > - the caret ^,
- // > - the dollar sign $,
- // > - the period or dot .,
- // > - the vertical bar or pipe symbol |,
- // > - the question mark ?,
- // > - the asterisk or star *,
- // > - the plus sign +,
- // > - the opening parenthesis (,
- // > - the closing parenthesis ),
- // > - and the opening square bracket [,
- // > - the opening curly brace {,
- // > These special characters are often called "metacharacters".
- [
- /[\\$.|*+(){^]/g,
- match => `\\${match}`
- ],
-
- [
- // > a question mark (?) matches a single character
- /(?!\\)\?/g,
- () => '[^/]'
- ],
-
- // leading slash
- [
-
- // > A leading slash matches the beginning of the pathname.
- // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
- // A leading slash matches the beginning of the pathname
- /^\//,
- () => '^'
- ],
-
- // replace special metacharacter slash after the leading slash
- [
- /\//g,
- () => '\\/'
- ],
-
- [
- // > A leading "**" followed by a slash means match in all directories.
- // > For example, "**/foo" matches file or directory "foo" anywhere,
- // > the same as pattern "foo".
- // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
- // > under directory "foo".
- // Notice that the '*'s have been replaced as '\\*'
- /^\^*\\\*\\\*\\\//,
-
- // '**/foo' <-> 'foo'
- () => '^(?:.*\\/)?'
- ],
-
- // starting
- [
- // there will be no leading '/'
- // (which has been replaced by section "leading slash")
- // If starts with '**', adding a '^' to the regular expression also works
- /^(?=[^^])/,
- function startingReplacer () {
- // If has a slash `/` at the beginning or middle
- return !/\/(?!$)/.test(this)
- // > Prior to 2.22.1
- // > If the pattern does not contain a slash /,
- // > Git treats it as a shell glob pattern
- // Actually, if there is only a trailing slash,
- // git also treats it as a shell glob pattern
-
- // After 2.22.1 (compatible but clearer)
- // > If there is a separator at the beginning or middle (or both)
- // > of the pattern, then the pattern is relative to the directory
- // > level of the particular .gitignore file itself.
- // > Otherwise the pattern may also match at any level below
- // > the .gitignore level.
- ? '(?:^|\\/)'
-
- // > Otherwise, Git treats the pattern as a shell glob suitable for
- // > consumption by fnmatch(3)
- : '^'
- }
- ],
-
- // two globstars
- [
- // Use lookahead assertions so that we could match more than one `'/**'`
- /\\\/\\\*\\\*(?=\\\/|$)/g,
-
- // Zero, one or several directories
- // should not use '*', or it will be replaced by the next replacer
-
- // Check if it is not the last `'/**'`
- (_, index, str) => index + 6 < str.length
-
- // case: /**/
- // > A slash followed by two consecutive asterisks then a slash matches
- // > zero or more directories.
- // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
- // '/**/'
- ? '(?:\\/[^\\/]+)*'
-
- // case: /**
- // > A trailing `"/**"` matches everything inside.
-
- // #21: everything inside but it should not include the current folder
- : '\\/.+'
- ],
-
- // intermediate wildcards
- [
- // Never replace escaped '*'
- // ignore rule '\*' will match the path '*'
-
- // 'abc.*/' -> go
- // 'abc.*' -> skip this rule
- /(^|[^\\]+)\\\*(?=.+)/g,
-
- // '*.js' matches '.js'
- // '*.js' doesn't match 'abc'
- (_, p1) => `${p1}[^\\/]*`
- ],
-
- [
- // unescape, revert step 3 except for back slash
- // For example, if a user escape a '\\*',
- // after step 3, the result will be '\\\\\\*'
- /\\\\\\(?=[$.|*+(){^])/g,
- () => ESCAPE
- ],
-
- [
- // '\\\\' -> '\\'
- /\\\\/g,
- () => ESCAPE
- ],
-
- [
- // > The range notation, e.g. [a-zA-Z],
- // > can be used to match one of the characters in a range.
-
- // `\` is escaped by step 3
- /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
- (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
- // '\\[bar]' -> '\\\\[bar\\]'
- ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
- : close === ']'
- ? endEscape.length % 2 === 0
- // A normal case, and it is a range notation
- // '[bar]'
- // '[bar\\\\]'
- ? `[${sanitizeRange(range)}${endEscape}]`
- // Invalid range notaton
- // '[bar\\]' -> '[bar\\\\]'
- : '[]'
- : '[]'
- ],
-
- // ending
- [
- // 'js' will not match 'js.'
- // 'ab' will not match 'abc'
- /(?:[^*])$/,
-
- // WTF!
- // https://git-scm.com/docs/gitignore
- // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
- // which re-fixes #24, #38
-
- // > If there is a separator at the end of the pattern then the pattern
- // > will only match directories, otherwise the pattern can match both
- // > files and directories.
-
- // 'js*' will not match 'a.js'
- // 'js/' will not match 'a.js'
- // 'js' will match 'a.js' and 'a.js/'
- match => /\/$/.test(match)
- // foo/ will not match 'foo'
- ? `${match}$`
- // foo matches 'foo' and 'foo/'
- : `${match}(?=$|\\/$)`
- ],
-
- // trailing wildcard
- [
- /(\^|\\\/)?\\\*$/,
- (_, p1) => {
- const prefix = p1
- // '\^':
- // '/*' does not match EMPTY
- // '/*' does not match everything
-
- // '\\\/':
- // 'abc/*' does not match 'abc/'
- ? `${p1}[^/]+`
-
- // 'a*' matches 'a'
- // 'a*' matches 'aa'
- : '[^/]*'
-
- return `${prefix}(?=$|\\/$)`
- }
- ],
-]
-
-// A simple cache, because an ignore rule only has only one certain meaning
-const regexCache = Object.create(null)
-
-// @param {pattern}
-const makeRegex = (pattern, negative, ignorecase) => {
- const r = regexCache[pattern]
- if (r) {
- return r
- }
-
- // const replacers = negative
- // ? NEGATIVE_REPLACERS
- // : POSITIVE_REPLACERS
-
- const source = REPLACERS.reduce(
- (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
- pattern
- )
-
- return regexCache[pattern] = ignorecase
- ? new RegExp(source, 'i')
- : new RegExp(source)
-}
-
-const isString = subject => typeof subject === 'string'
-
-// > A blank line matches no files, so it can serve as a separator for readability.
-const checkPattern = pattern => pattern
- && isString(pattern)
- && !REGEX_TEST_BLANK_LINE.test(pattern)
-
- // > A line starting with # serves as a comment.
- && pattern.indexOf('#') !== 0
-
-const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
-
-class IgnoreRule {
- constructor (
- origin,
- pattern,
- negative,
- regex
- ) {
- this.origin = origin
- this.pattern = pattern
- this.negative = negative
- this.regex = regex
- }
-}
-
-const createRule = (pattern, ignorecase) => {
- const origin = pattern
- let negative = false
-
- // > An optional prefix "!" which negates the pattern;
- if (pattern.indexOf('!') === 0) {
- negative = true
- pattern = pattern.substr(1)
- }
-
- pattern = pattern
- // > Put a backslash ("\") in front of the first "!" for patterns that
- // > begin with a literal "!", for example, `"\!important!.txt"`.
- .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
- // > Put a backslash ("\") in front of the first hash for patterns that
- // > begin with a hash.
- .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
-
- const regex = makeRegex(pattern, negative, ignorecase)
-
- return new IgnoreRule(
- origin,
- pattern,
- negative,
- regex
- )
-}
-
-const throwError = (message, Ctor) => {
- throw new Ctor(message)
-}
-
-const checkPath = (path, originalPath, doThrow) => {
- if (!isString(path)) {
- return doThrow(
- `path must be a string, but got \`${originalPath}\``,
- TypeError
- )
- }
-
- // We don't know if we should ignore EMPTY, so throw
- if (!path) {
- return doThrow(`path must not be empty`, TypeError)
- }
-
- // Check if it is a relative path
- if (checkPath.isNotRelative(path)) {
- const r = '`path.relative()`d'
- return doThrow(
- `path should be a ${r} string, but got "${originalPath}"`,
- RangeError
- )
- }
-
- return true
-}
-
-const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
-
-checkPath.isNotRelative = isNotRelative
-checkPath.convert = p => p
-
-class Ignore {
- constructor ({
- ignorecase = true
- } = {}) {
- this._rules = []
- this._ignorecase = ignorecase
- define(this, KEY_IGNORE, true)
- this._initCache()
- }
-
- _initCache () {
- this._ignoreCache = Object.create(null)
- this._testCache = Object.create(null)
- }
-
- _addPattern (pattern) {
- // #32
- if (pattern && pattern[KEY_IGNORE]) {
- this._rules = this._rules.concat(pattern._rules)
- this._added = true
- return
- }
-
- if (checkPattern(pattern)) {
- const rule = createRule(pattern, this._ignorecase)
- this._added = true
- this._rules.push(rule)
- }
- }
-
- // @param {Array<string> | string | Ignore} pattern
- add (pattern) {
- this._added = false
-
- makeArray(
- isString(pattern)
- ? splitPattern(pattern)
- : pattern
- ).forEach(this._addPattern, this)
-
- // Some rules have just added to the ignore,
- // making the behavior changed.
- if (this._added) {
- this._initCache()
- }
-
- return this
- }
-
- // legacy
- addPattern (pattern) {
- return this.add(pattern)
- }
-
- // | ignored : unignored
- // negative | 0:0 | 0:1 | 1:0 | 1:1
- // -------- | ------- | ------- | ------- | --------
- // 0 | TEST | TEST | SKIP | X
- // 1 | TESTIF | SKIP | TEST | X
-
- // - SKIP: always skip
- // - TEST: always test
- // - TESTIF: only test if checkUnignored
- // - X: that never happen
-
- // @param {boolean} whether should check if the path is unignored,
- // setting `checkUnignored` to `false` could reduce additional
- // path matching.
-
- // @returns {TestResult} true if a file is ignored
- _testOne (path, checkUnignored) {
- let ignored = false
- let unignored = false
-
- this._rules.forEach(rule => {
- const {negative} = rule
- if (
- unignored === negative && ignored !== unignored
- || negative && !ignored && !unignored && !checkUnignored
- ) {
- return
- }
-
- const matched = rule.regex.test(path)
-
- if (matched) {
- ignored = !negative
- unignored = negative
- }
- })
-
- return {
- ignored,
- unignored
- }
- }
-
- // @returns {TestResult}
- _test (originalPath, cache, checkUnignored, slices) {
- const path = originalPath
- // Supports nullable path
- && checkPath.convert(originalPath)
-
- checkPath(path, originalPath, throwError)
-
- return this._t(path, cache, checkUnignored, slices)
- }
-
- _t (path, cache, checkUnignored, slices) {
- if (path in cache) {
- return cache[path]
- }
-
- if (!slices) {
- // path/to/a.js
- // ['path', 'to', 'a.js']
- slices = path.split(SLASH)
- }
-
- slices.pop()
-
- // If the path has no parent directory, just test it
- if (!slices.length) {
- return cache[path] = this._testOne(path, checkUnignored)
- }
-
- const parent = this._t(
- slices.join(SLASH) + SLASH,
- cache,
- checkUnignored,
- slices
- )
-
- // If the path contains a parent directory, check the parent first
- return cache[path] = parent.ignored
- // > It is not possible to re-include a file if a parent directory of
- // > that file is excluded.
- ? parent
- : this._testOne(path, checkUnignored)
- }
-
- ignores (path) {
- return this._test(path, this._ignoreCache, false).ignored
- }
-
- createFilter () {
- return path => !this.ignores(path)
- }
-
- filter (paths) {
- return makeArray(paths).filter(this.createFilter())
- }
-
- // @returns {TestResult}
- test (path) {
- return this._test(path, this._testCache, true)
- }
-}
-
-const factory = options => new Ignore(options)
-
-const returnFalse = () => false
-
-const isPathValid = path =>
- checkPath(path && checkPath.convert(path), path, returnFalse)
-
-factory.isPathValid = isPathValid
-
-// Fixes typescript
-factory.default = factory
-
-module.exports = factory
-
-// Windows
-// --------------------------------------------------------------
-/* istanbul ignore if */
-if (
- // Detect `process` so that it can run in browsers.
- typeof process !== 'undefined'
- && (
- process.env && process.env.IGNORE_TEST_WIN32
- || process.platform === 'win32'
- )
-) {
- /* eslint no-control-regex: "off" */
- const makePosix = str => /^\\\\\?\\/.test(str)
- || /["<>|\u0000-\u001F]+/u.test(str)
- ? str
- : str.replace(/\\/g, '/')
-
- checkPath.convert = makePosix
-
- // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
- // 'd:\\foo'
- const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
- checkPath.isNotRelative = path =>
- REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
- || isNotRelative(path)
-}
-
-
-/***/ }),
-/* 85 */
-/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-
-"use strict";
-
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.fullDocumentRange = exports.format = void 0;
-const coc_nvim_1 = __webpack_require__(1);
-const path_1 = __importDefault(__webpack_require__(12));
-const vscode_languageserver_protocol_1 = __webpack_require__(2);
-const errorHandler_1 = __webpack_require__(34);
-const requirePkg_1 = __webpack_require__(38);
-const utils_1 = __webpack_require__(37);
-/**
- * HOLD style parsers (for stylelint integration)
- */
-const STYLE_PARSERS = ['postcss', 'css', 'less', 'scss'];
-/**
- * Resolves the prettierconfig for the given file.
- *
- * @param filePath file's path
- */
-function resolveConfig(filePath, options) {
- return __awaiter(this, void 0, void 0, function* () {
- try {
- const localPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(filePath), 'prettier', { silent: true, ignoreBundled: true }));
- let prettierInstance = localPrettier;
- if (!prettierInstance && !options.onlyUseLocalVersion) {
- prettierInstance = __webpack_require__(33);
- }
- const config = yield prettierInstance.resolveConfig(filePath, options);
- return { config };
- }
- catch (error) {
- return { config: null, error };
- }
- });
-}
-/**
- * Define which config should be used.
- * If a prettierconfig exists, it returns itself.
- * It merges prettierconfig into vscode's config (editorconfig).
- * Priority:
- * - additionalConfig
- * - prettierConfig
- * - vscodeConfig
- * @param hasPrettierConfig a prettierconfig exists
- * @param additionalConfig config we really want to see in. (range)
- * @param prettierConfig prettier's file config
- * @param vscodeConfig our config
- */
-function mergeConfig(hasPrettierConfig, additionalConfig, prettierConfig, vscodeConfig) {
- return hasPrettierConfig
- ? Object.assign({ parser: vscodeConfig.parser }, // always merge our inferred parser in
- prettierConfig, additionalConfig)
- : Object.assign(vscodeConfig, prettierConfig, additionalConfig);
-}
-/**
- * Format the given text with user's configuration.
- * @param text Text to format
- * @param path formatting file's path
- * @returns {string} formatted text
- */
-function format(text, { languageId, uri }, customOptions) {
- return __awaiter(this, void 0, void 0, function* () {
- let u = coc_nvim_1.Uri.parse(uri);
- const isUntitled = u.scheme == 'untitled';
- const fileName = u.fsPath;
- const vscodeConfig = utils_1.getConfig(u);
- const localOnly = vscodeConfig.onlyUseLocalVersion;
- const resolvedPrettier = yield utils_1.getPrettierInstance();
- if (!resolvedPrettier) {
- errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
- }
- let supportedLanguages = utils_1.allLanguages(resolvedPrettier);
- if (supportedLanguages.indexOf(languageId) == -1) {
- coc_nvim_1.workspace.showMessage(`${languageId} not supported by prettier`, 'error');
- return;
- }
- const dynamicParsers = utils_1.getParsersFromLanguageId(languageId, resolvedPrettier, isUntitled ? undefined : fileName);
- let useBundled = false;
- let parser;
- if (!dynamicParsers.length) {
- const bundledParsers = utils_1.getParsersFromLanguageId(languageId, __webpack_require__(33), isUntitled ? undefined : fileName);
- parser = bundledParsers[0] || 'babylon';
- useBundled = true;
- }
- else if (dynamicParsers.includes(vscodeConfig.parser)) {
- // handle deprecated parser option (parser: "flow")
- parser = vscodeConfig.parser;
- }
- else {
- parser = dynamicParsers[0];
- }
- const doesParserSupportEslint = [
- 'javascript',
- 'javascriptreact',
- 'typescript',
- 'typescriptreact',
- 'vue',
- ].includes(languageId);
- const { config: fileOptions, error } = yield resolveConfig(fileName, {
- editorconfig: true,
- onlyUseLocalVersion: localOnly,
- requireConfig: vscodeConfig.requireConfig,
- });
- const hasConfig = fileOptions != null;
- if (!hasConfig && vscodeConfig.requireConfig) {
- return text;
- }
- if (error) {
- errorHandler_1.addToOutput(`Failed to resolve config for ${fileName}. Falling back to the default config settings.`, 'Error');
- }
- const prettierOptions = mergeConfig(hasConfig, customOptions, fileOptions || {}, {
- printWidth: vscodeConfig.printWidth,
- tabWidth: vscodeConfig.tabWidth,
- singleQuote: vscodeConfig.singleQuote,
- jsxSingleQuote: vscodeConfig.jsxSingleQuote,
- trailingComma: vscodeConfig.trailingComma,
- bracketSpacing: vscodeConfig.bracketSpacing,
- jsxBracketSameLine: vscodeConfig.jsxBracketSameLine,
- parser,
- semi: vscodeConfig.semi,
- useTabs: vscodeConfig.useTabs,
- proseWrap: vscodeConfig.proseWrap,
- arrowParens: vscodeConfig.arrowParens,
- });
- if (vscodeConfig.tslintIntegration && parser === 'typescript') {
- return errorHandler_1.safeExecution(() => {
- const prettierTslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-tslint')
- .format;
- // setUsedModule('prettier-tslint', 'Unknown', true)
- return prettierTslint({
- text,
- filePath: fileName,
- fallbackPrettierOptions: prettierOptions,
- });
- }, text, fileName);
- }
- if (vscodeConfig.eslintIntegration && doesParserSupportEslint) {
- return errorHandler_1.safeExecution(() => {
- const prettierEslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-eslint');
- // setUsedModule('prettier-eslint', 'Unknown', true)
- return prettierEslint({
- text,
- filePath: fileName,
- fallbackPrettierOptions: prettierOptions,
- });
- }, text, fileName);
- }
- if (vscodeConfig.stylelintIntegration && STYLE_PARSERS.includes(parser)) {
- const prettierStylelint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-stylelint');
- return errorHandler_1.safeExecution(prettierStylelint.format({
- text,
- filePath: fileName,
- prettierOptions,
- }), text, fileName);
- }
- if (!doesParserSupportEslint && useBundled) {
- let bundledPrettier = __webpack_require__(33);
- return errorHandler_1.safeExecution(() => {
- const warningMessage = `prettier@${bundledPrettier.version} doesn't support ${languageId}. ` +
- `Falling back to bundled prettier@${bundledPrettier.version}.`;
- errorHandler_1.addToOutput(warningMessage, 'Warning');
- // setUsedModule('prettier', bundledPrettier.version, true)
- return bundledPrettier.format(text, prettierOptions);
- }, text, fileName);
- }
- // setUsedModule('prettier', localPrettier.version, false)
- return errorHandler_1.safeExecution(() => resolvedPrettier.format(text, prettierOptions), text, fileName);
- });
-}
-exports.format = format;
-function fullDocumentRange(document) {
- const lastLineId = document.lineCount - 1;
- let doc = coc_nvim_1.workspace.getDocument(document.uri);
- return vscode_languageserver_protocol_1.Range.create({ character: 0, line: 0 }, { character: doc.getline(lastLineId).length, line: lastLineId });
-}
-exports.fullDocumentRange = fullDocumentRange;
-class PrettierEditProvider {
- constructor(_fileIsIgnored) {
- this._fileIsIgnored = _fileIsIgnored;
- }
- provideDocumentRangeFormattingEdits(document, range, _options, _token) {
- return this._provideEdits(document, {
- rangeStart: document.offsetAt(range.start),
- rangeEnd: document.offsetAt(range.end),
- });
- }
- provideDocumentFormattingEdits(document, _options, _token) {
- return this._provideEdits(document, {});
- }
- _provideEdits(document, options) {
- return __awaiter(this, void 0, void 0, function* () {
- let fileName = coc_nvim_1.Uri.parse(document.uri).fsPath;
- if (!document.uri.startsWith('untitled') && this._fileIsIgnored(fileName)) {
- return Promise.resolve([]);
- }
- const code = yield format(document.getText(), document, options);
- const edits = [yield vscode_languageserver_protocol_1.TextEdit.replace(fullDocumentRange(document), code)];
- const { disableSuccessMessage } = utils_1.getConfig();
- if (edits && edits.length && !disableSuccessMessage) {
- coc_nvim_1.workspace.showMessage('Formatted by prettier');
- }
- errorHandler_1.addToOutput(`Formatted file: ${document.uri}`);
- errorHandler_1.addToOutput(`Prettier format edits: ${JSON.stringify(edits, null, 2)}`);
- return edits;
- });
- }
-}
-exports.default = PrettierEditProvider;
-
-
-/***/ })
-/******/ ]);
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/define property getters */
-/******/ (() => {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = (exports, definition) => {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
-/******/ })();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ (() => {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = (exports) => {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ })();
-/******/
-/************************************************************************/
-/******/ // module exports must be returned from runtime so entry inlining is disabled
-/******/ // startup
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })()
-
-));
\ No newline at end of file