1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
3 /******/ var __webpack_modules__ = ([
5 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
9 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12 }) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
16 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
21 var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
28 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30 return new (P || (P = Promise))(function (resolve, reject) {
31 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34 step((generator = generator.apply(thisArg, _arguments || [])).next());
37 var __importDefault = (this && this.__importDefault) || function (mod) {
38 return (mod && mod.__esModule) ? mod : { "default": mod };
40 Object.defineProperty(exports, "__esModule", ({ value: true }));
41 exports.activate = void 0;
42 const coc_nvim_1 = __webpack_require__(1);
43 const vscode_languageserver_protocol_1 = __webpack_require__(2);
44 const configCacheHandler_1 = __importDefault(__webpack_require__(32));
45 const errorHandler_1 = __webpack_require__(34);
46 const ignoreFileHandler_1 = __importDefault(__webpack_require__(35));
47 const PrettierEditProvider_1 = __importStar(__webpack_require__(85));
48 const utils_1 = __webpack_require__(37);
50 let rangeFormatterHandler;
54 function disposeHandlers() {
55 if (formatterHandler) {
56 formatterHandler.dispose();
58 if (rangeFormatterHandler) {
59 rangeFormatterHandler.dispose();
61 formatterHandler = undefined;
62 rangeFormatterHandler = undefined;
65 * Build formatter selectors
67 function selectors(prettierInstance) {
68 let languageSelector = utils_1.enabledLanguages(prettierInstance).reduce((curr, language) => {
70 { language, scheme: 'file' },
71 { language, scheme: 'untitled' },
74 let rangeLanguageSelector = utils_1.rangeLanguages().reduce((curr, language) => {
76 { language, scheme: 'file' },
77 { language, scheme: 'untitled' },
82 rangeLanguageSelector,
86 return new Promise(resolve => {
92 function activate(context) {
93 return __awaiter(this, void 0, void 0, function* () {
94 context.subscriptions.push(errorHandler_1.setupErrorHandler());
95 const { fileIsIgnored } = ignoreFileHandler_1.default(context.subscriptions);
96 const editProvider = new PrettierEditProvider_1.default(fileIsIgnored);
97 const statusItem = coc_nvim_1.workspace.createStatusBarItem(0);
98 context.subscriptions.push(statusItem);
99 const config = coc_nvim_1.workspace.getConfiguration('prettier');
100 statusItem.text = config.get('statusItemText', 'Prettier');
101 let priority = config.get('formatterPriority', 1);
102 const prettierInstance = yield utils_1.getPrettierInstance();
103 if (!prettierInstance)
105 function checkDocument() {
106 return __awaiter(this, void 0, void 0, function* () {
108 let doc = coc_nvim_1.workspace.getDocument(coc_nvim_1.workspace.bufnr);
109 let languageIds = utils_1.enabledLanguages(prettierInstance);
110 if (doc && languageIds.indexOf(doc.filetype) !== -1) {
118 function registerFormatter() {
120 const { languageSelector, rangeLanguageSelector } = selectors(prettierInstance);
121 rangeFormatterHandler = coc_nvim_1.languages.registerDocumentRangeFormatProvider(rangeLanguageSelector, editProvider, priority);
122 formatterHandler = coc_nvim_1.languages.registerDocumentFormatProvider(languageSelector, editProvider, priority);
125 checkDocument().catch(_e => {
128 coc_nvim_1.events.on('BufEnter', () => __awaiter(this, void 0, void 0, function* () {
129 yield checkDocument();
130 }), null, context.subscriptions);
131 context.subscriptions.push(configCacheHandler_1.default());
132 context.subscriptions.push(coc_nvim_1.commands.registerCommand('prettier.formatFile', () => __awaiter(this, void 0, void 0, function* () {
133 let document = yield coc_nvim_1.workspace.document;
134 let prettierConfig = coc_nvim_1.workspace.getConfiguration('prettier', document.uri);
135 let onlyUseLocalVersion = prettierConfig.get('onlyUseLocalVersion', false);
136 if (onlyUseLocalVersion &&
137 (!utils_1.hasLocalPrettierInstalled(coc_nvim_1.Uri.parse(document.uri).fsPath) ||
138 document.schema != 'file')) {
139 coc_nvim_1.workspace.showMessage(`Flag prettier.onlyUseLocalVersion is set, but prettier is not installed locally. No operation will be made.`, 'warning');
142 let edits = yield PrettierEditProvider_1.format(document.content, document.textDocument, {}).then(code => {
145 return [vscode_languageserver_protocol_1.TextEdit.replace(PrettierEditProvider_1.fullDocumentRange(document.textDocument), code),];
147 if (edits && edits.length) {
148 yield document.applyEdits(edits);
153 exports.activate = activate;
161 module.exports = require("coc.nvim");;
165 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
168 /* --------------------------------------------------------------------------------------------
\r
169 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
170 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
171 * ------------------------------------------------------------------------------------------ */
\r
173 function __export(m) {
\r
174 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
176 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
177 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
178 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;
\r
179 exports.ResponseError = vscode_jsonrpc_1.ResponseError;
\r
180 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;
\r
181 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;
\r
182 exports.Disposable = vscode_jsonrpc_1.Disposable;
\r
183 exports.Event = vscode_jsonrpc_1.Event;
\r
184 exports.Emitter = vscode_jsonrpc_1.Emitter;
\r
185 exports.Trace = vscode_jsonrpc_1.Trace;
\r
186 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;
\r
187 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;
\r
188 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;
\r
189 exports.RequestType = vscode_jsonrpc_1.RequestType;
\r
190 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;
\r
191 exports.NotificationType = vscode_jsonrpc_1.NotificationType;
\r
192 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;
\r
193 exports.MessageReader = vscode_jsonrpc_1.MessageReader;
\r
194 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;
\r
195 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;
\r
196 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;
\r
197 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;
\r
198 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;
\r
199 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;
\r
200 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;
\r
201 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;
\r
202 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;
\r
203 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;
\r
204 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;
\r
205 exports.ProgressType = vscode_jsonrpc_1.ProgressType;
\r
206 __export(__webpack_require__(17));
\r
207 __export(__webpack_require__(18));
\r
208 const callHierarchy = __webpack_require__(30);
\r
209 const st = __webpack_require__(31);
\r
211 (function (Proposed) {
\r
212 let CallHierarchyPrepareRequest;
\r
213 (function (CallHierarchyPrepareRequest) {
\r
214 CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;
\r
215 CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;
\r
216 })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));
\r
217 let CallHierarchyIncomingCallsRequest;
\r
218 (function (CallHierarchyIncomingCallsRequest) {
\r
219 CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;
\r
220 CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;
\r
221 })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));
\r
222 let CallHierarchyOutgoingCallsRequest;
\r
223 (function (CallHierarchyOutgoingCallsRequest) {
\r
224 CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;
\r
225 CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;
\r
226 })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));
\r
227 Proposed.SemanticTokenTypes = st.SemanticTokenTypes;
\r
228 Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;
\r
229 Proposed.SemanticTokens = st.SemanticTokens;
\r
230 let SemanticTokensRequest;
\r
231 (function (SemanticTokensRequest) {
\r
232 SemanticTokensRequest.method = st.SemanticTokensRequest.method;
\r
233 SemanticTokensRequest.type = st.SemanticTokensRequest.type;
\r
234 })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));
\r
235 let SemanticTokensEditsRequest;
\r
236 (function (SemanticTokensEditsRequest) {
\r
237 SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;
\r
238 SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;
\r
239 })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));
\r
240 let SemanticTokensRangeRequest;
\r
241 (function (SemanticTokensRangeRequest) {
\r
242 SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;
\r
243 SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;
\r
244 })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));
\r
245 })(Proposed = exports.Proposed || (exports.Proposed = {}));
\r
246 function createProtocolConnection(reader, writer, logger, strategy) {
\r
247 return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);
\r
249 exports.createProtocolConnection = createProtocolConnection;
\r
254 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
257 /* --------------------------------------------------------------------------------------------
\r
258 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
259 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
260 * ------------------------------------------------------------------------------------------ */
\r
261 /// <reference path="../typings/thenable.d.ts" />
\r
263 function __export(m) {
\r
264 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
\r
266 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
267 const Is = __webpack_require__(4);
\r
268 const messages_1 = __webpack_require__(5);
\r
269 exports.RequestType = messages_1.RequestType;
\r
270 exports.RequestType0 = messages_1.RequestType0;
\r
271 exports.RequestType1 = messages_1.RequestType1;
\r
272 exports.RequestType2 = messages_1.RequestType2;
\r
273 exports.RequestType3 = messages_1.RequestType3;
\r
274 exports.RequestType4 = messages_1.RequestType4;
\r
275 exports.RequestType5 = messages_1.RequestType5;
\r
276 exports.RequestType6 = messages_1.RequestType6;
\r
277 exports.RequestType7 = messages_1.RequestType7;
\r
278 exports.RequestType8 = messages_1.RequestType8;
\r
279 exports.RequestType9 = messages_1.RequestType9;
\r
280 exports.ResponseError = messages_1.ResponseError;
\r
281 exports.ErrorCodes = messages_1.ErrorCodes;
\r
282 exports.NotificationType = messages_1.NotificationType;
\r
283 exports.NotificationType0 = messages_1.NotificationType0;
\r
284 exports.NotificationType1 = messages_1.NotificationType1;
\r
285 exports.NotificationType2 = messages_1.NotificationType2;
\r
286 exports.NotificationType3 = messages_1.NotificationType3;
\r
287 exports.NotificationType4 = messages_1.NotificationType4;
\r
288 exports.NotificationType5 = messages_1.NotificationType5;
\r
289 exports.NotificationType6 = messages_1.NotificationType6;
\r
290 exports.NotificationType7 = messages_1.NotificationType7;
\r
291 exports.NotificationType8 = messages_1.NotificationType8;
\r
292 exports.NotificationType9 = messages_1.NotificationType9;
\r
293 const messageReader_1 = __webpack_require__(6);
\r
294 exports.MessageReader = messageReader_1.MessageReader;
\r
295 exports.StreamMessageReader = messageReader_1.StreamMessageReader;
\r
296 exports.IPCMessageReader = messageReader_1.IPCMessageReader;
\r
297 exports.SocketMessageReader = messageReader_1.SocketMessageReader;
\r
298 const messageWriter_1 = __webpack_require__(8);
\r
299 exports.MessageWriter = messageWriter_1.MessageWriter;
\r
300 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;
\r
301 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;
\r
302 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;
\r
303 const events_1 = __webpack_require__(7);
\r
304 exports.Disposable = events_1.Disposable;
\r
305 exports.Event = events_1.Event;
\r
306 exports.Emitter = events_1.Emitter;
\r
307 const cancellation_1 = __webpack_require__(9);
\r
308 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;
\r
309 exports.CancellationToken = cancellation_1.CancellationToken;
\r
310 const linkedMap_1 = __webpack_require__(10);
\r
311 __export(__webpack_require__(11));
\r
312 __export(__webpack_require__(16));
\r
313 var CancelNotification;
\r
314 (function (CancelNotification) {
\r
315 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
\r
316 })(CancelNotification || (CancelNotification = {}));
\r
317 var ProgressNotification;
\r
318 (function (ProgressNotification) {
\r
319 ProgressNotification.type = new messages_1.NotificationType('$/progress');
\r
320 })(ProgressNotification || (ProgressNotification = {}));
\r
321 class ProgressType {
\r
325 exports.ProgressType = ProgressType;
\r
326 exports.NullLogger = Object.freeze({
\r
333 (function (Trace) {
\r
334 Trace[Trace["Off"] = 0] = "Off";
\r
335 Trace[Trace["Messages"] = 1] = "Messages";
\r
336 Trace[Trace["Verbose"] = 2] = "Verbose";
\r
337 })(Trace = exports.Trace || (exports.Trace = {}));
\r
338 (function (Trace) {
\r
339 function fromString(value) {
\r
340 if (!Is.string(value)) {
\r
343 value = value.toLowerCase();
\r
348 return Trace.Messages;
\r
350 return Trace.Verbose;
\r
355 Trace.fromString = fromString;
\r
356 function toString(value) {
\r
360 case Trace.Messages:
\r
362 case Trace.Verbose:
\r
368 Trace.toString = toString;
\r
369 })(Trace = exports.Trace || (exports.Trace = {}));
\r
371 (function (TraceFormat) {
\r
372 TraceFormat["Text"] = "text";
\r
373 TraceFormat["JSON"] = "json";
\r
374 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
375 (function (TraceFormat) {
\r
376 function fromString(value) {
\r
377 value = value.toLowerCase();
\r
378 if (value === 'json') {
\r
379 return TraceFormat.JSON;
\r
382 return TraceFormat.Text;
\r
385 TraceFormat.fromString = fromString;
\r
386 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
\r
387 var SetTraceNotification;
\r
388 (function (SetTraceNotification) {
\r
389 SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');
\r
390 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
\r
391 var LogTraceNotification;
\r
392 (function (LogTraceNotification) {
\r
393 LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');
\r
394 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
\r
395 var ConnectionErrors;
\r
396 (function (ConnectionErrors) {
\r
398 * The connection is closed.
\r
400 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
\r
402 * The connection got disposed.
\r
404 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
\r
406 * The connection is already in listening mode.
\r
408 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
\r
409 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
\r
410 class ConnectionError extends Error {
\r
411 constructor(code, message) {
\r
414 Object.setPrototypeOf(this, ConnectionError.prototype);
\r
417 exports.ConnectionError = ConnectionError;
\r
418 var ConnectionStrategy;
\r
419 (function (ConnectionStrategy) {
\r
420 function is(value) {
\r
421 let candidate = value;
\r
422 return candidate && Is.func(candidate.cancelUndispatched);
\r
424 ConnectionStrategy.is = is;
\r
425 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
\r
426 var ConnectionState;
\r
427 (function (ConnectionState) {
\r
428 ConnectionState[ConnectionState["New"] = 1] = "New";
\r
429 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
\r
430 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
\r
431 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
\r
432 })(ConnectionState || (ConnectionState = {}));
\r
433 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {
\r
434 let sequenceNumber = 0;
\r
435 let notificationSquenceNumber = 0;
\r
436 let unknownResponseSquenceNumber = 0;
\r
437 const version = '2.0';
\r
438 let starRequestHandler = undefined;
\r
439 let requestHandlers = Object.create(null);
\r
440 let starNotificationHandler = undefined;
\r
441 let notificationHandlers = Object.create(null);
\r
442 let progressHandlers = new Map();
\r
444 let messageQueue = new linkedMap_1.LinkedMap();
\r
445 let responsePromises = Object.create(null);
\r
446 let requestTokens = Object.create(null);
\r
447 let trace = Trace.Off;
\r
448 let traceFormat = TraceFormat.Text;
\r
450 let state = ConnectionState.New;
\r
451 let errorEmitter = new events_1.Emitter();
\r
452 let closeEmitter = new events_1.Emitter();
\r
453 let unhandledNotificationEmitter = new events_1.Emitter();
\r
454 let unhandledProgressEmitter = new events_1.Emitter();
\r
455 let disposeEmitter = new events_1.Emitter();
\r
456 function createRequestQueueKey(id) {
\r
457 return 'req-' + id.toString();
\r
459 function createResponseQueueKey(id) {
\r
461 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
\r
464 return 'res-' + id.toString();
\r
467 function createNotificationQueueKey() {
\r
468 return 'not-' + (++notificationSquenceNumber).toString();
\r
470 function addMessageToQueue(queue, message) {
\r
471 if (messages_1.isRequestMessage(message)) {
\r
472 queue.set(createRequestQueueKey(message.id), message);
\r
474 else if (messages_1.isResponseMessage(message)) {
\r
475 queue.set(createResponseQueueKey(message.id), message);
\r
478 queue.set(createNotificationQueueKey(), message);
\r
481 function cancelUndispatched(_message) {
\r
484 function isListening() {
\r
485 return state === ConnectionState.Listening;
\r
487 function isClosed() {
\r
488 return state === ConnectionState.Closed;
\r
490 function isDisposed() {
\r
491 return state === ConnectionState.Disposed;
\r
493 function closeHandler() {
\r
494 if (state === ConnectionState.New || state === ConnectionState.Listening) {
\r
495 state = ConnectionState.Closed;
\r
496 closeEmitter.fire(undefined);
\r
498 // If the connection is disposed don't sent close events.
\r
500 function readErrorHandler(error) {
\r
501 errorEmitter.fire([error, undefined, undefined]);
\r
503 function writeErrorHandler(data) {
\r
504 errorEmitter.fire(data);
\r
506 messageReader.onClose(closeHandler);
\r
507 messageReader.onError(readErrorHandler);
\r
508 messageWriter.onClose(closeHandler);
\r
509 messageWriter.onError(writeErrorHandler);
\r
510 function triggerMessageQueue() {
\r
511 if (timer || messageQueue.size === 0) {
\r
514 timer = setImmediate(() => {
\r
516 processMessageQueue();
\r
519 function processMessageQueue() {
\r
520 if (messageQueue.size === 0) {
\r
523 let message = messageQueue.shift();
\r
525 if (messages_1.isRequestMessage(message)) {
\r
526 handleRequest(message);
\r
528 else if (messages_1.isNotificationMessage(message)) {
\r
529 handleNotification(message);
\r
531 else if (messages_1.isResponseMessage(message)) {
\r
532 handleResponse(message);
\r
535 handleInvalidMessage(message);
\r
539 triggerMessageQueue();
\r
542 let callback = (message) => {
\r
544 // We have received a cancellation message. Check if the message is still in the queue
\r
545 // and cancel it if allowed to do so.
\r
546 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
\r
547 let key = createRequestQueueKey(message.params.id);
\r
548 let toCancel = messageQueue.get(key);
\r
549 if (messages_1.isRequestMessage(toCancel)) {
\r
550 let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
\r
551 if (response && (response.error !== void 0 || response.result !== void 0)) {
\r
552 messageQueue.delete(key);
\r
553 response.id = toCancel.id;
\r
554 traceSendingResponse(response, message.method, Date.now());
\r
555 messageWriter.write(response);
\r
560 addMessageToQueue(messageQueue, message);
\r
563 triggerMessageQueue();
\r
566 function handleRequest(requestMessage) {
\r
567 if (isDisposed()) {
\r
568 // we return here silently since we fired an event when the
\r
569 // connection got disposed.
\r
572 function reply(resultOrError, method, startTime) {
\r
575 id: requestMessage.id
\r
577 if (resultOrError instanceof messages_1.ResponseError) {
\r
578 message.error = resultOrError.toJson();
\r
581 message.result = resultOrError === void 0 ? null : resultOrError;
\r
583 traceSendingResponse(message, method, startTime);
\r
584 messageWriter.write(message);
\r
586 function replyError(error, method, startTime) {
\r
589 id: requestMessage.id,
\r
590 error: error.toJson()
\r
592 traceSendingResponse(message, method, startTime);
\r
593 messageWriter.write(message);
\r
595 function replySuccess(result, method, startTime) {
\r
596 // The JSON RPC defines that a response must either have a result or an error
\r
597 // So we can't treat undefined as a valid response result.
\r
598 if (result === void 0) {
\r
603 id: requestMessage.id,
\r
606 traceSendingResponse(message, method, startTime);
\r
607 messageWriter.write(message);
\r
609 traceReceivedRequest(requestMessage);
\r
610 let element = requestHandlers[requestMessage.method];
\r
612 let requestHandler;
\r
614 type = element.type;
\r
615 requestHandler = element.handler;
\r
617 let startTime = Date.now();
\r
618 if (requestHandler || starRequestHandler) {
\r
619 let cancellationSource = new cancellation_1.CancellationTokenSource();
\r
620 let tokenKey = String(requestMessage.id);
\r
621 requestTokens[tokenKey] = cancellationSource;
\r
624 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
625 handlerResult = requestHandler
\r
626 ? requestHandler(cancellationSource.token)
\r
627 : starRequestHandler(requestMessage.method, cancellationSource.token);
\r
629 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
630 handlerResult = requestHandler
\r
631 ? requestHandler(...requestMessage.params, cancellationSource.token)
\r
632 : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);
\r
635 handlerResult = requestHandler
\r
636 ? requestHandler(requestMessage.params, cancellationSource.token)
\r
637 : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
\r
639 let promise = handlerResult;
\r
640 if (!handlerResult) {
\r
641 delete requestTokens[tokenKey];
\r
642 replySuccess(handlerResult, requestMessage.method, startTime);
\r
644 else if (promise.then) {
\r
645 promise.then((resultOrError) => {
\r
646 delete requestTokens[tokenKey];
\r
647 reply(resultOrError, requestMessage.method, startTime);
\r
649 delete requestTokens[tokenKey];
\r
650 if (error instanceof messages_1.ResponseError) {
\r
651 replyError(error, requestMessage.method, startTime);
\r
653 else if (error && Is.string(error.message)) {
\r
654 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
657 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
662 delete requestTokens[tokenKey];
\r
663 reply(handlerResult, requestMessage.method, startTime);
\r
667 delete requestTokens[tokenKey];
\r
668 if (error instanceof messages_1.ResponseError) {
\r
669 reply(error, requestMessage.method, startTime);
\r
671 else if (error && Is.string(error.message)) {
\r
672 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
\r
675 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
\r
680 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
\r
683 function handleResponse(responseMessage) {
\r
684 if (isDisposed()) {
\r
685 // See handle request.
\r
688 if (responseMessage.id === null) {
\r
689 if (responseMessage.error) {
\r
690 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
\r
693 logger.error(`Received response message without id. No further error information provided.`);
\r
697 let key = String(responseMessage.id);
\r
698 let responsePromise = responsePromises[key];
\r
699 traceReceivedResponse(responseMessage, responsePromise);
\r
700 if (responsePromise) {
\r
701 delete responsePromises[key];
\r
703 if (responseMessage.error) {
\r
704 let error = responseMessage.error;
\r
705 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
\r
707 else if (responseMessage.result !== void 0) {
\r
708 responsePromise.resolve(responseMessage.result);
\r
711 throw new Error('Should never happen.');
\r
715 if (error.message) {
\r
716 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
\r
719 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
\r
725 function handleNotification(message) {
\r
726 if (isDisposed()) {
\r
727 // See handle request.
\r
730 let type = undefined;
\r
731 let notificationHandler;
\r
732 if (message.method === CancelNotification.type.method) {
\r
733 notificationHandler = (params) => {
\r
734 let id = params.id;
\r
735 let source = requestTokens[String(id)];
\r
742 let element = notificationHandlers[message.method];
\r
744 notificationHandler = element.handler;
\r
745 type = element.type;
\r
748 if (notificationHandler || starNotificationHandler) {
\r
750 traceReceivedNotification(message);
\r
751 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {
\r
752 notificationHandler ? notificationHandler() : starNotificationHandler(message.method);
\r
754 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {
\r
755 notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);
\r
758 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
\r
762 if (error.message) {
\r
763 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
\r
766 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
\r
771 unhandledNotificationEmitter.fire(message);
\r
774 function handleInvalidMessage(message) {
\r
776 logger.error('Received empty message.');
\r
779 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
\r
780 // Test whether we find an id to reject the promise
\r
781 let responseMessage = message;
\r
782 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
\r
783 let key = String(responseMessage.id);
\r
784 let responseHandler = responsePromises[key];
\r
785 if (responseHandler) {
\r
786 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
\r
790 function traceSendingRequest(message) {
\r
791 if (trace === Trace.Off || !tracer) {
\r
794 if (traceFormat === TraceFormat.Text) {
\r
795 let data = undefined;
\r
796 if (trace === Trace.Verbose && message.params) {
\r
797 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
799 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
\r
802 logLSPMessage('send-request', message);
\r
805 function traceSendingNotification(message) {
\r
806 if (trace === Trace.Off || !tracer) {
\r
809 if (traceFormat === TraceFormat.Text) {
\r
810 let data = undefined;
\r
811 if (trace === Trace.Verbose) {
\r
812 if (message.params) {
\r
813 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
816 data = 'No parameters provided.\n\n';
\r
819 tracer.log(`Sending notification '${message.method}'.`, data);
\r
822 logLSPMessage('send-notification', message);
\r
825 function traceSendingResponse(message, method, startTime) {
\r
826 if (trace === Trace.Off || !tracer) {
\r
829 if (traceFormat === TraceFormat.Text) {
\r
830 let data = undefined;
\r
831 if (trace === Trace.Verbose) {
\r
832 if (message.error && message.error.data) {
\r
833 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
836 if (message.result) {
\r
837 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
839 else if (message.error === void 0) {
\r
840 data = 'No result returned.\n\n';
\r
844 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
\r
847 logLSPMessage('send-response', message);
\r
850 function traceReceivedRequest(message) {
\r
851 if (trace === Trace.Off || !tracer) {
\r
854 if (traceFormat === TraceFormat.Text) {
\r
855 let data = undefined;
\r
856 if (trace === Trace.Verbose && message.params) {
\r
857 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
859 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
\r
862 logLSPMessage('receive-request', message);
\r
865 function traceReceivedNotification(message) {
\r
866 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
\r
869 if (traceFormat === TraceFormat.Text) {
\r
870 let data = undefined;
\r
871 if (trace === Trace.Verbose) {
\r
872 if (message.params) {
\r
873 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
\r
876 data = 'No parameters provided.\n\n';
\r
879 tracer.log(`Received notification '${message.method}'.`, data);
\r
882 logLSPMessage('receive-notification', message);
\r
885 function traceReceivedResponse(message, responsePromise) {
\r
886 if (trace === Trace.Off || !tracer) {
\r
889 if (traceFormat === TraceFormat.Text) {
\r
890 let data = undefined;
\r
891 if (trace === Trace.Verbose) {
\r
892 if (message.error && message.error.data) {
\r
893 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
\r
896 if (message.result) {
\r
897 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
\r
899 else if (message.error === void 0) {
\r
900 data = 'No result returned.\n\n';
\r
904 if (responsePromise) {
\r
905 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
\r
906 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
\r
909 tracer.log(`Received response ${message.id} without active response promise.`, data);
\r
913 logLSPMessage('receive-response', message);
\r
916 function logLSPMessage(type, message) {
\r
917 if (!tracer || trace === Trace.Off) {
\r
920 const lspMessage = {
\r
921 isLSPMessage: true,
\r
924 timestamp: Date.now()
\r
926 tracer.log(lspMessage);
\r
928 function throwIfClosedOrDisposed() {
\r
930 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
\r
932 if (isDisposed()) {
\r
933 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
\r
936 function throwIfListening() {
\r
937 if (isListening()) {
\r
938 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
\r
941 function throwIfNotListening() {
\r
942 if (!isListening()) {
\r
943 throw new Error('Call listen() first.');
\r
946 function undefinedToNull(param) {
\r
947 if (param === void 0) {
\r
954 function computeMessageParams(type, params) {
\r
956 let numberOfParams = type.numberOfParams;
\r
957 switch (numberOfParams) {
\r
962 result = undefinedToNull(params[0]);
\r
966 for (let i = 0; i < params.length && i < numberOfParams; i++) {
\r
967 result.push(undefinedToNull(params[i]));
\r
969 if (params.length < numberOfParams) {
\r
970 for (let i = params.length; i < numberOfParams; i++) {
\r
979 sendNotification: (type, ...params) => {
\r
980 throwIfClosedOrDisposed();
\r
983 if (Is.string(type)) {
\r
985 switch (params.length) {
\r
987 messageParams = null;
\r
990 messageParams = params[0];
\r
993 messageParams = params;
\r
998 method = type.method;
\r
999 messageParams = computeMessageParams(type, params);
\r
1001 let notificationMessage = {
\r
1004 params: messageParams
\r
1006 traceSendingNotification(notificationMessage);
\r
1007 messageWriter.write(notificationMessage);
\r
1009 onNotification: (type, handler) => {
\r
1010 throwIfClosedOrDisposed();
\r
1011 if (Is.func(type)) {
\r
1012 starNotificationHandler = type;
\r
1014 else if (handler) {
\r
1015 if (Is.string(type)) {
\r
1016 notificationHandlers[type] = { type: undefined, handler };
\r
1019 notificationHandlers[type.method] = { type, handler };
\r
1023 onProgress: (_type, token, handler) => {
\r
1024 if (progressHandlers.has(token)) {
\r
1025 throw new Error(`Progress handler for token ${token} already registered`);
\r
1027 progressHandlers.set(token, handler);
\r
1030 progressHandlers.delete(token);
\r
1034 sendProgress: (_type, token, value) => {
\r
1035 connection.sendNotification(ProgressNotification.type, { token, value });
\r
1037 onUnhandledProgress: unhandledProgressEmitter.event,
\r
1038 sendRequest: (type, ...params) => {
\r
1039 throwIfClosedOrDisposed();
\r
1040 throwIfNotListening();
\r
1042 let messageParams;
\r
1043 let token = undefined;
\r
1044 if (Is.string(type)) {
\r
1046 switch (params.length) {
\r
1048 messageParams = null;
\r
1051 // The cancellation token is optional so it can also be undefined.
\r
1052 if (cancellation_1.CancellationToken.is(params[0])) {
\r
1053 messageParams = null;
\r
1054 token = params[0];
\r
1057 messageParams = undefinedToNull(params[0]);
\r
1061 const last = params.length - 1;
\r
1062 if (cancellation_1.CancellationToken.is(params[last])) {
\r
1063 token = params[last];
\r
1064 if (params.length === 2) {
\r
1065 messageParams = undefinedToNull(params[0]);
\r
1068 messageParams = params.slice(0, last).map(value => undefinedToNull(value));
\r
1072 messageParams = params.map(value => undefinedToNull(value));
\r
1078 method = type.method;
\r
1079 messageParams = computeMessageParams(type, params);
\r
1080 let numberOfParams = type.numberOfParams;
\r
1081 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
\r
1083 let id = sequenceNumber++;
\r
1084 let result = new Promise((resolve, reject) => {
\r
1085 let requestMessage = {
\r
1089 params: messageParams
\r
1091 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };
\r
1092 traceSendingRequest(requestMessage);
\r
1094 messageWriter.write(requestMessage);
\r
1097 // Writing the message failed. So we need to reject the promise.
\r
1098 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
\r
1099 responsePromise = null;
\r
1101 if (responsePromise) {
\r
1102 responsePromises[String(id)] = responsePromise;
\r
1106 token.onCancellationRequested(() => {
\r
1107 connection.sendNotification(CancelNotification.type, { id });
\r
1112 onRequest: (type, handler) => {
\r
1113 throwIfClosedOrDisposed();
\r
1114 if (Is.func(type)) {
\r
1115 starRequestHandler = type;
\r
1117 else if (handler) {
\r
1118 if (Is.string(type)) {
\r
1119 requestHandlers[type] = { type: undefined, handler };
\r
1122 requestHandlers[type.method] = { type, handler };
\r
1126 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
\r
1127 let _sendNotification = false;
\r
1128 let _traceFormat = TraceFormat.Text;
\r
1129 if (sendNotificationOrTraceOptions !== void 0) {
\r
1130 if (Is.boolean(sendNotificationOrTraceOptions)) {
\r
1131 _sendNotification = sendNotificationOrTraceOptions;
\r
1134 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
\r
1135 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
\r
1139 traceFormat = _traceFormat;
\r
1140 if (trace === Trace.Off) {
\r
1141 tracer = undefined;
\r
1146 if (_sendNotification && !isClosed() && !isDisposed()) {
\r
1147 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
\r
1150 onError: errorEmitter.event,
\r
1151 onClose: closeEmitter.event,
\r
1152 onUnhandledNotification: unhandledNotificationEmitter.event,
\r
1153 onDispose: disposeEmitter.event,
\r
1155 if (isDisposed()) {
\r
1158 state = ConnectionState.Disposed;
\r
1159 disposeEmitter.fire(undefined);
\r
1160 let error = new Error('Connection got disposed.');
\r
1161 Object.keys(responsePromises).forEach((key) => {
\r
1162 responsePromises[key].reject(error);
\r
1164 responsePromises = Object.create(null);
\r
1165 requestTokens = Object.create(null);
\r
1166 messageQueue = new linkedMap_1.LinkedMap();
\r
1167 // Test for backwards compatibility
\r
1168 if (Is.func(messageWriter.dispose)) {
\r
1169 messageWriter.dispose();
\r
1171 if (Is.func(messageReader.dispose)) {
\r
1172 messageReader.dispose();
\r
1176 throwIfClosedOrDisposed();
\r
1177 throwIfListening();
\r
1178 state = ConnectionState.Listening;
\r
1179 messageReader.listen(callback);
\r
1182 // eslint-disable-next-line no-console
\r
1183 console.log('inspect');
\r
1186 connection.onNotification(LogTraceNotification.type, (params) => {
\r
1187 if (trace === Trace.Off || !tracer) {
\r
1190 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
\r
1192 connection.onNotification(ProgressNotification.type, (params) => {
\r
1193 const handler = progressHandlers.get(params.token);
\r
1195 handler(params.value);
\r
1198 unhandledProgressEmitter.fire(params);
\r
1201 return connection;
\r
1203 function isMessageReader(value) {
\r
1204 return value.listen !== void 0 && value.read === void 0;
\r
1206 function isMessageWriter(value) {
\r
1207 return value.write !== void 0 && value.end === void 0;
\r
1209 function createMessageConnection(input, output, logger, strategy) {
\r
1211 logger = exports.NullLogger;
\r
1213 let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);
\r
1214 let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);
\r
1215 return _createMessageConnection(reader, writer, logger, strategy);
\r
1217 exports.createMessageConnection = createMessageConnection;
\r
1222 /***/ ((__unused_webpack_module, exports) => {
1225 /* --------------------------------------------------------------------------------------------
\r
1226 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1227 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1228 * ------------------------------------------------------------------------------------------ */
\r
1230 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1231 function boolean(value) {
\r
1232 return value === true || value === false;
\r
1234 exports.boolean = boolean;
\r
1235 function string(value) {
\r
1236 return typeof value === 'string' || value instanceof String;
\r
1238 exports.string = string;
\r
1239 function number(value) {
\r
1240 return typeof value === 'number' || value instanceof Number;
\r
1242 exports.number = number;
\r
1243 function error(value) {
\r
1244 return value instanceof Error;
\r
1246 exports.error = error;
\r
1247 function func(value) {
\r
1248 return typeof value === 'function';
\r
1250 exports.func = func;
\r
1251 function array(value) {
\r
1252 return Array.isArray(value);
\r
1254 exports.array = array;
\r
1255 function stringArray(value) {
\r
1256 return array(value) && value.every(elem => string(elem));
\r
1258 exports.stringArray = stringArray;
\r
1263 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1266 /* --------------------------------------------------------------------------------------------
\r
1267 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1268 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1269 * ------------------------------------------------------------------------------------------ */
\r
1271 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1272 const is = __webpack_require__(4);
\r
1274 * Predefined error codes.
\r
1277 (function (ErrorCodes) {
\r
1278 // Defined by JSON RPC
\r
1279 ErrorCodes.ParseError = -32700;
\r
1280 ErrorCodes.InvalidRequest = -32600;
\r
1281 ErrorCodes.MethodNotFound = -32601;
\r
1282 ErrorCodes.InvalidParams = -32602;
\r
1283 ErrorCodes.InternalError = -32603;
\r
1284 ErrorCodes.serverErrorStart = -32099;
\r
1285 ErrorCodes.serverErrorEnd = -32000;
\r
1286 ErrorCodes.ServerNotInitialized = -32002;
\r
1287 ErrorCodes.UnknownErrorCode = -32001;
\r
1288 // Defined by the protocol.
\r
1289 ErrorCodes.RequestCancelled = -32800;
\r
1290 ErrorCodes.ContentModified = -32801;
\r
1291 // Defined by VSCode library.
\r
1292 ErrorCodes.MessageWriteError = 1;
\r
1293 ErrorCodes.MessageReadError = 2;
\r
1294 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
\r
1296 * An error object return in a response in case a request
\r
1299 class ResponseError extends Error {
\r
1300 constructor(code, message, data) {
\r
1302 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
\r
1304 Object.setPrototypeOf(this, ResponseError.prototype);
\r
1309 message: this.message,
\r
1314 exports.ResponseError = ResponseError;
\r
1316 * An abstract implementation of a MessageType.
\r
1318 class AbstractMessageType {
\r
1319 constructor(_method, _numberOfParams) {
\r
1320 this._method = _method;
\r
1321 this._numberOfParams = _numberOfParams;
\r
1324 return this._method;
\r
1326 get numberOfParams() {
\r
1327 return this._numberOfParams;
\r
1330 exports.AbstractMessageType = AbstractMessageType;
\r
1332 * Classes to type request response pairs
\r
1334 * The type parameter RO will be removed in the next major version
\r
1335 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1336 * belong here. For now it is tagged as default never.
\r
1338 class RequestType0 extends AbstractMessageType {
\r
1339 constructor(method) {
\r
1343 exports.RequestType0 = RequestType0;
\r
1344 class RequestType extends AbstractMessageType {
\r
1345 constructor(method) {
\r
1349 exports.RequestType = RequestType;
\r
1350 class RequestType1 extends AbstractMessageType {
\r
1351 constructor(method) {
\r
1355 exports.RequestType1 = RequestType1;
\r
1356 class RequestType2 extends AbstractMessageType {
\r
1357 constructor(method) {
\r
1361 exports.RequestType2 = RequestType2;
\r
1362 class RequestType3 extends AbstractMessageType {
\r
1363 constructor(method) {
\r
1367 exports.RequestType3 = RequestType3;
\r
1368 class RequestType4 extends AbstractMessageType {
\r
1369 constructor(method) {
\r
1373 exports.RequestType4 = RequestType4;
\r
1374 class RequestType5 extends AbstractMessageType {
\r
1375 constructor(method) {
\r
1379 exports.RequestType5 = RequestType5;
\r
1380 class RequestType6 extends AbstractMessageType {
\r
1381 constructor(method) {
\r
1385 exports.RequestType6 = RequestType6;
\r
1386 class RequestType7 extends AbstractMessageType {
\r
1387 constructor(method) {
\r
1391 exports.RequestType7 = RequestType7;
\r
1392 class RequestType8 extends AbstractMessageType {
\r
1393 constructor(method) {
\r
1397 exports.RequestType8 = RequestType8;
\r
1398 class RequestType9 extends AbstractMessageType {
\r
1399 constructor(method) {
\r
1403 exports.RequestType9 = RequestType9;
\r
1405 * The type parameter RO will be removed in the next major version
\r
1406 * of the JSON RPC library since it is a LSP concept and doesn't
\r
1407 * belong here. For now it is tagged as default never.
\r
1409 class NotificationType extends AbstractMessageType {
\r
1410 constructor(method) {
\r
1412 this._ = undefined;
\r
1415 exports.NotificationType = NotificationType;
\r
1416 class NotificationType0 extends AbstractMessageType {
\r
1417 constructor(method) {
\r
1421 exports.NotificationType0 = NotificationType0;
\r
1422 class NotificationType1 extends AbstractMessageType {
\r
1423 constructor(method) {
\r
1427 exports.NotificationType1 = NotificationType1;
\r
1428 class NotificationType2 extends AbstractMessageType {
\r
1429 constructor(method) {
\r
1433 exports.NotificationType2 = NotificationType2;
\r
1434 class NotificationType3 extends AbstractMessageType {
\r
1435 constructor(method) {
\r
1439 exports.NotificationType3 = NotificationType3;
\r
1440 class NotificationType4 extends AbstractMessageType {
\r
1441 constructor(method) {
\r
1445 exports.NotificationType4 = NotificationType4;
\r
1446 class NotificationType5 extends AbstractMessageType {
\r
1447 constructor(method) {
\r
1451 exports.NotificationType5 = NotificationType5;
\r
1452 class NotificationType6 extends AbstractMessageType {
\r
1453 constructor(method) {
\r
1457 exports.NotificationType6 = NotificationType6;
\r
1458 class NotificationType7 extends AbstractMessageType {
\r
1459 constructor(method) {
\r
1463 exports.NotificationType7 = NotificationType7;
\r
1464 class NotificationType8 extends AbstractMessageType {
\r
1465 constructor(method) {
\r
1469 exports.NotificationType8 = NotificationType8;
\r
1470 class NotificationType9 extends AbstractMessageType {
\r
1471 constructor(method) {
\r
1475 exports.NotificationType9 = NotificationType9;
\r
1477 * Tests if the given message is a request message
\r
1479 function isRequestMessage(message) {
\r
1480 let candidate = message;
\r
1481 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
\r
1483 exports.isRequestMessage = isRequestMessage;
\r
1485 * Tests if the given message is a notification message
\r
1487 function isNotificationMessage(message) {
\r
1488 let candidate = message;
\r
1489 return candidate && is.string(candidate.method) && message.id === void 0;
\r
1491 exports.isNotificationMessage = isNotificationMessage;
\r
1493 * Tests if the given message is a response message
\r
1495 function isResponseMessage(message) {
\r
1496 let candidate = message;
\r
1497 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
\r
1499 exports.isResponseMessage = isResponseMessage;
\r
1504 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1507 /* --------------------------------------------------------------------------------------------
\r
1508 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1509 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1510 * ------------------------------------------------------------------------------------------ */
\r
1512 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1513 const events_1 = __webpack_require__(7);
\r
1514 const Is = __webpack_require__(4);
\r
1515 let DefaultSize = 8192;
\r
1516 let CR = Buffer.from('\r', 'ascii')[0];
\r
1517 let LF = Buffer.from('\n', 'ascii')[0];
\r
1518 let CRLF = '\r\n';
\r
1519 class MessageBuffer {
\r
1520 constructor(encoding = 'utf8') {
\r
1521 this.encoding = encoding;
\r
1523 this.buffer = Buffer.allocUnsafe(DefaultSize);
\r
1526 var toAppend = chunk;
\r
1527 if (typeof (chunk) === 'string') {
\r
1529 var bufferLen = Buffer.byteLength(str, this.encoding);
\r
1530 toAppend = Buffer.allocUnsafe(bufferLen);
\r
1531 toAppend.write(str, 0, bufferLen, this.encoding);
\r
1533 if (this.buffer.length - this.index >= toAppend.length) {
\r
1534 toAppend.copy(this.buffer, this.index, 0, toAppend.length);
\r
1537 var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;
\r
1538 if (this.index === 0) {
\r
1539 this.buffer = Buffer.allocUnsafe(newSize);
\r
1540 toAppend.copy(this.buffer, 0, 0, toAppend.length);
\r
1543 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
\r
1546 this.index += toAppend.length;
\r
1548 tryReadHeaders() {
\r
1549 let result = undefined;
\r
1551 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
1554 // No header / body separator found (e.g CRLFCRLF)
\r
1555 if (current + 3 >= this.index) {
\r
1558 result = Object.create(null);
\r
1559 let headers = this.buffer.toString('ascii', 0, current).split(CRLF);
\r
1560 headers.forEach((header) => {
\r
1561 let index = header.indexOf(':');
\r
1562 if (index === -1) {
\r
1563 throw new Error('Message header must separate key and value using :');
\r
1565 let key = header.substr(0, index);
\r
1566 let value = header.substr(index + 1).trim();
\r
1567 result[key] = value;
\r
1569 let nextStart = current + 4;
\r
1570 this.buffer = this.buffer.slice(nextStart);
\r
1571 this.index = this.index - nextStart;
\r
1574 tryReadContent(length) {
\r
1575 if (this.index < length) {
\r
1578 let result = this.buffer.toString(this.encoding, 0, length);
\r
1579 let nextStart = length;
\r
1580 this.buffer.copy(this.buffer, 0, nextStart);
\r
1581 this.index = this.index - nextStart;
\r
1584 get numberOfBytes() {
\r
1585 return this.index;
\r
1588 var MessageReader;
\r
1589 (function (MessageReader) {
\r
1590 function is(value) {
\r
1591 let candidate = value;
\r
1592 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
\r
1593 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
\r
1595 MessageReader.is = is;
\r
1596 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
\r
1597 class AbstractMessageReader {
\r
1599 this.errorEmitter = new events_1.Emitter();
\r
1600 this.closeEmitter = new events_1.Emitter();
\r
1601 this.partialMessageEmitter = new events_1.Emitter();
\r
1604 this.errorEmitter.dispose();
\r
1605 this.closeEmitter.dispose();
\r
1608 return this.errorEmitter.event;
\r
1610 fireError(error) {
\r
1611 this.errorEmitter.fire(this.asError(error));
\r
1614 return this.closeEmitter.event;
\r
1617 this.closeEmitter.fire(undefined);
\r
1619 get onPartialMessage() {
\r
1620 return this.partialMessageEmitter.event;
\r
1622 firePartialMessage(info) {
\r
1623 this.partialMessageEmitter.fire(info);
\r
1626 if (error instanceof Error) {
\r
1630 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1634 exports.AbstractMessageReader = AbstractMessageReader;
\r
1635 class StreamMessageReader extends AbstractMessageReader {
\r
1636 constructor(readable, encoding = 'utf8') {
\r
1638 this.readable = readable;
\r
1639 this.buffer = new MessageBuffer(encoding);
\r
1640 this._partialMessageTimeout = 10000;
\r
1642 set partialMessageTimeout(timeout) {
\r
1643 this._partialMessageTimeout = timeout;
\r
1645 get partialMessageTimeout() {
\r
1646 return this._partialMessageTimeout;
\r
1648 listen(callback) {
\r
1649 this.nextMessageLength = -1;
\r
1650 this.messageToken = 0;
\r
1651 this.partialMessageTimer = undefined;
\r
1652 this.callback = callback;
\r
1653 this.readable.on('data', (data) => {
\r
1654 this.onData(data);
\r
1656 this.readable.on('error', (error) => this.fireError(error));
\r
1657 this.readable.on('close', () => this.fireClose());
\r
1660 this.buffer.append(data);
\r
1662 if (this.nextMessageLength === -1) {
\r
1663 let headers = this.buffer.tryReadHeaders();
\r
1667 let contentLength = headers['Content-Length'];
\r
1668 if (!contentLength) {
\r
1669 throw new Error('Header must provide a Content-Length property.');
\r
1671 let length = parseInt(contentLength);
\r
1672 if (isNaN(length)) {
\r
1673 throw new Error('Content-Length value must be a number.');
\r
1675 this.nextMessageLength = length;
\r
1676 // Take the encoding form the header. For compatibility
\r
1677 // treat both utf-8 and utf8 as node utf8
\r
1679 var msg = this.buffer.tryReadContent(this.nextMessageLength);
\r
1680 if (msg === null) {
\r
1681 /** We haven't received the full message yet. */
\r
1682 this.setPartialMessageTimer();
\r
1685 this.clearPartialMessageTimer();
\r
1686 this.nextMessageLength = -1;
\r
1687 this.messageToken++;
\r
1688 var json = JSON.parse(msg);
\r
1689 this.callback(json);
\r
1692 clearPartialMessageTimer() {
\r
1693 if (this.partialMessageTimer) {
\r
1694 clearTimeout(this.partialMessageTimer);
\r
1695 this.partialMessageTimer = undefined;
\r
1698 setPartialMessageTimer() {
\r
1699 this.clearPartialMessageTimer();
\r
1700 if (this._partialMessageTimeout <= 0) {
\r
1703 this.partialMessageTimer = setTimeout((token, timeout) => {
\r
1704 this.partialMessageTimer = undefined;
\r
1705 if (token === this.messageToken) {
\r
1706 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
\r
1707 this.setPartialMessageTimer();
\r
1709 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
\r
1712 exports.StreamMessageReader = StreamMessageReader;
\r
1713 class IPCMessageReader extends AbstractMessageReader {
\r
1714 constructor(process) {
\r
1716 this.process = process;
\r
1717 let eventEmitter = this.process;
\r
1718 eventEmitter.on('error', (error) => this.fireError(error));
\r
1719 eventEmitter.on('close', () => this.fireClose());
\r
1721 listen(callback) {
\r
1722 this.process.on('message', callback);
\r
1725 exports.IPCMessageReader = IPCMessageReader;
\r
1726 class SocketMessageReader extends StreamMessageReader {
\r
1727 constructor(socket, encoding = 'utf-8') {
\r
1728 super(socket, encoding);
\r
1731 exports.SocketMessageReader = SocketMessageReader;
\r
1736 /***/ ((__unused_webpack_module, exports) => {
1739 /* --------------------------------------------------------------------------------------------
\r
1740 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1741 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1742 * ------------------------------------------------------------------------------------------ */
\r
1744 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1746 (function (Disposable) {
\r
1747 function create(func) {
\r
1752 Disposable.create = create;
\r
1753 })(Disposable = exports.Disposable || (exports.Disposable = {}));
\r
1755 (function (Event) {
\r
1756 const _disposable = { dispose() { } };
\r
1757 Event.None = function () { return _disposable; };
\r
1758 })(Event = exports.Event || (exports.Event = {}));
\r
1759 class CallbackList {
\r
1760 add(callback, context = null, bucket) {
\r
1761 if (!this._callbacks) {
\r
1762 this._callbacks = [];
\r
1763 this._contexts = [];
\r
1765 this._callbacks.push(callback);
\r
1766 this._contexts.push(context);
\r
1767 if (Array.isArray(bucket)) {
\r
1768 bucket.push({ dispose: () => this.remove(callback, context) });
\r
1771 remove(callback, context = null) {
\r
1772 if (!this._callbacks) {
\r
1775 var foundCallbackWithDifferentContext = false;
\r
1776 for (var i = 0, len = this._callbacks.length; i < len; i++) {
\r
1777 if (this._callbacks[i] === callback) {
\r
1778 if (this._contexts[i] === context) {
\r
1779 // callback & context match => remove it
\r
1780 this._callbacks.splice(i, 1);
\r
1781 this._contexts.splice(i, 1);
\r
1785 foundCallbackWithDifferentContext = true;
\r
1789 if (foundCallbackWithDifferentContext) {
\r
1790 throw new Error('When adding a listener with a context, you should remove it with the same context');
\r
1794 if (!this._callbacks) {
\r
1797 var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
\r
1798 for (var i = 0, len = callbacks.length; i < len; i++) {
\r
1800 ret.push(callbacks[i].apply(contexts[i], args));
\r
1803 // eslint-disable-next-line no-console
\r
1810 return !this._callbacks || this._callbacks.length === 0;
\r
1813 this._callbacks = undefined;
\r
1814 this._contexts = undefined;
\r
1818 constructor(_options) {
\r
1819 this._options = _options;
\r
1822 * For the public to allow to subscribe
\r
1823 * to events from this Emitter
\r
1826 if (!this._event) {
\r
1827 this._event = (listener, thisArgs, disposables) => {
\r
1828 if (!this._callbacks) {
\r
1829 this._callbacks = new CallbackList();
\r
1831 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
\r
1832 this._options.onFirstListenerAdd(this);
\r
1834 this._callbacks.add(listener, thisArgs);
\r
1838 this._callbacks.remove(listener, thisArgs);
\r
1839 result.dispose = Emitter._noop;
\r
1840 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
\r
1841 this._options.onLastListenerRemove(this);
\r
1845 if (Array.isArray(disposables)) {
\r
1846 disposables.push(result);
\r
1851 return this._event;
\r
1854 * To be kept private to fire an event to
\r
1858 if (this._callbacks) {
\r
1859 this._callbacks.invoke.call(this._callbacks, event);
\r
1863 if (this._callbacks) {
\r
1864 this._callbacks.dispose();
\r
1865 this._callbacks = undefined;
\r
1869 exports.Emitter = Emitter;
\r
1870 Emitter._noop = function () { };
\r
1875 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1878 /* --------------------------------------------------------------------------------------------
\r
1879 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
1880 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
1881 * ------------------------------------------------------------------------------------------ */
\r
1883 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
1884 const events_1 = __webpack_require__(7);
\r
1885 const Is = __webpack_require__(4);
\r
1886 let ContentLength = 'Content-Length: ';
\r
1887 let CRLF = '\r\n';
\r
1888 var MessageWriter;
\r
1889 (function (MessageWriter) {
\r
1890 function is(value) {
\r
1891 let candidate = value;
\r
1892 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
\r
1893 Is.func(candidate.onError) && Is.func(candidate.write);
\r
1895 MessageWriter.is = is;
\r
1896 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
\r
1897 class AbstractMessageWriter {
\r
1899 this.errorEmitter = new events_1.Emitter();
\r
1900 this.closeEmitter = new events_1.Emitter();
\r
1903 this.errorEmitter.dispose();
\r
1904 this.closeEmitter.dispose();
\r
1907 return this.errorEmitter.event;
\r
1909 fireError(error, message, count) {
\r
1910 this.errorEmitter.fire([this.asError(error), message, count]);
\r
1913 return this.closeEmitter.event;
\r
1916 this.closeEmitter.fire(undefined);
\r
1919 if (error instanceof Error) {
\r
1923 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
\r
1927 exports.AbstractMessageWriter = AbstractMessageWriter;
\r
1928 class StreamMessageWriter extends AbstractMessageWriter {
\r
1929 constructor(writable, encoding = 'utf8') {
\r
1931 this.writable = writable;
\r
1932 this.encoding = encoding;
\r
1933 this.errorCount = 0;
\r
1934 this.writable.on('error', (error) => this.fireError(error));
\r
1935 this.writable.on('close', () => this.fireClose());
\r
1938 let json = JSON.stringify(msg);
\r
1939 let contentLength = Buffer.byteLength(json, this.encoding);
\r
1941 ContentLength, contentLength.toString(), CRLF,
\r
1945 // Header must be written in ASCII encoding
\r
1946 this.writable.write(headers.join(''), 'ascii');
\r
1947 // Now write the content. This can be written in any encoding
\r
1948 this.writable.write(json, this.encoding);
\r
1949 this.errorCount = 0;
\r
1952 this.errorCount++;
\r
1953 this.fireError(error, msg, this.errorCount);
\r
1957 exports.StreamMessageWriter = StreamMessageWriter;
\r
1958 class IPCMessageWriter extends AbstractMessageWriter {
\r
1959 constructor(process) {
\r
1961 this.process = process;
\r
1962 this.errorCount = 0;
\r
1964 this.sending = false;
\r
1965 let eventEmitter = this.process;
\r
1966 eventEmitter.on('error', (error) => this.fireError(error));
\r
1967 eventEmitter.on('close', () => this.fireClose);
\r
1970 if (!this.sending && this.queue.length === 0) {
\r
1971 // See https://github.com/nodejs/node/issues/7657
\r
1972 this.doWriteMessage(msg);
\r
1975 this.queue.push(msg);
\r
1978 doWriteMessage(msg) {
\r
1980 if (this.process.send) {
\r
1981 this.sending = true;
\r
1982 this.process.send(msg, undefined, undefined, (error) => {
\r
1983 this.sending = false;
\r
1985 this.errorCount++;
\r
1986 this.fireError(error, msg, this.errorCount);
\r
1989 this.errorCount = 0;
\r
1991 if (this.queue.length > 0) {
\r
1992 this.doWriteMessage(this.queue.shift());
\r
1998 this.errorCount++;
\r
1999 this.fireError(error, msg, this.errorCount);
\r
2003 exports.IPCMessageWriter = IPCMessageWriter;
\r
2004 class SocketMessageWriter extends AbstractMessageWriter {
\r
2005 constructor(socket, encoding = 'utf8') {
\r
2007 this.socket = socket;
\r
2009 this.sending = false;
\r
2010 this.encoding = encoding;
\r
2011 this.errorCount = 0;
\r
2012 this.socket.on('error', (error) => this.fireError(error));
\r
2013 this.socket.on('close', () => this.fireClose());
\r
2017 this.socket.destroy();
\r
2020 if (!this.sending && this.queue.length === 0) {
\r
2021 // See https://github.com/nodejs/node/issues/7657
\r
2022 this.doWriteMessage(msg);
\r
2025 this.queue.push(msg);
\r
2028 doWriteMessage(msg) {
\r
2029 let json = JSON.stringify(msg);
\r
2030 let contentLength = Buffer.byteLength(json, this.encoding);
\r
2032 ContentLength, contentLength.toString(), CRLF,
\r
2036 // Header must be written in ASCII encoding
\r
2037 this.sending = true;
\r
2038 this.socket.write(headers.join(''), 'ascii', (error) => {
\r
2040 this.handleError(error, msg);
\r
2043 // Now write the content. This can be written in any encoding
\r
2044 this.socket.write(json, this.encoding, (error) => {
\r
2045 this.sending = false;
\r
2047 this.handleError(error, msg);
\r
2050 this.errorCount = 0;
\r
2052 if (this.queue.length > 0) {
\r
2053 this.doWriteMessage(this.queue.shift());
\r
2058 this.handleError(error, msg);
\r
2063 this.handleError(error, msg);
\r
2066 handleError(error, msg) {
\r
2067 this.errorCount++;
\r
2068 this.fireError(error, msg, this.errorCount);
\r
2071 exports.SocketMessageWriter = SocketMessageWriter;
\r
2076 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2079 /*---------------------------------------------------------------------------------------------
\r
2080 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2081 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2082 *--------------------------------------------------------------------------------------------*/
\r
2084 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2085 const events_1 = __webpack_require__(7);
\r
2086 const Is = __webpack_require__(4);
\r
2087 var CancellationToken;
\r
2088 (function (CancellationToken) {
\r
2089 CancellationToken.None = Object.freeze({
\r
2090 isCancellationRequested: false,
\r
2091 onCancellationRequested: events_1.Event.None
\r
2093 CancellationToken.Cancelled = Object.freeze({
\r
2094 isCancellationRequested: true,
\r
2095 onCancellationRequested: events_1.Event.None
\r
2097 function is(value) {
\r
2098 let candidate = value;
\r
2099 return candidate && (candidate === CancellationToken.None
\r
2100 || candidate === CancellationToken.Cancelled
\r
2101 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
\r
2103 CancellationToken.is = is;
\r
2104 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
\r
2105 const shortcutEvent = Object.freeze(function (callback, context) {
\r
2106 let handle = setTimeout(callback.bind(context), 0);
\r
2107 return { dispose() { clearTimeout(handle); } };
\r
2109 class MutableToken {
\r
2111 this._isCancelled = false;
\r
2114 if (!this._isCancelled) {
\r
2115 this._isCancelled = true;
\r
2116 if (this._emitter) {
\r
2117 this._emitter.fire(undefined);
\r
2122 get isCancellationRequested() {
\r
2123 return this._isCancelled;
\r
2125 get onCancellationRequested() {
\r
2126 if (this._isCancelled) {
\r
2127 return shortcutEvent;
\r
2129 if (!this._emitter) {
\r
2130 this._emitter = new events_1.Emitter();
\r
2132 return this._emitter.event;
\r
2135 if (this._emitter) {
\r
2136 this._emitter.dispose();
\r
2137 this._emitter = undefined;
\r
2141 class CancellationTokenSource {
\r
2143 if (!this._token) {
\r
2144 // be lazy and create the token only when
\r
2145 // actually needed
\r
2146 this._token = new MutableToken();
\r
2148 return this._token;
\r
2151 if (!this._token) {
\r
2152 // save an object by returning the default
\r
2153 // cancelled token when cancellation happens
\r
2154 // before someone asks for the token
\r
2155 this._token = CancellationToken.Cancelled;
\r
2158 this._token.cancel();
\r
2162 if (!this._token) {
\r
2163 // ensure to initialize with an empty token if we had none
\r
2164 this._token = CancellationToken.None;
\r
2166 else if (this._token instanceof MutableToken) {
\r
2167 // actually dispose
\r
2168 this._token.dispose();
\r
2172 exports.CancellationTokenSource = CancellationTokenSource;
\r
2177 /***/ ((__unused_webpack_module, exports) => {
2181 /*---------------------------------------------------------------------------------------------
\r
2182 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2183 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2184 *--------------------------------------------------------------------------------------------*/
\r
2185 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2187 (function (Touch) {
\r
2191 })(Touch = exports.Touch || (exports.Touch = {}));
\r
2194 this._map = new Map();
\r
2195 this._head = undefined;
\r
2196 this._tail = undefined;
\r
2200 this._map.clear();
\r
2201 this._head = undefined;
\r
2202 this._tail = undefined;
\r
2206 return !this._head && !this._tail;
\r
2209 return this._size;
\r
2212 return this._map.has(key);
\r
2215 const item = this._map.get(key);
\r
2219 return item.value;
\r
2221 set(key, value, touch = Touch.None) {
\r
2222 let item = this._map.get(key);
\r
2224 item.value = value;
\r
2225 if (touch !== Touch.None) {
\r
2226 this.touch(item, touch);
\r
2230 item = { key, value, next: undefined, previous: undefined };
\r
2233 this.addItemLast(item);
\r
2236 this.addItemFirst(item);
\r
2239 this.addItemLast(item);
\r
2242 this.addItemLast(item);
\r
2245 this._map.set(key, item);
\r
2250 const item = this._map.get(key);
\r
2254 this._map.delete(key);
\r
2255 this.removeItem(item);
\r
2260 if (!this._head && !this._tail) {
\r
2263 if (!this._head || !this._tail) {
\r
2264 throw new Error('Invalid list');
\r
2266 const item = this._head;
\r
2267 this._map.delete(item.key);
\r
2268 this.removeItem(item);
\r
2270 return item.value;
\r
2272 forEach(callbackfn, thisArg) {
\r
2273 let current = this._head;
\r
2276 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2279 callbackfn(current.value, current.key, this);
\r
2281 current = current.next;
\r
2284 forEachReverse(callbackfn, thisArg) {
\r
2285 let current = this._tail;
\r
2288 callbackfn.bind(thisArg)(current.value, current.key, this);
\r
2291 callbackfn(current.value, current.key, this);
\r
2293 current = current.previous;
\r
2298 let current = this._head;
\r
2300 result.push(current.value);
\r
2301 current = current.next;
\r
2307 let current = this._head;
\r
2309 result.push(current.key);
\r
2310 current = current.next;
\r
2314 /* JSON RPC run on es5 which has no Symbol.iterator
\r
2315 public keys(): IterableIterator<K> {
\r
2316 let current = this._head;
\r
2317 let iterator: IterableIterator<K> = {
\r
2318 [Symbol.iterator]() {
\r
2321 next():IteratorResult<K> {
\r
2323 let result = { value: current.key, done: false };
\r
2324 current = current.next;
\r
2327 return { value: undefined, done: true };
\r
2334 public values(): IterableIterator<V> {
\r
2335 let current = this._head;
\r
2336 let iterator: IterableIterator<V> = {
\r
2337 [Symbol.iterator]() {
\r
2340 next():IteratorResult<V> {
\r
2342 let result = { value: current.value, done: false };
\r
2343 current = current.next;
\r
2346 return { value: undefined, done: true };
\r
2353 addItemFirst(item) {
\r
2354 // First time Insert
\r
2355 if (!this._head && !this._tail) {
\r
2356 this._tail = item;
\r
2358 else if (!this._head) {
\r
2359 throw new Error('Invalid list');
\r
2362 item.next = this._head;
\r
2363 this._head.previous = item;
\r
2365 this._head = item;
\r
2367 addItemLast(item) {
\r
2368 // First time Insert
\r
2369 if (!this._head && !this._tail) {
\r
2370 this._head = item;
\r
2372 else if (!this._tail) {
\r
2373 throw new Error('Invalid list');
\r
2376 item.previous = this._tail;
\r
2377 this._tail.next = item;
\r
2379 this._tail = item;
\r
2381 removeItem(item) {
\r
2382 if (item === this._head && item === this._tail) {
\r
2383 this._head = undefined;
\r
2384 this._tail = undefined;
\r
2386 else if (item === this._head) {
\r
2387 this._head = item.next;
\r
2389 else if (item === this._tail) {
\r
2390 this._tail = item.previous;
\r
2393 const next = item.next;
\r
2394 const previous = item.previous;
\r
2395 if (!next || !previous) {
\r
2396 throw new Error('Invalid list');
\r
2398 next.previous = previous;
\r
2399 previous.next = next;
\r
2402 touch(item, touch) {
\r
2403 if (!this._head || !this._tail) {
\r
2404 throw new Error('Invalid list');
\r
2406 if ((touch !== Touch.First && touch !== Touch.Last)) {
\r
2409 if (touch === Touch.First) {
\r
2410 if (item === this._head) {
\r
2413 const next = item.next;
\r
2414 const previous = item.previous;
\r
2415 // Unlink the item
\r
2416 if (item === this._tail) {
\r
2417 // previous must be defined since item was not head but is tail
\r
2418 // So there are more than on item in the map
\r
2419 previous.next = undefined;
\r
2420 this._tail = previous;
\r
2423 // Both next and previous are not undefined since item was neither head nor tail.
\r
2424 next.previous = previous;
\r
2425 previous.next = next;
\r
2427 // Insert the node at head
\r
2428 item.previous = undefined;
\r
2429 item.next = this._head;
\r
2430 this._head.previous = item;
\r
2431 this._head = item;
\r
2433 else if (touch === Touch.Last) {
\r
2434 if (item === this._tail) {
\r
2437 const next = item.next;
\r
2438 const previous = item.previous;
\r
2439 // Unlink the item.
\r
2440 if (item === this._head) {
\r
2441 // next must be defined since item was not tail but is head
\r
2442 // So there are more than on item in the map
\r
2443 next.previous = undefined;
\r
2444 this._head = next;
\r
2447 // Both next and previous are not undefined since item was neither head nor tail.
\r
2448 next.previous = previous;
\r
2449 previous.next = next;
\r
2451 item.next = undefined;
\r
2452 item.previous = this._tail;
\r
2453 this._tail.next = item;
\r
2454 this._tail = item;
\r
2458 exports.LinkedMap = LinkedMap;
\r
2463 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2466 /* --------------------------------------------------------------------------------------------
\r
2467 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2468 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2469 * ------------------------------------------------------------------------------------------ */
\r
2471 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2472 const path_1 = __webpack_require__(12);
\r
2473 const os_1 = __webpack_require__(13);
\r
2474 const crypto_1 = __webpack_require__(14);
\r
2475 const net_1 = __webpack_require__(15);
\r
2476 const messageReader_1 = __webpack_require__(6);
\r
2477 const messageWriter_1 = __webpack_require__(8);
\r
2478 function generateRandomPipeName() {
\r
2479 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
\r
2480 if (process.platform === 'win32') {
\r
2481 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
\r
2484 // Mac/Unix: use socket file
\r
2485 return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);
\r
2488 exports.generateRandomPipeName = generateRandomPipeName;
\r
2489 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
\r
2490 let connectResolve;
\r
2491 let connected = new Promise((resolve, _reject) => {
\r
2492 connectResolve = resolve;
\r
2494 return new Promise((resolve, reject) => {
\r
2495 let server = net_1.createServer((socket) => {
\r
2498 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2499 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2502 server.on('error', reject);
\r
2503 server.listen(pipeName, () => {
\r
2504 server.removeListener('error', reject);
\r
2506 onConnected: () => { return connected; }
\r
2511 exports.createClientPipeTransport = createClientPipeTransport;
\r
2512 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
\r
2513 const socket = net_1.createConnection(pipeName);
\r
2515 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2516 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2519 exports.createServerPipeTransport = createServerPipeTransport;
\r
2524 /***/ ((module) => {
2527 module.exports = require("path");;
2531 /***/ ((module) => {
2534 module.exports = require("os");;
2538 /***/ ((module) => {
2541 module.exports = require("crypto");;
2545 /***/ ((module) => {
2548 module.exports = require("net");;
2552 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2555 /* --------------------------------------------------------------------------------------------
\r
2556 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2557 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2558 * ------------------------------------------------------------------------------------------ */
\r
2560 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
2561 const net_1 = __webpack_require__(15);
\r
2562 const messageReader_1 = __webpack_require__(6);
\r
2563 const messageWriter_1 = __webpack_require__(8);
\r
2564 function createClientSocketTransport(port, encoding = 'utf-8') {
\r
2565 let connectResolve;
\r
2566 let connected = new Promise((resolve, _reject) => {
\r
2567 connectResolve = resolve;
\r
2569 return new Promise((resolve, reject) => {
\r
2570 let server = net_1.createServer((socket) => {
\r
2573 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2574 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2577 server.on('error', reject);
\r
2578 server.listen(port, '127.0.0.1', () => {
\r
2579 server.removeListener('error', reject);
\r
2581 onConnected: () => { return connected; }
\r
2586 exports.createClientSocketTransport = createClientSocketTransport;
\r
2587 function createServerSocketTransport(port, encoding = 'utf-8') {
\r
2588 const socket = net_1.createConnection(port, '127.0.0.1');
\r
2590 new messageReader_1.SocketMessageReader(socket, encoding),
\r
2591 new messageWriter_1.SocketMessageWriter(socket, encoding)
\r
2594 exports.createServerSocketTransport = createServerSocketTransport;
\r
2599 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2602 __webpack_require__.r(__webpack_exports__);
2603 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2604 /* harmony export */ "Position": () => /* binding */ Position,
2605 /* harmony export */ "Range": () => /* binding */ Range,
2606 /* harmony export */ "Location": () => /* binding */ Location,
2607 /* harmony export */ "LocationLink": () => /* binding */ LocationLink,
2608 /* harmony export */ "Color": () => /* binding */ Color,
2609 /* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
2610 /* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
2611 /* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
2612 /* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
2613 /* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
2614 /* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
2615 /* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
2616 /* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
2617 /* harmony export */ "Command": () => /* binding */ Command,
2618 /* harmony export */ "TextEdit": () => /* binding */ TextEdit,
2619 /* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
2620 /* harmony export */ "CreateFile": () => /* binding */ CreateFile,
2621 /* harmony export */ "RenameFile": () => /* binding */ RenameFile,
2622 /* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
2623 /* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
2624 /* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
2625 /* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
2626 /* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
2627 /* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
2628 /* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
2629 /* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
2630 /* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
2631 /* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
2632 /* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
2633 /* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
2634 /* harmony export */ "CompletionList": () => /* binding */ CompletionList,
2635 /* harmony export */ "MarkedString": () => /* binding */ MarkedString,
2636 /* harmony export */ "Hover": () => /* binding */ Hover,
2637 /* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
2638 /* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
2639 /* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
2640 /* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
2641 /* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
2642 /* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
2643 /* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
2644 /* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
2645 /* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
2646 /* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
2647 /* harmony export */ "CodeAction": () => /* binding */ CodeAction,
2648 /* harmony export */ "CodeLens": () => /* binding */ CodeLens,
2649 /* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
2650 /* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
2651 /* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
2652 /* harmony export */ "EOL": () => /* binding */ EOL,
2653 /* harmony export */ "TextDocument": () => /* binding */ TextDocument
2654 /* harmony export */ });
2655 /* --------------------------------------------------------------------------------------------
\r
2656 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
2657 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
2658 * ------------------------------------------------------------------------------------------ */
\r
2661 * The Position namespace provides helper functions to work with
\r
2662 * [Position](#Position) literals.
\r
2665 (function (Position) {
\r
2667 * Creates a new Position literal from the given line and character.
\r
2668 * @param line The position's line.
\r
2669 * @param character The position's character.
\r
2671 function create(line, character) {
\r
2672 return { line: line, character: character };
\r
2674 Position.create = create;
\r
2676 * Checks whether the given liternal conforms to the [Position](#Position) interface.
\r
2678 function is(value) {
\r
2679 var candidate = value;
\r
2680 return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
\r
2683 })(Position || (Position = {}));
\r
2685 * The Range namespace provides helper functions to work with
\r
2686 * [Range](#Range) literals.
\r
2689 (function (Range) {
\r
2690 function create(one, two, three, four) {
\r
2691 if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
\r
2692 return { start: Position.create(one, two), end: Position.create(three, four) };
\r
2694 else if (Position.is(one) && Position.is(two)) {
\r
2695 return { start: one, end: two };
\r
2698 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
\r
2701 Range.create = create;
\r
2703 * Checks whether the given literal conforms to the [Range](#Range) interface.
\r
2705 function is(value) {
\r
2706 var candidate = value;
\r
2707 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
\r
2710 })(Range || (Range = {}));
\r
2712 * The Location namespace provides helper functions to work with
\r
2713 * [Location](#Location) literals.
\r
2716 (function (Location) {
\r
2718 * Creates a Location literal.
\r
2719 * @param uri The location's uri.
\r
2720 * @param range The location's range.
\r
2722 function create(uri, range) {
\r
2723 return { uri: uri, range: range };
\r
2725 Location.create = create;
\r
2727 * Checks whether the given literal conforms to the [Location](#Location) interface.
\r
2729 function is(value) {
\r
2730 var candidate = value;
\r
2731 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
\r
2734 })(Location || (Location = {}));
\r
2736 * The LocationLink namespace provides helper functions to work with
\r
2737 * [LocationLink](#LocationLink) literals.
\r
2740 (function (LocationLink) {
\r
2742 * Creates a LocationLink literal.
\r
2743 * @param targetUri The definition's uri.
\r
2744 * @param targetRange The full range of the definition.
\r
2745 * @param targetSelectionRange The span of the symbol definition at the target.
\r
2746 * @param originSelectionRange The span of the symbol being defined in the originating source file.
\r
2748 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
\r
2749 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
\r
2751 LocationLink.create = create;
\r
2753 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
\r
2755 function is(value) {
\r
2756 var candidate = value;
\r
2757 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
\r
2758 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
\r
2759 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
\r
2761 LocationLink.is = is;
\r
2762 })(LocationLink || (LocationLink = {}));
\r
2764 * The Color namespace provides helper functions to work with
\r
2765 * [Color](#Color) literals.
\r
2768 (function (Color) {
\r
2770 * Creates a new Color literal.
\r
2772 function create(red, green, blue, alpha) {
\r
2780 Color.create = create;
\r
2782 * Checks whether the given literal conforms to the [Color](#Color) interface.
\r
2784 function is(value) {
\r
2785 var candidate = value;
\r
2786 return Is.number(candidate.red)
\r
2787 && Is.number(candidate.green)
\r
2788 && Is.number(candidate.blue)
\r
2789 && Is.number(candidate.alpha);
\r
2792 })(Color || (Color = {}));
\r
2794 * The ColorInformation namespace provides helper functions to work with
\r
2795 * [ColorInformation](#ColorInformation) literals.
\r
2797 var ColorInformation;
\r
2798 (function (ColorInformation) {
\r
2800 * Creates a new ColorInformation literal.
\r
2802 function create(range, color) {
\r
2808 ColorInformation.create = create;
\r
2810 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2812 function is(value) {
\r
2813 var candidate = value;
\r
2814 return Range.is(candidate.range) && Color.is(candidate.color);
\r
2816 ColorInformation.is = is;
\r
2817 })(ColorInformation || (ColorInformation = {}));
\r
2819 * The Color namespace provides helper functions to work with
\r
2820 * [ColorPresentation](#ColorPresentation) literals.
\r
2822 var ColorPresentation;
\r
2823 (function (ColorPresentation) {
\r
2825 * Creates a new ColorInformation literal.
\r
2827 function create(label, textEdit, additionalTextEdits) {
\r
2830 textEdit: textEdit,
\r
2831 additionalTextEdits: additionalTextEdits,
\r
2834 ColorPresentation.create = create;
\r
2836 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
\r
2838 function is(value) {
\r
2839 var candidate = value;
\r
2840 return Is.string(candidate.label)
\r
2841 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
\r
2842 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
\r
2844 ColorPresentation.is = is;
\r
2845 })(ColorPresentation || (ColorPresentation = {}));
\r
2847 * Enum of known range kinds
\r
2849 var FoldingRangeKind;
\r
2850 (function (FoldingRangeKind) {
\r
2852 * Folding range for a comment
\r
2854 FoldingRangeKind["Comment"] = "comment";
\r
2856 * Folding range for a imports or includes
\r
2858 FoldingRangeKind["Imports"] = "imports";
\r
2860 * Folding range for a region (e.g. `#region`)
\r
2862 FoldingRangeKind["Region"] = "region";
\r
2863 })(FoldingRangeKind || (FoldingRangeKind = {}));
\r
2865 * The folding range namespace provides helper functions to work with
\r
2866 * [FoldingRange](#FoldingRange) literals.
\r
2869 (function (FoldingRange) {
\r
2871 * Creates a new FoldingRange literal.
\r
2873 function create(startLine, endLine, startCharacter, endCharacter, kind) {
\r
2875 startLine: startLine,
\r
2878 if (Is.defined(startCharacter)) {
\r
2879 result.startCharacter = startCharacter;
\r
2881 if (Is.defined(endCharacter)) {
\r
2882 result.endCharacter = endCharacter;
\r
2884 if (Is.defined(kind)) {
\r
2885 result.kind = kind;
\r
2889 FoldingRange.create = create;
\r
2891 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
\r
2893 function is(value) {
\r
2894 var candidate = value;
\r
2895 return Is.number(candidate.startLine) && Is.number(candidate.startLine)
\r
2896 && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
\r
2897 && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
\r
2898 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
\r
2900 FoldingRange.is = is;
\r
2901 })(FoldingRange || (FoldingRange = {}));
\r
2903 * The DiagnosticRelatedInformation namespace provides helper functions to work with
\r
2904 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
\r
2906 var DiagnosticRelatedInformation;
\r
2907 (function (DiagnosticRelatedInformation) {
\r
2909 * Creates a new DiagnosticRelatedInformation literal.
\r
2911 function create(location, message) {
\r
2913 location: location,
\r
2917 DiagnosticRelatedInformation.create = create;
\r
2919 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
\r
2921 function is(value) {
\r
2922 var candidate = value;
\r
2923 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
\r
2925 DiagnosticRelatedInformation.is = is;
\r
2926 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
\r
2928 * The diagnostic's severity.
\r
2930 var DiagnosticSeverity;
\r
2931 (function (DiagnosticSeverity) {
\r
2933 * Reports an error.
\r
2935 DiagnosticSeverity.Error = 1;
\r
2937 * Reports a warning.
\r
2939 DiagnosticSeverity.Warning = 2;
\r
2941 * Reports an information.
\r
2943 DiagnosticSeverity.Information = 3;
\r
2947 DiagnosticSeverity.Hint = 4;
\r
2948 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
\r
2950 * The diagnostic tags.
\r
2954 var DiagnosticTag;
\r
2955 (function (DiagnosticTag) {
\r
2957 * Unused or unnecessary code.
\r
2959 * Clients are allowed to render diagnostics with this tag faded out instead of having
\r
2960 * an error squiggle.
\r
2962 DiagnosticTag.Unnecessary = 1;
\r
2964 * Deprecated or obsolete code.
\r
2966 * Clients are allowed to rendered diagnostics with this tag strike through.
\r
2968 DiagnosticTag.Deprecated = 2;
\r
2969 })(DiagnosticTag || (DiagnosticTag = {}));
\r
2971 * The Diagnostic namespace provides helper functions to work with
\r
2972 * [Diagnostic](#Diagnostic) literals.
\r
2975 (function (Diagnostic) {
\r
2977 * Creates a new Diagnostic literal.
\r
2979 function create(range, message, severity, code, source, relatedInformation) {
\r
2980 var result = { range: range, message: message };
\r
2981 if (Is.defined(severity)) {
\r
2982 result.severity = severity;
\r
2984 if (Is.defined(code)) {
\r
2985 result.code = code;
\r
2987 if (Is.defined(source)) {
\r
2988 result.source = source;
\r
2990 if (Is.defined(relatedInformation)) {
\r
2991 result.relatedInformation = relatedInformation;
\r
2995 Diagnostic.create = create;
\r
2997 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
\r
2999 function is(value) {
\r
3000 var candidate = value;
\r
3001 return Is.defined(candidate)
\r
3002 && Range.is(candidate.range)
\r
3003 && Is.string(candidate.message)
\r
3004 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
\r
3005 && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
\r
3006 && (Is.string(candidate.source) || Is.undefined(candidate.source))
\r
3007 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
\r
3009 Diagnostic.is = is;
\r
3010 })(Diagnostic || (Diagnostic = {}));
\r
3012 * The Command namespace provides helper functions to work with
\r
3013 * [Command](#Command) literals.
\r
3016 (function (Command) {
\r
3018 * Creates a new Command literal.
\r
3020 function create(title, command) {
\r
3022 for (var _i = 2; _i < arguments.length; _i++) {
\r
3023 args[_i - 2] = arguments[_i];
\r
3025 var result = { title: title, command: command };
\r
3026 if (Is.defined(args) && args.length > 0) {
\r
3027 result.arguments = args;
\r
3031 Command.create = create;
\r
3033 * Checks whether the given literal conforms to the [Command](#Command) interface.
\r
3035 function is(value) {
\r
3036 var candidate = value;
\r
3037 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
\r
3040 })(Command || (Command = {}));
\r
3042 * The TextEdit namespace provides helper function to create replace,
\r
3043 * insert and delete edits more easily.
\r
3046 (function (TextEdit) {
\r
3048 * Creates a replace text edit.
\r
3049 * @param range The range of text to be replaced.
\r
3050 * @param newText The new text.
\r
3052 function replace(range, newText) {
\r
3053 return { range: range, newText: newText };
\r
3055 TextEdit.replace = replace;
\r
3057 * Creates a insert text edit.
\r
3058 * @param position The position to insert the text at.
\r
3059 * @param newText The text to be inserted.
\r
3061 function insert(position, newText) {
\r
3062 return { range: { start: position, end: position }, newText: newText };
\r
3064 TextEdit.insert = insert;
\r
3066 * Creates a delete text edit.
\r
3067 * @param range The range of text to be deleted.
\r
3069 function del(range) {
\r
3070 return { range: range, newText: '' };
\r
3072 TextEdit.del = del;
\r
3073 function is(value) {
\r
3074 var candidate = value;
\r
3075 return Is.objectLiteral(candidate)
\r
3076 && Is.string(candidate.newText)
\r
3077 && Range.is(candidate.range);
\r
3080 })(TextEdit || (TextEdit = {}));
\r
3082 * The TextDocumentEdit namespace provides helper function to create
\r
3083 * an edit that manipulates a text document.
\r
3085 var TextDocumentEdit;
\r
3086 (function (TextDocumentEdit) {
\r
3088 * Creates a new `TextDocumentEdit`
\r
3090 function create(textDocument, edits) {
\r
3091 return { textDocument: textDocument, edits: edits };
\r
3093 TextDocumentEdit.create = create;
\r
3094 function is(value) {
\r
3095 var candidate = value;
\r
3096 return Is.defined(candidate)
\r
3097 && VersionedTextDocumentIdentifier.is(candidate.textDocument)
\r
3098 && Array.isArray(candidate.edits);
\r
3100 TextDocumentEdit.is = is;
\r
3101 })(TextDocumentEdit || (TextDocumentEdit = {}));
\r
3103 (function (CreateFile) {
\r
3104 function create(uri, options) {
\r
3109 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3110 result.options = options;
\r
3114 CreateFile.create = create;
\r
3115 function is(value) {
\r
3116 var candidate = value;
\r
3117 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
\r
3118 (candidate.options === void 0 ||
\r
3119 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3121 CreateFile.is = is;
\r
3122 })(CreateFile || (CreateFile = {}));
\r
3124 (function (RenameFile) {
\r
3125 function create(oldUri, newUri, options) {
\r
3131 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
\r
3132 result.options = options;
\r
3136 RenameFile.create = create;
\r
3137 function is(value) {
\r
3138 var candidate = value;
\r
3139 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
\r
3140 (candidate.options === void 0 ||
\r
3141 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
\r
3143 RenameFile.is = is;
\r
3144 })(RenameFile || (RenameFile = {}));
\r
3146 (function (DeleteFile) {
\r
3147 function create(uri, options) {
\r
3152 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
\r
3153 result.options = options;
\r
3157 DeleteFile.create = create;
\r
3158 function is(value) {
\r
3159 var candidate = value;
\r
3160 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
\r
3161 (candidate.options === void 0 ||
\r
3162 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
\r
3164 DeleteFile.is = is;
\r
3165 })(DeleteFile || (DeleteFile = {}));
\r
3166 var WorkspaceEdit;
\r
3167 (function (WorkspaceEdit) {
\r
3168 function is(value) {
\r
3169 var candidate = value;
\r
3170 return candidate &&
\r
3171 (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
\r
3172 (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
\r
3173 if (Is.string(change.kind)) {
\r
3174 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
\r
3177 return TextDocumentEdit.is(change);
\r
3181 WorkspaceEdit.is = is;
\r
3182 })(WorkspaceEdit || (WorkspaceEdit = {}));
\r
3183 var TextEditChangeImpl = /** @class */ (function () {
\r
3184 function TextEditChangeImpl(edits) {
\r
3185 this.edits = edits;
\r
3187 TextEditChangeImpl.prototype.insert = function (position, newText) {
\r
3188 this.edits.push(TextEdit.insert(position, newText));
\r
3190 TextEditChangeImpl.prototype.replace = function (range, newText) {
\r
3191 this.edits.push(TextEdit.replace(range, newText));
\r
3193 TextEditChangeImpl.prototype.delete = function (range) {
\r
3194 this.edits.push(TextEdit.del(range));
\r
3196 TextEditChangeImpl.prototype.add = function (edit) {
\r
3197 this.edits.push(edit);
\r
3199 TextEditChangeImpl.prototype.all = function () {
\r
3200 return this.edits;
\r
3202 TextEditChangeImpl.prototype.clear = function () {
\r
3203 this.edits.splice(0, this.edits.length);
\r
3205 return TextEditChangeImpl;
\r
3208 * A workspace change helps constructing changes to a workspace.
\r
3210 var WorkspaceChange = /** @class */ (function () {
\r
3211 function WorkspaceChange(workspaceEdit) {
\r
3213 this._textEditChanges = Object.create(null);
\r
3214 if (workspaceEdit) {
\r
3215 this._workspaceEdit = workspaceEdit;
\r
3216 if (workspaceEdit.documentChanges) {
\r
3217 workspaceEdit.documentChanges.forEach(function (change) {
\r
3218 if (TextDocumentEdit.is(change)) {
\r
3219 var textEditChange = new TextEditChangeImpl(change.edits);
\r
3220 _this._textEditChanges[change.textDocument.uri] = textEditChange;
\r
3224 else if (workspaceEdit.changes) {
\r
3225 Object.keys(workspaceEdit.changes).forEach(function (key) {
\r
3226 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
\r
3227 _this._textEditChanges[key] = textEditChange;
\r
3232 Object.defineProperty(WorkspaceChange.prototype, "edit", {
\r
3234 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
\r
3235 * use to be returned from a workspace edit operation like rename.
\r
3237 get: function () {
\r
3238 return this._workspaceEdit;
\r
3241 configurable: true
\r
3243 WorkspaceChange.prototype.getTextEditChange = function (key) {
\r
3244 if (VersionedTextDocumentIdentifier.is(key)) {
\r
3245 if (!this._workspaceEdit) {
\r
3246 this._workspaceEdit = {
\r
3247 documentChanges: []
\r
3250 if (!this._workspaceEdit.documentChanges) {
\r
3251 throw new Error('Workspace edit is not configured for document changes.');
\r
3253 var textDocument = key;
\r
3254 var result = this._textEditChanges[textDocument.uri];
\r
3257 var textDocumentEdit = {
\r
3258 textDocument: textDocument,
\r
3261 this._workspaceEdit.documentChanges.push(textDocumentEdit);
\r
3262 result = new TextEditChangeImpl(edits);
\r
3263 this._textEditChanges[textDocument.uri] = result;
\r
3268 if (!this._workspaceEdit) {
\r
3269 this._workspaceEdit = {
\r
3270 changes: Object.create(null)
\r
3273 if (!this._workspaceEdit.changes) {
\r
3274 throw new Error('Workspace edit is not configured for normal text edit changes.');
\r
3276 var result = this._textEditChanges[key];
\r
3279 this._workspaceEdit.changes[key] = edits;
\r
3280 result = new TextEditChangeImpl(edits);
\r
3281 this._textEditChanges[key] = result;
\r
3286 WorkspaceChange.prototype.createFile = function (uri, options) {
\r
3287 this.checkDocumentChanges();
\r
3288 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
\r
3290 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
\r
3291 this.checkDocumentChanges();
\r
3292 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
\r
3294 WorkspaceChange.prototype.deleteFile = function (uri, options) {
\r
3295 this.checkDocumentChanges();
\r
3296 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
\r
3298 WorkspaceChange.prototype.checkDocumentChanges = function () {
\r
3299 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
\r
3300 throw new Error('Workspace edit is not configured for document changes.');
\r
3303 return WorkspaceChange;
\r
3307 * The TextDocumentIdentifier namespace provides helper functions to work with
\r
3308 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
\r
3310 var TextDocumentIdentifier;
\r
3311 (function (TextDocumentIdentifier) {
\r
3313 * Creates a new TextDocumentIdentifier literal.
\r
3314 * @param uri The document's uri.
\r
3316 function create(uri) {
\r
3317 return { uri: uri };
\r
3319 TextDocumentIdentifier.create = create;
\r
3321 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
\r
3323 function is(value) {
\r
3324 var candidate = value;
\r
3325 return Is.defined(candidate) && Is.string(candidate.uri);
\r
3327 TextDocumentIdentifier.is = is;
\r
3328 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
\r
3330 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
\r
3331 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
\r
3333 var VersionedTextDocumentIdentifier;
\r
3334 (function (VersionedTextDocumentIdentifier) {
\r
3336 * Creates a new VersionedTextDocumentIdentifier literal.
\r
3337 * @param uri The document's uri.
\r
3338 * @param uri The document's text.
\r
3340 function create(uri, version) {
\r
3341 return { uri: uri, version: version };
\r
3343 VersionedTextDocumentIdentifier.create = create;
\r
3345 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
\r
3347 function is(value) {
\r
3348 var candidate = value;
\r
3349 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
\r
3351 VersionedTextDocumentIdentifier.is = is;
\r
3352 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
\r
3354 * The TextDocumentItem namespace provides helper functions to work with
\r
3355 * [TextDocumentItem](#TextDocumentItem) literals.
\r
3357 var TextDocumentItem;
\r
3358 (function (TextDocumentItem) {
\r
3360 * Creates a new TextDocumentItem literal.
\r
3361 * @param uri The document's uri.
\r
3362 * @param languageId The document's language identifier.
\r
3363 * @param version The document's version number.
\r
3364 * @param text The document's text.
\r
3366 function create(uri, languageId, version, text) {
\r
3367 return { uri: uri, languageId: languageId, version: version, text: text };
\r
3369 TextDocumentItem.create = create;
\r
3371 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
\r
3373 function is(value) {
\r
3374 var candidate = value;
\r
3375 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
\r
3377 TextDocumentItem.is = is;
\r
3378 })(TextDocumentItem || (TextDocumentItem = {}));
\r
3380 * Describes the content type that a client supports in various
\r
3381 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
\r
3383 * Please note that `MarkupKinds` must not start with a `$`. This kinds
\r
3384 * are reserved for internal usage.
\r
3387 (function (MarkupKind) {
\r
3389 * Plain text is supported as a content format
\r
3391 MarkupKind.PlainText = 'plaintext';
\r
3393 * Markdown is supported as a content format
\r
3395 MarkupKind.Markdown = 'markdown';
\r
3396 })(MarkupKind || (MarkupKind = {}));
\r
3397 (function (MarkupKind) {
\r
3399 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
\r
3401 function is(value) {
\r
3402 var candidate = value;
\r
3403 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
\r
3405 MarkupKind.is = is;
\r
3406 })(MarkupKind || (MarkupKind = {}));
\r
3407 var MarkupContent;
\r
3408 (function (MarkupContent) {
\r
3410 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
\r
3412 function is(value) {
\r
3413 var candidate = value;
\r
3414 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
\r
3416 MarkupContent.is = is;
\r
3417 })(MarkupContent || (MarkupContent = {}));
\r
3419 * The kind of a completion entry.
\r
3421 var CompletionItemKind;
\r
3422 (function (CompletionItemKind) {
\r
3423 CompletionItemKind.Text = 1;
\r
3424 CompletionItemKind.Method = 2;
\r
3425 CompletionItemKind.Function = 3;
\r
3426 CompletionItemKind.Constructor = 4;
\r
3427 CompletionItemKind.Field = 5;
\r
3428 CompletionItemKind.Variable = 6;
\r
3429 CompletionItemKind.Class = 7;
\r
3430 CompletionItemKind.Interface = 8;
\r
3431 CompletionItemKind.Module = 9;
\r
3432 CompletionItemKind.Property = 10;
\r
3433 CompletionItemKind.Unit = 11;
\r
3434 CompletionItemKind.Value = 12;
\r
3435 CompletionItemKind.Enum = 13;
\r
3436 CompletionItemKind.Keyword = 14;
\r
3437 CompletionItemKind.Snippet = 15;
\r
3438 CompletionItemKind.Color = 16;
\r
3439 CompletionItemKind.File = 17;
\r
3440 CompletionItemKind.Reference = 18;
\r
3441 CompletionItemKind.Folder = 19;
\r
3442 CompletionItemKind.EnumMember = 20;
\r
3443 CompletionItemKind.Constant = 21;
\r
3444 CompletionItemKind.Struct = 22;
\r
3445 CompletionItemKind.Event = 23;
\r
3446 CompletionItemKind.Operator = 24;
\r
3447 CompletionItemKind.TypeParameter = 25;
\r
3448 })(CompletionItemKind || (CompletionItemKind = {}));
\r
3450 * Defines whether the insert text in a completion item should be interpreted as
\r
3451 * plain text or a snippet.
\r
3453 var InsertTextFormat;
\r
3454 (function (InsertTextFormat) {
\r
3456 * The primary text to be inserted is treated as a plain string.
\r
3458 InsertTextFormat.PlainText = 1;
\r
3460 * The primary text to be inserted is treated as a snippet.
\r
3462 * A snippet can define tab stops and placeholders with `$1`, `$2`
\r
3463 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
\r
3464 * the end of the snippet. Placeholders with equal identifiers are linked,
\r
3465 * that is typing in one will update others too.
\r
3467 * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
\r
3469 InsertTextFormat.Snippet = 2;
\r
3470 })(InsertTextFormat || (InsertTextFormat = {}));
\r
3472 * Completion item tags are extra annotations that tweak the rendering of a completion
\r
3477 var CompletionItemTag;
\r
3478 (function (CompletionItemTag) {
\r
3480 * Render a completion as obsolete, usually using a strike-out.
\r
3482 CompletionItemTag.Deprecated = 1;
\r
3483 })(CompletionItemTag || (CompletionItemTag = {}));
\r
3485 * The CompletionItem namespace provides functions to deal with
\r
3486 * completion items.
\r
3488 var CompletionItem;
\r
3489 (function (CompletionItem) {
\r
3491 * Create a completion item and seed it with a label.
\r
3492 * @param label The completion item's label
\r
3494 function create(label) {
\r
3495 return { label: label };
\r
3497 CompletionItem.create = create;
\r
3498 })(CompletionItem || (CompletionItem = {}));
\r
3500 * The CompletionList namespace provides functions to deal with
\r
3501 * completion lists.
\r
3503 var CompletionList;
\r
3504 (function (CompletionList) {
\r
3506 * Creates a new completion list.
\r
3508 * @param items The completion items.
\r
3509 * @param isIncomplete The list is not complete.
\r
3511 function create(items, isIncomplete) {
\r
3512 return { items: items ? items : [], isIncomplete: !!isIncomplete };
\r
3514 CompletionList.create = create;
\r
3515 })(CompletionList || (CompletionList = {}));
\r
3517 (function (MarkedString) {
\r
3519 * Creates a marked string from plain text.
\r
3521 * @param plainText The plain text.
\r
3523 function fromPlainText(plainText) {
\r
3524 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
\r
3526 MarkedString.fromPlainText = fromPlainText;
\r
3528 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
\r
3530 function is(value) {
\r
3531 var candidate = value;
\r
3532 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
\r
3534 MarkedString.is = is;
\r
3535 })(MarkedString || (MarkedString = {}));
\r
3537 (function (Hover) {
\r
3539 * Checks whether the given value conforms to the [Hover](#Hover) interface.
\r
3541 function is(value) {
\r
3542 var candidate = value;
\r
3543 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
\r
3544 MarkedString.is(candidate.contents) ||
\r
3545 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
\r
3548 })(Hover || (Hover = {}));
\r
3550 * The ParameterInformation namespace provides helper functions to work with
\r
3551 * [ParameterInformation](#ParameterInformation) literals.
\r
3553 var ParameterInformation;
\r
3554 (function (ParameterInformation) {
\r
3556 * Creates a new parameter information literal.
\r
3558 * @param label A label string.
\r
3559 * @param documentation A doc string.
\r
3561 function create(label, documentation) {
\r
3562 return documentation ? { label: label, documentation: documentation } : { label: label };
\r
3564 ParameterInformation.create = create;
\r
3565 })(ParameterInformation || (ParameterInformation = {}));
\r
3567 * The SignatureInformation namespace provides helper functions to work with
\r
3568 * [SignatureInformation](#SignatureInformation) literals.
\r
3570 var SignatureInformation;
\r
3571 (function (SignatureInformation) {
\r
3572 function create(label, documentation) {
\r
3573 var parameters = [];
\r
3574 for (var _i = 2; _i < arguments.length; _i++) {
\r
3575 parameters[_i - 2] = arguments[_i];
\r
3577 var result = { label: label };
\r
3578 if (Is.defined(documentation)) {
\r
3579 result.documentation = documentation;
\r
3581 if (Is.defined(parameters)) {
\r
3582 result.parameters = parameters;
\r
3585 result.parameters = [];
\r
3589 SignatureInformation.create = create;
\r
3590 })(SignatureInformation || (SignatureInformation = {}));
\r
3592 * A document highlight kind.
\r
3594 var DocumentHighlightKind;
\r
3595 (function (DocumentHighlightKind) {
\r
3597 * A textual occurrence.
\r
3599 DocumentHighlightKind.Text = 1;
\r
3601 * Read-access of a symbol, like reading a variable.
\r
3603 DocumentHighlightKind.Read = 2;
\r
3605 * Write-access of a symbol, like writing to a variable.
\r
3607 DocumentHighlightKind.Write = 3;
\r
3608 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
\r
3610 * DocumentHighlight namespace to provide helper functions to work with
\r
3611 * [DocumentHighlight](#DocumentHighlight) literals.
\r
3613 var DocumentHighlight;
\r
3614 (function (DocumentHighlight) {
\r
3616 * Create a DocumentHighlight object.
\r
3617 * @param range The range the highlight applies to.
\r
3619 function create(range, kind) {
\r
3620 var result = { range: range };
\r
3621 if (Is.number(kind)) {
\r
3622 result.kind = kind;
\r
3626 DocumentHighlight.create = create;
\r
3627 })(DocumentHighlight || (DocumentHighlight = {}));
\r
3632 (function (SymbolKind) {
\r
3633 SymbolKind.File = 1;
\r
3634 SymbolKind.Module = 2;
\r
3635 SymbolKind.Namespace = 3;
\r
3636 SymbolKind.Package = 4;
\r
3637 SymbolKind.Class = 5;
\r
3638 SymbolKind.Method = 6;
\r
3639 SymbolKind.Property = 7;
\r
3640 SymbolKind.Field = 8;
\r
3641 SymbolKind.Constructor = 9;
\r
3642 SymbolKind.Enum = 10;
\r
3643 SymbolKind.Interface = 11;
\r
3644 SymbolKind.Function = 12;
\r
3645 SymbolKind.Variable = 13;
\r
3646 SymbolKind.Constant = 14;
\r
3647 SymbolKind.String = 15;
\r
3648 SymbolKind.Number = 16;
\r
3649 SymbolKind.Boolean = 17;
\r
3650 SymbolKind.Array = 18;
\r
3651 SymbolKind.Object = 19;
\r
3652 SymbolKind.Key = 20;
\r
3653 SymbolKind.Null = 21;
\r
3654 SymbolKind.EnumMember = 22;
\r
3655 SymbolKind.Struct = 23;
\r
3656 SymbolKind.Event = 24;
\r
3657 SymbolKind.Operator = 25;
\r
3658 SymbolKind.TypeParameter = 26;
\r
3659 })(SymbolKind || (SymbolKind = {}));
\r
3661 * Symbol tags are extra annotations that tweak the rendering of a symbol.
\r
3665 (function (SymbolTag) {
\r
3667 * Render a symbol as obsolete, usually using a strike-out.
\r
3669 SymbolTag.Deprecated = 1;
\r
3670 })(SymbolTag || (SymbolTag = {}));
\r
3671 var SymbolInformation;
\r
3672 (function (SymbolInformation) {
\r
3674 * Creates a new symbol information literal.
\r
3676 * @param name The name of the symbol.
\r
3677 * @param kind The kind of the symbol.
\r
3678 * @param range The range of the location of the symbol.
\r
3679 * @param uri The resource of the location of symbol, defaults to the current document.
\r
3680 * @param containerName The name of the symbol containing the symbol.
\r
3682 function create(name, kind, range, uri, containerName) {
\r
3686 location: { uri: uri, range: range }
\r
3688 if (containerName) {
\r
3689 result.containerName = containerName;
\r
3693 SymbolInformation.create = create;
\r
3694 })(SymbolInformation || (SymbolInformation = {}));
\r
3695 var DocumentSymbol;
\r
3696 (function (DocumentSymbol) {
\r
3698 * Creates a new symbol information literal.
\r
3700 * @param name The name of the symbol.
\r
3701 * @param detail The detail of the symbol.
\r
3702 * @param kind The kind of the symbol.
\r
3703 * @param range The range of the symbol.
\r
3704 * @param selectionRange The selectionRange of the symbol.
\r
3705 * @param children Children of the symbol.
\r
3707 function create(name, detail, kind, range, selectionRange, children) {
\r
3713 selectionRange: selectionRange
\r
3715 if (children !== void 0) {
\r
3716 result.children = children;
\r
3720 DocumentSymbol.create = create;
\r
3722 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
\r
3724 function is(value) {
\r
3725 var candidate = value;
\r
3726 return candidate &&
\r
3727 Is.string(candidate.name) && Is.number(candidate.kind) &&
\r
3728 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
\r
3729 (candidate.detail === void 0 || Is.string(candidate.detail)) &&
\r
3730 (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
\r
3731 (candidate.children === void 0 || Array.isArray(candidate.children));
\r
3733 DocumentSymbol.is = is;
\r
3734 })(DocumentSymbol || (DocumentSymbol = {}));
\r
3736 * A set of predefined code action kinds
\r
3738 var CodeActionKind;
\r
3739 (function (CodeActionKind) {
\r
3743 CodeActionKind.Empty = '';
\r
3745 * Base kind for quickfix actions: 'quickfix'
\r
3747 CodeActionKind.QuickFix = 'quickfix';
\r
3749 * Base kind for refactoring actions: 'refactor'
\r
3751 CodeActionKind.Refactor = 'refactor';
\r
3753 * Base kind for refactoring extraction actions: 'refactor.extract'
\r
3755 * Example extract actions:
\r
3757 * - Extract method
\r
3758 * - Extract function
\r
3759 * - Extract variable
\r
3760 * - Extract interface from class
\r
3763 CodeActionKind.RefactorExtract = 'refactor.extract';
\r
3765 * Base kind for refactoring inline actions: 'refactor.inline'
\r
3767 * Example inline actions:
\r
3769 * - Inline function
\r
3770 * - Inline variable
\r
3771 * - Inline constant
\r
3774 CodeActionKind.RefactorInline = 'refactor.inline';
\r
3776 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
\r
3778 * Example rewrite actions:
\r
3780 * - Convert JavaScript function to class
\r
3781 * - Add or remove parameter
\r
3782 * - Encapsulate field
\r
3783 * - Make method static
\r
3784 * - Move method to base class
\r
3787 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
\r
3789 * Base kind for source actions: `source`
\r
3791 * Source code actions apply to the entire file.
\r
3793 CodeActionKind.Source = 'source';
\r
3795 * Base kind for an organize imports source action: `source.organizeImports`
\r
3797 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
\r
3799 * Base kind for auto-fix source actions: `source.fixAll`.
\r
3801 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
\r
3802 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
\r
3806 CodeActionKind.SourceFixAll = 'source.fixAll';
\r
3807 })(CodeActionKind || (CodeActionKind = {}));
\r
3809 * The CodeActionContext namespace provides helper functions to work with
\r
3810 * [CodeActionContext](#CodeActionContext) literals.
\r
3812 var CodeActionContext;
\r
3813 (function (CodeActionContext) {
\r
3815 * Creates a new CodeActionContext literal.
\r
3817 function create(diagnostics, only) {
\r
3818 var result = { diagnostics: diagnostics };
\r
3819 if (only !== void 0 && only !== null) {
\r
3820 result.only = only;
\r
3824 CodeActionContext.create = create;
\r
3826 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
\r
3828 function is(value) {
\r
3829 var candidate = value;
\r
3830 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
\r
3832 CodeActionContext.is = is;
\r
3833 })(CodeActionContext || (CodeActionContext = {}));
\r
3835 (function (CodeAction) {
\r
3836 function create(title, commandOrEdit, kind) {
\r
3837 var result = { title: title };
\r
3838 if (Command.is(commandOrEdit)) {
\r
3839 result.command = commandOrEdit;
\r
3842 result.edit = commandOrEdit;
\r
3844 if (kind !== void 0) {
\r
3845 result.kind = kind;
\r
3849 CodeAction.create = create;
\r
3850 function is(value) {
\r
3851 var candidate = value;
\r
3852 return candidate && Is.string(candidate.title) &&
\r
3853 (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
\r
3854 (candidate.kind === void 0 || Is.string(candidate.kind)) &&
\r
3855 (candidate.edit !== void 0 || candidate.command !== void 0) &&
\r
3856 (candidate.command === void 0 || Command.is(candidate.command)) &&
\r
3857 (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
\r
3858 (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
\r
3860 CodeAction.is = is;
\r
3861 })(CodeAction || (CodeAction = {}));
\r
3863 * The CodeLens namespace provides helper functions to work with
\r
3864 * [CodeLens](#CodeLens) literals.
\r
3867 (function (CodeLens) {
\r
3869 * Creates a new CodeLens literal.
\r
3871 function create(range, data) {
\r
3872 var result = { range: range };
\r
3873 if (Is.defined(data)) {
\r
3874 result.data = data;
\r
3878 CodeLens.create = create;
\r
3880 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
\r
3882 function is(value) {
\r
3883 var candidate = value;
\r
3884 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
\r
3887 })(CodeLens || (CodeLens = {}));
\r
3889 * The FormattingOptions namespace provides helper functions to work with
\r
3890 * [FormattingOptions](#FormattingOptions) literals.
\r
3892 var FormattingOptions;
\r
3893 (function (FormattingOptions) {
\r
3895 * Creates a new FormattingOptions literal.
\r
3897 function create(tabSize, insertSpaces) {
\r
3898 return { tabSize: tabSize, insertSpaces: insertSpaces };
\r
3900 FormattingOptions.create = create;
\r
3902 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
\r
3904 function is(value) {
\r
3905 var candidate = value;
\r
3906 return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
\r
3908 FormattingOptions.is = is;
\r
3909 })(FormattingOptions || (FormattingOptions = {}));
\r
3911 * The DocumentLink namespace provides helper functions to work with
\r
3912 * [DocumentLink](#DocumentLink) literals.
\r
3915 (function (DocumentLink) {
\r
3917 * Creates a new DocumentLink literal.
\r
3919 function create(range, target, data) {
\r
3920 return { range: range, target: target, data: data };
\r
3922 DocumentLink.create = create;
\r
3924 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
\r
3926 function is(value) {
\r
3927 var candidate = value;
\r
3928 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
\r
3930 DocumentLink.is = is;
\r
3931 })(DocumentLink || (DocumentLink = {}));
\r
3933 * The SelectionRange namespace provides helper function to work with
\r
3934 * SelectionRange literals.
\r
3936 var SelectionRange;
\r
3937 (function (SelectionRange) {
\r
3939 * Creates a new SelectionRange
\r
3940 * @param range the range.
\r
3941 * @param parent an optional parent.
\r
3943 function create(range, parent) {
\r
3944 return { range: range, parent: parent };
\r
3946 SelectionRange.create = create;
\r
3947 function is(value) {
\r
3948 var candidate = value;
\r
3949 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
\r
3951 SelectionRange.is = is;
\r
3952 })(SelectionRange || (SelectionRange = {}));
\r
3953 var EOL = ['\n', '\r\n', '\r'];
\r
3955 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
\r
3958 (function (TextDocument) {
\r
3960 * Creates a new ITextDocument literal from the given uri and content.
\r
3961 * @param uri The document's uri.
\r
3962 * @param languageId The document's language Id.
\r
3963 * @param content The document's content.
\r
3965 function create(uri, languageId, version, content) {
\r
3966 return new FullTextDocument(uri, languageId, version, content);
\r
3968 TextDocument.create = create;
\r
3970 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
\r
3972 function is(value) {
\r
3973 var candidate = value;
\r
3974 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
\r
3975 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
\r
3977 TextDocument.is = is;
\r
3978 function applyEdits(document, edits) {
\r
3979 var text = document.getText();
\r
3980 var sortedEdits = mergeSort(edits, function (a, b) {
\r
3981 var diff = a.range.start.line - b.range.start.line;
\r
3983 return a.range.start.character - b.range.start.character;
\r
3987 var lastModifiedOffset = text.length;
\r
3988 for (var i = sortedEdits.length - 1; i >= 0; i--) {
\r
3989 var e = sortedEdits[i];
\r
3990 var startOffset = document.offsetAt(e.range.start);
\r
3991 var endOffset = document.offsetAt(e.range.end);
\r
3992 if (endOffset <= lastModifiedOffset) {
\r
3993 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
\r
3996 throw new Error('Overlapping edit');
\r
3998 lastModifiedOffset = startOffset;
\r
4002 TextDocument.applyEdits = applyEdits;
\r
4003 function mergeSort(data, compare) {
\r
4004 if (data.length <= 1) {
\r
4008 var p = (data.length / 2) | 0;
\r
4009 var left = data.slice(0, p);
\r
4010 var right = data.slice(p);
\r
4011 mergeSort(left, compare);
\r
4012 mergeSort(right, compare);
\r
4016 while (leftIdx < left.length && rightIdx < right.length) {
\r
4017 var ret = compare(left[leftIdx], right[rightIdx]);
\r
4019 // smaller_equal -> take left to preserve order
\r
4020 data[i++] = left[leftIdx++];
\r
4023 // greater -> take right
\r
4024 data[i++] = right[rightIdx++];
\r
4027 while (leftIdx < left.length) {
\r
4028 data[i++] = left[leftIdx++];
\r
4030 while (rightIdx < right.length) {
\r
4031 data[i++] = right[rightIdx++];
\r
4035 })(TextDocument || (TextDocument = {}));
\r
4036 var FullTextDocument = /** @class */ (function () {
\r
4037 function FullTextDocument(uri, languageId, version, content) {
\r
4039 this._languageId = languageId;
\r
4040 this._version = version;
\r
4041 this._content = content;
\r
4042 this._lineOffsets = undefined;
\r
4044 Object.defineProperty(FullTextDocument.prototype, "uri", {
\r
4045 get: function () {
\r
4049 configurable: true
\r
4051 Object.defineProperty(FullTextDocument.prototype, "languageId", {
\r
4052 get: function () {
\r
4053 return this._languageId;
\r
4056 configurable: true
\r
4058 Object.defineProperty(FullTextDocument.prototype, "version", {
\r
4059 get: function () {
\r
4060 return this._version;
\r
4063 configurable: true
\r
4065 FullTextDocument.prototype.getText = function (range) {
\r
4067 var start = this.offsetAt(range.start);
\r
4068 var end = this.offsetAt(range.end);
\r
4069 return this._content.substring(start, end);
\r
4071 return this._content;
\r
4073 FullTextDocument.prototype.update = function (event, version) {
\r
4074 this._content = event.text;
\r
4075 this._version = version;
\r
4076 this._lineOffsets = undefined;
\r
4078 FullTextDocument.prototype.getLineOffsets = function () {
\r
4079 if (this._lineOffsets === undefined) {
\r
4080 var lineOffsets = [];
\r
4081 var text = this._content;
\r
4082 var isLineStart = true;
\r
4083 for (var i = 0; i < text.length; i++) {
\r
4084 if (isLineStart) {
\r
4085 lineOffsets.push(i);
\r
4086 isLineStart = false;
\r
4088 var ch = text.charAt(i);
\r
4089 isLineStart = (ch === '\r' || ch === '\n');
\r
4090 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
\r
4094 if (isLineStart && text.length > 0) {
\r
4095 lineOffsets.push(text.length);
\r
4097 this._lineOffsets = lineOffsets;
\r
4099 return this._lineOffsets;
\r
4101 FullTextDocument.prototype.positionAt = function (offset) {
\r
4102 offset = Math.max(Math.min(offset, this._content.length), 0);
\r
4103 var lineOffsets = this.getLineOffsets();
\r
4104 var low = 0, high = lineOffsets.length;
\r
4106 return Position.create(0, offset);
\r
4108 while (low < high) {
\r
4109 var mid = Math.floor((low + high) / 2);
\r
4110 if (lineOffsets[mid] > offset) {
\r
4117 // low is the least x for which the line offset is larger than the current offset
\r
4118 // or array.length if no line offset is larger than the current offset
\r
4119 var line = low - 1;
\r
4120 return Position.create(line, offset - lineOffsets[line]);
\r
4122 FullTextDocument.prototype.offsetAt = function (position) {
\r
4123 var lineOffsets = this.getLineOffsets();
\r
4124 if (position.line >= lineOffsets.length) {
\r
4125 return this._content.length;
\r
4127 else if (position.line < 0) {
\r
4130 var lineOffset = lineOffsets[position.line];
\r
4131 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
\r
4132 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
\r
4134 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
\r
4135 get: function () {
\r
4136 return this.getLineOffsets().length;
\r
4139 configurable: true
\r
4141 return FullTextDocument;
\r
4145 var toString = Object.prototype.toString;
\r
4146 function defined(value) {
\r
4147 return typeof value !== 'undefined';
\r
4149 Is.defined = defined;
\r
4150 function undefined(value) {
\r
4151 return typeof value === 'undefined';
\r
4153 Is.undefined = undefined;
\r
4154 function boolean(value) {
\r
4155 return value === true || value === false;
\r
4157 Is.boolean = boolean;
\r
4158 function string(value) {
\r
4159 return toString.call(value) === '[object String]';
\r
4161 Is.string = string;
\r
4162 function number(value) {
\r
4163 return toString.call(value) === '[object Number]';
\r
4165 Is.number = number;
\r
4166 function func(value) {
\r
4167 return toString.call(value) === '[object Function]';
\r
4170 function objectLiteral(value) {
\r
4171 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4172 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4173 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4174 return value !== null && typeof value === 'object';
\r
4176 Is.objectLiteral = objectLiteral;
\r
4177 function typedArray(value, check) {
\r
4178 return Array.isArray(value) && value.every(check);
\r
4180 Is.typedArray = typedArray;
\r
4181 })(Is || (Is = {}));
\r
4186 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4189 /* --------------------------------------------------------------------------------------------
\r
4190 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4191 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4192 * ------------------------------------------------------------------------------------------ */
\r
4194 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4195 const Is = __webpack_require__(19);
\r
4196 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
4197 const messages_1 = __webpack_require__(20);
\r
4198 const protocol_implementation_1 = __webpack_require__(21);
\r
4199 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;
\r
4200 const protocol_typeDefinition_1 = __webpack_require__(22);
\r
4201 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;
\r
4202 const protocol_workspaceFolders_1 = __webpack_require__(23);
\r
4203 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;
\r
4204 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
\r
4205 const protocol_configuration_1 = __webpack_require__(24);
\r
4206 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;
\r
4207 const protocol_colorProvider_1 = __webpack_require__(25);
\r
4208 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;
\r
4209 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;
\r
4210 const protocol_foldingRange_1 = __webpack_require__(26);
\r
4211 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;
\r
4212 const protocol_declaration_1 = __webpack_require__(27);
\r
4213 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;
\r
4214 const protocol_selectionRange_1 = __webpack_require__(28);
\r
4215 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;
\r
4216 const protocol_progress_1 = __webpack_require__(29);
\r
4217 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;
\r
4218 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;
\r
4219 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;
\r
4220 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4221 let __noDynamicImport;
\r
4223 * The DocumentFilter namespace provides helper functions to work with
\r
4224 * [DocumentFilter](#DocumentFilter) literals.
\r
4226 var DocumentFilter;
\r
4227 (function (DocumentFilter) {
\r
4228 function is(value) {
\r
4229 const candidate = value;
\r
4230 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
\r
4232 DocumentFilter.is = is;
\r
4233 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
\r
4235 * The DocumentSelector namespace provides helper functions to work with
\r
4236 * [DocumentSelector](#DocumentSelector)s.
\r
4238 var DocumentSelector;
\r
4239 (function (DocumentSelector) {
\r
4240 function is(value) {
\r
4241 if (!Array.isArray(value)) {
\r
4244 for (let elem of value) {
\r
4245 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
\r
4251 DocumentSelector.is = is;
\r
4252 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
\r
4254 * The `client/registerCapability` request is sent from the server to the client to register a new capability
\r
4255 * handler on the client side.
\r
4257 var RegistrationRequest;
\r
4258 (function (RegistrationRequest) {
\r
4259 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
\r
4260 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
\r
4262 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
\r
4263 * handler on the client side.
\r
4265 var UnregistrationRequest;
\r
4266 (function (UnregistrationRequest) {
\r
4267 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
\r
4268 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
\r
4269 var ResourceOperationKind;
\r
4270 (function (ResourceOperationKind) {
\r
4272 * Supports creating new files and folders.
\r
4274 ResourceOperationKind.Create = 'create';
\r
4276 * Supports renaming existing files and folders.
\r
4278 ResourceOperationKind.Rename = 'rename';
\r
4280 * Supports deleting existing files and folders.
\r
4282 ResourceOperationKind.Delete = 'delete';
\r
4283 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
\r
4284 var FailureHandlingKind;
\r
4285 (function (FailureHandlingKind) {
\r
4287 * Applying the workspace change is simply aborted if one of the changes provided
\r
4288 * fails. All operations executed before the failing operation stay executed.
\r
4290 FailureHandlingKind.Abort = 'abort';
\r
4292 * All operations are executed transactional. That means they either all
\r
4293 * succeed or no changes at all are applied to the workspace.
\r
4295 FailureHandlingKind.Transactional = 'transactional';
\r
4297 * If the workspace edit contains only textual file changes they are executed transactional.
\r
4298 * If resource changes (create, rename or delete file) are part of the change the failure
\r
4299 * handling startegy is abort.
\r
4301 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
\r
4303 * The client tries to undo the operations already executed. But there is no
\r
4304 * guarantee that this is succeeding.
\r
4306 FailureHandlingKind.Undo = 'undo';
\r
4307 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
\r
4309 * The StaticRegistrationOptions namespace provides helper functions to work with
\r
4310 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
\r
4312 var StaticRegistrationOptions;
\r
4313 (function (StaticRegistrationOptions) {
\r
4314 function hasId(value) {
\r
4315 const candidate = value;
\r
4316 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
\r
4318 StaticRegistrationOptions.hasId = hasId;
\r
4319 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
\r
4321 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
\r
4322 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
\r
4324 var TextDocumentRegistrationOptions;
\r
4325 (function (TextDocumentRegistrationOptions) {
\r
4326 function is(value) {
\r
4327 const candidate = value;
\r
4328 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
\r
4330 TextDocumentRegistrationOptions.is = is;
\r
4331 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
\r
4333 * The WorkDoneProgressOptions namespace provides helper functions to work with
\r
4334 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
\r
4336 var WorkDoneProgressOptions;
\r
4337 (function (WorkDoneProgressOptions) {
\r
4338 function is(value) {
\r
4339 const candidate = value;
\r
4340 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
\r
4342 WorkDoneProgressOptions.is = is;
\r
4343 function hasWorkDoneProgress(value) {
\r
4344 const candidate = value;
\r
4345 return candidate && Is.boolean(candidate.workDoneProgress);
\r
4347 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
\r
4348 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
\r
4350 * The initialize request is sent from the client to the server.
\r
4351 * It is sent once as the request after starting up the server.
\r
4352 * The requests parameter is of type [InitializeParams](#InitializeParams)
\r
4353 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
\r
4354 * resolves to such.
\r
4356 var InitializeRequest;
\r
4357 (function (InitializeRequest) {
\r
4358 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
\r
4359 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
\r
4361 * Known error codes for an `InitializeError`;
\r
4363 var InitializeError;
\r
4364 (function (InitializeError) {
\r
4366 * If the protocol version provided by the client can't be handled by the server.
\r
4367 * @deprecated This initialize error got replaced by client capabilities. There is
\r
4368 * no version handshake in version 3.0x
\r
4370 InitializeError.unknownProtocolVersion = 1;
\r
4371 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
\r
4373 * The intialized notification is sent from the client to the
\r
4374 * server after the client is fully initialized and the server
\r
4375 * is allowed to send requests from the server to the client.
\r
4377 var InitializedNotification;
\r
4378 (function (InitializedNotification) {
\r
4379 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
\r
4380 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
\r
4381 //---- Shutdown Method ----
\r
4383 * A shutdown request is sent from the client to the server.
\r
4384 * It is sent once when the client decides to shutdown the
\r
4385 * server. The only notification that is sent after a shutdown request
\r
4386 * is the exit event.
\r
4388 var ShutdownRequest;
\r
4389 (function (ShutdownRequest) {
\r
4390 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
\r
4391 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
\r
4392 //---- Exit Notification ----
\r
4394 * The exit event is sent from the client to the server to
\r
4395 * ask the server to exit its process.
\r
4397 var ExitNotification;
\r
4398 (function (ExitNotification) {
\r
4399 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
\r
4400 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
\r
4402 * The configuration change notification is sent from the client to the server
\r
4403 * when the client's configuration has changed. The notification contains
\r
4404 * the changed configuration as defined by the language client.
\r
4406 var DidChangeConfigurationNotification;
\r
4407 (function (DidChangeConfigurationNotification) {
\r
4408 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
\r
4409 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
\r
4410 //---- Message show and log notifications ----
\r
4412 * The message type
\r
4415 (function (MessageType) {
\r
4417 * An error message.
\r
4419 MessageType.Error = 1;
\r
4421 * A warning message.
\r
4423 MessageType.Warning = 2;
\r
4425 * An information message.
\r
4427 MessageType.Info = 3;
\r
4431 MessageType.Log = 4;
\r
4432 })(MessageType = exports.MessageType || (exports.MessageType = {}));
\r
4434 * The show message notification is sent from a server to a client to ask
\r
4435 * the client to display a particular message in the user interface.
\r
4437 var ShowMessageNotification;
\r
4438 (function (ShowMessageNotification) {
\r
4439 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
\r
4440 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
\r
4442 * The show message request is sent from the server to the client to show a message
\r
4443 * and a set of options actions to the user.
\r
4445 var ShowMessageRequest;
\r
4446 (function (ShowMessageRequest) {
\r
4447 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
\r
4448 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
\r
4450 * The log message notification is sent from the server to the client to ask
\r
4451 * the client to log a particular message.
\r
4453 var LogMessageNotification;
\r
4454 (function (LogMessageNotification) {
\r
4455 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
\r
4456 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
\r
4457 //---- Telemetry notification
\r
4459 * The telemetry event notification is sent from the server to the client to ask
\r
4460 * the client to log telemetry data.
\r
4462 var TelemetryEventNotification;
\r
4463 (function (TelemetryEventNotification) {
\r
4464 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
\r
4465 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
\r
4467 * Defines how the host (editor) should sync
\r
4468 * document changes to the language server.
\r
4470 var TextDocumentSyncKind;
\r
4471 (function (TextDocumentSyncKind) {
\r
4473 * Documents should not be synced at all.
\r
4475 TextDocumentSyncKind.None = 0;
\r
4477 * Documents are synced by always sending the full content
\r
4478 * of the document.
\r
4480 TextDocumentSyncKind.Full = 1;
\r
4482 * Documents are synced by sending the full content on open.
\r
4483 * After that only incremental updates to the document are
\r
4486 TextDocumentSyncKind.Incremental = 2;
\r
4487 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
\r
4489 * The document open notification is sent from the client to the server to signal
\r
4490 * newly opened text documents. The document's truth is now managed by the client
\r
4491 * and the server must not try to read the document's truth using the document's
\r
4492 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
\r
4493 * mean that its content is presented in an editor. An open notification must not
\r
4494 * be sent more than once without a corresponding close notification send before.
\r
4495 * This means open and close notification must be balanced and the max open count
\r
4498 var DidOpenTextDocumentNotification;
\r
4499 (function (DidOpenTextDocumentNotification) {
\r
4500 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
\r
4501 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
\r
4502 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
\r
4504 * The document change notification is sent from the client to the server to signal
\r
4505 * changes to a text document.
\r
4507 var DidChangeTextDocumentNotification;
\r
4508 (function (DidChangeTextDocumentNotification) {
\r
4509 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
\r
4510 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
\r
4511 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
\r
4513 * The document close notification is sent from the client to the server when
\r
4514 * the document got closed in the client. The document's truth now exists where
\r
4515 * the document's uri points to (e.g. if the document's uri is a file uri the
\r
4516 * truth now exists on disk). As with the open notification the close notification
\r
4517 * is about managing the document's content. Receiving a close notification
\r
4518 * doesn't mean that the document was open in an editor before. A close
\r
4519 * notification requires a previous open notification to be sent.
\r
4521 var DidCloseTextDocumentNotification;
\r
4522 (function (DidCloseTextDocumentNotification) {
\r
4523 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
\r
4524 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
\r
4525 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
\r
4527 * The document save notification is sent from the client to the server when
\r
4528 * the document got saved in the client.
\r
4530 var DidSaveTextDocumentNotification;
\r
4531 (function (DidSaveTextDocumentNotification) {
\r
4532 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
\r
4533 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
\r
4534 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
\r
4536 * Represents reasons why a text document is saved.
\r
4538 var TextDocumentSaveReason;
\r
4539 (function (TextDocumentSaveReason) {
\r
4541 * Manually triggered, e.g. by the user pressing save, by starting debugging,
\r
4542 * or by an API call.
\r
4544 TextDocumentSaveReason.Manual = 1;
\r
4546 * Automatic after a delay.
\r
4548 TextDocumentSaveReason.AfterDelay = 2;
\r
4550 * When the editor lost focus.
\r
4552 TextDocumentSaveReason.FocusOut = 3;
\r
4553 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
\r
4555 * A document will save notification is sent from the client to the server before
\r
4556 * the document is actually saved.
\r
4558 var WillSaveTextDocumentNotification;
\r
4559 (function (WillSaveTextDocumentNotification) {
\r
4560 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
\r
4561 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
\r
4562 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
\r
4564 * A document will save request is sent from the client to the server before
\r
4565 * the document is actually saved. The request can return an array of TextEdits
\r
4566 * which will be applied to the text document before it is saved. Please note that
\r
4567 * clients might drop results if computing the text edits took too long or if a
\r
4568 * server constantly fails on this request. This is done to keep the save fast and
\r
4571 var WillSaveTextDocumentWaitUntilRequest;
\r
4572 (function (WillSaveTextDocumentWaitUntilRequest) {
\r
4573 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
\r
4574 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
\r
4575 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
\r
4577 * The watched files notification is sent from the client to the server when
\r
4578 * the client detects changes to file watched by the language client.
\r
4580 var DidChangeWatchedFilesNotification;
\r
4581 (function (DidChangeWatchedFilesNotification) {
\r
4582 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
\r
4583 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
\r
4585 * The file event type
\r
4587 var FileChangeType;
\r
4588 (function (FileChangeType) {
\r
4590 * The file got created.
\r
4592 FileChangeType.Created = 1;
\r
4594 * The file got changed.
\r
4596 FileChangeType.Changed = 2;
\r
4598 * The file got deleted.
\r
4600 FileChangeType.Deleted = 3;
\r
4601 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
\r
4603 (function (WatchKind) {
\r
4605 * Interested in create events.
\r
4607 WatchKind.Create = 1;
\r
4609 * Interested in change events
\r
4611 WatchKind.Change = 2;
\r
4613 * Interested in delete events
\r
4615 WatchKind.Delete = 4;
\r
4616 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
\r
4618 * Diagnostics notification are sent from the server to the client to signal
\r
4619 * results of validation runs.
\r
4621 var PublishDiagnosticsNotification;
\r
4622 (function (PublishDiagnosticsNotification) {
\r
4623 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
\r
4624 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
\r
4626 * How a completion was triggered
\r
4628 var CompletionTriggerKind;
\r
4629 (function (CompletionTriggerKind) {
\r
4631 * Completion was triggered by typing an identifier (24x7 code
\r
4632 * complete), manual invocation (e.g Ctrl+Space) or via API.
\r
4634 CompletionTriggerKind.Invoked = 1;
\r
4636 * Completion was triggered by a trigger character specified by
\r
4637 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
\r
4639 CompletionTriggerKind.TriggerCharacter = 2;
\r
4641 * Completion was re-triggered as current completion list is incomplete
\r
4643 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
\r
4644 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
\r
4646 * Request to request completion at a given text document position. The request's
\r
4647 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
\r
4648 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
\r
4649 * or a Thenable that resolves to such.
\r
4651 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
\r
4652 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
\r
4653 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
\r
4654 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
\r
4656 var CompletionRequest;
\r
4657 (function (CompletionRequest) {
\r
4658 CompletionRequest.method = 'textDocument/completion';
\r
4659 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
\r
4660 /** @deprecated Use CompletionRequest.type */
\r
4661 CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4662 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
\r
4664 * Request to resolve additional information for a given completion item.The request's
\r
4665 * parameter is of type [CompletionItem](#CompletionItem) the response
\r
4666 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
\r
4668 var CompletionResolveRequest;
\r
4669 (function (CompletionResolveRequest) {
\r
4670 CompletionResolveRequest.method = 'completionItem/resolve';
\r
4671 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
\r
4672 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
\r
4674 * Request to request hover information at a given text document position. The request's
\r
4675 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
\r
4676 * type [Hover](#Hover) or a Thenable that resolves to such.
\r
4679 (function (HoverRequest) {
\r
4680 HoverRequest.method = 'textDocument/hover';
\r
4681 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
\r
4682 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
\r
4684 * How a signature help was triggered.
\r
4688 var SignatureHelpTriggerKind;
\r
4689 (function (SignatureHelpTriggerKind) {
\r
4691 * Signature help was invoked manually by the user or by a command.
\r
4693 SignatureHelpTriggerKind.Invoked = 1;
\r
4695 * Signature help was triggered by a trigger character.
\r
4697 SignatureHelpTriggerKind.TriggerCharacter = 2;
\r
4699 * Signature help was triggered by the cursor moving or by the document content changing.
\r
4701 SignatureHelpTriggerKind.ContentChange = 3;
\r
4702 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
\r
4703 var SignatureHelpRequest;
\r
4704 (function (SignatureHelpRequest) {
\r
4705 SignatureHelpRequest.method = 'textDocument/signatureHelp';
\r
4706 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
\r
4707 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
\r
4709 * A request to resolve the definition location of a symbol at a given text
\r
4710 * document position. The request's parameter is of type [TextDocumentPosition]
\r
4711 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
\r
4712 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
\r
4715 var DefinitionRequest;
\r
4716 (function (DefinitionRequest) {
\r
4717 DefinitionRequest.method = 'textDocument/definition';
\r
4718 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
\r
4719 /** @deprecated Use DefinitionRequest.type */
\r
4720 DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4721 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
\r
4723 * A request to resolve project-wide references for the symbol denoted
\r
4724 * by the given text document position. The request's parameter is of
\r
4725 * type [ReferenceParams](#ReferenceParams) the response is of type
\r
4726 * [Location[]](#Location) or a Thenable that resolves to such.
\r
4728 var ReferencesRequest;
\r
4729 (function (ReferencesRequest) {
\r
4730 ReferencesRequest.method = 'textDocument/references';
\r
4731 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
\r
4732 /** @deprecated Use ReferencesRequest.type */
\r
4733 ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4734 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
\r
4736 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
\r
4737 * text document position. The request's parameter is of type [TextDocumentPosition]
\r
4738 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
\r
4739 * (#DocumentHighlight) or a Thenable that resolves to such.
\r
4741 var DocumentHighlightRequest;
\r
4742 (function (DocumentHighlightRequest) {
\r
4743 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
\r
4744 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
\r
4745 /** @deprecated Use DocumentHighlightRequest.type */
\r
4746 DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4747 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
\r
4749 * A request to list all symbols found in a given text document. The request's
\r
4750 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
\r
4751 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
\r
4752 * that resolves to such.
\r
4754 var DocumentSymbolRequest;
\r
4755 (function (DocumentSymbolRequest) {
\r
4756 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
\r
4757 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
\r
4758 /** @deprecated Use DocumentSymbolRequest.type */
\r
4759 DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4760 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
\r
4762 * A request to provide commands for the given text document and range.
\r
4764 var CodeActionRequest;
\r
4765 (function (CodeActionRequest) {
\r
4766 CodeActionRequest.method = 'textDocument/codeAction';
\r
4767 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
\r
4768 /** @deprecated Use CodeActionRequest.type */
\r
4769 CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4770 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
\r
4772 * A request to list project-wide symbols matching the query string given
\r
4773 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
\r
4774 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
\r
4775 * resolves to such.
\r
4777 var WorkspaceSymbolRequest;
\r
4778 (function (WorkspaceSymbolRequest) {
\r
4779 WorkspaceSymbolRequest.method = 'workspace/symbol';
\r
4780 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
\r
4781 /** @deprecated Use WorkspaceSymbolRequest.type */
\r
4782 WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4783 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
\r
4785 * A request to provide code lens for the given text document.
\r
4787 var CodeLensRequest;
\r
4788 (function (CodeLensRequest) {
\r
4789 CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');
\r
4790 /** @deprecated Use CodeLensRequest.type */
\r
4791 CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4792 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
\r
4794 * A request to resolve a command for a given code lens.
\r
4796 var CodeLensResolveRequest;
\r
4797 (function (CodeLensResolveRequest) {
\r
4798 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');
\r
4799 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
\r
4801 * A request to provide document links
\r
4803 var DocumentLinkRequest;
\r
4804 (function (DocumentLinkRequest) {
\r
4805 DocumentLinkRequest.method = 'textDocument/documentLink';
\r
4806 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
\r
4807 /** @deprecated Use DocumentLinkRequest.type */
\r
4808 DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4809 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
\r
4811 * Request to resolve additional information for a given document link. The request's
\r
4812 * parameter is of type [DocumentLink](#DocumentLink) the response
\r
4813 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
\r
4815 var DocumentLinkResolveRequest;
\r
4816 (function (DocumentLinkResolveRequest) {
\r
4817 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');
\r
4818 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
\r
4820 * A request to to format a whole document.
\r
4822 var DocumentFormattingRequest;
\r
4823 (function (DocumentFormattingRequest) {
\r
4824 DocumentFormattingRequest.method = 'textDocument/formatting';
\r
4825 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
\r
4826 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
\r
4828 * A request to to format a range in a document.
\r
4830 var DocumentRangeFormattingRequest;
\r
4831 (function (DocumentRangeFormattingRequest) {
\r
4832 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
\r
4833 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
\r
4834 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
\r
4836 * A request to format a document on type.
\r
4838 var DocumentOnTypeFormattingRequest;
\r
4839 (function (DocumentOnTypeFormattingRequest) {
\r
4840 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
\r
4841 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
\r
4842 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
\r
4844 * A request to rename a symbol.
\r
4846 var RenameRequest;
\r
4847 (function (RenameRequest) {
\r
4848 RenameRequest.method = 'textDocument/rename';
\r
4849 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
\r
4850 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
\r
4852 * A request to test and perform the setup necessary for a rename.
\r
4854 var PrepareRenameRequest;
\r
4855 (function (PrepareRenameRequest) {
\r
4856 PrepareRenameRequest.method = 'textDocument/prepareRename';
\r
4857 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
\r
4858 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
\r
4860 * A request send from the client to the server to execute a command. The request might return
\r
4861 * a workspace edit which the client will apply to the workspace.
\r
4863 var ExecuteCommandRequest;
\r
4864 (function (ExecuteCommandRequest) {
\r
4865 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
\r
4866 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
\r
4868 * A request sent from the server to the client to modified certain resources.
\r
4870 var ApplyWorkspaceEditRequest;
\r
4871 (function (ApplyWorkspaceEditRequest) {
\r
4872 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
\r
4873 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
\r
4878 /***/ ((__unused_webpack_module, exports) => {
4881 /* --------------------------------------------------------------------------------------------
\r
4882 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4883 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4884 * ------------------------------------------------------------------------------------------ */
\r
4886 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4887 function boolean(value) {
\r
4888 return value === true || value === false;
\r
4890 exports.boolean = boolean;
\r
4891 function string(value) {
\r
4892 return typeof value === 'string' || value instanceof String;
\r
4894 exports.string = string;
\r
4895 function number(value) {
\r
4896 return typeof value === 'number' || value instanceof Number;
\r
4898 exports.number = number;
\r
4899 function error(value) {
\r
4900 return value instanceof Error;
\r
4902 exports.error = error;
\r
4903 function func(value) {
\r
4904 return typeof value === 'function';
\r
4906 exports.func = func;
\r
4907 function array(value) {
\r
4908 return Array.isArray(value);
\r
4910 exports.array = array;
\r
4911 function stringArray(value) {
\r
4912 return array(value) && value.every(elem => string(elem));
\r
4914 exports.stringArray = stringArray;
\r
4915 function typedArray(value, check) {
\r
4916 return Array.isArray(value) && value.every(check);
\r
4918 exports.typedArray = typedArray;
\r
4919 function objectLiteral(value) {
\r
4920 // Strictly speaking class instances pass this check as well. Since the LSP
\r
4921 // doesn't use classes we ignore this for now. If we do we need to add something
\r
4922 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
\r
4923 return value !== null && typeof value === 'object';
\r
4925 exports.objectLiteral = objectLiteral;
\r
4930 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4933 /* --------------------------------------------------------------------------------------------
\r
4934 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4935 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4936 * ------------------------------------------------------------------------------------------ */
\r
4938 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4939 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
4940 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
\r
4941 constructor(method) {
\r
4945 exports.ProtocolRequestType0 = ProtocolRequestType0;
\r
4946 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
\r
4947 constructor(method) {
\r
4951 exports.ProtocolRequestType = ProtocolRequestType;
\r
4952 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
\r
4953 constructor(method) {
\r
4957 exports.ProtocolNotificationType = ProtocolNotificationType;
\r
4958 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
\r
4959 constructor(method) {
\r
4963 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
\r
4968 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4971 /* --------------------------------------------------------------------------------------------
\r
4972 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4973 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
4974 * ------------------------------------------------------------------------------------------ */
\r
4976 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
4977 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
4978 const messages_1 = __webpack_require__(20);
\r
4979 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
4980 let __noDynamicImport;
\r
4982 * A request to resolve the implementation locations of a symbol at a given text
\r
4983 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
4984 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
4985 * Thenable that resolves to such.
\r
4987 var ImplementationRequest;
\r
4988 (function (ImplementationRequest) {
\r
4989 ImplementationRequest.method = 'textDocument/implementation';
\r
4990 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
\r
4991 /** @deprecated Use ImplementationRequest.type */
\r
4992 ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
4993 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
\r
4998 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5001 /* --------------------------------------------------------------------------------------------
\r
5002 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5003 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5004 * ------------------------------------------------------------------------------------------ */
\r
5006 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5007 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5008 const messages_1 = __webpack_require__(20);
\r
5009 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5010 let __noDynamicImport;
\r
5012 * A request to resolve the type definition locations of a symbol at a given text
\r
5013 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5014 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
\r
5015 * Thenable that resolves to such.
\r
5017 var TypeDefinitionRequest;
\r
5018 (function (TypeDefinitionRequest) {
\r
5019 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
\r
5020 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
\r
5021 /** @deprecated Use TypeDefinitionRequest.type */
\r
5022 TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5023 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
\r
5028 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5031 /* --------------------------------------------------------------------------------------------
\r
5032 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5033 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5034 * ------------------------------------------------------------------------------------------ */
\r
5036 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5037 const messages_1 = __webpack_require__(20);
\r
5039 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
\r
5041 var WorkspaceFoldersRequest;
\r
5042 (function (WorkspaceFoldersRequest) {
\r
5043 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
\r
5044 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
\r
5046 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
\r
5047 * folder configuration changes.
\r
5049 var DidChangeWorkspaceFoldersNotification;
\r
5050 (function (DidChangeWorkspaceFoldersNotification) {
\r
5051 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
\r
5052 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
\r
5057 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5060 /* --------------------------------------------------------------------------------------------
\r
5061 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5062 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5063 * ------------------------------------------------------------------------------------------ */
\r
5065 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5066 const messages_1 = __webpack_require__(20);
\r
5068 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
\r
5069 * configuration setting.
\r
5071 * This pull model replaces the old push model were the client signaled configuration change via an
\r
5072 * event. If the server still needs to react to configuration changes (since the server caches the
\r
5073 * result of `workspace/configuration` requests) the server should register for an empty configuration
\r
5074 * change event and empty the cache if such an event is received.
\r
5076 var ConfigurationRequest;
\r
5077 (function (ConfigurationRequest) {
\r
5078 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
\r
5079 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
\r
5084 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5087 /* --------------------------------------------------------------------------------------------
\r
5088 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5089 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5090 * ------------------------------------------------------------------------------------------ */
\r
5092 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5093 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5094 const messages_1 = __webpack_require__(20);
\r
5096 * A request to list all color symbols found in a given text document. The request's
\r
5097 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
\r
5098 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5099 * that resolves to such.
\r
5101 var DocumentColorRequest;
\r
5102 (function (DocumentColorRequest) {
\r
5103 DocumentColorRequest.method = 'textDocument/documentColor';
\r
5104 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
\r
5105 /** @deprecated Use DocumentColorRequest.type */
\r
5106 DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5107 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
\r
5109 * A request to list all presentation for a color. The request's
\r
5110 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
\r
5111 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
\r
5112 * that resolves to such.
\r
5114 var ColorPresentationRequest;
\r
5115 (function (ColorPresentationRequest) {
\r
5116 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
\r
5117 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
\r
5122 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5126 /*---------------------------------------------------------------------------------------------
\r
5127 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5128 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5129 *--------------------------------------------------------------------------------------------*/
\r
5130 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5131 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5132 const messages_1 = __webpack_require__(20);
\r
5134 * Enum of known range kinds
\r
5136 var FoldingRangeKind;
\r
5137 (function (FoldingRangeKind) {
\r
5139 * Folding range for a comment
\r
5141 FoldingRangeKind["Comment"] = "comment";
\r
5143 * Folding range for a imports or includes
\r
5145 FoldingRangeKind["Imports"] = "imports";
\r
5147 * Folding range for a region (e.g. `#region`)
\r
5149 FoldingRangeKind["Region"] = "region";
\r
5150 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
\r
5152 * A request to provide folding ranges in a document. The request's
\r
5153 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
\r
5154 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
\r
5155 * that resolves to such.
\r
5157 var FoldingRangeRequest;
\r
5158 (function (FoldingRangeRequest) {
\r
5159 FoldingRangeRequest.method = 'textDocument/foldingRange';
\r
5160 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
\r
5161 /** @deprecated Use FoldingRangeRequest.type */
\r
5162 FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5163 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
\r
5168 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5171 /* --------------------------------------------------------------------------------------------
\r
5172 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5173 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5174 * ------------------------------------------------------------------------------------------ */
\r
5176 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5177 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5178 const messages_1 = __webpack_require__(20);
\r
5179 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
\r
5180 let __noDynamicImport;
\r
5182 * A request to resolve the type definition locations of a symbol at a given text
\r
5183 * document position. The request's parameter is of type [TextDocumentPositioParams]
\r
5184 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
\r
5185 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
\r
5188 var DeclarationRequest;
\r
5189 (function (DeclarationRequest) {
\r
5190 DeclarationRequest.method = 'textDocument/declaration';
\r
5191 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
\r
5192 /** @deprecated Use DeclarationRequest.type */
\r
5193 DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5194 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
\r
5199 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5203 /*---------------------------------------------------------------------------------------------
\r
5204 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5205 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5206 *--------------------------------------------------------------------------------------------*/
\r
5207 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5208 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5209 const messages_1 = __webpack_require__(20);
\r
5211 * A request to provide selection ranges in a document. The request's
\r
5212 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
\r
5213 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
\r
5214 * that resolves to such.
\r
5216 var SelectionRangeRequest;
\r
5217 (function (SelectionRangeRequest) {
\r
5218 SelectionRangeRequest.method = 'textDocument/selectionRange';
\r
5219 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
\r
5220 /** @deprecated Use SelectionRangeRequest.type */
\r
5221 SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
\r
5222 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
\r
5227 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5230 /* --------------------------------------------------------------------------------------------
\r
5231 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5232 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5233 * ------------------------------------------------------------------------------------------ */
\r
5235 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5236 const vscode_jsonrpc_1 = __webpack_require__(3);
\r
5237 const messages_1 = __webpack_require__(20);
\r
5238 var WorkDoneProgress;
\r
5239 (function (WorkDoneProgress) {
\r
5240 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
\r
5241 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
\r
5243 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
\r
5244 * reporting from the server.
\r
5246 var WorkDoneProgressCreateRequest;
\r
5247 (function (WorkDoneProgressCreateRequest) {
\r
5248 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
\r
5249 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
\r
5251 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
\r
5252 * initiated on the server side.
\r
5254 var WorkDoneProgressCancelNotification;
\r
5255 (function (WorkDoneProgressCancelNotification) {
\r
5256 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
\r
5257 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
\r
5262 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5265 /* --------------------------------------------------------------------------------------------
\r
5266 * Copyright (c) TypeFox and others. All rights reserved.
\r
5267 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5268 * ------------------------------------------------------------------------------------------ */
\r
5270 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5271 const messages_1 = __webpack_require__(20);
\r
5273 * A request to result a `CallHierarchyItem` in a document at a given position.
\r
5274 * Can be used as an input to a incoming or outgoing call hierarchy.
\r
5276 * @since 3.16.0 - Proposed state
\r
5278 var CallHierarchyPrepareRequest;
\r
5279 (function (CallHierarchyPrepareRequest) {
\r
5280 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
\r
5281 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
\r
5282 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
\r
5284 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
\r
5286 * @since 3.16.0 - Proposed state
\r
5288 var CallHierarchyIncomingCallsRequest;
\r
5289 (function (CallHierarchyIncomingCallsRequest) {
\r
5290 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
\r
5291 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
\r
5292 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
\r
5294 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
\r
5296 * @since 3.16.0 - Proposed state
\r
5298 var CallHierarchyOutgoingCallsRequest;
\r
5299 (function (CallHierarchyOutgoingCallsRequest) {
\r
5300 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
\r
5301 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
\r
5302 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
\r
5307 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5310 /* --------------------------------------------------------------------------------------------
\r
5311 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5312 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5313 * ------------------------------------------------------------------------------------------ */
\r
5315 Object.defineProperty(exports, "__esModule", ({ value: true }));
\r
5316 const messages_1 = __webpack_require__(20);
\r
5318 * A set of predefined token types. This set is not fixed
\r
5319 * an clients can specify additional token types via the
\r
5320 * corresponding client capabilities.
\r
5322 * @since 3.16.0 - Proposed state
\r
5324 var SemanticTokenTypes;
\r
5325 (function (SemanticTokenTypes) {
\r
5326 SemanticTokenTypes["comment"] = "comment";
\r
5327 SemanticTokenTypes["keyword"] = "keyword";
\r
5328 SemanticTokenTypes["string"] = "string";
\r
5329 SemanticTokenTypes["number"] = "number";
\r
5330 SemanticTokenTypes["regexp"] = "regexp";
\r
5331 SemanticTokenTypes["operator"] = "operator";
\r
5332 SemanticTokenTypes["namespace"] = "namespace";
\r
5333 SemanticTokenTypes["type"] = "type";
\r
5334 SemanticTokenTypes["struct"] = "struct";
\r
5335 SemanticTokenTypes["class"] = "class";
\r
5336 SemanticTokenTypes["interface"] = "interface";
\r
5337 SemanticTokenTypes["enum"] = "enum";
\r
5338 SemanticTokenTypes["typeParameter"] = "typeParameter";
\r
5339 SemanticTokenTypes["function"] = "function";
\r
5340 SemanticTokenTypes["member"] = "member";
\r
5341 SemanticTokenTypes["property"] = "property";
\r
5342 SemanticTokenTypes["macro"] = "macro";
\r
5343 SemanticTokenTypes["variable"] = "variable";
\r
5344 SemanticTokenTypes["parameter"] = "parameter";
\r
5345 SemanticTokenTypes["label"] = "label";
\r
5346 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
\r
5348 * A set of predefined token modifiers. This set is not fixed
\r
5349 * an clients can specify additional token types via the
\r
5350 * corresponding client capabilities.
\r
5352 * @since 3.16.0 - Proposed state
\r
5354 var SemanticTokenModifiers;
\r
5355 (function (SemanticTokenModifiers) {
\r
5356 SemanticTokenModifiers["documentation"] = "documentation";
\r
5357 SemanticTokenModifiers["declaration"] = "declaration";
\r
5358 SemanticTokenModifiers["definition"] = "definition";
\r
5359 SemanticTokenModifiers["reference"] = "reference";
\r
5360 SemanticTokenModifiers["static"] = "static";
\r
5361 SemanticTokenModifiers["abstract"] = "abstract";
\r
5362 SemanticTokenModifiers["deprecated"] = "deprecated";
\r
5363 SemanticTokenModifiers["async"] = "async";
\r
5364 SemanticTokenModifiers["volatile"] = "volatile";
\r
5365 SemanticTokenModifiers["readonly"] = "readonly";
\r
5366 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
\r
5368 * @since 3.16.0 - Proposed state
\r
5370 var SemanticTokens;
\r
5371 (function (SemanticTokens) {
\r
5372 function is(value) {
\r
5373 const candidate = value;
\r
5374 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
\r
5375 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
\r
5377 SemanticTokens.is = is;
\r
5378 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
\r
5380 * @since 3.16.0 - Proposed state
\r
5382 var SemanticTokensRequest;
\r
5383 (function (SemanticTokensRequest) {
\r
5384 SemanticTokensRequest.method = 'textDocument/semanticTokens';
\r
5385 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
\r
5386 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
\r
5388 * @since 3.16.0 - Proposed state
\r
5390 var SemanticTokensEditsRequest;
\r
5391 (function (SemanticTokensEditsRequest) {
\r
5392 SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';
\r
5393 SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);
\r
5394 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));
\r
5396 * @since 3.16.0 - Proposed state
\r
5398 var SemanticTokensRangeRequest;
\r
5399 (function (SemanticTokensRangeRequest) {
\r
5400 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
\r
5401 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
\r
5402 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
\r
5407 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5411 Object.defineProperty(exports, "__esModule", ({ value: true }));
5412 const coc_nvim_1 = __webpack_require__(1);
5413 const prettier = __webpack_require__(33);
5415 * Prettier reads configuration from files
5417 const PRETTIER_CONFIG_FILES = [
5424 'prettier.config.js',
5427 * Create a file watcher. Clears prettier's configuration cache on
5428 * file change, create, delete.
5429 * @returns disposable file system watcher.
5431 function fileListener() {
5432 const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(`**/{${PRETTIER_CONFIG_FILES.join(',')}}`);
5433 fileWatcher.onDidChange(prettier.clearConfigCache);
5434 fileWatcher.onDidCreate(prettier.clearConfigCache);
5435 fileWatcher.onDidDelete(prettier.clearConfigCache);
5438 exports.default = fileListener;
5443 /***/ ((module) => {
5446 module.exports = require("prettier");;
5450 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5454 Object.defineProperty(exports, "__esModule", ({ value: true }));
5455 exports.setupErrorHandler = exports.safeExecution = exports.addToOutput = void 0;
5456 const coc_nvim_1 = __webpack_require__(1);
5459 * Adds the filepath to the error message
5461 * @param msg The original error message
5462 * @param fileName The path to the file
5463 * @returns {string} enhanced message with the filename
5465 function addFilePath(msg, fileName) {
5466 const lines = msg.split('\n');
5467 if (lines.length > 0) {
5468 lines[0] = lines[0].replace(/(\d*):(\d*)/g, `${fileName}:$1:$2`);
5469 return lines.join('\n');
5474 * Append messages to the output channel and format it with a title
5476 * @param message The message to append to the output channel
5478 function addToOutput(message, type = 'Trace') {
5481 const title = `${type} - ${new Date().toLocaleString()}:`;
5482 // Create a sort of title, to differentiate between messages
5483 outputChannel.appendLine('');
5484 // Append actual output
5485 outputChannel.appendLine(`[${title}] ${message}\n`);
5487 exports.addToOutput = addToOutput;
5489 * Execute a callback safely, if it doesn't work, return default and log messages.
5491 * @param cb The function to be executed,
5492 * @param defaultText The default value if execution of the cb failed
5493 * @param fileName The filename of the current document
5494 * @returns {string} formatted text or defaultText
5496 function safeExecution(cb, defaultText, fileName) {
5497 if (cb instanceof Promise) {
5499 .then(returnValue => {
5500 // updateStatusBar('Prettier: $(check)')
5504 addToOutput(addFilePath(err.message, fileName), 'Error');
5505 // updateStatusBar('Prettier: $(x)')
5510 const returnValue = cb();
5511 // updateStatusBar('Prettier: $(check)')
5515 addToOutput(addFilePath(err.message, fileName), 'Error');
5516 // updateStatusBar('Prettier: $(x)')
5520 exports.safeExecution = safeExecution;
5522 * Setup the output channel and the statusBarItem.
5523 * Create a command to show the output channel
5525 * @returns {Disposable} The command to open the output channel
5527 function setupErrorHandler() {
5528 // Setup the outputChannel
5529 outputChannel = coc_nvim_1.workspace.createOutputChannel('prettier');
5530 return coc_nvim_1.commands.registerCommand('prettier.open-output', () => {
5531 outputChannel.show();
5534 exports.setupErrorHandler = setupErrorHandler;
5539 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5543 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5544 if (k2 === undefined) k2 = k;
5545 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5546 }) : (function(o, m, k, k2) {
5547 if (k2 === undefined) k2 = k;
5550 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5551 Object.defineProperty(o, "default", { enumerable: true, value: v });
5552 }) : function(o, v) {
5555 var __importStar = (this && this.__importStar) || function (mod) {
5556 if (mod && mod.__esModule) return mod;
5558 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5559 __setModuleDefault(result, mod);
5562 Object.defineProperty(exports, "__esModule", ({ value: true }));
5563 const coc_nvim_1 = __webpack_require__(1);
5564 const fs_1 = __webpack_require__(36);
5565 const path = __importStar(__webpack_require__(12));
5566 const errorHandler_1 = __webpack_require__(34);
5567 const utils_1 = __webpack_require__(37);
5568 const ignore = __webpack_require__(84);
5569 const nullIgnorer = { ignores: () => false };
5571 * Create an ignore file handler. Will lazily read ignore files on a per-resource
5572 * basis, and cache the contents until it changes.
5574 function ignoreFileHandler(disposables) {
5575 const ignorers = new Map();
5576 disposables.push({ dispose: () => ignorers.clear() });
5578 fileIsIgnored(filePath) {
5579 const { ignorer, ignoreFilePath } = getIgnorerForFile(filePath);
5580 return ignorer.ignores(path.relative(path.dirname(ignoreFilePath), filePath));
5583 function getIgnorerForFile(fsPath) {
5584 const absolutePath = getIgnorePathForFile(fsPath, utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath);
5585 if (!absolutePath) {
5586 return { ignoreFilePath: '', ignorer: nullIgnorer };
5588 if (!ignorers.has(absolutePath)) {
5589 loadIgnorer(coc_nvim_1.Uri.file(absolutePath));
5591 if (!fs_1.existsSync(absolutePath)) {
5592 // Don't log default value.
5593 const ignorePath = utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath;
5594 if (ignorePath !== '.prettierignore') {
5595 errorHandler_1.addToOutput(`Wrong prettier.ignorePath provided in your settings. The path (${ignorePath}) does not exist.`, 'Warning');
5597 return { ignoreFilePath: '', ignorer: nullIgnorer };
5600 ignoreFilePath: absolutePath,
5601 ignorer: ignorers.get(absolutePath),
5604 function loadIgnorer(ignoreUri) {
5605 let ignorer = nullIgnorer;
5606 if (!ignorers.has(ignoreUri.fsPath)) {
5607 const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(ignoreUri.fsPath);
5608 disposables.push(fileWatcher);
5609 fileWatcher.onDidCreate(loadIgnorer, null, disposables);
5610 fileWatcher.onDidChange(loadIgnorer, null, disposables);
5611 fileWatcher.onDidDelete(unloadIgnorer, null, disposables);
5613 if (fs_1.existsSync(ignoreUri.fsPath)) {
5614 const ignoreFileContents = fs_1.readFileSync(ignoreUri.fsPath, 'utf8');
5615 ignorer = ignore().add(ignoreFileContents);
5617 ignorers.set(ignoreUri.fsPath, ignorer);
5619 function unloadIgnorer(ignoreUri) {
5620 ignorers.set(ignoreUri.fsPath, nullIgnorer);
5623 function getIgnorePathForFile(_filePath, ignorePath) {
5624 // Configuration `prettier.ignorePath` is set to `null`
5628 if (coc_nvim_1.workspace.workspaceFolder) {
5629 const folder = coc_nvim_1.workspace.workspaceFolder;
5630 return folder ? getPath(ignorePath, coc_nvim_1.Uri.parse(folder.uri).fsPath) : null;
5634 function getPath(fsPath, relativeTo) {
5635 return path.isAbsolute(fsPath) ? fsPath : path.join(relativeTo, fsPath);
5637 exports.default = ignoreFileHandler;
5642 /***/ ((module) => {
5645 module.exports = require("fs");;
5649 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5653 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5654 if (k2 === undefined) k2 = k;
5655 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5656 }) : (function(o, m, k, k2) {
5657 if (k2 === undefined) k2 = k;
5660 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5661 Object.defineProperty(o, "default", { enumerable: true, value: v });
5662 }) : function(o, v) {
5665 var __importStar = (this && this.__importStar) || function (mod) {
5666 if (mod && mod.__esModule) return mod;
5668 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5669 __setModuleDefault(result, mod);
5672 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5673 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5674 return new (P || (P = Promise))(function (resolve, reject) {
5675 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5676 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5677 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5678 step((generator = generator.apply(thisArg, _arguments || [])).next());
5681 var __importDefault = (this && this.__importDefault) || function (mod) {
5682 return (mod && mod.__esModule) ? mod : { "default": mod };
5684 Object.defineProperty(exports, "__esModule", ({ value: true }));
5685 exports.hasLocalPrettierInstalled = exports.getGroup = exports.rangeLanguages = exports.enabledLanguages = exports.allLanguages = exports.getParsersFromLanguageId = exports.getPrettierInstance = exports.getConfig = void 0;
5686 const coc_nvim_1 = __webpack_require__(1);
5687 const path_1 = __importStar(__webpack_require__(12));
5688 const requirePkg_1 = __webpack_require__(38);
5689 const errorHandler_1 = __webpack_require__(34);
5690 const semver_1 = __importDefault(__webpack_require__(41));
5691 function getConfig(uri) {
5692 return coc_nvim_1.workspace.getConfiguration('prettier', uri ? uri.toString() : undefined);
5694 exports.getConfig = getConfig;
5695 function getPrettierInstance() {
5696 return __awaiter(this, void 0, void 0, function* () {
5697 const document = yield coc_nvim_1.workspace.document;
5698 const uri = coc_nvim_1.Uri.parse(document.uri);
5699 const fileName = uri.fsPath;
5700 const vscodeConfig = getConfig(uri);
5701 const localOnly = vscodeConfig.onlyUseLocalVersion;
5702 const resolvedPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(fileName), 'prettier', { silent: true, ignoreBundled: localOnly }));
5703 if (!resolvedPrettier) {
5704 errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
5706 return resolvedPrettier;
5709 exports.getPrettierInstance = getPrettierInstance;
5710 function getParsersFromLanguageId(languageId, prettierInstance, path) {
5711 const supportedLanguages = getSupportLanguages(prettierInstance);
5712 const language = supportedLanguages.find(lang => Array.isArray(lang.vscodeLanguageIds) &&
5713 lang.vscodeLanguageIds.includes(languageId) &&
5714 // Only for some specific filenames
5715 (lang.extensions.length > 0 ||
5717 lang.filenames != null &&
5718 lang.filenames.includes(path_1.basename(path)))));
5722 return language.parsers;
5724 exports.getParsersFromLanguageId = getParsersFromLanguageId;
5725 function allLanguages(prettierInstance) {
5726 const supportedLanguages = getSupportLanguages(prettierInstance);
5727 return supportedLanguages.reduce((ids, language) => [...ids, ...(language.vscodeLanguageIds || [])], []);
5729 exports.allLanguages = allLanguages;
5730 function enabledLanguages(prettierInstance) {
5731 const { disableLanguages } = getConfig();
5732 const languages = allLanguages(prettierInstance);
5733 return languages.filter(x => disableLanguages.indexOf(x) == -1);
5735 exports.enabledLanguages = enabledLanguages;
5736 function rangeLanguages() {
5737 const { disableLanguages } = getConfig();
5745 ].filter(x => disableLanguages.indexOf(x) == -1);
5747 exports.rangeLanguages = rangeLanguages;
5748 function getGroup(group, prettierInstance) {
5749 const supportedLanguages = getSupportLanguages(prettierInstance);
5750 return supportedLanguages.filter(language => language.group === group);
5752 exports.getGroup = getGroup;
5753 function getSupportLanguages(prettierInstance) {
5754 if (semver_1.default.gte(prettierInstance.version, '2.0.0')) {
5755 return prettierInstance.getSupportInfo({
5756 showUnreleased: true
5759 return prettierInstance.getSupportInfo().languages;
5761 function hasLocalPrettierInstalled(filePath) {
5762 const localPrettier = requirePkg_1.requireLocalPkg(filePath, 'prettier', {
5764 ignoreBundled: true,
5766 return localPrettier != null;
5768 exports.hasLocalPrettierInstalled = hasLocalPrettierInstalled;
5773 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5777 var __importDefault = (this && this.__importDefault) || function (mod) {
5778 return (mod && mod.__esModule) ? mod : { "default": mod };
5780 Object.defineProperty(exports, "__esModule", ({ value: true }));
5781 exports.requireLocalPkg = void 0;
5782 const errorHandler_1 = __webpack_require__(34);
5783 const resolve_from_1 = __importDefault(__webpack_require__(39));
5784 const requireFunc = true ? require : 0;
5786 * Require package explicitly installed relative to given path.
5787 * Fallback to bundled one if no package was found bottom up.
5788 * @param {string} fspath file system path starting point to resolve package
5789 * @param {string} pkgName package's name to require
5792 function requireLocalPkg(fspath, pkgName, options = { silent: true, ignoreBundled: false }) {
5793 let modulePath = resolve_from_1.default.silent(fspath, pkgName);
5794 if (modulePath !== void 0) {
5796 return requireFunc(modulePath);
5799 if (!options.silent) {
5800 errorHandler_1.addToOutput(`Failed to load require ${pkgName} from ${modulePath}.${options.ignoreBundled ? `` : ` Using bundled`}`, 'Error');
5804 return options.ignoreBundled ? null : requireFunc(pkgName);
5806 exports.requireLocalPkg = requireLocalPkg;
5811 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5815 const path = __webpack_require__(12);
5816 const Module = __webpack_require__(40);
5817 const fs = __webpack_require__(36);
5819 const resolveFrom = (fromDirectory, moduleId, silent) => {
5820 if (typeof fromDirectory !== 'string') {
5821 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
5824 if (typeof moduleId !== 'string') {
5825 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
5829 fromDirectory = fs.realpathSync(fromDirectory);
5831 if (error.code === 'ENOENT') {
5832 fromDirectory = path.resolve(fromDirectory);
5833 } else if (silent) {
5840 const fromFile = path.join(fromDirectory, 'noop.js');
5842 const resolveFileName = () => Module._resolveFilename(moduleId, {
5845 paths: Module._nodeModulePaths(fromDirectory)
5850 return resolveFileName();
5856 return resolveFileName();
5859 module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
5860 module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);
5865 /***/ ((module) => {
5868 module.exports = require("module");;
5872 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5874 // just pre-load all the stuff that index.js lazily exports
5875 const internalRe = __webpack_require__(42)
5878 src: internalRe.src,
5879 tokens: internalRe.t,
5880 SEMVER_SPEC_VERSION: __webpack_require__(43).SEMVER_SPEC_VERSION,
5881 SemVer: __webpack_require__(45),
5882 compareIdentifiers: __webpack_require__(46).compareIdentifiers,
5883 rcompareIdentifiers: __webpack_require__(46).rcompareIdentifiers,
5884 parse: __webpack_require__(47),
5885 valid: __webpack_require__(48),
5886 clean: __webpack_require__(49),
5887 inc: __webpack_require__(50),
5888 diff: __webpack_require__(51),
5889 major: __webpack_require__(54),
5890 minor: __webpack_require__(55),
5891 patch: __webpack_require__(56),
5892 prerelease: __webpack_require__(57),
5893 compare: __webpack_require__(53),
5894 rcompare: __webpack_require__(58),
5895 compareLoose: __webpack_require__(59),
5896 compareBuild: __webpack_require__(60),
5897 sort: __webpack_require__(61),
5898 rsort: __webpack_require__(62),
5899 gt: __webpack_require__(63),
5900 lt: __webpack_require__(64),
5901 eq: __webpack_require__(52),
5902 neq: __webpack_require__(65),
5903 gte: __webpack_require__(66),
5904 lte: __webpack_require__(67),
5905 cmp: __webpack_require__(68),
5906 coerce: __webpack_require__(69),
5907 Comparator: __webpack_require__(70),
5908 Range: __webpack_require__(71),
5909 satisfies: __webpack_require__(72),
5910 toComparators: __webpack_require__(73),
5911 maxSatisfying: __webpack_require__(74),
5912 minSatisfying: __webpack_require__(75),
5913 minVersion: __webpack_require__(76),
5914 validRange: __webpack_require__(77),
5915 outside: __webpack_require__(78),
5916 gtr: __webpack_require__(79),
5917 ltr: __webpack_require__(80),
5918 intersects: __webpack_require__(81),
5919 simplifyRange: __webpack_require__(82),
5920 subset: __webpack_require__(83),
5926 /***/ ((module, exports, __webpack_require__) => {
5928 const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(43)
5929 const debug = __webpack_require__(44)
5930 exports = module.exports = {}
5932 // The actual regexps go on exports.re
5933 const re = exports.re = []
5934 const src = exports.src = []
5935 const t = exports.t = {}
5938 const createToken = (name, value, isGlobal) => {
5943 re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
5946 // The following Regular Expressions can be used for tokenizing,
5947 // validating, and parsing SemVer version strings.
5949 // ## Numeric Identifier
5950 // A single `0`, or a non-zero digit followed by zero or more digits.
5952 createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
5953 createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
5955 // ## Non-numeric Identifier
5956 // Zero or more digits, followed by a letter or hyphen, and then zero or
5957 // more letters, digits, or hyphens.
5959 createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
5962 // Three dot-separated numeric identifiers.
5964 createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
5965 `(${src[t.NUMERICIDENTIFIER]})\\.` +
5966 `(${src[t.NUMERICIDENTIFIER]})`)
5968 createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
5969 `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
5970 `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
5972 // ## Pre-release Version Identifier
5973 // A numeric identifier, or a non-numeric identifier.
5975 createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
5976 }|${src[t.NONNUMERICIDENTIFIER]})`)
5978 createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
5979 }|${src[t.NONNUMERICIDENTIFIER]})`)
5981 // ## Pre-release Version
5982 // Hyphen, followed by one or more dot-separated pre-release version
5985 createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
5986 }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
5988 createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
5989 }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
5991 // ## Build Metadata Identifier
5992 // Any combination of digits, letters, or hyphens.
5994 createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
5996 // ## Build Metadata
5997 // Plus sign, followed by one or more period-separated build metadata
6000 createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
6001 }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
6003 // ## Full Version String
6004 // A main version, followed optionally by a pre-release version and
6007 // Note that the only major, minor, patch, and pre-release sections of
6008 // the version string are capturing groups. The build metadata is not a
6009 // capturing group, because it should not ever be used in version
6012 createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
6013 }${src[t.PRERELEASE]}?${
6016 createToken('FULL', `^${src[t.FULLPLAIN]}$`)
6018 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
6019 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
6020 // common in the npm registry.
6021 createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
6022 }${src[t.PRERELEASELOOSE]}?${
6025 createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
6027 createToken('GTLT', '((?:<|>)?=?)')
6029 // Something like "2.*" or "1.2.x".
6030 // Note that "x.x" is a valid xRange identifer, meaning "any version"
6031 // Only the first item is strictly required.
6032 createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
6033 createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
6035 createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
6036 `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
6037 `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
6038 `(?:${src[t.PRERELEASE]})?${
6042 createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6043 `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6044 `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6045 `(?:${src[t.PRERELEASELOOSE]})?${
6049 createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
6050 createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
6053 // Extract anything that could conceivably be a part of a valid semver
6054 createToken('COERCE', `${'(^|[^\\d])' +
6055 '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
6056 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
6057 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
6059 createToken('COERCERTL', src[t.COERCE], true)
6062 // Meaning is "reasonably at or greater than"
6063 createToken('LONETILDE', '(?:~>?)')
6065 createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
6066 exports.tildeTrimReplace = '$1~'
6068 createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
6069 createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
6072 // Meaning is "at least and backwards compatible with"
6073 createToken('LONECARET', '(?:\\^)')
6075 createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
6076 exports.caretTrimReplace = '$1^'
6078 createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
6079 createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
6081 // A simple gt/lt/eq thing, or just "" to indicate "any version"
6082 createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
6083 createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
6085 // An expression to strip any whitespace between the gtlt and the thing
6086 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
6087 createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
6088 }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
6089 exports.comparatorTrimReplace = '$1$2$3'
6091 // Something like `1.2.3 - 1.2.4`
6092 // Note that these all use the loose form, because they'll be
6093 // checked against either the strict or loose comparator form
6095 createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
6097 `(${src[t.XRANGEPLAIN]})` +
6100 createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
6102 `(${src[t.XRANGEPLAINLOOSE]})` +
6105 // Star ranges basically just allow anything at all.
6106 createToken('STAR', '(<|>)?=?\\s*\\*')
6107 // >=0.0.0 is like a star
6108 createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
6109 createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
6114 /***/ ((module) => {
6116 // Note: this is the semver.org version of the spec that it implements
6117 // Not necessarily the package version of this code.
6118 const SEMVER_SPEC_VERSION = '2.0.0'
6120 const MAX_LENGTH = 256
6121 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
6122 /* istanbul ignore next */ 9007199254740991
6124 // Max safe segment length for coercion.
6125 const MAX_SAFE_COMPONENT_LENGTH = 16
6128 SEMVER_SPEC_VERSION,
6131 MAX_SAFE_COMPONENT_LENGTH
6137 /***/ ((module) => {
6140 typeof process === 'object' &&
6142 process.env.NODE_DEBUG &&
6143 /\bsemver\b/i.test(process.env.NODE_DEBUG)
6144 ) ? (...args) => console.error('SEMVER', ...args)
6147 module.exports = debug
6152 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6154 const debug = __webpack_require__(44)
6155 const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(43)
6156 const { re, t } = __webpack_require__(42)
6158 const { compareIdentifiers } = __webpack_require__(46)
6160 constructor (version, options) {
6161 if (!options || typeof options !== 'object') {
6164 includePrerelease: false
6167 if (version instanceof SemVer) {
6168 if (version.loose === !!options.loose &&
6169 version.includePrerelease === !!options.includePrerelease) {
6172 version = version.version
6174 } else if (typeof version !== 'string') {
6175 throw new TypeError(`Invalid Version: ${version}`)
6178 if (version.length > MAX_LENGTH) {
6179 throw new TypeError(
6180 `version is longer than ${MAX_LENGTH} characters`
6184 debug('SemVer', version, options)
6185 this.options = options
6186 this.loose = !!options.loose
6187 // this isn't actually relevant for versions, but keep it so that we
6188 // don't run into trouble passing this.options around.
6189 this.includePrerelease = !!options.includePrerelease
6191 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
6194 throw new TypeError(`Invalid Version: ${version}`)
6199 // these are actually numbers
6204 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
6205 throw new TypeError('Invalid major version')
6208 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
6209 throw new TypeError('Invalid minor version')
6212 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
6213 throw new TypeError('Invalid patch version')
6216 // numberify any prerelease numeric ids
6218 this.prerelease = []
6220 this.prerelease = m[4].split('.').map((id) => {
6221 if (/^[0-9]+$/.test(id)) {
6223 if (num >= 0 && num < MAX_SAFE_INTEGER) {
6231 this.build = m[5] ? m[5].split('.') : []
6236 this.version = `${this.major}.${this.minor}.${this.patch}`
6237 if (this.prerelease.length) {
6238 this.version += `-${this.prerelease.join('.')}`
6248 debug('SemVer.compare', this.version, this.options, other)
6249 if (!(other instanceof SemVer)) {
6250 if (typeof other === 'string' && other === this.version) {
6253 other = new SemVer(other, this.options)
6256 if (other.version === this.version) {
6260 return this.compareMain(other) || this.comparePre(other)
6263 compareMain (other) {
6264 if (!(other instanceof SemVer)) {
6265 other = new SemVer(other, this.options)
6269 compareIdentifiers(this.major, other.major) ||
6270 compareIdentifiers(this.minor, other.minor) ||
6271 compareIdentifiers(this.patch, other.patch)
6275 comparePre (other) {
6276 if (!(other instanceof SemVer)) {
6277 other = new SemVer(other, this.options)
6280 // NOT having a prerelease is > having one
6281 if (this.prerelease.length && !other.prerelease.length) {
6283 } else if (!this.prerelease.length && other.prerelease.length) {
6285 } else if (!this.prerelease.length && !other.prerelease.length) {
6291 const a = this.prerelease[i]
6292 const b = other.prerelease[i]
6293 debug('prerelease compare', i, a, b)
6294 if (a === undefined && b === undefined) {
6296 } else if (b === undefined) {
6298 } else if (a === undefined) {
6300 } else if (a === b) {
6303 return compareIdentifiers(a, b)
6308 compareBuild (other) {
6309 if (!(other instanceof SemVer)) {
6310 other = new SemVer(other, this.options)
6315 const a = this.build[i]
6316 const b = other.build[i]
6317 debug('prerelease compare', i, a, b)
6318 if (a === undefined && b === undefined) {
6320 } else if (b === undefined) {
6322 } else if (a === undefined) {
6324 } else if (a === b) {
6327 return compareIdentifiers(a, b)
6332 // preminor will bump the version up to the next minor release, and immediately
6333 // down to pre-release. premajor and prepatch work the same way.
6334 inc (release, identifier) {
6337 this.prerelease.length = 0
6341 this.inc('pre', identifier)
6344 this.prerelease.length = 0
6347 this.inc('pre', identifier)
6350 // If this is already a prerelease, it will bump to the next version
6351 // drop any prereleases that might already exist, since they are not
6352 // relevant at this point.
6353 this.prerelease.length = 0
6354 this.inc('patch', identifier)
6355 this.inc('pre', identifier)
6357 // If the input is a non-prerelease version, this acts the same as
6360 if (this.prerelease.length === 0) {
6361 this.inc('patch', identifier)
6363 this.inc('pre', identifier)
6367 // If this is a pre-major version, bump up to the same major version.
6368 // Otherwise increment major.
6369 // 1.0.0-5 bumps to 1.0.0
6370 // 1.1.0 bumps to 2.0.0
6374 this.prerelease.length === 0
6380 this.prerelease = []
6383 // If this is a pre-minor version, bump up to the same minor version.
6384 // Otherwise increment minor.
6385 // 1.2.0-5 bumps to 1.2.0
6386 // 1.2.1 bumps to 1.3.0
6387 if (this.patch !== 0 || this.prerelease.length === 0) {
6391 this.prerelease = []
6394 // If this is not a pre-release version, it will increment the patch.
6395 // If it is a pre-release it will bump up to the same patch version.
6396 // 1.2.0-5 patches to 1.2.0
6397 // 1.2.0 patches to 1.2.1
6398 if (this.prerelease.length === 0) {
6401 this.prerelease = []
6403 // This probably shouldn't be used publicly.
6404 // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
6406 if (this.prerelease.length === 0) {
6407 this.prerelease = [0]
6409 let i = this.prerelease.length
6411 if (typeof this.prerelease[i] === 'number') {
6412 this.prerelease[i]++
6417 // didn't increment anything
6418 this.prerelease.push(0)
6422 // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
6423 // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
6424 if (this.prerelease[0] === identifier) {
6425 if (isNaN(this.prerelease[1])) {
6426 this.prerelease = [identifier, 0]
6429 this.prerelease = [identifier, 0]
6435 throw new Error(`invalid increment argument: ${release}`)
6438 this.raw = this.version
6443 module.exports = SemVer
6448 /***/ ((module) => {
6450 const numeric = /^[0-9]+$/
6451 const compareIdentifiers = (a, b) => {
6452 const anum = numeric.test(a)
6453 const bnum = numeric.test(b)
6461 : (anum && !bnum) ? -1
6462 : (bnum && !anum) ? 1
6467 const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
6477 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6479 const {MAX_LENGTH} = __webpack_require__(43)
6480 const { re, t } = __webpack_require__(42)
6481 const SemVer = __webpack_require__(45)
6483 const parse = (version, options) => {
6484 if (!options || typeof options !== 'object') {
6487 includePrerelease: false
6491 if (version instanceof SemVer) {
6495 if (typeof version !== 'string') {
6499 if (version.length > MAX_LENGTH) {
6503 const r = options.loose ? re[t.LOOSE] : re[t.FULL]
6504 if (!r.test(version)) {
6509 return new SemVer(version, options)
6515 module.exports = parse
6520 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6522 const parse = __webpack_require__(47)
6523 const valid = (version, options) => {
6524 const v = parse(version, options)
6525 return v ? v.version : null
6527 module.exports = valid
6532 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6534 const parse = __webpack_require__(47)
6535 const clean = (version, options) => {
6536 const s = parse(version.trim().replace(/^[=v]+/, ''), options)
6537 return s ? s.version : null
6539 module.exports = clean
6544 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6546 const SemVer = __webpack_require__(45)
6548 const inc = (version, release, options, identifier) => {
6549 if (typeof (options) === 'string') {
6550 identifier = options
6555 return new SemVer(version, options).inc(release, identifier).version
6560 module.exports = inc
6565 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6567 const parse = __webpack_require__(47)
6568 const eq = __webpack_require__(52)
6570 const diff = (version1, version2) => {
6571 if (eq(version1, version2)) {
6574 const v1 = parse(version1)
6575 const v2 = parse(version2)
6576 const hasPre = v1.prerelease.length || v2.prerelease.length
6577 const prefix = hasPre ? 'pre' : ''
6578 const defaultResult = hasPre ? 'prerelease' : ''
6579 for (const key in v1) {
6580 if (key === 'major' || key === 'minor' || key === 'patch') {
6581 if (v1[key] !== v2[key]) {
6586 return defaultResult // may be undefined
6589 module.exports = diff
6594 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6596 const compare = __webpack_require__(53)
6597 const eq = (a, b, loose) => compare(a, b, loose) === 0
6603 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6605 const SemVer = __webpack_require__(45)
6606 const compare = (a, b, loose) =>
6607 new SemVer(a, loose).compare(new SemVer(b, loose))
6609 module.exports = compare
6614 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6616 const SemVer = __webpack_require__(45)
6617 const major = (a, loose) => new SemVer(a, loose).major
6618 module.exports = major
6623 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6625 const SemVer = __webpack_require__(45)
6626 const minor = (a, loose) => new SemVer(a, loose).minor
6627 module.exports = minor
6632 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6634 const SemVer = __webpack_require__(45)
6635 const patch = (a, loose) => new SemVer(a, loose).patch
6636 module.exports = patch
6641 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6643 const parse = __webpack_require__(47)
6644 const prerelease = (version, options) => {
6645 const parsed = parse(version, options)
6646 return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
6648 module.exports = prerelease
6653 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6655 const compare = __webpack_require__(53)
6656 const rcompare = (a, b, loose) => compare(b, a, loose)
6657 module.exports = rcompare
6662 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6664 const compare = __webpack_require__(53)
6665 const compareLoose = (a, b) => compare(a, b, true)
6666 module.exports = compareLoose
6671 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6673 const SemVer = __webpack_require__(45)
6674 const compareBuild = (a, b, loose) => {
6675 const versionA = new SemVer(a, loose)
6676 const versionB = new SemVer(b, loose)
6677 return versionA.compare(versionB) || versionA.compareBuild(versionB)
6679 module.exports = compareBuild
6684 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6686 const compareBuild = __webpack_require__(60)
6687 const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
6688 module.exports = sort
6693 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6695 const compareBuild = __webpack_require__(60)
6696 const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
6697 module.exports = rsort
6702 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6704 const compare = __webpack_require__(53)
6705 const gt = (a, b, loose) => compare(a, b, loose) > 0
6711 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6713 const compare = __webpack_require__(53)
6714 const lt = (a, b, loose) => compare(a, b, loose) < 0
6720 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6722 const compare = __webpack_require__(53)
6723 const neq = (a, b, loose) => compare(a, b, loose) !== 0
6724 module.exports = neq
6729 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6731 const compare = __webpack_require__(53)
6732 const gte = (a, b, loose) => compare(a, b, loose) >= 0
6733 module.exports = gte
6738 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6740 const compare = __webpack_require__(53)
6741 const lte = (a, b, loose) => compare(a, b, loose) <= 0
6742 module.exports = lte
6747 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6749 const eq = __webpack_require__(52)
6750 const neq = __webpack_require__(65)
6751 const gt = __webpack_require__(63)
6752 const gte = __webpack_require__(66)
6753 const lt = __webpack_require__(64)
6754 const lte = __webpack_require__(67)
6756 const cmp = (a, op, b, loose) => {
6759 if (typeof a === 'object')
6761 if (typeof b === 'object')
6766 if (typeof a === 'object')
6768 if (typeof b === 'object')
6775 return eq(a, b, loose)
6778 return neq(a, b, loose)
6781 return gt(a, b, loose)
6784 return gte(a, b, loose)
6787 return lt(a, b, loose)
6790 return lte(a, b, loose)
6793 throw new TypeError(`Invalid operator: ${op}`)
6796 module.exports = cmp
6801 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6803 const SemVer = __webpack_require__(45)
6804 const parse = __webpack_require__(47)
6805 const {re, t} = __webpack_require__(42)
6807 const coerce = (version, options) => {
6808 if (version instanceof SemVer) {
6812 if (typeof version === 'number') {
6813 version = String(version)
6816 if (typeof version !== 'string') {
6820 options = options || {}
6824 match = version.match(re[t.COERCE])
6826 // Find the right-most coercible string that does not share
6827 // a terminus with a more left-ward coercible string.
6828 // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
6830 // Walk through the string checking with a /g regexp
6831 // Manually set the index so as to pick up overlapping matches.
6832 // Stop when we get a match that ends at the string end, since no
6833 // coercible string can be more right-ward without the same terminus.
6835 while ((next = re[t.COERCERTL].exec(version)) &&
6836 (!match || match.index + match[0].length !== version.length)
6839 next.index + next[0].length !== match.index + match[0].length) {
6842 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
6844 // leave it in a clean state
6845 re[t.COERCERTL].lastIndex = -1
6851 return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
6853 module.exports = coerce
6858 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6860 const ANY = Symbol('SemVer ANY')
6861 // hoisted class for cyclic dependency
6866 constructor (comp, options) {
6867 if (!options || typeof options !== 'object') {
6870 includePrerelease: false
6874 if (comp instanceof Comparator) {
6875 if (comp.loose === !!options.loose) {
6882 debug('comparator', comp, options)
6883 this.options = options
6884 this.loose = !!options.loose
6887 if (this.semver === ANY) {
6890 this.value = this.operator + this.semver.version
6897 const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
6898 const m = comp.match(r)
6901 throw new TypeError(`Invalid comparator: ${comp}`)
6904 this.operator = m[1] !== undefined ? m[1] : ''
6905 if (this.operator === '=') {
6909 // if it literally is just '>' or '' then allow anything.
6913 this.semver = new SemVer(m[2], this.options.loose)
6922 debug('Comparator.test', version, this.options.loose)
6924 if (this.semver === ANY || version === ANY) {
6928 if (typeof version === 'string') {
6930 version = new SemVer(version, this.options)
6936 return cmp(version, this.operator, this.semver, this.options)
6939 intersects (comp, options) {
6940 if (!(comp instanceof Comparator)) {
6941 throw new TypeError('a Comparator is required')
6944 if (!options || typeof options !== 'object') {
6947 includePrerelease: false
6951 if (this.operator === '') {
6952 if (this.value === '') {
6955 return new Range(comp.value, options).test(this.value)
6956 } else if (comp.operator === '') {
6957 if (comp.value === '') {
6960 return new Range(this.value, options).test(comp.semver)
6963 const sameDirectionIncreasing =
6964 (this.operator === '>=' || this.operator === '>') &&
6965 (comp.operator === '>=' || comp.operator === '>')
6966 const sameDirectionDecreasing =
6967 (this.operator === '<=' || this.operator === '<') &&
6968 (comp.operator === '<=' || comp.operator === '<')
6969 const sameSemVer = this.semver.version === comp.semver.version
6970 const differentDirectionsInclusive =
6971 (this.operator === '>=' || this.operator === '<=') &&
6972 (comp.operator === '>=' || comp.operator === '<=')
6973 const oppositeDirectionsLessThan =
6974 cmp(this.semver, '<', comp.semver, options) &&
6975 (this.operator === '>=' || this.operator === '>') &&
6976 (comp.operator === '<=' || comp.operator === '<')
6977 const oppositeDirectionsGreaterThan =
6978 cmp(this.semver, '>', comp.semver, options) &&
6979 (this.operator === '<=' || this.operator === '<') &&
6980 (comp.operator === '>=' || comp.operator === '>')
6983 sameDirectionIncreasing ||
6984 sameDirectionDecreasing ||
6985 (sameSemVer && differentDirectionsInclusive) ||
6986 oppositeDirectionsLessThan ||
6987 oppositeDirectionsGreaterThan
6992 module.exports = Comparator
6994 const {re, t} = __webpack_require__(42)
6995 const cmp = __webpack_require__(68)
6996 const debug = __webpack_require__(44)
6997 const SemVer = __webpack_require__(45)
6998 const Range = __webpack_require__(71)
7003 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7005 // hoisted class for cyclic dependency
7007 constructor (range, options) {
7008 if (!options || typeof options !== 'object') {
7011 includePrerelease: false
7015 if (range instanceof Range) {
7017 range.loose === !!options.loose &&
7018 range.includePrerelease === !!options.includePrerelease
7022 return new Range(range.raw, options)
7026 if (range instanceof Comparator) {
7027 // just put it in the set and return
7028 this.raw = range.value
7029 this.set = [[range]]
7034 this.options = options
7035 this.loose = !!options.loose
7036 this.includePrerelease = !!options.includePrerelease
7038 // First, split based on boolean or ||
7041 .split(/\s*\|\|\s*/)
7042 // map the range to a 2d array of comparators
7043 .map(range => this.parseRange(range.trim()))
7044 // throw out any comparator lists that are empty
7045 // this generally means that it was not a valid range, which is allowed
7046 // in loose mode, but will still throw if the WHOLE range is invalid.
7047 .filter(c => c.length)
7049 if (!this.set.length) {
7050 throw new TypeError(`Invalid SemVer Range: ${range}`)
7057 this.range = this.set
7059 return comps.join(' ').trim()
7070 parseRange (range) {
7071 const loose = this.options.loose
7072 range = range.trim()
7073 // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
7074 const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
7075 range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
7076 debug('hyphen replace', range)
7077 // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
7078 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
7079 debug('comparator trim', range, re[t.COMPARATORTRIM])
7081 // `~ 1.2.3` => `~1.2.3`
7082 range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
7084 // `^ 1.2.3` => `^1.2.3`
7085 range = range.replace(re[t.CARETTRIM], caretTrimReplace)
7088 range = range.split(/\s+/).join(' ')
7090 // At this point, the range is completely trimmed and
7091 // ready to be split into comparators.
7093 const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
7096 .map(comp => parseComparator(comp, this.options))
7099 .map(comp => replaceGTE0(comp, this.options))
7100 // in loose mode, throw out any that are not valid comparators
7101 .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
7102 .map(comp => new Comparator(comp, this.options))
7105 intersects (range, options) {
7106 if (!(range instanceof Range)) {
7107 throw new TypeError('a Range is required')
7110 return this.set.some((thisComparators) => {
7112 isSatisfiable(thisComparators, options) &&
7113 range.set.some((rangeComparators) => {
7115 isSatisfiable(rangeComparators, options) &&
7116 thisComparators.every((thisComparator) => {
7117 return rangeComparators.every((rangeComparator) => {
7118 return thisComparator.intersects(rangeComparator, options)
7127 // if ANY of the sets match ALL of its comparators, then pass
7133 if (typeof version === 'string') {
7135 version = new SemVer(version, this.options)
7141 for (let i = 0; i < this.set.length; i++) {
7142 if (testSet(this.set[i], version, this.options)) {
7149 module.exports = Range
7151 const Comparator = __webpack_require__(70)
7152 const debug = __webpack_require__(44)
7153 const SemVer = __webpack_require__(45)
7157 comparatorTrimReplace,
7160 } = __webpack_require__(42)
7162 // take a set of comparators and determine whether there
7163 // exists a version which can satisfy it
7164 const isSatisfiable = (comparators, options) => {
7166 const remainingComparators = comparators.slice()
7167 let testComparator = remainingComparators.pop()
7169 while (result && remainingComparators.length) {
7170 result = remainingComparators.every((otherComparator) => {
7171 return testComparator.intersects(otherComparator, options)
7174 testComparator = remainingComparators.pop()
7180 // comprised of xranges, tildes, stars, and gtlt's at this point.
7181 // already replaced the hyphen ranges
7182 // turn into a set of JUST comparators.
7183 const parseComparator = (comp, options) => {
7184 debug('comp', comp, options)
7185 comp = replaceCarets(comp, options)
7186 debug('caret', comp)
7187 comp = replaceTildes(comp, options)
7188 debug('tildes', comp)
7189 comp = replaceXRanges(comp, options)
7190 debug('xrange', comp)
7191 comp = replaceStars(comp, options)
7192 debug('stars', comp)
7196 const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
7198 // ~, ~> --> * (any, kinda silly)
7199 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
7200 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
7201 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
7202 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
7203 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
7204 const replaceTildes = (comp, options) =>
7205 comp.trim().split(/\s+/).map((comp) => {
7206 return replaceTilde(comp, options)
7209 const replaceTilde = (comp, options) => {
7210 const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
7211 return comp.replace(r, (_, M, m, p, pr) => {
7212 debug('tilde', comp, _, M, m, p, pr)
7217 } else if (isX(m)) {
7218 ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
7219 } else if (isX(p)) {
7220 // ~1.2 == >=1.2.0 <1.3.0-0
7221 ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
7223 debug('replaceTilde pr', pr)
7224 ret = `>=${M}.${m}.${p}-${pr
7225 } <${M}.${+m + 1}.0-0`
7227 // ~1.2.3 == >=1.2.3 <1.3.0-0
7228 ret = `>=${M}.${m}.${p
7229 } <${M}.${+m + 1}.0-0`
7232 debug('tilde return', ret)
7237 // ^ --> * (any, kinda silly)
7238 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
7239 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
7240 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
7241 // ^1.2.3 --> >=1.2.3 <2.0.0-0
7242 // ^1.2.0 --> >=1.2.0 <2.0.0-0
7243 const replaceCarets = (comp, options) =>
7244 comp.trim().split(/\s+/).map((comp) => {
7245 return replaceCaret(comp, options)
7248 const replaceCaret = (comp, options) => {
7249 debug('caret', comp, options)
7250 const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
7251 const z = options.includePrerelease ? '-0' : ''
7252 return comp.replace(r, (_, M, m, p, pr) => {
7253 debug('caret', comp, _, M, m, p, pr)
7258 } else if (isX(m)) {
7259 ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
7260 } else if (isX(p)) {
7262 ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
7264 ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
7267 debug('replaceCaret pr', pr)
7270 ret = `>=${M}.${m}.${p}-${pr
7271 } <${M}.${m}.${+p + 1}-0`
7273 ret = `>=${M}.${m}.${p}-${pr
7274 } <${M}.${+m + 1}.0-0`
7277 ret = `>=${M}.${m}.${p}-${pr
7284 ret = `>=${M}.${m}.${p
7285 }${z} <${M}.${m}.${+p + 1}-0`
7287 ret = `>=${M}.${m}.${p
7288 }${z} <${M}.${+m + 1}.0-0`
7291 ret = `>=${M}.${m}.${p
7296 debug('caret return', ret)
7301 const replaceXRanges = (comp, options) => {
7302 debug('replaceXRanges', comp, options)
7303 return comp.split(/\s+/).map((comp) => {
7304 return replaceXRange(comp, options)
7308 const replaceXRange = (comp, options) => {
7310 const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
7311 return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
7312 debug('xRange', comp, ret, gtlt, M, m, p, pr)
7314 const xm = xM || isX(m)
7315 const xp = xm || isX(p)
7318 if (gtlt === '=' && anyX) {
7322 // if we're including prereleases in the match, then we need
7323 // to fix this to -0, the lowest possible prerelease value
7324 pr = options.includePrerelease ? '-0' : ''
7327 if (gtlt === '>' || gtlt === '<') {
7328 // nothing is allowed
7331 // nothing is forbidden
7334 } else if (gtlt && anyX) {
7335 // we know patch is an x, because we have any x at all.
7354 } else if (gtlt === '<=') {
7355 // <=0.7.x is actually <0.8.0, since any 0.7.x should
7356 // pass. Similarly, <=7.x is actually <8.0.0, etc.
7368 ret = `${gtlt + M}.${m}.${p}${pr}`
7370 ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
7372 ret = `>=${M}.${m}.0${pr
7373 } <${M}.${+m + 1}.0-0`
7376 debug('xRange return', ret)
7382 // Because * is AND-ed with everything else in the comparator,
7383 // and '' means "any version", just remove the *s entirely.
7384 const replaceStars = (comp, options) => {
7385 debug('replaceStars', comp, options)
7386 // Looseness is ignored here. star is always as loose as it gets!
7387 return comp.trim().replace(re[t.STAR], '')
7390 const replaceGTE0 = (comp, options) => {
7391 debug('replaceGTE0', comp, options)
7393 .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
7396 // This function is passed to string.replace(re[t.HYPHENRANGE])
7397 // M, m, patch, prerelease, build
7398 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
7399 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
7400 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
7401 const hyphenReplace = incPr => ($0,
7402 from, fM, fm, fp, fpr, fb,
7403 to, tM, tm, tp, tpr, tb) => {
7406 } else if (isX(fm)) {
7407 from = `>=${fM}.0.0${incPr ? '-0' : ''}`
7408 } else if (isX(fp)) {
7409 from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
7413 from = `>=${from}${incPr ? '-0' : ''}`
7418 } else if (isX(tm)) {
7419 to = `<${+tM + 1}.0.0-0`
7420 } else if (isX(tp)) {
7421 to = `<${tM}.${+tm + 1}.0-0`
7423 to = `<=${tM}.${tm}.${tp}-${tpr}`
7425 to = `<${tM}.${tm}.${+tp + 1}-0`
7430 return (`${from} ${to}`).trim()
7433 const testSet = (set, version, options) => {
7434 for (let i = 0; i < set.length; i++) {
7435 if (!set[i].test(version)) {
7440 if (version.prerelease.length && !options.includePrerelease) {
7441 // Find the set of versions that are allowed to have prereleases
7442 // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
7443 // That should allow `1.2.3-pr.2` to pass.
7444 // However, `1.2.4-alpha.notready` should NOT be allowed,
7445 // even though it's within the range set by the comparators.
7446 for (let i = 0; i < set.length; i++) {
7447 debug(set[i].semver)
7448 if (set[i].semver === Comparator.ANY) {
7452 if (set[i].semver.prerelease.length > 0) {
7453 const allowed = set[i].semver
7454 if (allowed.major === version.major &&
7455 allowed.minor === version.minor &&
7456 allowed.patch === version.patch) {
7462 // Version has a -pre, but it's not one of the ones we like.
7472 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7474 const Range = __webpack_require__(71)
7475 const satisfies = (version, range, options) => {
7477 range = new Range(range, options)
7481 return range.test(version)
7483 module.exports = satisfies
7488 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7490 const Range = __webpack_require__(71)
7492 // Mostly just for testing and legacy API reasons
7493 const toComparators = (range, options) =>
7494 new Range(range, options).set
7495 .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
7497 module.exports = toComparators
7502 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7504 const SemVer = __webpack_require__(45)
7505 const Range = __webpack_require__(71)
7507 const maxSatisfying = (versions, range, options) => {
7512 rangeObj = new Range(range, options)
7516 versions.forEach((v) => {
7517 if (rangeObj.test(v)) {
7518 // satisfies(v, range, options)
7519 if (!max || maxSV.compare(v) === -1) {
7520 // compare(max, v, true)
7522 maxSV = new SemVer(max, options)
7528 module.exports = maxSatisfying
7533 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7535 const SemVer = __webpack_require__(45)
7536 const Range = __webpack_require__(71)
7537 const minSatisfying = (versions, range, options) => {
7542 rangeObj = new Range(range, options)
7546 versions.forEach((v) => {
7547 if (rangeObj.test(v)) {
7548 // satisfies(v, range, options)
7549 if (!min || minSV.compare(v) === 1) {
7550 // compare(min, v, true)
7552 minSV = new SemVer(min, options)
7558 module.exports = minSatisfying
7563 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7565 const SemVer = __webpack_require__(45)
7566 const Range = __webpack_require__(71)
7567 const gt = __webpack_require__(63)
7569 const minVersion = (range, loose) => {
7570 range = new Range(range, loose)
7572 let minver = new SemVer('0.0.0')
7573 if (range.test(minver)) {
7577 minver = new SemVer('0.0.0-0')
7578 if (range.test(minver)) {
7583 for (let i = 0; i < range.set.length; ++i) {
7584 const comparators = range.set[i]
7586 comparators.forEach((comparator) => {
7587 // Clone to avoid manipulating the comparator's semver object.
7588 const compver = new SemVer(comparator.semver.version)
7589 switch (comparator.operator) {
7591 if (compver.prerelease.length === 0) {
7594 compver.prerelease.push(0)
7596 compver.raw = compver.format()
7600 if (!minver || gt(minver, compver)) {
7606 /* Ignore maximum versions */
7608 /* istanbul ignore next */
7610 throw new Error(`Unexpected operation: ${comparator.operator}`)
7615 if (minver && range.test(minver)) {
7621 module.exports = minVersion
7626 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7628 const Range = __webpack_require__(71)
7629 const validRange = (range, options) => {
7631 // Return '*' instead of '' so that truthiness works.
7632 // This will throw if it's invalid anyway
7633 return new Range(range, options).range || '*'
7638 module.exports = validRange
7643 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7645 const SemVer = __webpack_require__(45)
7646 const Comparator = __webpack_require__(70)
7647 const {ANY} = Comparator
7648 const Range = __webpack_require__(71)
7649 const satisfies = __webpack_require__(72)
7650 const gt = __webpack_require__(63)
7651 const lt = __webpack_require__(64)
7652 const lte = __webpack_require__(67)
7653 const gte = __webpack_require__(66)
7655 const outside = (version, range, hilo, options) => {
7656 version = new SemVer(version, options)
7657 range = new Range(range, options)
7659 let gtfn, ltefn, ltfn, comp, ecomp
7676 throw new TypeError('Must provide a hilo val of "<" or ">"')
7679 // If it satisifes the range it is not outside
7680 if (satisfies(version, range, options)) {
7684 // From now on, variable terms are as if we're in "gtr" mode.
7685 // but note that everything is flipped for the "ltr" function.
7687 for (let i = 0; i < range.set.length; ++i) {
7688 const comparators = range.set[i]
7693 comparators.forEach((comparator) => {
7694 if (comparator.semver === ANY) {
7695 comparator = new Comparator('>=0.0.0')
7697 high = high || comparator
7698 low = low || comparator
7699 if (gtfn(comparator.semver, high.semver, options)) {
7701 } else if (ltfn(comparator.semver, low.semver, options)) {
7706 // If the edge version comparator has a operator then our version
7708 if (high.operator === comp || high.operator === ecomp) {
7712 // If the lowest version comparator has an operator and our version
7713 // is less than it then it isn't higher than the range
7714 if ((!low.operator || low.operator === comp) &&
7715 ltefn(version, low.semver)) {
7717 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
7724 module.exports = outside
7729 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7731 // Determine if version is greater than all the versions possible in the range.
7732 const outside = __webpack_require__(78)
7733 const gtr = (version, range, options) => outside(version, range, '>', options)
7734 module.exports = gtr
7739 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7741 const outside = __webpack_require__(78)
7742 // Determine if version is less than all the versions possible in the range
7743 const ltr = (version, range, options) => outside(version, range, '<', options)
7744 module.exports = ltr
7749 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7751 const Range = __webpack_require__(71)
7752 const intersects = (r1, r2, options) => {
7753 r1 = new Range(r1, options)
7754 r2 = new Range(r2, options)
7755 return r1.intersects(r2)
7757 module.exports = intersects
7762 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7764 // given a set of versions and a range, create a "simplified" range
7765 // that includes the same versions that the original range does
7766 // If the original range is shorter than the simplified one, return that.
7767 const satisfies = __webpack_require__(72)
7768 const compare = __webpack_require__(53)
7769 module.exports = (versions, range, options) => {
7773 const v = versions.sort((a, b) => compare(a, b, options))
7774 for (const version of v) {
7775 const included = satisfies(version, range, options)
7782 set.push([min, prev])
7789 set.push([min, null])
7792 for (const [min, max] of set) {
7795 else if (!max && min === v[0])
7798 ranges.push(`>=${min}`)
7799 else if (min === v[0])
7800 ranges.push(`<=${max}`)
7802 ranges.push(`${min} - ${max}`)
7804 const simplified = ranges.join(' || ')
7805 const original = typeof range.raw === 'string' ? range.raw : String(range)
7806 return simplified.length < original.length ? simplified : range
7812 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7814 const Range = __webpack_require__(71)
7815 const { ANY } = __webpack_require__(70)
7816 const satisfies = __webpack_require__(72)
7817 const compare = __webpack_require__(53)
7819 // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
7820 // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
7822 // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
7823 // - If c is only the ANY comparator
7824 // - If C is only the ANY comparator, return true
7825 // - Else return false
7826 // - Let EQ be the set of = comparators in c
7827 // - If EQ is more than one, return true (null set)
7828 // - Let GT be the highest > or >= comparator in c
7829 // - Let LT be the lowest < or <= comparator in c
7830 // - If GT and LT, and GT.semver > LT.semver, return true (null set)
7832 // - If GT, and EQ does not satisfy GT, return true (null set)
7833 // - If LT, and EQ does not satisfy LT, return true (null set)
7834 // - If EQ satisfies every C, return true
7835 // - Else return false
7837 // - If GT is lower than any > or >= comp in C, return false
7838 // - If GT is >=, and GT.semver does not satisfy every C, return false
7840 // - If LT.semver is greater than that of any > comp in C, return false
7841 // - If LT is <=, and LT.semver does not satisfy every C, return false
7842 // - If any C is a = range, and GT or LT are set, return false
7843 // - Else return true
7845 const subset = (sub, dom, options) => {
7846 sub = new Range(sub, options)
7847 dom = new Range(dom, options)
7848 let sawNonNull = false
7850 OUTER: for (const simpleSub of sub.set) {
7851 for (const simpleDom of dom.set) {
7852 const isSub = simpleSubset(simpleSub, simpleDom, options)
7853 sawNonNull = sawNonNull || isSub !== null
7857 // the null set is a subset of everything, but null simple ranges in
7858 // a complex range should be ignored. so if we saw a non-null range,
7859 // then we know this isn't a subset, but if EVERY simple range was null,
7860 // then it is a subset.
7867 const simpleSubset = (sub, dom, options) => {
7868 if (sub.length === 1 && sub[0].semver === ANY)
7869 return dom.length === 1 && dom[0].semver === ANY
7871 const eqSet = new Set()
7873 for (const c of sub) {
7874 if (c.operator === '>' || c.operator === '>=')
7875 gt = higherGT(gt, c, options)
7876 else if (c.operator === '<' || c.operator === '<=')
7877 lt = lowerLT(lt, c, options)
7887 gtltComp = compare(gt.semver, lt.semver, options)
7890 else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
7894 // will iterate one or zero times
7895 for (const eq of eqSet) {
7896 if (gt && !satisfies(eq, String(gt), options))
7899 if (lt && !satisfies(eq, String(lt), options))
7902 for (const c of dom) {
7903 if (!satisfies(eq, String(c), options))
7910 let hasDomLT, hasDomGT
7911 for (const c of dom) {
7912 hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
7913 hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
7915 if (c.operator === '>' || c.operator === '>=') {
7916 higher = higherGT(gt, c, options)
7919 } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
7923 if (c.operator === '<' || c.operator === '<=') {
7924 lower = lowerLT(lt, c, options)
7927 } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
7930 if (!c.operator && (lt || gt) && gtltComp !== 0)
7934 // if there was a < or >, and nothing in the dom, then must be false
7935 // UNLESS it was limited by another range in the other direction.
7936 // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
7937 if (gt && hasDomLT && !lt && gtltComp !== 0)
7940 if (lt && hasDomGT && !gt && gtltComp !== 0)
7946 // >=1.2.3 is lower than >1.2.3
7947 const higherGT = (a, b, options) => {
7950 const comp = compare(a.semver, b.semver, options)
7953 : b.operator === '>' && a.operator === '>=' ? b
7957 // <=1.2.3 is higher than <1.2.3
7958 const lowerLT = (a, b, options) => {
7961 const comp = compare(a.semver, b.semver, options)
7964 : b.operator === '<' && a.operator === '<=' ? b
7968 module.exports = subset
7973 /***/ ((module) => {
7975 // A simple implementation of make-array
7976 function makeArray (subject) {
7977 return Array.isArray(subject)
7985 const REGEX_TEST_BLANK_LINE = /^\s+$/
7986 const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
7987 const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
7988 const REGEX_SPLITALL_CRLF = /\r?\n/g
7994 const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
7997 const KEY_IGNORE = typeof Symbol !== 'undefined'
7998 ? Symbol.for('node-ignore')
7999 /* istanbul ignore next */
8002 const define = (object, key, value) =>
8003 Object.defineProperty(object, key, {value})
8005 const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
8007 // Sanitize the range of a regular expression
8008 // The cases are complicated, see test cases for details
8009 const sanitizeRange = range => range.replace(
8011 (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
8013 // Invalid range (out of order) which is ok for gitignore rules but
8014 // fatal for JavaScript regular expression, so eliminate it.
8019 const cleanRangeBackSlash = slashes => {
8020 const {length} = slashes
8021 return slashes.slice(0, length - length % 2)
8024 // > If the pattern ends with a slash,
8025 // > it is removed for the purpose of the following description,
8026 // > but it would only find a match with a directory.
8027 // > In other words, foo/ will match a directory foo and paths underneath it,
8028 // > but will not match a regular file or a symbolic link foo
8029 // > (this is consistent with the way how pathspec works in general in Git).
8030 // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
8031 // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
8032 // you could use option `mark: true` with `glob`
8034 // '`foo/`' should not continue with the '`..`'
8037 // > Trailing spaces are ignored unless they are quoted with backslash ("\")
8043 match => match.indexOf('\\') === 0
8048 // replace (\ ) with ' '
8054 // Escape metacharacters
8055 // which is written down by users but means special for regular expressions.
8057 // > There are 12 characters with special meanings:
8058 // > - the backslash \,
8060 // > - the dollar sign $,
8061 // > - the period or dot .,
8062 // > - the vertical bar or pipe symbol |,
8063 // > - the question mark ?,
8064 // > - the asterisk or star *,
8065 // > - the plus sign +,
8066 // > - the opening parenthesis (,
8067 // > - the closing parenthesis ),
8068 // > - and the opening square bracket [,
8069 // > - the opening curly brace {,
8070 // > These special characters are often called "metacharacters".
8073 match => `\\${match}`
8077 // > a question mark (?) matches a single character
8085 // > A leading slash matches the beginning of the pathname.
8086 // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
8087 // A leading slash matches the beginning of the pathname
8092 // replace special metacharacter slash after the leading slash
8099 // > A leading "**" followed by a slash means match in all directories.
8100 // > For example, "**/foo" matches file or directory "foo" anywhere,
8101 // > the same as pattern "foo".
8102 // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
8103 // > under directory "foo".
8104 // Notice that the '*'s have been replaced as '\\*'
8107 // '**/foo' <-> 'foo'
8113 // there will be no leading '/'
8114 // (which has been replaced by section "leading slash")
8115 // If starts with '**', adding a '^' to the regular expression also works
8117 function startingReplacer () {
8118 // If has a slash `/` at the beginning or middle
8119 return !/\/(?!$)/.test(this)
8120 // > Prior to 2.22.1
8121 // > If the pattern does not contain a slash /,
8122 // > Git treats it as a shell glob pattern
8123 // Actually, if there is only a trailing slash,
8124 // git also treats it as a shell glob pattern
8126 // After 2.22.1 (compatible but clearer)
8127 // > If there is a separator at the beginning or middle (or both)
8128 // > of the pattern, then the pattern is relative to the directory
8129 // > level of the particular .gitignore file itself.
8130 // > Otherwise the pattern may also match at any level below
8131 // > the .gitignore level.
8134 // > Otherwise, Git treats the pattern as a shell glob suitable for
8135 // > consumption by fnmatch(3)
8142 // Use lookahead assertions so that we could match more than one `'/**'`
8143 /\\\/\\\*\\\*(?=\\\/|$)/g,
8145 // Zero, one or several directories
8146 // should not use '*', or it will be replaced by the next replacer
8148 // Check if it is not the last `'/**'`
8149 (_, index, str) => index + 6 < str.length
8152 // > A slash followed by two consecutive asterisks then a slash matches
8153 // > zero or more directories.
8154 // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
8159 // > A trailing `"/**"` matches everything inside.
8161 // #21: everything inside but it should not include the current folder
8165 // intermediate wildcards
8167 // Never replace escaped '*'
8168 // ignore rule '\*' will match the path '*'
8171 // 'abc.*' -> skip this rule
8172 /(^|[^\\]+)\\\*(?=.+)/g,
8174 // '*.js' matches '.js'
8175 // '*.js' doesn't match 'abc'
8176 (_, p1) => `${p1}[^\\/]*`
8180 // unescape, revert step 3 except for back slash
8181 // For example, if a user escape a '\\*',
8182 // after step 3, the result will be '\\\\\\*'
8183 /\\\\\\(?=[$.|*+(){^])/g,
8194 // > The range notation, e.g. [a-zA-Z],
8195 // > can be used to match one of the characters in a range.
8197 // `\` is escaped by step 3
8198 /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
8199 (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
8200 // '\\[bar]' -> '\\\\[bar\\]'
8201 ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
8203 ? endEscape.length % 2 === 0
8204 // A normal case, and it is a range notation
8207 ? `[${sanitizeRange(range)}${endEscape}]`
8208 // Invalid range notaton
8209 // '[bar\\]' -> '[bar\\\\]'
8216 // 'js' will not match 'js.'
8217 // 'ab' will not match 'abc'
8221 // https://git-scm.com/docs/gitignore
8222 // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
8223 // which re-fixes #24, #38
8225 // > If there is a separator at the end of the pattern then the pattern
8226 // > will only match directories, otherwise the pattern can match both
8227 // > files and directories.
8229 // 'js*' will not match 'a.js'
8230 // 'js/' will not match 'a.js'
8231 // 'js' will match 'a.js' and 'a.js/'
8232 match => /\/$/.test(match)
8233 // foo/ will not match 'foo'
8235 // foo matches 'foo' and 'foo/'
8236 : `${match}(?=$|\\/$)`
8239 // trailing wildcard
8245 // '/*' does not match EMPTY
8246 // '/*' does not match everything
8249 // 'abc/*' does not match 'abc/'
8253 // 'a*' matches 'aa'
8256 return `${prefix}(?=$|\\/$)`
8261 // A simple cache, because an ignore rule only has only one certain meaning
8262 const regexCache = Object.create(null)
8265 const makeRegex = (pattern, negative, ignorecase) => {
8266 const r = regexCache[pattern]
8271 // const replacers = negative
8272 // ? NEGATIVE_REPLACERS
8273 // : POSITIVE_REPLACERS
8275 const source = REPLACERS.reduce(
8276 (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
8280 return regexCache[pattern] = ignorecase
8281 ? new RegExp(source, 'i')
8282 : new RegExp(source)
8285 const isString = subject => typeof subject === 'string'
8287 // > A blank line matches no files, so it can serve as a separator for readability.
8288 const checkPattern = pattern => pattern
8289 && isString(pattern)
8290 && !REGEX_TEST_BLANK_LINE.test(pattern)
8292 // > A line starting with # serves as a comment.
8293 && pattern.indexOf('#') !== 0
8295 const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
8304 this.origin = origin
8305 this.pattern = pattern
8306 this.negative = negative
8311 const createRule = (pattern, ignorecase) => {
8312 const origin = pattern
8313 let negative = false
8315 // > An optional prefix "!" which negates the pattern;
8316 if (pattern.indexOf('!') === 0) {
8318 pattern = pattern.substr(1)
8322 // > Put a backslash ("\") in front of the first "!" for patterns that
8323 // > begin with a literal "!", for example, `"\!important!.txt"`.
8324 .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
8325 // > Put a backslash ("\") in front of the first hash for patterns that
8326 // > begin with a hash.
8327 .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
8329 const regex = makeRegex(pattern, negative, ignorecase)
8331 return new IgnoreRule(
8339 const throwError = (message, Ctor) => {
8340 throw new Ctor(message)
8343 const checkPath = (path, originalPath, doThrow) => {
8344 if (!isString(path)) {
8346 `path must be a string, but got \`${originalPath}\``,
8351 // We don't know if we should ignore EMPTY, so throw
8353 return doThrow(`path must not be empty`, TypeError)
8356 // Check if it is a relative path
8357 if (checkPath.isNotRelative(path)) {
8358 const r = '`path.relative()`d'
8360 `path should be a ${r} string, but got "${originalPath}"`,
8368 const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
8370 checkPath.isNotRelative = isNotRelative
8371 checkPath.convert = p => p
8378 this._ignorecase = ignorecase
8379 define(this, KEY_IGNORE, true)
8384 this._ignoreCache = Object.create(null)
8385 this._testCache = Object.create(null)
8388 _addPattern (pattern) {
8390 if (pattern && pattern[KEY_IGNORE]) {
8391 this._rules = this._rules.concat(pattern._rules)
8396 if (checkPattern(pattern)) {
8397 const rule = createRule(pattern, this._ignorecase)
8399 this._rules.push(rule)
8403 // @param {Array<string> | string | Ignore} pattern
8409 ? splitPattern(pattern)
8411 ).forEach(this._addPattern, this)
8413 // Some rules have just added to the ignore,
8414 // making the behavior changed.
8423 addPattern (pattern) {
8424 return this.add(pattern)
8427 // | ignored : unignored
8428 // negative | 0:0 | 0:1 | 1:0 | 1:1
8429 // -------- | ------- | ------- | ------- | --------
8430 // 0 | TEST | TEST | SKIP | X
8431 // 1 | TESTIF | SKIP | TEST | X
8433 // - SKIP: always skip
8434 // - TEST: always test
8435 // - TESTIF: only test if checkUnignored
8436 // - X: that never happen
8438 // @param {boolean} whether should check if the path is unignored,
8439 // setting `checkUnignored` to `false` could reduce additional
8442 // @returns {TestResult} true if a file is ignored
8443 _testOne (path, checkUnignored) {
8445 let unignored = false
8447 this._rules.forEach(rule => {
8448 const {negative} = rule
8450 unignored === negative && ignored !== unignored
8451 || negative && !ignored && !unignored && !checkUnignored
8456 const matched = rule.regex.test(path)
8460 unignored = negative
8470 // @returns {TestResult}
8471 _test (originalPath, cache, checkUnignored, slices) {
8472 const path = originalPath
8473 // Supports nullable path
8474 && checkPath.convert(originalPath)
8476 checkPath(path, originalPath, throwError)
8478 return this._t(path, cache, checkUnignored, slices)
8481 _t (path, cache, checkUnignored, slices) {
8482 if (path in cache) {
8488 // ['path', 'to', 'a.js']
8489 slices = path.split(SLASH)
8494 // If the path has no parent directory, just test it
8495 if (!slices.length) {
8496 return cache[path] = this._testOne(path, checkUnignored)
8499 const parent = this._t(
8500 slices.join(SLASH) + SLASH,
8506 // If the path contains a parent directory, check the parent first
8507 return cache[path] = parent.ignored
8508 // > It is not possible to re-include a file if a parent directory of
8509 // > that file is excluded.
8511 : this._testOne(path, checkUnignored)
8515 return this._test(path, this._ignoreCache, false).ignored
8519 return path => !this.ignores(path)
8523 return makeArray(paths).filter(this.createFilter())
8526 // @returns {TestResult}
8528 return this._test(path, this._testCache, true)
8532 const factory = options => new Ignore(options)
8534 const returnFalse = () => false
8536 const isPathValid = path =>
8537 checkPath(path && checkPath.convert(path), path, returnFalse)
8539 factory.isPathValid = isPathValid
8542 factory.default = factory
8544 module.exports = factory
8547 // --------------------------------------------------------------
8548 /* istanbul ignore if */
8550 // Detect `process` so that it can run in browsers.
8551 typeof process !== 'undefined'
8553 process.env && process.env.IGNORE_TEST_WIN32
8554 || process.platform === 'win32'
8557 /* eslint no-control-regex: "off" */
8558 const makePosix = str => /^\\\\\?\\/.test(str)
8559 || /["<>|\u0000-\u001F]+/u.test(str)
8561 : str.replace(/\\/g, '/')
8563 checkPath.convert = makePosix
8565 // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
8567 const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
8568 checkPath.isNotRelative = path =>
8569 REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
8570 || isNotRelative(path)
8576 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8580 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8581 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8582 return new (P || (P = Promise))(function (resolve, reject) {
8583 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8584 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8585 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8586 step((generator = generator.apply(thisArg, _arguments || [])).next());
8589 var __importDefault = (this && this.__importDefault) || function (mod) {
8590 return (mod && mod.__esModule) ? mod : { "default": mod };
8592 Object.defineProperty(exports, "__esModule", ({ value: true }));
8593 exports.fullDocumentRange = exports.format = void 0;
8594 const coc_nvim_1 = __webpack_require__(1);
8595 const path_1 = __importDefault(__webpack_require__(12));
8596 const vscode_languageserver_protocol_1 = __webpack_require__(2);
8597 const errorHandler_1 = __webpack_require__(34);
8598 const requirePkg_1 = __webpack_require__(38);
8599 const utils_1 = __webpack_require__(37);
8601 * HOLD style parsers (for stylelint integration)
8603 const STYLE_PARSERS = ['postcss', 'css', 'less', 'scss'];
8605 * Resolves the prettierconfig for the given file.
8607 * @param filePath file's path
8609 function resolveConfig(filePath, options) {
8610 return __awaiter(this, void 0, void 0, function* () {
8612 const localPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(filePath), 'prettier', { silent: true, ignoreBundled: true }));
8613 let prettierInstance = localPrettier;
8614 if (!prettierInstance && !options.onlyUseLocalVersion) {
8615 prettierInstance = __webpack_require__(33);
8617 const config = yield prettierInstance.resolveConfig(filePath, options);
8621 return { config: null, error };
8626 * Define which config should be used.
8627 * If a prettierconfig exists, it returns itself.
8628 * It merges prettierconfig into vscode's config (editorconfig).
8630 * - additionalConfig
8633 * @param hasPrettierConfig a prettierconfig exists
8634 * @param additionalConfig config we really want to see in. (range)
8635 * @param prettierConfig prettier's file config
8636 * @param vscodeConfig our config
8638 function mergeConfig(hasPrettierConfig, additionalConfig, prettierConfig, vscodeConfig) {
8639 return hasPrettierConfig
8640 ? Object.assign({ parser: vscodeConfig.parser }, // always merge our inferred parser in
8641 prettierConfig, additionalConfig)
8642 : Object.assign(vscodeConfig, prettierConfig, additionalConfig);
8645 * Format the given text with user's configuration.
8646 * @param text Text to format
8647 * @param path formatting file's path
8648 * @returns {string} formatted text
8650 function format(text, { languageId, uri }, customOptions) {
8651 return __awaiter(this, void 0, void 0, function* () {
8652 let u = coc_nvim_1.Uri.parse(uri);
8653 const isUntitled = u.scheme == 'untitled';
8654 const fileName = u.fsPath;
8655 const vscodeConfig = utils_1.getConfig(u);
8656 const localOnly = vscodeConfig.onlyUseLocalVersion;
8657 const resolvedPrettier = yield utils_1.getPrettierInstance();
8658 if (!resolvedPrettier) {
8659 errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
8661 let supportedLanguages = utils_1.allLanguages(resolvedPrettier);
8662 if (supportedLanguages.indexOf(languageId) == -1) {
8663 coc_nvim_1.workspace.showMessage(`${languageId} not supported by prettier`, 'error');
8666 const dynamicParsers = utils_1.getParsersFromLanguageId(languageId, resolvedPrettier, isUntitled ? undefined : fileName);
8667 let useBundled = false;
8669 if (!dynamicParsers.length) {
8670 const bundledParsers = utils_1.getParsersFromLanguageId(languageId, __webpack_require__(33), isUntitled ? undefined : fileName);
8671 parser = bundledParsers[0] || 'babylon';
8674 else if (dynamicParsers.includes(vscodeConfig.parser)) {
8675 // handle deprecated parser option (parser: "flow")
8676 parser = vscodeConfig.parser;
8679 parser = dynamicParsers[0];
8681 const doesParserSupportEslint = [
8687 ].includes(languageId);
8688 const { config: fileOptions, error } = yield resolveConfig(fileName, {
8690 onlyUseLocalVersion: localOnly,
8691 requireConfig: vscodeConfig.requireConfig,
8693 const hasConfig = fileOptions != null;
8694 if (!hasConfig && vscodeConfig.requireConfig) {
8698 errorHandler_1.addToOutput(`Failed to resolve config for ${fileName}. Falling back to the default config settings.`, 'Error');
8700 const prettierOptions = mergeConfig(hasConfig, customOptions, fileOptions || {}, {
8701 printWidth: vscodeConfig.printWidth,
8702 tabWidth: vscodeConfig.tabWidth,
8703 singleQuote: vscodeConfig.singleQuote,
8704 jsxSingleQuote: vscodeConfig.jsxSingleQuote,
8705 trailingComma: vscodeConfig.trailingComma,
8706 bracketSpacing: vscodeConfig.bracketSpacing,
8707 jsxBracketSameLine: vscodeConfig.jsxBracketSameLine,
8709 semi: vscodeConfig.semi,
8710 useTabs: vscodeConfig.useTabs,
8711 proseWrap: vscodeConfig.proseWrap,
8712 arrowParens: vscodeConfig.arrowParens,
8714 if (vscodeConfig.tslintIntegration && parser === 'typescript') {
8715 return errorHandler_1.safeExecution(() => {
8716 const prettierTslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-tslint')
8718 // setUsedModule('prettier-tslint', 'Unknown', true)
8719 return prettierTslint({
8722 fallbackPrettierOptions: prettierOptions,
8726 if (vscodeConfig.eslintIntegration && doesParserSupportEslint) {
8727 return errorHandler_1.safeExecution(() => {
8728 const prettierEslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-eslint');
8729 // setUsedModule('prettier-eslint', 'Unknown', true)
8730 return prettierEslint({
8733 fallbackPrettierOptions: prettierOptions,
8737 if (vscodeConfig.stylelintIntegration && STYLE_PARSERS.includes(parser)) {
8738 const prettierStylelint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-stylelint');
8739 return errorHandler_1.safeExecution(prettierStylelint.format({
8743 }), text, fileName);
8745 if (!doesParserSupportEslint && useBundled) {
8746 let bundledPrettier = __webpack_require__(33);
8747 return errorHandler_1.safeExecution(() => {
8748 const warningMessage = `prettier@${bundledPrettier.version} doesn't support ${languageId}. ` +
8749 `Falling back to bundled prettier@${bundledPrettier.version}.`;
8750 errorHandler_1.addToOutput(warningMessage, 'Warning');
8751 // setUsedModule('prettier', bundledPrettier.version, true)
8752 return bundledPrettier.format(text, prettierOptions);
8755 // setUsedModule('prettier', localPrettier.version, false)
8756 return errorHandler_1.safeExecution(() => resolvedPrettier.format(text, prettierOptions), text, fileName);
8759 exports.format = format;
8760 function fullDocumentRange(document) {
8761 const lastLineId = document.lineCount - 1;
8762 let doc = coc_nvim_1.workspace.getDocument(document.uri);
8763 return vscode_languageserver_protocol_1.Range.create({ character: 0, line: 0 }, { character: doc.getline(lastLineId).length, line: lastLineId });
8765 exports.fullDocumentRange = fullDocumentRange;
8766 class PrettierEditProvider {
8767 constructor(_fileIsIgnored) {
8768 this._fileIsIgnored = _fileIsIgnored;
8770 provideDocumentRangeFormattingEdits(document, range, _options, _token) {
8771 return this._provideEdits(document, {
8772 rangeStart: document.offsetAt(range.start),
8773 rangeEnd: document.offsetAt(range.end),
8776 provideDocumentFormattingEdits(document, _options, _token) {
8777 return this._provideEdits(document, {});
8779 _provideEdits(document, options) {
8780 return __awaiter(this, void 0, void 0, function* () {
8781 let fileName = coc_nvim_1.Uri.parse(document.uri).fsPath;
8782 if (!document.uri.startsWith('untitled') && this._fileIsIgnored(fileName)) {
8783 return Promise.resolve([]);
8785 const code = yield format(document.getText(), document, options);
8786 const edits = [yield vscode_languageserver_protocol_1.TextEdit.replace(fullDocumentRange(document), code)];
8787 const { disableSuccessMessage } = utils_1.getConfig();
8788 if (edits && edits.length && !disableSuccessMessage) {
8789 coc_nvim_1.workspace.showMessage('Formatted by prettier');
8791 errorHandler_1.addToOutput(`Formatted file: ${document.uri}`);
8792 errorHandler_1.addToOutput(`Prettier format edits: ${JSON.stringify(edits, null, 2)}`);
8797 exports.default = PrettierEditProvider;
8802 /************************************************************************/
8803 /******/ // The module cache
8804 /******/ var __webpack_module_cache__ = {};
8806 /******/ // The require function
8807 /******/ function __webpack_require__(moduleId) {
8808 /******/ // Check if module is in cache
8809 /******/ if(__webpack_module_cache__[moduleId]) {
8810 /******/ return __webpack_module_cache__[moduleId].exports;
8812 /******/ // Create a new module (and put it into the cache)
8813 /******/ var module = __webpack_module_cache__[moduleId] = {
8814 /******/ // no module.id needed
8815 /******/ // no module.loaded needed
8816 /******/ exports: {}
8819 /******/ // Execute the module function
8820 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
8822 /******/ // Return the exports of the module
8823 /******/ return module.exports;
8826 /************************************************************************/
8827 /******/ /* webpack/runtime/define property getters */
8829 /******/ // define getter functions for harmony exports
8830 /******/ __webpack_require__.d = (exports, definition) => {
8831 /******/ for(var key in definition) {
8832 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
8833 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
8839 /******/ /* webpack/runtime/hasOwnProperty shorthand */
8841 /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
8844 /******/ /* webpack/runtime/make namespace object */
8846 /******/ // define __esModule on exports
8847 /******/ __webpack_require__.r = (exports) => {
8848 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
8849 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
8851 /******/ Object.defineProperty(exports, '__esModule', { value: true });
8855 /************************************************************************/
8856 /******/ // module exports must be returned from runtime so entry inlining is disabled
8858 /******/ // Load entry module and return exports
8859 /******/ return __webpack_require__(0);