Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-eslint / lib / server.js
1 (function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
2 /******/        // The module cache
3 /******/        var installedModules = {};
4 /******/
5 /******/        // The require function
6 /******/        function __webpack_require__(moduleId) {
7 /******/
8 /******/                // Check if module is in cache
9 /******/                if(installedModules[moduleId]) {
10 /******/                        return installedModules[moduleId].exports;
11 /******/                }
12 /******/                // Create a new module (and put it into the cache)
13 /******/                var module = installedModules[moduleId] = {
14 /******/                        i: moduleId,
15 /******/                        l: false,
16 /******/                        exports: {}
17 /******/                };
18 /******/
19 /******/                // Execute the module function
20 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 /******/
22 /******/                // Flag the module as loaded
23 /******/                module.l = true;
24 /******/
25 /******/                // Return the exports of the module
26 /******/                return module.exports;
27 /******/        }
28 /******/
29 /******/
30 /******/        // expose the modules object (__webpack_modules__)
31 /******/        __webpack_require__.m = modules;
32 /******/
33 /******/        // expose the module cache
34 /******/        __webpack_require__.c = installedModules;
35 /******/
36 /******/        // define getter function for harmony exports
37 /******/        __webpack_require__.d = function(exports, name, getter) {
38 /******/                if(!__webpack_require__.o(exports, name)) {
39 /******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 /******/                }
41 /******/        };
42 /******/
43 /******/        // define __esModule on exports
44 /******/        __webpack_require__.r = function(exports) {
45 /******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 /******/                }
48 /******/                Object.defineProperty(exports, '__esModule', { value: true });
49 /******/        };
50 /******/
51 /******/        // create a fake namespace object
52 /******/        // mode & 1: value is a module id, require it
53 /******/        // mode & 2: merge all properties of value into the ns
54 /******/        // mode & 4: return value when already ns object
55 /******/        // mode & 8|1: behave like require
56 /******/        __webpack_require__.t = function(value, mode) {
57 /******/                if(mode & 1) value = __webpack_require__(value);
58 /******/                if(mode & 8) return value;
59 /******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/                var ns = Object.create(null);
61 /******/                __webpack_require__.r(ns);
62 /******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 /******/                return ns;
65 /******/        };
66 /******/
67 /******/        // getDefaultExport function for compatibility with non-harmony modules
68 /******/        __webpack_require__.n = function(module) {
69 /******/                var getter = module && module.__esModule ?
70 /******/                        function getDefault() { return module['default']; } :
71 /******/                        function getModuleExports() { return module; };
72 /******/                __webpack_require__.d(getter, 'a', getter);
73 /******/                return getter;
74 /******/        };
75 /******/
76 /******/        // Object.prototype.hasOwnProperty.call
77 /******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 /******/
79 /******/        // __webpack_public_path__
80 /******/        __webpack_require__.p = "";
81 /******/
82 /******/
83 /******/        // Load entry module and return exports
84 /******/        return __webpack_require__(__webpack_require__.s = 36);
85 /******/ })
86 /************************************************************************/
87 /******/ ([
88 /* 0 */,
89 /* 1 */,
90 /* 2 */
91 /***/ (function(module, exports) {
92
93 module.exports = require("fs");
94
95 /***/ }),
96 /* 3 */
97 /***/ (function(module, exports) {
98
99 module.exports = require("path");
100
101 /***/ }),
102 /* 4 */
103 /***/ (function(module, exports, __webpack_require__) {
104
105 "use strict";
106 /* --------------------------------------------------------------------------------------------\r
107  * Copyright (c) Microsoft Corporation. All rights reserved.\r
108  * Licensed under the MIT License. See License.txt in the project root for license information.\r
109  * ------------------------------------------------------------------------------------------ */\r
110 \r
111 function __export(m) {\r
112     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
113 }\r
114 Object.defineProperty(exports, "__esModule", { value: true });\r
115 const vscode_jsonrpc_1 = __webpack_require__(5);\r
116 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
117 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
118 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
119 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
120 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
121 exports.Event = vscode_jsonrpc_1.Event;\r
122 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
123 exports.Trace = vscode_jsonrpc_1.Trace;\r
124 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
125 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
126 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
127 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
128 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
129 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
130 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
131 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
132 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
133 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
134 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
135 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
136 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
137 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
138 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
139 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
140 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
141 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
142 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
143 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
144 __export(__webpack_require__(18));\r
145 __export(__webpack_require__(19));\r
146 const callHierarchy = __webpack_require__(30);\r
147 var Proposed;\r
148 (function (Proposed) {\r
149     let CallHierarchyPrepareRequest;\r
150     (function (CallHierarchyPrepareRequest) {\r
151         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
152         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
153     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
154     let CallHierarchyIncomingCallsRequest;\r
155     (function (CallHierarchyIncomingCallsRequest) {\r
156         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
157         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest;\r
158         CallHierarchyIncomingCallsRequest.resultType = callHierarchy.CallHierarchyIncomingCallsRequest.resultType;\r
159     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
160     let CallHierarchyOutgoingCallsRequest;\r
161     (function (CallHierarchyOutgoingCallsRequest) {\r
162         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
163         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest;\r
164         CallHierarchyOutgoingCallsRequest.resultType = callHierarchy.CallHierarchyOutgoingCallsRequest.resultType;\r
165     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
166 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
167 function createProtocolConnection(reader, writer, logger, strategy) {\r
168     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
169 }\r
170 exports.createProtocolConnection = createProtocolConnection;\r
171
172
173 /***/ }),
174 /* 5 */
175 /***/ (function(module, exports, __webpack_require__) {
176
177 "use strict";
178 /* --------------------------------------------------------------------------------------------\r
179  * Copyright (c) Microsoft Corporation. All rights reserved.\r
180  * Licensed under the MIT License. See License.txt in the project root for license information.\r
181  * ------------------------------------------------------------------------------------------ */\r
182 /// <reference path="../typings/thenable.d.ts" />\r
183 \r
184 function __export(m) {\r
185     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
186 }\r
187 Object.defineProperty(exports, "__esModule", { value: true });\r
188 const Is = __webpack_require__(6);\r
189 const messages_1 = __webpack_require__(7);\r
190 exports.RequestType = messages_1.RequestType;\r
191 exports.RequestType0 = messages_1.RequestType0;\r
192 exports.RequestType1 = messages_1.RequestType1;\r
193 exports.RequestType2 = messages_1.RequestType2;\r
194 exports.RequestType3 = messages_1.RequestType3;\r
195 exports.RequestType4 = messages_1.RequestType4;\r
196 exports.RequestType5 = messages_1.RequestType5;\r
197 exports.RequestType6 = messages_1.RequestType6;\r
198 exports.RequestType7 = messages_1.RequestType7;\r
199 exports.RequestType8 = messages_1.RequestType8;\r
200 exports.RequestType9 = messages_1.RequestType9;\r
201 exports.ResponseError = messages_1.ResponseError;\r
202 exports.ErrorCodes = messages_1.ErrorCodes;\r
203 exports.NotificationType = messages_1.NotificationType;\r
204 exports.NotificationType0 = messages_1.NotificationType0;\r
205 exports.NotificationType1 = messages_1.NotificationType1;\r
206 exports.NotificationType2 = messages_1.NotificationType2;\r
207 exports.NotificationType3 = messages_1.NotificationType3;\r
208 exports.NotificationType4 = messages_1.NotificationType4;\r
209 exports.NotificationType5 = messages_1.NotificationType5;\r
210 exports.NotificationType6 = messages_1.NotificationType6;\r
211 exports.NotificationType7 = messages_1.NotificationType7;\r
212 exports.NotificationType8 = messages_1.NotificationType8;\r
213 exports.NotificationType9 = messages_1.NotificationType9;\r
214 const messageReader_1 = __webpack_require__(8);\r
215 exports.MessageReader = messageReader_1.MessageReader;\r
216 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
217 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
218 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
219 const messageWriter_1 = __webpack_require__(10);\r
220 exports.MessageWriter = messageWriter_1.MessageWriter;\r
221 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
222 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
223 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
224 const events_1 = __webpack_require__(9);\r
225 exports.Disposable = events_1.Disposable;\r
226 exports.Event = events_1.Event;\r
227 exports.Emitter = events_1.Emitter;\r
228 const cancellation_1 = __webpack_require__(11);\r
229 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
230 exports.CancellationToken = cancellation_1.CancellationToken;\r
231 const linkedMap_1 = __webpack_require__(12);\r
232 __export(__webpack_require__(13));\r
233 __export(__webpack_require__(17));\r
234 var CancelNotification;\r
235 (function (CancelNotification) {\r
236     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
237 })(CancelNotification || (CancelNotification = {}));\r
238 var ProgressNotification;\r
239 (function (ProgressNotification) {\r
240     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
241 })(ProgressNotification || (ProgressNotification = {}));\r
242 class ProgressType {\r
243     constructor() {\r
244         this._ = undefined;\r
245     }\r
246 }\r
247 exports.ProgressType = ProgressType;\r
248 exports.NullLogger = Object.freeze({\r
249     error: () => { },\r
250     warn: () => { },\r
251     info: () => { },\r
252     log: () => { }\r
253 });\r
254 var Trace;\r
255 (function (Trace) {\r
256     Trace[Trace["Off"] = 0] = "Off";\r
257     Trace[Trace["Messages"] = 1] = "Messages";\r
258     Trace[Trace["Verbose"] = 2] = "Verbose";\r
259 })(Trace = exports.Trace || (exports.Trace = {}));\r
260 (function (Trace) {\r
261     function fromString(value) {\r
262         if (!Is.string(value)) {\r
263             return Trace.Off;\r
264         }\r
265         value = value.toLowerCase();\r
266         switch (value) {\r
267             case 'off':\r
268                 return Trace.Off;\r
269             case 'messages':\r
270                 return Trace.Messages;\r
271             case 'verbose':\r
272                 return Trace.Verbose;\r
273             default:\r
274                 return Trace.Off;\r
275         }\r
276     }\r
277     Trace.fromString = fromString;\r
278     function toString(value) {\r
279         switch (value) {\r
280             case Trace.Off:\r
281                 return 'off';\r
282             case Trace.Messages:\r
283                 return 'messages';\r
284             case Trace.Verbose:\r
285                 return 'verbose';\r
286             default:\r
287                 return 'off';\r
288         }\r
289     }\r
290     Trace.toString = toString;\r
291 })(Trace = exports.Trace || (exports.Trace = {}));\r
292 var TraceFormat;\r
293 (function (TraceFormat) {\r
294     TraceFormat["Text"] = "text";\r
295     TraceFormat["JSON"] = "json";\r
296 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
297 (function (TraceFormat) {\r
298     function fromString(value) {\r
299         value = value.toLowerCase();\r
300         if (value === 'json') {\r
301             return TraceFormat.JSON;\r
302         }\r
303         else {\r
304             return TraceFormat.Text;\r
305         }\r
306     }\r
307     TraceFormat.fromString = fromString;\r
308 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
309 var SetTraceNotification;\r
310 (function (SetTraceNotification) {\r
311     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
312 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
313 var LogTraceNotification;\r
314 (function (LogTraceNotification) {\r
315     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
316 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
317 var ConnectionErrors;\r
318 (function (ConnectionErrors) {\r
319     /**\r
320      * The connection is closed.\r
321      */\r
322     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
323     /**\r
324      * The connection got disposed.\r
325      */\r
326     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
327     /**\r
328      * The connection is already in listening mode.\r
329      */\r
330     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
331 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
332 class ConnectionError extends Error {\r
333     constructor(code, message) {\r
334         super(message);\r
335         this.code = code;\r
336         Object.setPrototypeOf(this, ConnectionError.prototype);\r
337     }\r
338 }\r
339 exports.ConnectionError = ConnectionError;\r
340 var ConnectionStrategy;\r
341 (function (ConnectionStrategy) {\r
342     function is(value) {\r
343         let candidate = value;\r
344         return candidate && Is.func(candidate.cancelUndispatched);\r
345     }\r
346     ConnectionStrategy.is = is;\r
347 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
348 var ConnectionState;\r
349 (function (ConnectionState) {\r
350     ConnectionState[ConnectionState["New"] = 1] = "New";\r
351     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
352     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
353     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
354 })(ConnectionState || (ConnectionState = {}));\r
355 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
356     let sequenceNumber = 0;\r
357     let notificationSquenceNumber = 0;\r
358     let unknownResponseSquenceNumber = 0;\r
359     const version = '2.0';\r
360     let starRequestHandler = undefined;\r
361     let requestHandlers = Object.create(null);\r
362     let starNotificationHandler = undefined;\r
363     let notificationHandlers = Object.create(null);\r
364     let progressHandlers = new Map();\r
365     let timer;\r
366     let messageQueue = new linkedMap_1.LinkedMap();\r
367     let responsePromises = Object.create(null);\r
368     let requestTokens = Object.create(null);\r
369     let trace = Trace.Off;\r
370     let traceFormat = TraceFormat.Text;\r
371     let tracer;\r
372     let state = ConnectionState.New;\r
373     let errorEmitter = new events_1.Emitter();\r
374     let closeEmitter = new events_1.Emitter();\r
375     let unhandledNotificationEmitter = new events_1.Emitter();\r
376     let unhandledProgressEmitter = new events_1.Emitter();\r
377     let disposeEmitter = new events_1.Emitter();\r
378     function createRequestQueueKey(id) {\r
379         return 'req-' + id.toString();\r
380     }\r
381     function createResponseQueueKey(id) {\r
382         if (id === null) {\r
383             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
384         }\r
385         else {\r
386             return 'res-' + id.toString();\r
387         }\r
388     }\r
389     function createNotificationQueueKey() {\r
390         return 'not-' + (++notificationSquenceNumber).toString();\r
391     }\r
392     function addMessageToQueue(queue, message) {\r
393         if (messages_1.isRequestMessage(message)) {\r
394             queue.set(createRequestQueueKey(message.id), message);\r
395         }\r
396         else if (messages_1.isResponseMessage(message)) {\r
397             queue.set(createResponseQueueKey(message.id), message);\r
398         }\r
399         else {\r
400             queue.set(createNotificationQueueKey(), message);\r
401         }\r
402     }\r
403     function cancelUndispatched(_message) {\r
404         return undefined;\r
405     }\r
406     function isListening() {\r
407         return state === ConnectionState.Listening;\r
408     }\r
409     function isClosed() {\r
410         return state === ConnectionState.Closed;\r
411     }\r
412     function isDisposed() {\r
413         return state === ConnectionState.Disposed;\r
414     }\r
415     function closeHandler() {\r
416         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
417             state = ConnectionState.Closed;\r
418             closeEmitter.fire(undefined);\r
419         }\r
420         // If the connection is disposed don't sent close events.\r
421     }\r
422     function readErrorHandler(error) {\r
423         errorEmitter.fire([error, undefined, undefined]);\r
424     }\r
425     function writeErrorHandler(data) {\r
426         errorEmitter.fire(data);\r
427     }\r
428     messageReader.onClose(closeHandler);\r
429     messageReader.onError(readErrorHandler);\r
430     messageWriter.onClose(closeHandler);\r
431     messageWriter.onError(writeErrorHandler);\r
432     function triggerMessageQueue() {\r
433         if (timer || messageQueue.size === 0) {\r
434             return;\r
435         }\r
436         timer = setImmediate(() => {\r
437             timer = undefined;\r
438             processMessageQueue();\r
439         });\r
440     }\r
441     function processMessageQueue() {\r
442         if (messageQueue.size === 0) {\r
443             return;\r
444         }\r
445         let message = messageQueue.shift();\r
446         try {\r
447             if (messages_1.isRequestMessage(message)) {\r
448                 handleRequest(message);\r
449             }\r
450             else if (messages_1.isNotificationMessage(message)) {\r
451                 handleNotification(message);\r
452             }\r
453             else if (messages_1.isResponseMessage(message)) {\r
454                 handleResponse(message);\r
455             }\r
456             else {\r
457                 handleInvalidMessage(message);\r
458             }\r
459         }\r
460         finally {\r
461             triggerMessageQueue();\r
462         }\r
463     }\r
464     let callback = (message) => {\r
465         try {\r
466             // We have received a cancellation message. Check if the message is still in the queue\r
467             // and cancel it if allowed to do so.\r
468             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
469                 let key = createRequestQueueKey(message.params.id);\r
470                 let toCancel = messageQueue.get(key);\r
471                 if (messages_1.isRequestMessage(toCancel)) {\r
472                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
473                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
474                         messageQueue.delete(key);\r
475                         response.id = toCancel.id;\r
476                         traceSendingResponse(response, message.method, Date.now());\r
477                         messageWriter.write(response);\r
478                         return;\r
479                     }\r
480                 }\r
481             }\r
482             addMessageToQueue(messageQueue, message);\r
483         }\r
484         finally {\r
485             triggerMessageQueue();\r
486         }\r
487     };\r
488     function handleRequest(requestMessage) {\r
489         if (isDisposed()) {\r
490             // we return here silently since we fired an event when the\r
491             // connection got disposed.\r
492             return;\r
493         }\r
494         function reply(resultOrError, method, startTime) {\r
495             let message = {\r
496                 jsonrpc: version,\r
497                 id: requestMessage.id\r
498             };\r
499             if (resultOrError instanceof messages_1.ResponseError) {\r
500                 message.error = resultOrError.toJson();\r
501             }\r
502             else {\r
503                 message.result = resultOrError === void 0 ? null : resultOrError;\r
504             }\r
505             traceSendingResponse(message, method, startTime);\r
506             messageWriter.write(message);\r
507         }\r
508         function replyError(error, method, startTime) {\r
509             let message = {\r
510                 jsonrpc: version,\r
511                 id: requestMessage.id,\r
512                 error: error.toJson()\r
513             };\r
514             traceSendingResponse(message, method, startTime);\r
515             messageWriter.write(message);\r
516         }\r
517         function replySuccess(result, method, startTime) {\r
518             // The JSON RPC defines that a response must either have a result or an error\r
519             // So we can't treat undefined as a valid response result.\r
520             if (result === void 0) {\r
521                 result = null;\r
522             }\r
523             let message = {\r
524                 jsonrpc: version,\r
525                 id: requestMessage.id,\r
526                 result: result\r
527             };\r
528             traceSendingResponse(message, method, startTime);\r
529             messageWriter.write(message);\r
530         }\r
531         traceReceivedRequest(requestMessage);\r
532         let element = requestHandlers[requestMessage.method];\r
533         let type;\r
534         let requestHandler;\r
535         if (element) {\r
536             type = element.type;\r
537             requestHandler = element.handler;\r
538         }\r
539         let startTime = Date.now();\r
540         if (requestHandler || starRequestHandler) {\r
541             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
542             let tokenKey = String(requestMessage.id);\r
543             requestTokens[tokenKey] = cancellationSource;\r
544             try {\r
545                 let handlerResult;\r
546                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
547                     handlerResult = requestHandler\r
548                         ? requestHandler(cancellationSource.token)\r
549                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
550                 }\r
551                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
552                     handlerResult = requestHandler\r
553                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
554                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
555                 }\r
556                 else {\r
557                     handlerResult = requestHandler\r
558                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
559                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
560                 }\r
561                 let promise = handlerResult;\r
562                 if (!handlerResult) {\r
563                     delete requestTokens[tokenKey];\r
564                     replySuccess(handlerResult, requestMessage.method, startTime);\r
565                 }\r
566                 else if (promise.then) {\r
567                     promise.then((resultOrError) => {\r
568                         delete requestTokens[tokenKey];\r
569                         reply(resultOrError, requestMessage.method, startTime);\r
570                     }, error => {\r
571                         delete requestTokens[tokenKey];\r
572                         if (error instanceof messages_1.ResponseError) {\r
573                             replyError(error, requestMessage.method, startTime);\r
574                         }\r
575                         else if (error && Is.string(error.message)) {\r
576                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
577                         }\r
578                         else {\r
579                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
580                         }\r
581                     });\r
582                 }\r
583                 else {\r
584                     delete requestTokens[tokenKey];\r
585                     reply(handlerResult, requestMessage.method, startTime);\r
586                 }\r
587             }\r
588             catch (error) {\r
589                 delete requestTokens[tokenKey];\r
590                 if (error instanceof messages_1.ResponseError) {\r
591                     reply(error, requestMessage.method, startTime);\r
592                 }\r
593                 else if (error && Is.string(error.message)) {\r
594                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
595                 }\r
596                 else {\r
597                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
598                 }\r
599             }\r
600         }\r
601         else {\r
602             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
603         }\r
604     }\r
605     function handleResponse(responseMessage) {\r
606         if (isDisposed()) {\r
607             // See handle request.\r
608             return;\r
609         }\r
610         if (responseMessage.id === null) {\r
611             if (responseMessage.error) {\r
612                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
613             }\r
614             else {\r
615                 logger.error(`Received response message without id. No further error information provided.`);\r
616             }\r
617         }\r
618         else {\r
619             let key = String(responseMessage.id);\r
620             let responsePromise = responsePromises[key];\r
621             traceReceivedResponse(responseMessage, responsePromise);\r
622             if (responsePromise) {\r
623                 delete responsePromises[key];\r
624                 try {\r
625                     if (responseMessage.error) {\r
626                         let error = responseMessage.error;\r
627                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
628                     }\r
629                     else if (responseMessage.result !== void 0) {\r
630                         responsePromise.resolve(responseMessage.result);\r
631                     }\r
632                     else {\r
633                         throw new Error('Should never happen.');\r
634                     }\r
635                 }\r
636                 catch (error) {\r
637                     if (error.message) {\r
638                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
639                     }\r
640                     else {\r
641                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
642                     }\r
643                 }\r
644             }\r
645         }\r
646     }\r
647     function handleNotification(message) {\r
648         if (isDisposed()) {\r
649             // See handle request.\r
650             return;\r
651         }\r
652         let type = undefined;\r
653         let notificationHandler;\r
654         if (message.method === CancelNotification.type.method) {\r
655             notificationHandler = (params) => {\r
656                 let id = params.id;\r
657                 let source = requestTokens[String(id)];\r
658                 if (source) {\r
659                     source.cancel();\r
660                 }\r
661             };\r
662         }\r
663         else {\r
664             let element = notificationHandlers[message.method];\r
665             if (element) {\r
666                 notificationHandler = element.handler;\r
667                 type = element.type;\r
668             }\r
669         }\r
670         if (notificationHandler || starNotificationHandler) {\r
671             try {\r
672                 traceReceivedNotification(message);\r
673                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
674                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
675                 }\r
676                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
677                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
678                 }\r
679                 else {\r
680                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
681                 }\r
682             }\r
683             catch (error) {\r
684                 if (error.message) {\r
685                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
686                 }\r
687                 else {\r
688                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
689                 }\r
690             }\r
691         }\r
692         else {\r
693             unhandledNotificationEmitter.fire(message);\r
694         }\r
695     }\r
696     function handleInvalidMessage(message) {\r
697         if (!message) {\r
698             logger.error('Received empty message.');\r
699             return;\r
700         }\r
701         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
702         // Test whether we find an id to reject the promise\r
703         let responseMessage = message;\r
704         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
705             let key = String(responseMessage.id);\r
706             let responseHandler = responsePromises[key];\r
707             if (responseHandler) {\r
708                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
709             }\r
710         }\r
711     }\r
712     function traceSendingRequest(message) {\r
713         if (trace === Trace.Off || !tracer) {\r
714             return;\r
715         }\r
716         if (traceFormat === TraceFormat.Text) {\r
717             let data = undefined;\r
718             if (trace === Trace.Verbose && message.params) {\r
719                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
720             }\r
721             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
722         }\r
723         else {\r
724             logLSPMessage('send-request', message);\r
725         }\r
726     }\r
727     function traceSendingNotification(message) {\r
728         if (trace === Trace.Off || !tracer) {\r
729             return;\r
730         }\r
731         if (traceFormat === TraceFormat.Text) {\r
732             let data = undefined;\r
733             if (trace === Trace.Verbose) {\r
734                 if (message.params) {\r
735                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
736                 }\r
737                 else {\r
738                     data = 'No parameters provided.\n\n';\r
739                 }\r
740             }\r
741             tracer.log(`Sending notification '${message.method}'.`, data);\r
742         }\r
743         else {\r
744             logLSPMessage('send-notification', message);\r
745         }\r
746     }\r
747     function traceSendingResponse(message, method, startTime) {\r
748         if (trace === Trace.Off || !tracer) {\r
749             return;\r
750         }\r
751         if (traceFormat === TraceFormat.Text) {\r
752             let data = undefined;\r
753             if (trace === Trace.Verbose) {\r
754                 if (message.error && message.error.data) {\r
755                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
756                 }\r
757                 else {\r
758                     if (message.result) {\r
759                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
760                     }\r
761                     else if (message.error === void 0) {\r
762                         data = 'No result returned.\n\n';\r
763                     }\r
764                 }\r
765             }\r
766             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
767         }\r
768         else {\r
769             logLSPMessage('send-response', message);\r
770         }\r
771     }\r
772     function traceReceivedRequest(message) {\r
773         if (trace === Trace.Off || !tracer) {\r
774             return;\r
775         }\r
776         if (traceFormat === TraceFormat.Text) {\r
777             let data = undefined;\r
778             if (trace === Trace.Verbose && message.params) {\r
779                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
780             }\r
781             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
782         }\r
783         else {\r
784             logLSPMessage('receive-request', message);\r
785         }\r
786     }\r
787     function traceReceivedNotification(message) {\r
788         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
789             return;\r
790         }\r
791         if (traceFormat === TraceFormat.Text) {\r
792             let data = undefined;\r
793             if (trace === Trace.Verbose) {\r
794                 if (message.params) {\r
795                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
796                 }\r
797                 else {\r
798                     data = 'No parameters provided.\n\n';\r
799                 }\r
800             }\r
801             tracer.log(`Received notification '${message.method}'.`, data);\r
802         }\r
803         else {\r
804             logLSPMessage('receive-notification', message);\r
805         }\r
806     }\r
807     function traceReceivedResponse(message, responsePromise) {\r
808         if (trace === Trace.Off || !tracer) {\r
809             return;\r
810         }\r
811         if (traceFormat === TraceFormat.Text) {\r
812             let data = undefined;\r
813             if (trace === Trace.Verbose) {\r
814                 if (message.error && message.error.data) {\r
815                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
816                 }\r
817                 else {\r
818                     if (message.result) {\r
819                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
820                     }\r
821                     else if (message.error === void 0) {\r
822                         data = 'No result returned.\n\n';\r
823                     }\r
824                 }\r
825             }\r
826             if (responsePromise) {\r
827                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
828                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
829             }\r
830             else {\r
831                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
832             }\r
833         }\r
834         else {\r
835             logLSPMessage('receive-response', message);\r
836         }\r
837     }\r
838     function logLSPMessage(type, message) {\r
839         if (!tracer || trace === Trace.Off) {\r
840             return;\r
841         }\r
842         const lspMessage = {\r
843             isLSPMessage: true,\r
844             type,\r
845             message,\r
846             timestamp: Date.now()\r
847         };\r
848         tracer.log(lspMessage);\r
849     }\r
850     function throwIfClosedOrDisposed() {\r
851         if (isClosed()) {\r
852             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
853         }\r
854         if (isDisposed()) {\r
855             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
856         }\r
857     }\r
858     function throwIfListening() {\r
859         if (isListening()) {\r
860             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
861         }\r
862     }\r
863     function throwIfNotListening() {\r
864         if (!isListening()) {\r
865             throw new Error('Call listen() first.');\r
866         }\r
867     }\r
868     function undefinedToNull(param) {\r
869         if (param === void 0) {\r
870             return null;\r
871         }\r
872         else {\r
873             return param;\r
874         }\r
875     }\r
876     function computeMessageParams(type, params) {\r
877         let result;\r
878         let numberOfParams = type.numberOfParams;\r
879         switch (numberOfParams) {\r
880             case 0:\r
881                 result = null;\r
882                 break;\r
883             case 1:\r
884                 result = undefinedToNull(params[0]);\r
885                 break;\r
886             default:\r
887                 result = [];\r
888                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
889                     result.push(undefinedToNull(params[i]));\r
890                 }\r
891                 if (params.length < numberOfParams) {\r
892                     for (let i = params.length; i < numberOfParams; i++) {\r
893                         result.push(null);\r
894                     }\r
895                 }\r
896                 break;\r
897         }\r
898         return result;\r
899     }\r
900     let connection = {\r
901         sendNotification: (type, ...params) => {\r
902             throwIfClosedOrDisposed();\r
903             let method;\r
904             let messageParams;\r
905             if (Is.string(type)) {\r
906                 method = type;\r
907                 switch (params.length) {\r
908                     case 0:\r
909                         messageParams = null;\r
910                         break;\r
911                     case 1:\r
912                         messageParams = params[0];\r
913                         break;\r
914                     default:\r
915                         messageParams = params;\r
916                         break;\r
917                 }\r
918             }\r
919             else {\r
920                 method = type.method;\r
921                 messageParams = computeMessageParams(type, params);\r
922             }\r
923             let notificationMessage = {\r
924                 jsonrpc: version,\r
925                 method: method,\r
926                 params: messageParams\r
927             };\r
928             traceSendingNotification(notificationMessage);\r
929             messageWriter.write(notificationMessage);\r
930         },\r
931         onNotification: (type, handler) => {\r
932             throwIfClosedOrDisposed();\r
933             if (Is.func(type)) {\r
934                 starNotificationHandler = type;\r
935             }\r
936             else if (handler) {\r
937                 if (Is.string(type)) {\r
938                     notificationHandlers[type] = { type: undefined, handler };\r
939                 }\r
940                 else {\r
941                     notificationHandlers[type.method] = { type, handler };\r
942                 }\r
943             }\r
944         },\r
945         onProgress: (_type, token, handler) => {\r
946             if (progressHandlers.has(token)) {\r
947                 throw new Error(`Progress handler for token ${token} already registered`);\r
948             }\r
949             progressHandlers.set(token, handler);\r
950             return {\r
951                 dispose: () => {\r
952                     progressHandlers.delete(token);\r
953                 }\r
954             };\r
955         },\r
956         sendProgress: (_type, token, value) => {\r
957             connection.sendNotification(ProgressNotification.type, { token, value });\r
958         },\r
959         onUnhandledProgress: unhandledProgressEmitter.event,\r
960         sendRequest: (type, ...params) => {\r
961             throwIfClosedOrDisposed();\r
962             throwIfNotListening();\r
963             let method;\r
964             let messageParams;\r
965             let token = undefined;\r
966             if (Is.string(type)) {\r
967                 method = type;\r
968                 switch (params.length) {\r
969                     case 0:\r
970                         messageParams = null;\r
971                         break;\r
972                     case 1:\r
973                         // The cancellation token is optional so it can also be undefined.\r
974                         if (cancellation_1.CancellationToken.is(params[0])) {\r
975                             messageParams = null;\r
976                             token = params[0];\r
977                         }\r
978                         else {\r
979                             messageParams = undefinedToNull(params[0]);\r
980                         }\r
981                         break;\r
982                     default:\r
983                         const last = params.length - 1;\r
984                         if (cancellation_1.CancellationToken.is(params[last])) {\r
985                             token = params[last];\r
986                             if (params.length === 2) {\r
987                                 messageParams = undefinedToNull(params[0]);\r
988                             }\r
989                             else {\r
990                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
991                             }\r
992                         }\r
993                         else {\r
994                             messageParams = params.map(value => undefinedToNull(value));\r
995                         }\r
996                         break;\r
997                 }\r
998             }\r
999             else {\r
1000                 method = type.method;\r
1001                 messageParams = computeMessageParams(type, params);\r
1002                 let numberOfParams = type.numberOfParams;\r
1003                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
1004             }\r
1005             let id = sequenceNumber++;\r
1006             let result = new Promise((resolve, reject) => {\r
1007                 let requestMessage = {\r
1008                     jsonrpc: version,\r
1009                     id: id,\r
1010                     method: method,\r
1011                     params: messageParams\r
1012                 };\r
1013                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
1014                 traceSendingRequest(requestMessage);\r
1015                 try {\r
1016                     messageWriter.write(requestMessage);\r
1017                 }\r
1018                 catch (e) {\r
1019                     // Writing the message failed. So we need to reject the promise.\r
1020                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
1021                     responsePromise = null;\r
1022                 }\r
1023                 if (responsePromise) {\r
1024                     responsePromises[String(id)] = responsePromise;\r
1025                 }\r
1026             });\r
1027             if (token) {\r
1028                 token.onCancellationRequested(() => {\r
1029                     connection.sendNotification(CancelNotification.type, { id });\r
1030                 });\r
1031             }\r
1032             return result;\r
1033         },\r
1034         onRequest: (type, handler) => {\r
1035             throwIfClosedOrDisposed();\r
1036             if (Is.func(type)) {\r
1037                 starRequestHandler = type;\r
1038             }\r
1039             else if (handler) {\r
1040                 if (Is.string(type)) {\r
1041                     requestHandlers[type] = { type: undefined, handler };\r
1042                 }\r
1043                 else {\r
1044                     requestHandlers[type.method] = { type, handler };\r
1045                 }\r
1046             }\r
1047         },\r
1048         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
1049             let _sendNotification = false;\r
1050             let _traceFormat = TraceFormat.Text;\r
1051             if (sendNotificationOrTraceOptions !== void 0) {\r
1052                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
1053                     _sendNotification = sendNotificationOrTraceOptions;\r
1054                 }\r
1055                 else {\r
1056                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
1057                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
1058                 }\r
1059             }\r
1060             trace = _value;\r
1061             traceFormat = _traceFormat;\r
1062             if (trace === Trace.Off) {\r
1063                 tracer = undefined;\r
1064             }\r
1065             else {\r
1066                 tracer = _tracer;\r
1067             }\r
1068             if (_sendNotification && !isClosed() && !isDisposed()) {\r
1069                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
1070             }\r
1071         },\r
1072         onError: errorEmitter.event,\r
1073         onClose: closeEmitter.event,\r
1074         onUnhandledNotification: unhandledNotificationEmitter.event,\r
1075         onDispose: disposeEmitter.event,\r
1076         dispose: () => {\r
1077             if (isDisposed()) {\r
1078                 return;\r
1079             }\r
1080             state = ConnectionState.Disposed;\r
1081             disposeEmitter.fire(undefined);\r
1082             let error = new Error('Connection got disposed.');\r
1083             Object.keys(responsePromises).forEach((key) => {\r
1084                 responsePromises[key].reject(error);\r
1085             });\r
1086             responsePromises = Object.create(null);\r
1087             requestTokens = Object.create(null);\r
1088             messageQueue = new linkedMap_1.LinkedMap();\r
1089             // Test for backwards compatibility\r
1090             if (Is.func(messageWriter.dispose)) {\r
1091                 messageWriter.dispose();\r
1092             }\r
1093             if (Is.func(messageReader.dispose)) {\r
1094                 messageReader.dispose();\r
1095             }\r
1096         },\r
1097         listen: () => {\r
1098             throwIfClosedOrDisposed();\r
1099             throwIfListening();\r
1100             state = ConnectionState.Listening;\r
1101             messageReader.listen(callback);\r
1102         },\r
1103         inspect: () => {\r
1104             // eslint-disable-next-line no-console\r
1105             console.log('inspect');\r
1106         }\r
1107     };\r
1108     connection.onNotification(LogTraceNotification.type, (params) => {\r
1109         if (trace === Trace.Off || !tracer) {\r
1110             return;\r
1111         }\r
1112         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
1113     });\r
1114     connection.onNotification(ProgressNotification.type, (params) => {\r
1115         const handler = progressHandlers.get(params.token);\r
1116         if (handler) {\r
1117             handler(params.value);\r
1118         }\r
1119         else {\r
1120             unhandledProgressEmitter.fire(params);\r
1121         }\r
1122     });\r
1123     return connection;\r
1124 }\r
1125 function isMessageReader(value) {\r
1126     return value.listen !== void 0 && value.read === void 0;\r
1127 }\r
1128 function isMessageWriter(value) {\r
1129     return value.write !== void 0 && value.end === void 0;\r
1130 }\r
1131 function createMessageConnection(input, output, logger, strategy) {\r
1132     if (!logger) {\r
1133         logger = exports.NullLogger;\r
1134     }\r
1135     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
1136     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
1137     return _createMessageConnection(reader, writer, logger, strategy);\r
1138 }\r
1139 exports.createMessageConnection = createMessageConnection;\r
1140
1141
1142 /***/ }),
1143 /* 6 */
1144 /***/ (function(module, exports, __webpack_require__) {
1145
1146 "use strict";
1147 /* --------------------------------------------------------------------------------------------\r
1148  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1149  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1150  * ------------------------------------------------------------------------------------------ */\r
1151 \r
1152 Object.defineProperty(exports, "__esModule", { value: true });\r
1153 function boolean(value) {\r
1154     return value === true || value === false;\r
1155 }\r
1156 exports.boolean = boolean;\r
1157 function string(value) {\r
1158     return typeof value === 'string' || value instanceof String;\r
1159 }\r
1160 exports.string = string;\r
1161 function number(value) {\r
1162     return typeof value === 'number' || value instanceof Number;\r
1163 }\r
1164 exports.number = number;\r
1165 function error(value) {\r
1166     return value instanceof Error;\r
1167 }\r
1168 exports.error = error;\r
1169 function func(value) {\r
1170     return typeof value === 'function';\r
1171 }\r
1172 exports.func = func;\r
1173 function array(value) {\r
1174     return Array.isArray(value);\r
1175 }\r
1176 exports.array = array;\r
1177 function stringArray(value) {\r
1178     return array(value) && value.every(elem => string(elem));\r
1179 }\r
1180 exports.stringArray = stringArray;\r
1181
1182
1183 /***/ }),
1184 /* 7 */
1185 /***/ (function(module, exports, __webpack_require__) {
1186
1187 "use strict";
1188 /* --------------------------------------------------------------------------------------------\r
1189  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1190  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1191  * ------------------------------------------------------------------------------------------ */\r
1192 \r
1193 Object.defineProperty(exports, "__esModule", { value: true });\r
1194 const is = __webpack_require__(6);\r
1195 /**\r
1196  * Predefined error codes.\r
1197  */\r
1198 var ErrorCodes;\r
1199 (function (ErrorCodes) {\r
1200     // Defined by JSON RPC\r
1201     ErrorCodes.ParseError = -32700;\r
1202     ErrorCodes.InvalidRequest = -32600;\r
1203     ErrorCodes.MethodNotFound = -32601;\r
1204     ErrorCodes.InvalidParams = -32602;\r
1205     ErrorCodes.InternalError = -32603;\r
1206     ErrorCodes.serverErrorStart = -32099;\r
1207     ErrorCodes.serverErrorEnd = -32000;\r
1208     ErrorCodes.ServerNotInitialized = -32002;\r
1209     ErrorCodes.UnknownErrorCode = -32001;\r
1210     // Defined by the protocol.\r
1211     ErrorCodes.RequestCancelled = -32800;\r
1212     ErrorCodes.ContentModified = -32801;\r
1213     // Defined by VSCode library.\r
1214     ErrorCodes.MessageWriteError = 1;\r
1215     ErrorCodes.MessageReadError = 2;\r
1216 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
1217 /**\r
1218  * An error object return in a response in case a request\r
1219  * has failed.\r
1220  */\r
1221 class ResponseError extends Error {\r
1222     constructor(code, message, data) {\r
1223         super(message);\r
1224         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
1225         this.data = data;\r
1226         Object.setPrototypeOf(this, ResponseError.prototype);\r
1227     }\r
1228     toJson() {\r
1229         return {\r
1230             code: this.code,\r
1231             message: this.message,\r
1232             data: this.data,\r
1233         };\r
1234     }\r
1235 }\r
1236 exports.ResponseError = ResponseError;\r
1237 /**\r
1238  * An abstract implementation of a MessageType.\r
1239  */\r
1240 class AbstractMessageType {\r
1241     constructor(_method, _numberOfParams) {\r
1242         this._method = _method;\r
1243         this._numberOfParams = _numberOfParams;\r
1244     }\r
1245     get method() {\r
1246         return this._method;\r
1247     }\r
1248     get numberOfParams() {\r
1249         return this._numberOfParams;\r
1250     }\r
1251 }\r
1252 exports.AbstractMessageType = AbstractMessageType;\r
1253 /**\r
1254  * Classes to type request response pairs\r
1255  */\r
1256 class RequestType0 extends AbstractMessageType {\r
1257     constructor(method) {\r
1258         super(method, 0);\r
1259         this._ = undefined;\r
1260     }\r
1261 }\r
1262 exports.RequestType0 = RequestType0;\r
1263 class RequestType extends AbstractMessageType {\r
1264     constructor(method) {\r
1265         super(method, 1);\r
1266         this._ = undefined;\r
1267     }\r
1268 }\r
1269 exports.RequestType = RequestType;\r
1270 class RequestType1 extends AbstractMessageType {\r
1271     constructor(method) {\r
1272         super(method, 1);\r
1273         this._ = undefined;\r
1274     }\r
1275 }\r
1276 exports.RequestType1 = RequestType1;\r
1277 class RequestType2 extends AbstractMessageType {\r
1278     constructor(method) {\r
1279         super(method, 2);\r
1280         this._ = undefined;\r
1281     }\r
1282 }\r
1283 exports.RequestType2 = RequestType2;\r
1284 class RequestType3 extends AbstractMessageType {\r
1285     constructor(method) {\r
1286         super(method, 3);\r
1287         this._ = undefined;\r
1288     }\r
1289 }\r
1290 exports.RequestType3 = RequestType3;\r
1291 class RequestType4 extends AbstractMessageType {\r
1292     constructor(method) {\r
1293         super(method, 4);\r
1294         this._ = undefined;\r
1295     }\r
1296 }\r
1297 exports.RequestType4 = RequestType4;\r
1298 class RequestType5 extends AbstractMessageType {\r
1299     constructor(method) {\r
1300         super(method, 5);\r
1301         this._ = undefined;\r
1302     }\r
1303 }\r
1304 exports.RequestType5 = RequestType5;\r
1305 class RequestType6 extends AbstractMessageType {\r
1306     constructor(method) {\r
1307         super(method, 6);\r
1308         this._ = undefined;\r
1309     }\r
1310 }\r
1311 exports.RequestType6 = RequestType6;\r
1312 class RequestType7 extends AbstractMessageType {\r
1313     constructor(method) {\r
1314         super(method, 7);\r
1315         this._ = undefined;\r
1316     }\r
1317 }\r
1318 exports.RequestType7 = RequestType7;\r
1319 class RequestType8 extends AbstractMessageType {\r
1320     constructor(method) {\r
1321         super(method, 8);\r
1322         this._ = undefined;\r
1323     }\r
1324 }\r
1325 exports.RequestType8 = RequestType8;\r
1326 class RequestType9 extends AbstractMessageType {\r
1327     constructor(method) {\r
1328         super(method, 9);\r
1329         this._ = undefined;\r
1330     }\r
1331 }\r
1332 exports.RequestType9 = RequestType9;\r
1333 class NotificationType extends AbstractMessageType {\r
1334     constructor(method) {\r
1335         super(method, 1);\r
1336         this._ = undefined;\r
1337     }\r
1338 }\r
1339 exports.NotificationType = NotificationType;\r
1340 class NotificationType0 extends AbstractMessageType {\r
1341     constructor(method) {\r
1342         super(method, 0);\r
1343         this._ = undefined;\r
1344     }\r
1345 }\r
1346 exports.NotificationType0 = NotificationType0;\r
1347 class NotificationType1 extends AbstractMessageType {\r
1348     constructor(method) {\r
1349         super(method, 1);\r
1350         this._ = undefined;\r
1351     }\r
1352 }\r
1353 exports.NotificationType1 = NotificationType1;\r
1354 class NotificationType2 extends AbstractMessageType {\r
1355     constructor(method) {\r
1356         super(method, 2);\r
1357         this._ = undefined;\r
1358     }\r
1359 }\r
1360 exports.NotificationType2 = NotificationType2;\r
1361 class NotificationType3 extends AbstractMessageType {\r
1362     constructor(method) {\r
1363         super(method, 3);\r
1364         this._ = undefined;\r
1365     }\r
1366 }\r
1367 exports.NotificationType3 = NotificationType3;\r
1368 class NotificationType4 extends AbstractMessageType {\r
1369     constructor(method) {\r
1370         super(method, 4);\r
1371         this._ = undefined;\r
1372     }\r
1373 }\r
1374 exports.NotificationType4 = NotificationType4;\r
1375 class NotificationType5 extends AbstractMessageType {\r
1376     constructor(method) {\r
1377         super(method, 5);\r
1378         this._ = undefined;\r
1379     }\r
1380 }\r
1381 exports.NotificationType5 = NotificationType5;\r
1382 class NotificationType6 extends AbstractMessageType {\r
1383     constructor(method) {\r
1384         super(method, 6);\r
1385         this._ = undefined;\r
1386     }\r
1387 }\r
1388 exports.NotificationType6 = NotificationType6;\r
1389 class NotificationType7 extends AbstractMessageType {\r
1390     constructor(method) {\r
1391         super(method, 7);\r
1392         this._ = undefined;\r
1393     }\r
1394 }\r
1395 exports.NotificationType7 = NotificationType7;\r
1396 class NotificationType8 extends AbstractMessageType {\r
1397     constructor(method) {\r
1398         super(method, 8);\r
1399         this._ = undefined;\r
1400     }\r
1401 }\r
1402 exports.NotificationType8 = NotificationType8;\r
1403 class NotificationType9 extends AbstractMessageType {\r
1404     constructor(method) {\r
1405         super(method, 9);\r
1406         this._ = undefined;\r
1407     }\r
1408 }\r
1409 exports.NotificationType9 = NotificationType9;\r
1410 /**\r
1411  * Tests if the given message is a request message\r
1412  */\r
1413 function isRequestMessage(message) {\r
1414     let candidate = message;\r
1415     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
1416 }\r
1417 exports.isRequestMessage = isRequestMessage;\r
1418 /**\r
1419  * Tests if the given message is a notification message\r
1420  */\r
1421 function isNotificationMessage(message) {\r
1422     let candidate = message;\r
1423     return candidate && is.string(candidate.method) && message.id === void 0;\r
1424 }\r
1425 exports.isNotificationMessage = isNotificationMessage;\r
1426 /**\r
1427  * Tests if the given message is a response message\r
1428  */\r
1429 function isResponseMessage(message) {\r
1430     let candidate = message;\r
1431     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
1432 }\r
1433 exports.isResponseMessage = isResponseMessage;\r
1434
1435
1436 /***/ }),
1437 /* 8 */
1438 /***/ (function(module, exports, __webpack_require__) {
1439
1440 "use strict";
1441 /* --------------------------------------------------------------------------------------------\r
1442  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1443  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1444  * ------------------------------------------------------------------------------------------ */\r
1445 \r
1446 Object.defineProperty(exports, "__esModule", { value: true });\r
1447 const events_1 = __webpack_require__(9);\r
1448 const Is = __webpack_require__(6);\r
1449 let DefaultSize = 8192;\r
1450 let CR = Buffer.from('\r', 'ascii')[0];\r
1451 let LF = Buffer.from('\n', 'ascii')[0];\r
1452 let CRLF = '\r\n';\r
1453 class MessageBuffer {\r
1454     constructor(encoding = 'utf8') {\r
1455         this.encoding = encoding;\r
1456         this.index = 0;\r
1457         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
1458     }\r
1459     append(chunk) {\r
1460         var toAppend = chunk;\r
1461         if (typeof (chunk) === 'string') {\r
1462             var str = chunk;\r
1463             var bufferLen = Buffer.byteLength(str, this.encoding);\r
1464             toAppend = Buffer.allocUnsafe(bufferLen);\r
1465             toAppend.write(str, 0, bufferLen, this.encoding);\r
1466         }\r
1467         if (this.buffer.length - this.index >= toAppend.length) {\r
1468             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
1469         }\r
1470         else {\r
1471             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
1472             if (this.index === 0) {\r
1473                 this.buffer = Buffer.allocUnsafe(newSize);\r
1474                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
1475             }\r
1476             else {\r
1477                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
1478             }\r
1479         }\r
1480         this.index += toAppend.length;\r
1481     }\r
1482     tryReadHeaders() {\r
1483         let result = undefined;\r
1484         let current = 0;\r
1485         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
1486             current++;\r
1487         }\r
1488         // No header / body separator found (e.g CRLFCRLF)\r
1489         if (current + 3 >= this.index) {\r
1490             return result;\r
1491         }\r
1492         result = Object.create(null);\r
1493         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
1494         headers.forEach((header) => {\r
1495             let index = header.indexOf(':');\r
1496             if (index === -1) {\r
1497                 throw new Error('Message header must separate key and value using :');\r
1498             }\r
1499             let key = header.substr(0, index);\r
1500             let value = header.substr(index + 1).trim();\r
1501             result[key] = value;\r
1502         });\r
1503         let nextStart = current + 4;\r
1504         this.buffer = this.buffer.slice(nextStart);\r
1505         this.index = this.index - nextStart;\r
1506         return result;\r
1507     }\r
1508     tryReadContent(length) {\r
1509         if (this.index < length) {\r
1510             return null;\r
1511         }\r
1512         let result = this.buffer.toString(this.encoding, 0, length);\r
1513         let nextStart = length;\r
1514         this.buffer.copy(this.buffer, 0, nextStart);\r
1515         this.index = this.index - nextStart;\r
1516         return result;\r
1517     }\r
1518     get numberOfBytes() {\r
1519         return this.index;\r
1520     }\r
1521 }\r
1522 var MessageReader;\r
1523 (function (MessageReader) {\r
1524     function is(value) {\r
1525         let candidate = value;\r
1526         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
1527             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
1528     }\r
1529     MessageReader.is = is;\r
1530 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
1531 class AbstractMessageReader {\r
1532     constructor() {\r
1533         this.errorEmitter = new events_1.Emitter();\r
1534         this.closeEmitter = new events_1.Emitter();\r
1535         this.partialMessageEmitter = new events_1.Emitter();\r
1536     }\r
1537     dispose() {\r
1538         this.errorEmitter.dispose();\r
1539         this.closeEmitter.dispose();\r
1540     }\r
1541     get onError() {\r
1542         return this.errorEmitter.event;\r
1543     }\r
1544     fireError(error) {\r
1545         this.errorEmitter.fire(this.asError(error));\r
1546     }\r
1547     get onClose() {\r
1548         return this.closeEmitter.event;\r
1549     }\r
1550     fireClose() {\r
1551         this.closeEmitter.fire(undefined);\r
1552     }\r
1553     get onPartialMessage() {\r
1554         return this.partialMessageEmitter.event;\r
1555     }\r
1556     firePartialMessage(info) {\r
1557         this.partialMessageEmitter.fire(info);\r
1558     }\r
1559     asError(error) {\r
1560         if (error instanceof Error) {\r
1561             return error;\r
1562         }\r
1563         else {\r
1564             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1565         }\r
1566     }\r
1567 }\r
1568 exports.AbstractMessageReader = AbstractMessageReader;\r
1569 class StreamMessageReader extends AbstractMessageReader {\r
1570     constructor(readable, encoding = 'utf8') {\r
1571         super();\r
1572         this.readable = readable;\r
1573         this.buffer = new MessageBuffer(encoding);\r
1574         this._partialMessageTimeout = 10000;\r
1575     }\r
1576     set partialMessageTimeout(timeout) {\r
1577         this._partialMessageTimeout = timeout;\r
1578     }\r
1579     get partialMessageTimeout() {\r
1580         return this._partialMessageTimeout;\r
1581     }\r
1582     listen(callback) {\r
1583         this.nextMessageLength = -1;\r
1584         this.messageToken = 0;\r
1585         this.partialMessageTimer = undefined;\r
1586         this.callback = callback;\r
1587         this.readable.on('data', (data) => {\r
1588             this.onData(data);\r
1589         });\r
1590         this.readable.on('error', (error) => this.fireError(error));\r
1591         this.readable.on('close', () => this.fireClose());\r
1592     }\r
1593     onData(data) {\r
1594         this.buffer.append(data);\r
1595         while (true) {\r
1596             if (this.nextMessageLength === -1) {\r
1597                 let headers = this.buffer.tryReadHeaders();\r
1598                 if (!headers) {\r
1599                     return;\r
1600                 }\r
1601                 let contentLength = headers['Content-Length'];\r
1602                 if (!contentLength) {\r
1603                     throw new Error('Header must provide a Content-Length property.');\r
1604                 }\r
1605                 let length = parseInt(contentLength);\r
1606                 if (isNaN(length)) {\r
1607                     throw new Error('Content-Length value must be a number.');\r
1608                 }\r
1609                 this.nextMessageLength = length;\r
1610                 // Take the encoding form the header. For compatibility\r
1611                 // treat both utf-8 and utf8 as node utf8\r
1612             }\r
1613             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
1614             if (msg === null) {\r
1615                 /** We haven't received the full message yet. */\r
1616                 this.setPartialMessageTimer();\r
1617                 return;\r
1618             }\r
1619             this.clearPartialMessageTimer();\r
1620             this.nextMessageLength = -1;\r
1621             this.messageToken++;\r
1622             var json = JSON.parse(msg);\r
1623             this.callback(json);\r
1624         }\r
1625     }\r
1626     clearPartialMessageTimer() {\r
1627         if (this.partialMessageTimer) {\r
1628             clearTimeout(this.partialMessageTimer);\r
1629             this.partialMessageTimer = undefined;\r
1630         }\r
1631     }\r
1632     setPartialMessageTimer() {\r
1633         this.clearPartialMessageTimer();\r
1634         if (this._partialMessageTimeout <= 0) {\r
1635             return;\r
1636         }\r
1637         this.partialMessageTimer = setTimeout((token, timeout) => {\r
1638             this.partialMessageTimer = undefined;\r
1639             if (token === this.messageToken) {\r
1640                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
1641                 this.setPartialMessageTimer();\r
1642             }\r
1643         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
1644     }\r
1645 }\r
1646 exports.StreamMessageReader = StreamMessageReader;\r
1647 class IPCMessageReader extends AbstractMessageReader {\r
1648     constructor(process) {\r
1649         super();\r
1650         this.process = process;\r
1651         let eventEmitter = this.process;\r
1652         eventEmitter.on('error', (error) => this.fireError(error));\r
1653         eventEmitter.on('close', () => this.fireClose());\r
1654     }\r
1655     listen(callback) {\r
1656         this.process.on('message', callback);\r
1657     }\r
1658 }\r
1659 exports.IPCMessageReader = IPCMessageReader;\r
1660 class SocketMessageReader extends StreamMessageReader {\r
1661     constructor(socket, encoding = 'utf-8') {\r
1662         super(socket, encoding);\r
1663     }\r
1664 }\r
1665 exports.SocketMessageReader = SocketMessageReader;\r
1666
1667
1668 /***/ }),
1669 /* 9 */
1670 /***/ (function(module, exports, __webpack_require__) {
1671
1672 "use strict";
1673 /* --------------------------------------------------------------------------------------------\r
1674  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1675  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1676  * ------------------------------------------------------------------------------------------ */\r
1677 \r
1678 Object.defineProperty(exports, "__esModule", { value: true });\r
1679 var Disposable;\r
1680 (function (Disposable) {\r
1681     function create(func) {\r
1682         return {\r
1683             dispose: func\r
1684         };\r
1685     }\r
1686     Disposable.create = create;\r
1687 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
1688 var Event;\r
1689 (function (Event) {\r
1690     const _disposable = { dispose() { } };\r
1691     Event.None = function () { return _disposable; };\r
1692 })(Event = exports.Event || (exports.Event = {}));\r
1693 class CallbackList {\r
1694     add(callback, context = null, bucket) {\r
1695         if (!this._callbacks) {\r
1696             this._callbacks = [];\r
1697             this._contexts = [];\r
1698         }\r
1699         this._callbacks.push(callback);\r
1700         this._contexts.push(context);\r
1701         if (Array.isArray(bucket)) {\r
1702             bucket.push({ dispose: () => this.remove(callback, context) });\r
1703         }\r
1704     }\r
1705     remove(callback, context = null) {\r
1706         if (!this._callbacks) {\r
1707             return;\r
1708         }\r
1709         var foundCallbackWithDifferentContext = false;\r
1710         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
1711             if (this._callbacks[i] === callback) {\r
1712                 if (this._contexts[i] === context) {\r
1713                     // callback & context match => remove it\r
1714                     this._callbacks.splice(i, 1);\r
1715                     this._contexts.splice(i, 1);\r
1716                     return;\r
1717                 }\r
1718                 else {\r
1719                     foundCallbackWithDifferentContext = true;\r
1720                 }\r
1721             }\r
1722         }\r
1723         if (foundCallbackWithDifferentContext) {\r
1724             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
1725         }\r
1726     }\r
1727     invoke(...args) {\r
1728         if (!this._callbacks) {\r
1729             return [];\r
1730         }\r
1731         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
1732         for (var i = 0, len = callbacks.length; i < len; i++) {\r
1733             try {\r
1734                 ret.push(callbacks[i].apply(contexts[i], args));\r
1735             }\r
1736             catch (e) {\r
1737                 // eslint-disable-next-line no-console\r
1738                 console.error(e);\r
1739             }\r
1740         }\r
1741         return ret;\r
1742     }\r
1743     isEmpty() {\r
1744         return !this._callbacks || this._callbacks.length === 0;\r
1745     }\r
1746     dispose() {\r
1747         this._callbacks = undefined;\r
1748         this._contexts = undefined;\r
1749     }\r
1750 }\r
1751 class Emitter {\r
1752     constructor(_options) {\r
1753         this._options = _options;\r
1754     }\r
1755     /**\r
1756      * For the public to allow to subscribe\r
1757      * to events from this Emitter\r
1758      */\r
1759     get event() {\r
1760         if (!this._event) {\r
1761             this._event = (listener, thisArgs, disposables) => {\r
1762                 if (!this._callbacks) {\r
1763                     this._callbacks = new CallbackList();\r
1764                 }\r
1765                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
1766                     this._options.onFirstListenerAdd(this);\r
1767                 }\r
1768                 this._callbacks.add(listener, thisArgs);\r
1769                 let result;\r
1770                 result = {\r
1771                     dispose: () => {\r
1772                         this._callbacks.remove(listener, thisArgs);\r
1773                         result.dispose = Emitter._noop;\r
1774                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
1775                             this._options.onLastListenerRemove(this);\r
1776                         }\r
1777                     }\r
1778                 };\r
1779                 if (Array.isArray(disposables)) {\r
1780                     disposables.push(result);\r
1781                 }\r
1782                 return result;\r
1783             };\r
1784         }\r
1785         return this._event;\r
1786     }\r
1787     /**\r
1788      * To be kept private to fire an event to\r
1789      * subscribers\r
1790      */\r
1791     fire(event) {\r
1792         if (this._callbacks) {\r
1793             this._callbacks.invoke.call(this._callbacks, event);\r
1794         }\r
1795     }\r
1796     dispose() {\r
1797         if (this._callbacks) {\r
1798             this._callbacks.dispose();\r
1799             this._callbacks = undefined;\r
1800         }\r
1801     }\r
1802 }\r
1803 exports.Emitter = Emitter;\r
1804 Emitter._noop = function () { };\r
1805
1806
1807 /***/ }),
1808 /* 10 */
1809 /***/ (function(module, exports, __webpack_require__) {
1810
1811 "use strict";
1812 /* --------------------------------------------------------------------------------------------\r
1813  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1814  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1815  * ------------------------------------------------------------------------------------------ */\r
1816 \r
1817 Object.defineProperty(exports, "__esModule", { value: true });\r
1818 const events_1 = __webpack_require__(9);\r
1819 const Is = __webpack_require__(6);\r
1820 let ContentLength = 'Content-Length: ';\r
1821 let CRLF = '\r\n';\r
1822 var MessageWriter;\r
1823 (function (MessageWriter) {\r
1824     function is(value) {\r
1825         let candidate = value;\r
1826         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
1827             Is.func(candidate.onError) && Is.func(candidate.write);\r
1828     }\r
1829     MessageWriter.is = is;\r
1830 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
1831 class AbstractMessageWriter {\r
1832     constructor() {\r
1833         this.errorEmitter = new events_1.Emitter();\r
1834         this.closeEmitter = new events_1.Emitter();\r
1835     }\r
1836     dispose() {\r
1837         this.errorEmitter.dispose();\r
1838         this.closeEmitter.dispose();\r
1839     }\r
1840     get onError() {\r
1841         return this.errorEmitter.event;\r
1842     }\r
1843     fireError(error, message, count) {\r
1844         this.errorEmitter.fire([this.asError(error), message, count]);\r
1845     }\r
1846     get onClose() {\r
1847         return this.closeEmitter.event;\r
1848     }\r
1849     fireClose() {\r
1850         this.closeEmitter.fire(undefined);\r
1851     }\r
1852     asError(error) {\r
1853         if (error instanceof Error) {\r
1854             return error;\r
1855         }\r
1856         else {\r
1857             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1858         }\r
1859     }\r
1860 }\r
1861 exports.AbstractMessageWriter = AbstractMessageWriter;\r
1862 class StreamMessageWriter extends AbstractMessageWriter {\r
1863     constructor(writable, encoding = 'utf8') {\r
1864         super();\r
1865         this.writable = writable;\r
1866         this.encoding = encoding;\r
1867         this.errorCount = 0;\r
1868         this.writable.on('error', (error) => this.fireError(error));\r
1869         this.writable.on('close', () => this.fireClose());\r
1870     }\r
1871     write(msg) {\r
1872         let json = JSON.stringify(msg);\r
1873         let contentLength = Buffer.byteLength(json, this.encoding);\r
1874         let headers = [\r
1875             ContentLength, contentLength.toString(), CRLF,\r
1876             CRLF\r
1877         ];\r
1878         try {\r
1879             // Header must be written in ASCII encoding\r
1880             this.writable.write(headers.join(''), 'ascii');\r
1881             // Now write the content. This can be written in any encoding\r
1882             this.writable.write(json, this.encoding);\r
1883             this.errorCount = 0;\r
1884         }\r
1885         catch (error) {\r
1886             this.errorCount++;\r
1887             this.fireError(error, msg, this.errorCount);\r
1888         }\r
1889     }\r
1890 }\r
1891 exports.StreamMessageWriter = StreamMessageWriter;\r
1892 class IPCMessageWriter extends AbstractMessageWriter {\r
1893     constructor(process) {\r
1894         super();\r
1895         this.process = process;\r
1896         this.errorCount = 0;\r
1897         this.queue = [];\r
1898         this.sending = false;\r
1899         let eventEmitter = this.process;\r
1900         eventEmitter.on('error', (error) => this.fireError(error));\r
1901         eventEmitter.on('close', () => this.fireClose);\r
1902     }\r
1903     write(msg) {\r
1904         if (!this.sending && this.queue.length === 0) {\r
1905             // See https://github.com/nodejs/node/issues/7657\r
1906             this.doWriteMessage(msg);\r
1907         }\r
1908         else {\r
1909             this.queue.push(msg);\r
1910         }\r
1911     }\r
1912     doWriteMessage(msg) {\r
1913         try {\r
1914             if (this.process.send) {\r
1915                 this.sending = true;\r
1916                 this.process.send(msg, undefined, undefined, (error) => {\r
1917                     this.sending = false;\r
1918                     if (error) {\r
1919                         this.errorCount++;\r
1920                         this.fireError(error, msg, this.errorCount);\r
1921                     }\r
1922                     else {\r
1923                         this.errorCount = 0;\r
1924                     }\r
1925                     if (this.queue.length > 0) {\r
1926                         this.doWriteMessage(this.queue.shift());\r
1927                     }\r
1928                 });\r
1929             }\r
1930         }\r
1931         catch (error) {\r
1932             this.errorCount++;\r
1933             this.fireError(error, msg, this.errorCount);\r
1934         }\r
1935     }\r
1936 }\r
1937 exports.IPCMessageWriter = IPCMessageWriter;\r
1938 class SocketMessageWriter extends AbstractMessageWriter {\r
1939     constructor(socket, encoding = 'utf8') {\r
1940         super();\r
1941         this.socket = socket;\r
1942         this.queue = [];\r
1943         this.sending = false;\r
1944         this.encoding = encoding;\r
1945         this.errorCount = 0;\r
1946         this.socket.on('error', (error) => this.fireError(error));\r
1947         this.socket.on('close', () => this.fireClose());\r
1948     }\r
1949     dispose() {\r
1950         super.dispose();\r
1951         this.socket.destroy();\r
1952     }\r
1953     write(msg) {\r
1954         if (!this.sending && this.queue.length === 0) {\r
1955             // See https://github.com/nodejs/node/issues/7657\r
1956             this.doWriteMessage(msg);\r
1957         }\r
1958         else {\r
1959             this.queue.push(msg);\r
1960         }\r
1961     }\r
1962     doWriteMessage(msg) {\r
1963         let json = JSON.stringify(msg);\r
1964         let contentLength = Buffer.byteLength(json, this.encoding);\r
1965         let headers = [\r
1966             ContentLength, contentLength.toString(), CRLF,\r
1967             CRLF\r
1968         ];\r
1969         try {\r
1970             // Header must be written in ASCII encoding\r
1971             this.sending = true;\r
1972             this.socket.write(headers.join(''), 'ascii', (error) => {\r
1973                 if (error) {\r
1974                     this.handleError(error, msg);\r
1975                 }\r
1976                 try {\r
1977                     // Now write the content. This can be written in any encoding\r
1978                     this.socket.write(json, this.encoding, (error) => {\r
1979                         this.sending = false;\r
1980                         if (error) {\r
1981                             this.handleError(error, msg);\r
1982                         }\r
1983                         else {\r
1984                             this.errorCount = 0;\r
1985                         }\r
1986                         if (this.queue.length > 0) {\r
1987                             this.doWriteMessage(this.queue.shift());\r
1988                         }\r
1989                     });\r
1990                 }\r
1991                 catch (error) {\r
1992                     this.handleError(error, msg);\r
1993                 }\r
1994             });\r
1995         }\r
1996         catch (error) {\r
1997             this.handleError(error, msg);\r
1998         }\r
1999     }\r
2000     handleError(error, msg) {\r
2001         this.errorCount++;\r
2002         this.fireError(error, msg, this.errorCount);\r
2003     }\r
2004 }\r
2005 exports.SocketMessageWriter = SocketMessageWriter;\r
2006
2007
2008 /***/ }),
2009 /* 11 */
2010 /***/ (function(module, exports, __webpack_require__) {
2011
2012 "use strict";
2013 /*---------------------------------------------------------------------------------------------\r
2014  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2015  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2016  *--------------------------------------------------------------------------------------------*/\r
2017 \r
2018 Object.defineProperty(exports, "__esModule", { value: true });\r
2019 const events_1 = __webpack_require__(9);\r
2020 const Is = __webpack_require__(6);\r
2021 var CancellationToken;\r
2022 (function (CancellationToken) {\r
2023     CancellationToken.None = Object.freeze({\r
2024         isCancellationRequested: false,\r
2025         onCancellationRequested: events_1.Event.None\r
2026     });\r
2027     CancellationToken.Cancelled = Object.freeze({\r
2028         isCancellationRequested: true,\r
2029         onCancellationRequested: events_1.Event.None\r
2030     });\r
2031     function is(value) {\r
2032         let candidate = value;\r
2033         return candidate && (candidate === CancellationToken.None\r
2034             || candidate === CancellationToken.Cancelled\r
2035             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
2036     }\r
2037     CancellationToken.is = is;\r
2038 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
2039 const shortcutEvent = Object.freeze(function (callback, context) {\r
2040     let handle = setTimeout(callback.bind(context), 0);\r
2041     return { dispose() { clearTimeout(handle); } };\r
2042 });\r
2043 class MutableToken {\r
2044     constructor() {\r
2045         this._isCancelled = false;\r
2046     }\r
2047     cancel() {\r
2048         if (!this._isCancelled) {\r
2049             this._isCancelled = true;\r
2050             if (this._emitter) {\r
2051                 this._emitter.fire(undefined);\r
2052                 this.dispose();\r
2053             }\r
2054         }\r
2055     }\r
2056     get isCancellationRequested() {\r
2057         return this._isCancelled;\r
2058     }\r
2059     get onCancellationRequested() {\r
2060         if (this._isCancelled) {\r
2061             return shortcutEvent;\r
2062         }\r
2063         if (!this._emitter) {\r
2064             this._emitter = new events_1.Emitter();\r
2065         }\r
2066         return this._emitter.event;\r
2067     }\r
2068     dispose() {\r
2069         if (this._emitter) {\r
2070             this._emitter.dispose();\r
2071             this._emitter = undefined;\r
2072         }\r
2073     }\r
2074 }\r
2075 class CancellationTokenSource {\r
2076     get token() {\r
2077         if (!this._token) {\r
2078             // be lazy and create the token only when\r
2079             // actually needed\r
2080             this._token = new MutableToken();\r
2081         }\r
2082         return this._token;\r
2083     }\r
2084     cancel() {\r
2085         if (!this._token) {\r
2086             // save an object by returning the default\r
2087             // cancelled token when cancellation happens\r
2088             // before someone asks for the token\r
2089             this._token = CancellationToken.Cancelled;\r
2090         }\r
2091         else {\r
2092             this._token.cancel();\r
2093         }\r
2094     }\r
2095     dispose() {\r
2096         if (!this._token) {\r
2097             // ensure to initialize with an empty token if we had none\r
2098             this._token = CancellationToken.None;\r
2099         }\r
2100         else if (this._token instanceof MutableToken) {\r
2101             // actually dispose\r
2102             this._token.dispose();\r
2103         }\r
2104     }\r
2105 }\r
2106 exports.CancellationTokenSource = CancellationTokenSource;\r
2107
2108
2109 /***/ }),
2110 /* 12 */
2111 /***/ (function(module, exports, __webpack_require__) {
2112
2113 "use strict";
2114 \r
2115 /*---------------------------------------------------------------------------------------------\r
2116  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2117  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2118  *--------------------------------------------------------------------------------------------*/\r
2119 Object.defineProperty(exports, "__esModule", { value: true });\r
2120 var Touch;\r
2121 (function (Touch) {\r
2122     Touch.None = 0;\r
2123     Touch.First = 1;\r
2124     Touch.Last = 2;\r
2125 })(Touch = exports.Touch || (exports.Touch = {}));\r
2126 class LinkedMap {\r
2127     constructor() {\r
2128         this._map = new Map();\r
2129         this._head = undefined;\r
2130         this._tail = undefined;\r
2131         this._size = 0;\r
2132     }\r
2133     clear() {\r
2134         this._map.clear();\r
2135         this._head = undefined;\r
2136         this._tail = undefined;\r
2137         this._size = 0;\r
2138     }\r
2139     isEmpty() {\r
2140         return !this._head && !this._tail;\r
2141     }\r
2142     get size() {\r
2143         return this._size;\r
2144     }\r
2145     has(key) {\r
2146         return this._map.has(key);\r
2147     }\r
2148     get(key) {\r
2149         const item = this._map.get(key);\r
2150         if (!item) {\r
2151             return undefined;\r
2152         }\r
2153         return item.value;\r
2154     }\r
2155     set(key, value, touch = Touch.None) {\r
2156         let item = this._map.get(key);\r
2157         if (item) {\r
2158             item.value = value;\r
2159             if (touch !== Touch.None) {\r
2160                 this.touch(item, touch);\r
2161             }\r
2162         }\r
2163         else {\r
2164             item = { key, value, next: undefined, previous: undefined };\r
2165             switch (touch) {\r
2166                 case Touch.None:\r
2167                     this.addItemLast(item);\r
2168                     break;\r
2169                 case Touch.First:\r
2170                     this.addItemFirst(item);\r
2171                     break;\r
2172                 case Touch.Last:\r
2173                     this.addItemLast(item);\r
2174                     break;\r
2175                 default:\r
2176                     this.addItemLast(item);\r
2177                     break;\r
2178             }\r
2179             this._map.set(key, item);\r
2180             this._size++;\r
2181         }\r
2182     }\r
2183     delete(key) {\r
2184         const item = this._map.get(key);\r
2185         if (!item) {\r
2186             return false;\r
2187         }\r
2188         this._map.delete(key);\r
2189         this.removeItem(item);\r
2190         this._size--;\r
2191         return true;\r
2192     }\r
2193     shift() {\r
2194         if (!this._head && !this._tail) {\r
2195             return undefined;\r
2196         }\r
2197         if (!this._head || !this._tail) {\r
2198             throw new Error('Invalid list');\r
2199         }\r
2200         const item = this._head;\r
2201         this._map.delete(item.key);\r
2202         this.removeItem(item);\r
2203         this._size--;\r
2204         return item.value;\r
2205     }\r
2206     forEach(callbackfn, thisArg) {\r
2207         let current = this._head;\r
2208         while (current) {\r
2209             if (thisArg) {\r
2210                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2211             }\r
2212             else {\r
2213                 callbackfn(current.value, current.key, this);\r
2214             }\r
2215             current = current.next;\r
2216         }\r
2217     }\r
2218     forEachReverse(callbackfn, thisArg) {\r
2219         let current = this._tail;\r
2220         while (current) {\r
2221             if (thisArg) {\r
2222                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2223             }\r
2224             else {\r
2225                 callbackfn(current.value, current.key, this);\r
2226             }\r
2227             current = current.previous;\r
2228         }\r
2229     }\r
2230     values() {\r
2231         let result = [];\r
2232         let current = this._head;\r
2233         while (current) {\r
2234             result.push(current.value);\r
2235             current = current.next;\r
2236         }\r
2237         return result;\r
2238     }\r
2239     keys() {\r
2240         let result = [];\r
2241         let current = this._head;\r
2242         while (current) {\r
2243             result.push(current.key);\r
2244             current = current.next;\r
2245         }\r
2246         return result;\r
2247     }\r
2248     /* JSON RPC run on es5 which has no Symbol.iterator\r
2249     public keys(): IterableIterator<K> {\r
2250         let current = this._head;\r
2251         let iterator: IterableIterator<K> = {\r
2252             [Symbol.iterator]() {\r
2253                 return iterator;\r
2254             },\r
2255             next():IteratorResult<K> {\r
2256                 if (current) {\r
2257                     let result = { value: current.key, done: false };\r
2258                     current = current.next;\r
2259                     return result;\r
2260                 } else {\r
2261                     return { value: undefined, done: true };\r
2262                 }\r
2263             }\r
2264         };\r
2265         return iterator;\r
2266     }\r
2267 \r
2268     public values(): IterableIterator<V> {\r
2269         let current = this._head;\r
2270         let iterator: IterableIterator<V> = {\r
2271             [Symbol.iterator]() {\r
2272                 return iterator;\r
2273             },\r
2274             next():IteratorResult<V> {\r
2275                 if (current) {\r
2276                     let result = { value: current.value, done: false };\r
2277                     current = current.next;\r
2278                     return result;\r
2279                 } else {\r
2280                     return { value: undefined, done: true };\r
2281                 }\r
2282             }\r
2283         };\r
2284         return iterator;\r
2285     }\r
2286     */\r
2287     addItemFirst(item) {\r
2288         // First time Insert\r
2289         if (!this._head && !this._tail) {\r
2290             this._tail = item;\r
2291         }\r
2292         else if (!this._head) {\r
2293             throw new Error('Invalid list');\r
2294         }\r
2295         else {\r
2296             item.next = this._head;\r
2297             this._head.previous = item;\r
2298         }\r
2299         this._head = item;\r
2300     }\r
2301     addItemLast(item) {\r
2302         // First time Insert\r
2303         if (!this._head && !this._tail) {\r
2304             this._head = item;\r
2305         }\r
2306         else if (!this._tail) {\r
2307             throw new Error('Invalid list');\r
2308         }\r
2309         else {\r
2310             item.previous = this._tail;\r
2311             this._tail.next = item;\r
2312         }\r
2313         this._tail = item;\r
2314     }\r
2315     removeItem(item) {\r
2316         if (item === this._head && item === this._tail) {\r
2317             this._head = undefined;\r
2318             this._tail = undefined;\r
2319         }\r
2320         else if (item === this._head) {\r
2321             this._head = item.next;\r
2322         }\r
2323         else if (item === this._tail) {\r
2324             this._tail = item.previous;\r
2325         }\r
2326         else {\r
2327             const next = item.next;\r
2328             const previous = item.previous;\r
2329             if (!next || !previous) {\r
2330                 throw new Error('Invalid list');\r
2331             }\r
2332             next.previous = previous;\r
2333             previous.next = next;\r
2334         }\r
2335     }\r
2336     touch(item, touch) {\r
2337         if (!this._head || !this._tail) {\r
2338             throw new Error('Invalid list');\r
2339         }\r
2340         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
2341             return;\r
2342         }\r
2343         if (touch === Touch.First) {\r
2344             if (item === this._head) {\r
2345                 return;\r
2346             }\r
2347             const next = item.next;\r
2348             const previous = item.previous;\r
2349             // Unlink the item\r
2350             if (item === this._tail) {\r
2351                 // previous must be defined since item was not head but is tail\r
2352                 // So there are more than on item in the map\r
2353                 previous.next = undefined;\r
2354                 this._tail = previous;\r
2355             }\r
2356             else {\r
2357                 // Both next and previous are not undefined since item was neither head nor tail.\r
2358                 next.previous = previous;\r
2359                 previous.next = next;\r
2360             }\r
2361             // Insert the node at head\r
2362             item.previous = undefined;\r
2363             item.next = this._head;\r
2364             this._head.previous = item;\r
2365             this._head = item;\r
2366         }\r
2367         else if (touch === Touch.Last) {\r
2368             if (item === this._tail) {\r
2369                 return;\r
2370             }\r
2371             const next = item.next;\r
2372             const previous = item.previous;\r
2373             // Unlink the item.\r
2374             if (item === this._head) {\r
2375                 // next must be defined since item was not tail but is head\r
2376                 // So there are more than on item in the map\r
2377                 next.previous = undefined;\r
2378                 this._head = next;\r
2379             }\r
2380             else {\r
2381                 // Both next and previous are not undefined since item was neither head nor tail.\r
2382                 next.previous = previous;\r
2383                 previous.next = next;\r
2384             }\r
2385             item.next = undefined;\r
2386             item.previous = this._tail;\r
2387             this._tail.next = item;\r
2388             this._tail = item;\r
2389         }\r
2390     }\r
2391 }\r
2392 exports.LinkedMap = LinkedMap;\r
2393
2394
2395 /***/ }),
2396 /* 13 */
2397 /***/ (function(module, exports, __webpack_require__) {
2398
2399 "use strict";
2400 /* --------------------------------------------------------------------------------------------\r
2401  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2402  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2403  * ------------------------------------------------------------------------------------------ */\r
2404 \r
2405 Object.defineProperty(exports, "__esModule", { value: true });\r
2406 const path_1 = __webpack_require__(3);\r
2407 const os_1 = __webpack_require__(14);\r
2408 const crypto_1 = __webpack_require__(15);\r
2409 const net_1 = __webpack_require__(16);\r
2410 const messageReader_1 = __webpack_require__(8);\r
2411 const messageWriter_1 = __webpack_require__(10);\r
2412 function generateRandomPipeName() {\r
2413     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
2414     if (process.platform === 'win32') {\r
2415         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
2416     }\r
2417     else {\r
2418         // Mac/Unix: use socket file\r
2419         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
2420     }\r
2421 }\r
2422 exports.generateRandomPipeName = generateRandomPipeName;\r
2423 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
2424     let connectResolve;\r
2425     let connected = new Promise((resolve, _reject) => {\r
2426         connectResolve = resolve;\r
2427     });\r
2428     return new Promise((resolve, reject) => {\r
2429         let server = net_1.createServer((socket) => {\r
2430             server.close();\r
2431             connectResolve([\r
2432                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2433                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2434             ]);\r
2435         });\r
2436         server.on('error', reject);\r
2437         server.listen(pipeName, () => {\r
2438             server.removeListener('error', reject);\r
2439             resolve({\r
2440                 onConnected: () => { return connected; }\r
2441             });\r
2442         });\r
2443     });\r
2444 }\r
2445 exports.createClientPipeTransport = createClientPipeTransport;\r
2446 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
2447     const socket = net_1.createConnection(pipeName);\r
2448     return [\r
2449         new messageReader_1.SocketMessageReader(socket, encoding),\r
2450         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2451     ];\r
2452 }\r
2453 exports.createServerPipeTransport = createServerPipeTransport;\r
2454
2455
2456 /***/ }),
2457 /* 14 */
2458 /***/ (function(module, exports) {
2459
2460 module.exports = require("os");
2461
2462 /***/ }),
2463 /* 15 */
2464 /***/ (function(module, exports) {
2465
2466 module.exports = require("crypto");
2467
2468 /***/ }),
2469 /* 16 */
2470 /***/ (function(module, exports) {
2471
2472 module.exports = require("net");
2473
2474 /***/ }),
2475 /* 17 */
2476 /***/ (function(module, exports, __webpack_require__) {
2477
2478 "use strict";
2479 /* --------------------------------------------------------------------------------------------\r
2480  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2481  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2482  * ------------------------------------------------------------------------------------------ */\r
2483 \r
2484 Object.defineProperty(exports, "__esModule", { value: true });\r
2485 const net_1 = __webpack_require__(16);\r
2486 const messageReader_1 = __webpack_require__(8);\r
2487 const messageWriter_1 = __webpack_require__(10);\r
2488 function createClientSocketTransport(port, encoding = 'utf-8') {\r
2489     let connectResolve;\r
2490     let connected = new Promise((resolve, _reject) => {\r
2491         connectResolve = resolve;\r
2492     });\r
2493     return new Promise((resolve, reject) => {\r
2494         let server = net_1.createServer((socket) => {\r
2495             server.close();\r
2496             connectResolve([\r
2497                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2498                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2499             ]);\r
2500         });\r
2501         server.on('error', reject);\r
2502         server.listen(port, '127.0.0.1', () => {\r
2503             server.removeListener('error', reject);\r
2504             resolve({\r
2505                 onConnected: () => { return connected; }\r
2506             });\r
2507         });\r
2508     });\r
2509 }\r
2510 exports.createClientSocketTransport = createClientSocketTransport;\r
2511 function createServerSocketTransport(port, encoding = 'utf-8') {\r
2512     const socket = net_1.createConnection(port, '127.0.0.1');\r
2513     return [\r
2514         new messageReader_1.SocketMessageReader(socket, encoding),\r
2515         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2516     ];\r
2517 }\r
2518 exports.createServerSocketTransport = createServerSocketTransport;\r
2519
2520
2521 /***/ }),
2522 /* 18 */
2523 /***/ (function(module, __webpack_exports__, __webpack_require__) {
2524
2525 "use strict";
2526 __webpack_require__.r(__webpack_exports__);
2527 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
2528 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
2529 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
2530 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
2531 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
2532 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
2533 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
2534 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
2535 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
2536 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
2537 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
2538 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
2539 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
2540 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
2541 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
2542 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
2543 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
2544 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
2545 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
2546 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
2547 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
2548 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
2549 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
2550 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
2551 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
2552 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
2553 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
2554 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
2555 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
2556 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
2557 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
2558 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
2559 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
2560 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
2561 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
2562 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
2563 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
2564 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
2565 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
2566 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
2567 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
2568 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
2569 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
2570 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
2571 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
2572 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
2573 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
2574 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
2575 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
2576 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
2577 /* --------------------------------------------------------------------------------------------\r
2578  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2579  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2580  * ------------------------------------------------------------------------------------------ */\r
2581 \r
2582 /**\r
2583  * The Position namespace provides helper functions to work with\r
2584  * [Position](#Position) literals.\r
2585  */\r
2586 var Position;\r
2587 (function (Position) {\r
2588     /**\r
2589      * Creates a new Position literal from the given line and character.\r
2590      * @param line The position's line.\r
2591      * @param character The position's character.\r
2592      */\r
2593     function create(line, character) {\r
2594         return { line: line, character: character };\r
2595     }\r
2596     Position.create = create;\r
2597     /**\r
2598      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
2599      */\r
2600     function is(value) {\r
2601         var candidate = value;\r
2602         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
2603     }\r
2604     Position.is = is;\r
2605 })(Position || (Position = {}));\r
2606 /**\r
2607  * The Range namespace provides helper functions to work with\r
2608  * [Range](#Range) literals.\r
2609  */\r
2610 var Range;\r
2611 (function (Range) {\r
2612     function create(one, two, three, four) {\r
2613         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
2614             return { start: Position.create(one, two), end: Position.create(three, four) };\r
2615         }\r
2616         else if (Position.is(one) && Position.is(two)) {\r
2617             return { start: one, end: two };\r
2618         }\r
2619         else {\r
2620             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
2621         }\r
2622     }\r
2623     Range.create = create;\r
2624     /**\r
2625      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
2626      */\r
2627     function is(value) {\r
2628         var candidate = value;\r
2629         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
2630     }\r
2631     Range.is = is;\r
2632 })(Range || (Range = {}));\r
2633 /**\r
2634  * The Location namespace provides helper functions to work with\r
2635  * [Location](#Location) literals.\r
2636  */\r
2637 var Location;\r
2638 (function (Location) {\r
2639     /**\r
2640      * Creates a Location literal.\r
2641      * @param uri The location's uri.\r
2642      * @param range The location's range.\r
2643      */\r
2644     function create(uri, range) {\r
2645         return { uri: uri, range: range };\r
2646     }\r
2647     Location.create = create;\r
2648     /**\r
2649      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
2650      */\r
2651     function is(value) {\r
2652         var candidate = value;\r
2653         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
2654     }\r
2655     Location.is = is;\r
2656 })(Location || (Location = {}));\r
2657 /**\r
2658  * The LocationLink namespace provides helper functions to work with\r
2659  * [LocationLink](#LocationLink) literals.\r
2660  */\r
2661 var LocationLink;\r
2662 (function (LocationLink) {\r
2663     /**\r
2664      * Creates a LocationLink literal.\r
2665      * @param targetUri The definition's uri.\r
2666      * @param targetRange The full range of the definition.\r
2667      * @param targetSelectionRange The span of the symbol definition at the target.\r
2668      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
2669      */\r
2670     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
2671         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
2672     }\r
2673     LocationLink.create = create;\r
2674     /**\r
2675      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
2676      */\r
2677     function is(value) {\r
2678         var candidate = value;\r
2679         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
2680             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
2681             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
2682     }\r
2683     LocationLink.is = is;\r
2684 })(LocationLink || (LocationLink = {}));\r
2685 /**\r
2686  * The Color namespace provides helper functions to work with\r
2687  * [Color](#Color) literals.\r
2688  */\r
2689 var Color;\r
2690 (function (Color) {\r
2691     /**\r
2692      * Creates a new Color literal.\r
2693      */\r
2694     function create(red, green, blue, alpha) {\r
2695         return {\r
2696             red: red,\r
2697             green: green,\r
2698             blue: blue,\r
2699             alpha: alpha,\r
2700         };\r
2701     }\r
2702     Color.create = create;\r
2703     /**\r
2704      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
2705      */\r
2706     function is(value) {\r
2707         var candidate = value;\r
2708         return Is.number(candidate.red)\r
2709             && Is.number(candidate.green)\r
2710             && Is.number(candidate.blue)\r
2711             && Is.number(candidate.alpha);\r
2712     }\r
2713     Color.is = is;\r
2714 })(Color || (Color = {}));\r
2715 /**\r
2716  * The ColorInformation namespace provides helper functions to work with\r
2717  * [ColorInformation](#ColorInformation) literals.\r
2718  */\r
2719 var ColorInformation;\r
2720 (function (ColorInformation) {\r
2721     /**\r
2722      * Creates a new ColorInformation literal.\r
2723      */\r
2724     function create(range, color) {\r
2725         return {\r
2726             range: range,\r
2727             color: color,\r
2728         };\r
2729     }\r
2730     ColorInformation.create = create;\r
2731     /**\r
2732      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2733      */\r
2734     function is(value) {\r
2735         var candidate = value;\r
2736         return Range.is(candidate.range) && Color.is(candidate.color);\r
2737     }\r
2738     ColorInformation.is = is;\r
2739 })(ColorInformation || (ColorInformation = {}));\r
2740 /**\r
2741  * The Color namespace provides helper functions to work with\r
2742  * [ColorPresentation](#ColorPresentation) literals.\r
2743  */\r
2744 var ColorPresentation;\r
2745 (function (ColorPresentation) {\r
2746     /**\r
2747      * Creates a new ColorInformation literal.\r
2748      */\r
2749     function create(label, textEdit, additionalTextEdits) {\r
2750         return {\r
2751             label: label,\r
2752             textEdit: textEdit,\r
2753             additionalTextEdits: additionalTextEdits,\r
2754         };\r
2755     }\r
2756     ColorPresentation.create = create;\r
2757     /**\r
2758      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2759      */\r
2760     function is(value) {\r
2761         var candidate = value;\r
2762         return Is.string(candidate.label)\r
2763             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
2764             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
2765     }\r
2766     ColorPresentation.is = is;\r
2767 })(ColorPresentation || (ColorPresentation = {}));\r
2768 /**\r
2769  * Enum of known range kinds\r
2770  */\r
2771 var FoldingRangeKind;\r
2772 (function (FoldingRangeKind) {\r
2773     /**\r
2774      * Folding range for a comment\r
2775      */\r
2776     FoldingRangeKind["Comment"] = "comment";\r
2777     /**\r
2778      * Folding range for a imports or includes\r
2779      */\r
2780     FoldingRangeKind["Imports"] = "imports";\r
2781     /**\r
2782      * Folding range for a region (e.g. `#region`)\r
2783      */\r
2784     FoldingRangeKind["Region"] = "region";\r
2785 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
2786 /**\r
2787  * The folding range namespace provides helper functions to work with\r
2788  * [FoldingRange](#FoldingRange) literals.\r
2789  */\r
2790 var FoldingRange;\r
2791 (function (FoldingRange) {\r
2792     /**\r
2793      * Creates a new FoldingRange literal.\r
2794      */\r
2795     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
2796         var result = {\r
2797             startLine: startLine,\r
2798             endLine: endLine\r
2799         };\r
2800         if (Is.defined(startCharacter)) {\r
2801             result.startCharacter = startCharacter;\r
2802         }\r
2803         if (Is.defined(endCharacter)) {\r
2804             result.endCharacter = endCharacter;\r
2805         }\r
2806         if (Is.defined(kind)) {\r
2807             result.kind = kind;\r
2808         }\r
2809         return result;\r
2810     }\r
2811     FoldingRange.create = create;\r
2812     /**\r
2813      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
2814      */\r
2815     function is(value) {\r
2816         var candidate = value;\r
2817         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
2818             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
2819             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
2820             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
2821     }\r
2822     FoldingRange.is = is;\r
2823 })(FoldingRange || (FoldingRange = {}));\r
2824 /**\r
2825  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
2826  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
2827  */\r
2828 var DiagnosticRelatedInformation;\r
2829 (function (DiagnosticRelatedInformation) {\r
2830     /**\r
2831      * Creates a new DiagnosticRelatedInformation literal.\r
2832      */\r
2833     function create(location, message) {\r
2834         return {\r
2835             location: location,\r
2836             message: message\r
2837         };\r
2838     }\r
2839     DiagnosticRelatedInformation.create = create;\r
2840     /**\r
2841      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
2842      */\r
2843     function is(value) {\r
2844         var candidate = value;\r
2845         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
2846     }\r
2847     DiagnosticRelatedInformation.is = is;\r
2848 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
2849 /**\r
2850  * The diagnostic's severity.\r
2851  */\r
2852 var DiagnosticSeverity;\r
2853 (function (DiagnosticSeverity) {\r
2854     /**\r
2855      * Reports an error.\r
2856      */\r
2857     DiagnosticSeverity.Error = 1;\r
2858     /**\r
2859      * Reports a warning.\r
2860      */\r
2861     DiagnosticSeverity.Warning = 2;\r
2862     /**\r
2863      * Reports an information.\r
2864      */\r
2865     DiagnosticSeverity.Information = 3;\r
2866     /**\r
2867      * Reports a hint.\r
2868      */\r
2869     DiagnosticSeverity.Hint = 4;\r
2870 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
2871 /**\r
2872  * The diagnostic tags.\r
2873  *\r
2874  * @since 3.15.0\r
2875  */\r
2876 var DiagnosticTag;\r
2877 (function (DiagnosticTag) {\r
2878     /**\r
2879      * Unused or unnecessary code.\r
2880      *\r
2881      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
2882      * an error squiggle.\r
2883      */\r
2884     DiagnosticTag.Unnecessary = 1;\r
2885     /**\r
2886      * Deprecated or obsolete code.\r
2887      *\r
2888      * Clients are allowed to rendered diagnostics with this tag strike through.\r
2889      */\r
2890     DiagnosticTag.Deprecated = 2;\r
2891 })(DiagnosticTag || (DiagnosticTag = {}));\r
2892 /**\r
2893  * The Diagnostic namespace provides helper functions to work with\r
2894  * [Diagnostic](#Diagnostic) literals.\r
2895  */\r
2896 var Diagnostic;\r
2897 (function (Diagnostic) {\r
2898     /**\r
2899      * Creates a new Diagnostic literal.\r
2900      */\r
2901     function create(range, message, severity, code, source, relatedInformation) {\r
2902         var result = { range: range, message: message };\r
2903         if (Is.defined(severity)) {\r
2904             result.severity = severity;\r
2905         }\r
2906         if (Is.defined(code)) {\r
2907             result.code = code;\r
2908         }\r
2909         if (Is.defined(source)) {\r
2910             result.source = source;\r
2911         }\r
2912         if (Is.defined(relatedInformation)) {\r
2913             result.relatedInformation = relatedInformation;\r
2914         }\r
2915         return result;\r
2916     }\r
2917     Diagnostic.create = create;\r
2918     /**\r
2919      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
2920      */\r
2921     function is(value) {\r
2922         var candidate = value;\r
2923         return Is.defined(candidate)\r
2924             && Range.is(candidate.range)\r
2925             && Is.string(candidate.message)\r
2926             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
2927             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
2928             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
2929             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
2930     }\r
2931     Diagnostic.is = is;\r
2932 })(Diagnostic || (Diagnostic = {}));\r
2933 /**\r
2934  * The Command namespace provides helper functions to work with\r
2935  * [Command](#Command) literals.\r
2936  */\r
2937 var Command;\r
2938 (function (Command) {\r
2939     /**\r
2940      * Creates a new Command literal.\r
2941      */\r
2942     function create(title, command) {\r
2943         var args = [];\r
2944         for (var _i = 2; _i < arguments.length; _i++) {\r
2945             args[_i - 2] = arguments[_i];\r
2946         }\r
2947         var result = { title: title, command: command };\r
2948         if (Is.defined(args) && args.length > 0) {\r
2949             result.arguments = args;\r
2950         }\r
2951         return result;\r
2952     }\r
2953     Command.create = create;\r
2954     /**\r
2955      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
2956      */\r
2957     function is(value) {\r
2958         var candidate = value;\r
2959         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
2960     }\r
2961     Command.is = is;\r
2962 })(Command || (Command = {}));\r
2963 /**\r
2964  * The TextEdit namespace provides helper function to create replace,\r
2965  * insert and delete edits more easily.\r
2966  */\r
2967 var TextEdit;\r
2968 (function (TextEdit) {\r
2969     /**\r
2970      * Creates a replace text edit.\r
2971      * @param range The range of text to be replaced.\r
2972      * @param newText The new text.\r
2973      */\r
2974     function replace(range, newText) {\r
2975         return { range: range, newText: newText };\r
2976     }\r
2977     TextEdit.replace = replace;\r
2978     /**\r
2979      * Creates a insert text edit.\r
2980      * @param position The position to insert the text at.\r
2981      * @param newText The text to be inserted.\r
2982      */\r
2983     function insert(position, newText) {\r
2984         return { range: { start: position, end: position }, newText: newText };\r
2985     }\r
2986     TextEdit.insert = insert;\r
2987     /**\r
2988      * Creates a delete text edit.\r
2989      * @param range The range of text to be deleted.\r
2990      */\r
2991     function del(range) {\r
2992         return { range: range, newText: '' };\r
2993     }\r
2994     TextEdit.del = del;\r
2995     function is(value) {\r
2996         var candidate = value;\r
2997         return Is.objectLiteral(candidate)\r
2998             && Is.string(candidate.newText)\r
2999             && Range.is(candidate.range);\r
3000     }\r
3001     TextEdit.is = is;\r
3002 })(TextEdit || (TextEdit = {}));\r
3003 /**\r
3004  * The TextDocumentEdit namespace provides helper function to create\r
3005  * an edit that manipulates a text document.\r
3006  */\r
3007 var TextDocumentEdit;\r
3008 (function (TextDocumentEdit) {\r
3009     /**\r
3010      * Creates a new `TextDocumentEdit`\r
3011      */\r
3012     function create(textDocument, edits) {\r
3013         return { textDocument: textDocument, edits: edits };\r
3014     }\r
3015     TextDocumentEdit.create = create;\r
3016     function is(value) {\r
3017         var candidate = value;\r
3018         return Is.defined(candidate)\r
3019             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
3020             && Array.isArray(candidate.edits);\r
3021     }\r
3022     TextDocumentEdit.is = is;\r
3023 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
3024 var CreateFile;\r
3025 (function (CreateFile) {\r
3026     function create(uri, options) {\r
3027         var result = {\r
3028             kind: 'create',\r
3029             uri: uri\r
3030         };\r
3031         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3032             result.options = options;\r
3033         }\r
3034         return result;\r
3035     }\r
3036     CreateFile.create = create;\r
3037     function is(value) {\r
3038         var candidate = value;\r
3039         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
3040             (candidate.options === void 0 ||\r
3041                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3042     }\r
3043     CreateFile.is = is;\r
3044 })(CreateFile || (CreateFile = {}));\r
3045 var RenameFile;\r
3046 (function (RenameFile) {\r
3047     function create(oldUri, newUri, options) {\r
3048         var result = {\r
3049             kind: 'rename',\r
3050             oldUri: oldUri,\r
3051             newUri: newUri\r
3052         };\r
3053         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3054             result.options = options;\r
3055         }\r
3056         return result;\r
3057     }\r
3058     RenameFile.create = create;\r
3059     function is(value) {\r
3060         var candidate = value;\r
3061         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
3062             (candidate.options === void 0 ||\r
3063                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3064     }\r
3065     RenameFile.is = is;\r
3066 })(RenameFile || (RenameFile = {}));\r
3067 var DeleteFile;\r
3068 (function (DeleteFile) {\r
3069     function create(uri, options) {\r
3070         var result = {\r
3071             kind: 'delete',\r
3072             uri: uri\r
3073         };\r
3074         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
3075             result.options = options;\r
3076         }\r
3077         return result;\r
3078     }\r
3079     DeleteFile.create = create;\r
3080     function is(value) {\r
3081         var candidate = value;\r
3082         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
3083             (candidate.options === void 0 ||\r
3084                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
3085     }\r
3086     DeleteFile.is = is;\r
3087 })(DeleteFile || (DeleteFile = {}));\r
3088 var WorkspaceEdit;\r
3089 (function (WorkspaceEdit) {\r
3090     function is(value) {\r
3091         var candidate = value;\r
3092         return candidate &&\r
3093             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
3094             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
3095                 if (Is.string(change.kind)) {\r
3096                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
3097                 }\r
3098                 else {\r
3099                     return TextDocumentEdit.is(change);\r
3100                 }\r
3101             }));\r
3102     }\r
3103     WorkspaceEdit.is = is;\r
3104 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
3105 var TextEditChangeImpl = /** @class */ (function () {\r
3106     function TextEditChangeImpl(edits) {\r
3107         this.edits = edits;\r
3108     }\r
3109     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
3110         this.edits.push(TextEdit.insert(position, newText));\r
3111     };\r
3112     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
3113         this.edits.push(TextEdit.replace(range, newText));\r
3114     };\r
3115     TextEditChangeImpl.prototype.delete = function (range) {\r
3116         this.edits.push(TextEdit.del(range));\r
3117     };\r
3118     TextEditChangeImpl.prototype.add = function (edit) {\r
3119         this.edits.push(edit);\r
3120     };\r
3121     TextEditChangeImpl.prototype.all = function () {\r
3122         return this.edits;\r
3123     };\r
3124     TextEditChangeImpl.prototype.clear = function () {\r
3125         this.edits.splice(0, this.edits.length);\r
3126     };\r
3127     return TextEditChangeImpl;\r
3128 }());\r
3129 /**\r
3130  * A workspace change helps constructing changes to a workspace.\r
3131  */\r
3132 var WorkspaceChange = /** @class */ (function () {\r
3133     function WorkspaceChange(workspaceEdit) {\r
3134         var _this = this;\r
3135         this._textEditChanges = Object.create(null);\r
3136         if (workspaceEdit) {\r
3137             this._workspaceEdit = workspaceEdit;\r
3138             if (workspaceEdit.documentChanges) {\r
3139                 workspaceEdit.documentChanges.forEach(function (change) {\r
3140                     if (TextDocumentEdit.is(change)) {\r
3141                         var textEditChange = new TextEditChangeImpl(change.edits);\r
3142                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
3143                     }\r
3144                 });\r
3145             }\r
3146             else if (workspaceEdit.changes) {\r
3147                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
3148                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
3149                     _this._textEditChanges[key] = textEditChange;\r
3150                 });\r
3151             }\r
3152         }\r
3153     }\r
3154     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
3155         /**\r
3156          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
3157          * use to be returned from a workspace edit operation like rename.\r
3158          */\r
3159         get: function () {\r
3160             return this._workspaceEdit;\r
3161         },\r
3162         enumerable: true,\r
3163         configurable: true\r
3164     });\r
3165     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
3166         if (VersionedTextDocumentIdentifier.is(key)) {\r
3167             if (!this._workspaceEdit) {\r
3168                 this._workspaceEdit = {\r
3169                     documentChanges: []\r
3170                 };\r
3171             }\r
3172             if (!this._workspaceEdit.documentChanges) {\r
3173                 throw new Error('Workspace edit is not configured for document changes.');\r
3174             }\r
3175             var textDocument = key;\r
3176             var result = this._textEditChanges[textDocument.uri];\r
3177             if (!result) {\r
3178                 var edits = [];\r
3179                 var textDocumentEdit = {\r
3180                     textDocument: textDocument,\r
3181                     edits: edits\r
3182                 };\r
3183                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
3184                 result = new TextEditChangeImpl(edits);\r
3185                 this._textEditChanges[textDocument.uri] = result;\r
3186             }\r
3187             return result;\r
3188         }\r
3189         else {\r
3190             if (!this._workspaceEdit) {\r
3191                 this._workspaceEdit = {\r
3192                     changes: Object.create(null)\r
3193                 };\r
3194             }\r
3195             if (!this._workspaceEdit.changes) {\r
3196                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
3197             }\r
3198             var result = this._textEditChanges[key];\r
3199             if (!result) {\r
3200                 var edits = [];\r
3201                 this._workspaceEdit.changes[key] = edits;\r
3202                 result = new TextEditChangeImpl(edits);\r
3203                 this._textEditChanges[key] = result;\r
3204             }\r
3205             return result;\r
3206         }\r
3207     };\r
3208     WorkspaceChange.prototype.createFile = function (uri, options) {\r
3209         this.checkDocumentChanges();\r
3210         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
3211     };\r
3212     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
3213         this.checkDocumentChanges();\r
3214         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
3215     };\r
3216     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
3217         this.checkDocumentChanges();\r
3218         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
3219     };\r
3220     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
3221         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
3222             throw new Error('Workspace edit is not configured for document changes.');\r
3223         }\r
3224     };\r
3225     return WorkspaceChange;\r
3226 }());\r
3227 \r
3228 /**\r
3229  * The TextDocumentIdentifier namespace provides helper functions to work with\r
3230  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
3231  */\r
3232 var TextDocumentIdentifier;\r
3233 (function (TextDocumentIdentifier) {\r
3234     /**\r
3235      * Creates a new TextDocumentIdentifier literal.\r
3236      * @param uri The document's uri.\r
3237      */\r
3238     function create(uri) {\r
3239         return { uri: uri };\r
3240     }\r
3241     TextDocumentIdentifier.create = create;\r
3242     /**\r
3243      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
3244      */\r
3245     function is(value) {\r
3246         var candidate = value;\r
3247         return Is.defined(candidate) && Is.string(candidate.uri);\r
3248     }\r
3249     TextDocumentIdentifier.is = is;\r
3250 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
3251 /**\r
3252  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
3253  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
3254  */\r
3255 var VersionedTextDocumentIdentifier;\r
3256 (function (VersionedTextDocumentIdentifier) {\r
3257     /**\r
3258      * Creates a new VersionedTextDocumentIdentifier literal.\r
3259      * @param uri The document's uri.\r
3260      * @param uri The document's text.\r
3261      */\r
3262     function create(uri, version) {\r
3263         return { uri: uri, version: version };\r
3264     }\r
3265     VersionedTextDocumentIdentifier.create = create;\r
3266     /**\r
3267      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
3268      */\r
3269     function is(value) {\r
3270         var candidate = value;\r
3271         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
3272     }\r
3273     VersionedTextDocumentIdentifier.is = is;\r
3274 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
3275 /**\r
3276  * The TextDocumentItem namespace provides helper functions to work with\r
3277  * [TextDocumentItem](#TextDocumentItem) literals.\r
3278  */\r
3279 var TextDocumentItem;\r
3280 (function (TextDocumentItem) {\r
3281     /**\r
3282      * Creates a new TextDocumentItem literal.\r
3283      * @param uri The document's uri.\r
3284      * @param languageId The document's language identifier.\r
3285      * @param version The document's version number.\r
3286      * @param text The document's text.\r
3287      */\r
3288     function create(uri, languageId, version, text) {\r
3289         return { uri: uri, languageId: languageId, version: version, text: text };\r
3290     }\r
3291     TextDocumentItem.create = create;\r
3292     /**\r
3293      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
3294      */\r
3295     function is(value) {\r
3296         var candidate = value;\r
3297         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
3298     }\r
3299     TextDocumentItem.is = is;\r
3300 })(TextDocumentItem || (TextDocumentItem = {}));\r
3301 /**\r
3302  * Describes the content type that a client supports in various\r
3303  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
3304  *\r
3305  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
3306  * are reserved for internal usage.\r
3307  */\r
3308 var MarkupKind;\r
3309 (function (MarkupKind) {\r
3310     /**\r
3311      * Plain text is supported as a content format\r
3312      */\r
3313     MarkupKind.PlainText = 'plaintext';\r
3314     /**\r
3315      * Markdown is supported as a content format\r
3316      */\r
3317     MarkupKind.Markdown = 'markdown';\r
3318 })(MarkupKind || (MarkupKind = {}));\r
3319 (function (MarkupKind) {\r
3320     /**\r
3321      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
3322      */\r
3323     function is(value) {\r
3324         var candidate = value;\r
3325         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
3326     }\r
3327     MarkupKind.is = is;\r
3328 })(MarkupKind || (MarkupKind = {}));\r
3329 var MarkupContent;\r
3330 (function (MarkupContent) {\r
3331     /**\r
3332      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
3333      */\r
3334     function is(value) {\r
3335         var candidate = value;\r
3336         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
3337     }\r
3338     MarkupContent.is = is;\r
3339 })(MarkupContent || (MarkupContent = {}));\r
3340 /**\r
3341  * The kind of a completion entry.\r
3342  */\r
3343 var CompletionItemKind;\r
3344 (function (CompletionItemKind) {\r
3345     CompletionItemKind.Text = 1;\r
3346     CompletionItemKind.Method = 2;\r
3347     CompletionItemKind.Function = 3;\r
3348     CompletionItemKind.Constructor = 4;\r
3349     CompletionItemKind.Field = 5;\r
3350     CompletionItemKind.Variable = 6;\r
3351     CompletionItemKind.Class = 7;\r
3352     CompletionItemKind.Interface = 8;\r
3353     CompletionItemKind.Module = 9;\r
3354     CompletionItemKind.Property = 10;\r
3355     CompletionItemKind.Unit = 11;\r
3356     CompletionItemKind.Value = 12;\r
3357     CompletionItemKind.Enum = 13;\r
3358     CompletionItemKind.Keyword = 14;\r
3359     CompletionItemKind.Snippet = 15;\r
3360     CompletionItemKind.Color = 16;\r
3361     CompletionItemKind.File = 17;\r
3362     CompletionItemKind.Reference = 18;\r
3363     CompletionItemKind.Folder = 19;\r
3364     CompletionItemKind.EnumMember = 20;\r
3365     CompletionItemKind.Constant = 21;\r
3366     CompletionItemKind.Struct = 22;\r
3367     CompletionItemKind.Event = 23;\r
3368     CompletionItemKind.Operator = 24;\r
3369     CompletionItemKind.TypeParameter = 25;\r
3370 })(CompletionItemKind || (CompletionItemKind = {}));\r
3371 /**\r
3372  * Defines whether the insert text in a completion item should be interpreted as\r
3373  * plain text or a snippet.\r
3374  */\r
3375 var InsertTextFormat;\r
3376 (function (InsertTextFormat) {\r
3377     /**\r
3378      * The primary text to be inserted is treated as a plain string.\r
3379      */\r
3380     InsertTextFormat.PlainText = 1;\r
3381     /**\r
3382      * The primary text to be inserted is treated as a snippet.\r
3383      *\r
3384      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
3385      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
3386      * the end of the snippet. Placeholders with equal identifiers are linked,\r
3387      * that is typing in one will update others too.\r
3388      *\r
3389      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
3390      */\r
3391     InsertTextFormat.Snippet = 2;\r
3392 })(InsertTextFormat || (InsertTextFormat = {}));\r
3393 /**\r
3394  * Completion item tags are extra annotations that tweak the rendering of a completion\r
3395  * item.\r
3396  *\r
3397  * @since 3.15.0\r
3398  */\r
3399 var CompletionItemTag;\r
3400 (function (CompletionItemTag) {\r
3401     /**\r
3402      * Render a completion as obsolete, usually using a strike-out.\r
3403      */\r
3404     CompletionItemTag.Deprecated = 1;\r
3405 })(CompletionItemTag || (CompletionItemTag = {}));\r
3406 /**\r
3407  * The CompletionItem namespace provides functions to deal with\r
3408  * completion items.\r
3409  */\r
3410 var CompletionItem;\r
3411 (function (CompletionItem) {\r
3412     /**\r
3413      * Create a completion item and seed it with a label.\r
3414      * @param label The completion item's label\r
3415      */\r
3416     function create(label) {\r
3417         return { label: label };\r
3418     }\r
3419     CompletionItem.create = create;\r
3420 })(CompletionItem || (CompletionItem = {}));\r
3421 /**\r
3422  * The CompletionList namespace provides functions to deal with\r
3423  * completion lists.\r
3424  */\r
3425 var CompletionList;\r
3426 (function (CompletionList) {\r
3427     /**\r
3428      * Creates a new completion list.\r
3429      *\r
3430      * @param items The completion items.\r
3431      * @param isIncomplete The list is not complete.\r
3432      */\r
3433     function create(items, isIncomplete) {\r
3434         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
3435     }\r
3436     CompletionList.create = create;\r
3437 })(CompletionList || (CompletionList = {}));\r
3438 var MarkedString;\r
3439 (function (MarkedString) {\r
3440     /**\r
3441      * Creates a marked string from plain text.\r
3442      *\r
3443      * @param plainText The plain text.\r
3444      */\r
3445     function fromPlainText(plainText) {\r
3446         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
3447     }\r
3448     MarkedString.fromPlainText = fromPlainText;\r
3449     /**\r
3450      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
3451      */\r
3452     function is(value) {\r
3453         var candidate = value;\r
3454         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
3455     }\r
3456     MarkedString.is = is;\r
3457 })(MarkedString || (MarkedString = {}));\r
3458 var Hover;\r
3459 (function (Hover) {\r
3460     /**\r
3461      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
3462      */\r
3463     function is(value) {\r
3464         var candidate = value;\r
3465         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
3466             MarkedString.is(candidate.contents) ||\r
3467             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
3468     }\r
3469     Hover.is = is;\r
3470 })(Hover || (Hover = {}));\r
3471 /**\r
3472  * The ParameterInformation namespace provides helper functions to work with\r
3473  * [ParameterInformation](#ParameterInformation) literals.\r
3474  */\r
3475 var ParameterInformation;\r
3476 (function (ParameterInformation) {\r
3477     /**\r
3478      * Creates a new parameter information literal.\r
3479      *\r
3480      * @param label A label string.\r
3481      * @param documentation A doc string.\r
3482      */\r
3483     function create(label, documentation) {\r
3484         return documentation ? { label: label, documentation: documentation } : { label: label };\r
3485     }\r
3486     ParameterInformation.create = create;\r
3487 })(ParameterInformation || (ParameterInformation = {}));\r
3488 /**\r
3489  * The SignatureInformation namespace provides helper functions to work with\r
3490  * [SignatureInformation](#SignatureInformation) literals.\r
3491  */\r
3492 var SignatureInformation;\r
3493 (function (SignatureInformation) {\r
3494     function create(label, documentation) {\r
3495         var parameters = [];\r
3496         for (var _i = 2; _i < arguments.length; _i++) {\r
3497             parameters[_i - 2] = arguments[_i];\r
3498         }\r
3499         var result = { label: label };\r
3500         if (Is.defined(documentation)) {\r
3501             result.documentation = documentation;\r
3502         }\r
3503         if (Is.defined(parameters)) {\r
3504             result.parameters = parameters;\r
3505         }\r
3506         else {\r
3507             result.parameters = [];\r
3508         }\r
3509         return result;\r
3510     }\r
3511     SignatureInformation.create = create;\r
3512 })(SignatureInformation || (SignatureInformation = {}));\r
3513 /**\r
3514  * A document highlight kind.\r
3515  */\r
3516 var DocumentHighlightKind;\r
3517 (function (DocumentHighlightKind) {\r
3518     /**\r
3519      * A textual occurrence.\r
3520      */\r
3521     DocumentHighlightKind.Text = 1;\r
3522     /**\r
3523      * Read-access of a symbol, like reading a variable.\r
3524      */\r
3525     DocumentHighlightKind.Read = 2;\r
3526     /**\r
3527      * Write-access of a symbol, like writing to a variable.\r
3528      */\r
3529     DocumentHighlightKind.Write = 3;\r
3530 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
3531 /**\r
3532  * DocumentHighlight namespace to provide helper functions to work with\r
3533  * [DocumentHighlight](#DocumentHighlight) literals.\r
3534  */\r
3535 var DocumentHighlight;\r
3536 (function (DocumentHighlight) {\r
3537     /**\r
3538      * Create a DocumentHighlight object.\r
3539      * @param range The range the highlight applies to.\r
3540      */\r
3541     function create(range, kind) {\r
3542         var result = { range: range };\r
3543         if (Is.number(kind)) {\r
3544             result.kind = kind;\r
3545         }\r
3546         return result;\r
3547     }\r
3548     DocumentHighlight.create = create;\r
3549 })(DocumentHighlight || (DocumentHighlight = {}));\r
3550 /**\r
3551  * A symbol kind.\r
3552  */\r
3553 var SymbolKind;\r
3554 (function (SymbolKind) {\r
3555     SymbolKind.File = 1;\r
3556     SymbolKind.Module = 2;\r
3557     SymbolKind.Namespace = 3;\r
3558     SymbolKind.Package = 4;\r
3559     SymbolKind.Class = 5;\r
3560     SymbolKind.Method = 6;\r
3561     SymbolKind.Property = 7;\r
3562     SymbolKind.Field = 8;\r
3563     SymbolKind.Constructor = 9;\r
3564     SymbolKind.Enum = 10;\r
3565     SymbolKind.Interface = 11;\r
3566     SymbolKind.Function = 12;\r
3567     SymbolKind.Variable = 13;\r
3568     SymbolKind.Constant = 14;\r
3569     SymbolKind.String = 15;\r
3570     SymbolKind.Number = 16;\r
3571     SymbolKind.Boolean = 17;\r
3572     SymbolKind.Array = 18;\r
3573     SymbolKind.Object = 19;\r
3574     SymbolKind.Key = 20;\r
3575     SymbolKind.Null = 21;\r
3576     SymbolKind.EnumMember = 22;\r
3577     SymbolKind.Struct = 23;\r
3578     SymbolKind.Event = 24;\r
3579     SymbolKind.Operator = 25;\r
3580     SymbolKind.TypeParameter = 26;\r
3581 })(SymbolKind || (SymbolKind = {}));\r
3582 /**\r
3583  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
3584  * @since 3.15\r
3585  */\r
3586 var SymbolTag;\r
3587 (function (SymbolTag) {\r
3588     /**\r
3589      * Render a symbol as obsolete, usually using a strike-out.\r
3590      */\r
3591     SymbolTag.Deprecated = 1;\r
3592 })(SymbolTag || (SymbolTag = {}));\r
3593 var SymbolInformation;\r
3594 (function (SymbolInformation) {\r
3595     /**\r
3596      * Creates a new symbol information literal.\r
3597      *\r
3598      * @param name The name of the symbol.\r
3599      * @param kind The kind of the symbol.\r
3600      * @param range The range of the location of the symbol.\r
3601      * @param uri The resource of the location of symbol, defaults to the current document.\r
3602      * @param containerName The name of the symbol containing the symbol.\r
3603      */\r
3604     function create(name, kind, range, uri, containerName) {\r
3605         var result = {\r
3606             name: name,\r
3607             kind: kind,\r
3608             location: { uri: uri, range: range }\r
3609         };\r
3610         if (containerName) {\r
3611             result.containerName = containerName;\r
3612         }\r
3613         return result;\r
3614     }\r
3615     SymbolInformation.create = create;\r
3616 })(SymbolInformation || (SymbolInformation = {}));\r
3617 var DocumentSymbol;\r
3618 (function (DocumentSymbol) {\r
3619     /**\r
3620      * Creates a new symbol information literal.\r
3621      *\r
3622      * @param name The name of the symbol.\r
3623      * @param detail The detail of the symbol.\r
3624      * @param kind The kind of the symbol.\r
3625      * @param range The range of the symbol.\r
3626      * @param selectionRange The selectionRange of the symbol.\r
3627      * @param children Children of the symbol.\r
3628      */\r
3629     function create(name, detail, kind, range, selectionRange, children) {\r
3630         var result = {\r
3631             name: name,\r
3632             detail: detail,\r
3633             kind: kind,\r
3634             range: range,\r
3635             selectionRange: selectionRange\r
3636         };\r
3637         if (children !== void 0) {\r
3638             result.children = children;\r
3639         }\r
3640         return result;\r
3641     }\r
3642     DocumentSymbol.create = create;\r
3643     /**\r
3644      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
3645      */\r
3646     function is(value) {\r
3647         var candidate = value;\r
3648         return candidate &&\r
3649             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
3650             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
3651             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
3652             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
3653             (candidate.children === void 0 || Array.isArray(candidate.children));\r
3654     }\r
3655     DocumentSymbol.is = is;\r
3656 })(DocumentSymbol || (DocumentSymbol = {}));\r
3657 /**\r
3658  * A set of predefined code action kinds\r
3659  */\r
3660 var CodeActionKind;\r
3661 (function (CodeActionKind) {\r
3662     /**\r
3663      * Empty kind.\r
3664      */\r
3665     CodeActionKind.Empty = '';\r
3666     /**\r
3667      * Base kind for quickfix actions: 'quickfix'\r
3668      */\r
3669     CodeActionKind.QuickFix = 'quickfix';\r
3670     /**\r
3671      * Base kind for refactoring actions: 'refactor'\r
3672      */\r
3673     CodeActionKind.Refactor = 'refactor';\r
3674     /**\r
3675      * Base kind for refactoring extraction actions: 'refactor.extract'\r
3676      *\r
3677      * Example extract actions:\r
3678      *\r
3679      * - Extract method\r
3680      * - Extract function\r
3681      * - Extract variable\r
3682      * - Extract interface from class\r
3683      * - ...\r
3684      */\r
3685     CodeActionKind.RefactorExtract = 'refactor.extract';\r
3686     /**\r
3687      * Base kind for refactoring inline actions: 'refactor.inline'\r
3688      *\r
3689      * Example inline actions:\r
3690      *\r
3691      * - Inline function\r
3692      * - Inline variable\r
3693      * - Inline constant\r
3694      * - ...\r
3695      */\r
3696     CodeActionKind.RefactorInline = 'refactor.inline';\r
3697     /**\r
3698      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
3699      *\r
3700      * Example rewrite actions:\r
3701      *\r
3702      * - Convert JavaScript function to class\r
3703      * - Add or remove parameter\r
3704      * - Encapsulate field\r
3705      * - Make method static\r
3706      * - Move method to base class\r
3707      * - ...\r
3708      */\r
3709     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
3710     /**\r
3711      * Base kind for source actions: `source`\r
3712      *\r
3713      * Source code actions apply to the entire file.\r
3714      */\r
3715     CodeActionKind.Source = 'source';\r
3716     /**\r
3717      * Base kind for an organize imports source action: `source.organizeImports`\r
3718      */\r
3719     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
3720     /**\r
3721      * Base kind for auto-fix source actions: `source.fixAll`.\r
3722      *\r
3723      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
3724      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
3725      *\r
3726      * @since 3.15.0\r
3727      */\r
3728     CodeActionKind.SourceFixAll = 'source.fixAll';\r
3729 })(CodeActionKind || (CodeActionKind = {}));\r
3730 /**\r
3731  * The CodeActionContext namespace provides helper functions to work with\r
3732  * [CodeActionContext](#CodeActionContext) literals.\r
3733  */\r
3734 var CodeActionContext;\r
3735 (function (CodeActionContext) {\r
3736     /**\r
3737      * Creates a new CodeActionContext literal.\r
3738      */\r
3739     function create(diagnostics, only) {\r
3740         var result = { diagnostics: diagnostics };\r
3741         if (only !== void 0 && only !== null) {\r
3742             result.only = only;\r
3743         }\r
3744         return result;\r
3745     }\r
3746     CodeActionContext.create = create;\r
3747     /**\r
3748      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
3749      */\r
3750     function is(value) {\r
3751         var candidate = value;\r
3752         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
3753     }\r
3754     CodeActionContext.is = is;\r
3755 })(CodeActionContext || (CodeActionContext = {}));\r
3756 var CodeAction;\r
3757 (function (CodeAction) {\r
3758     function create(title, commandOrEdit, kind) {\r
3759         var result = { title: title };\r
3760         if (Command.is(commandOrEdit)) {\r
3761             result.command = commandOrEdit;\r
3762         }\r
3763         else {\r
3764             result.edit = commandOrEdit;\r
3765         }\r
3766         if (kind !== void 0) {\r
3767             result.kind = kind;\r
3768         }\r
3769         return result;\r
3770     }\r
3771     CodeAction.create = create;\r
3772     function is(value) {\r
3773         var candidate = value;\r
3774         return candidate && Is.string(candidate.title) &&\r
3775             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
3776             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
3777             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
3778             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
3779             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
3780             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
3781     }\r
3782     CodeAction.is = is;\r
3783 })(CodeAction || (CodeAction = {}));\r
3784 /**\r
3785  * The CodeLens namespace provides helper functions to work with\r
3786  * [CodeLens](#CodeLens) literals.\r
3787  */\r
3788 var CodeLens;\r
3789 (function (CodeLens) {\r
3790     /**\r
3791      * Creates a new CodeLens literal.\r
3792      */\r
3793     function create(range, data) {\r
3794         var result = { range: range };\r
3795         if (Is.defined(data)) {\r
3796             result.data = data;\r
3797         }\r
3798         return result;\r
3799     }\r
3800     CodeLens.create = create;\r
3801     /**\r
3802      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
3803      */\r
3804     function is(value) {\r
3805         var candidate = value;\r
3806         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
3807     }\r
3808     CodeLens.is = is;\r
3809 })(CodeLens || (CodeLens = {}));\r
3810 /**\r
3811  * The FormattingOptions namespace provides helper functions to work with\r
3812  * [FormattingOptions](#FormattingOptions) literals.\r
3813  */\r
3814 var FormattingOptions;\r
3815 (function (FormattingOptions) {\r
3816     /**\r
3817      * Creates a new FormattingOptions literal.\r
3818      */\r
3819     function create(tabSize, insertSpaces) {\r
3820         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
3821     }\r
3822     FormattingOptions.create = create;\r
3823     /**\r
3824      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
3825      */\r
3826     function is(value) {\r
3827         var candidate = value;\r
3828         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
3829     }\r
3830     FormattingOptions.is = is;\r
3831 })(FormattingOptions || (FormattingOptions = {}));\r
3832 /**\r
3833  * The DocumentLink namespace provides helper functions to work with\r
3834  * [DocumentLink](#DocumentLink) literals.\r
3835  */\r
3836 var DocumentLink;\r
3837 (function (DocumentLink) {\r
3838     /**\r
3839      * Creates a new DocumentLink literal.\r
3840      */\r
3841     function create(range, target, data) {\r
3842         return { range: range, target: target, data: data };\r
3843     }\r
3844     DocumentLink.create = create;\r
3845     /**\r
3846      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
3847      */\r
3848     function is(value) {\r
3849         var candidate = value;\r
3850         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
3851     }\r
3852     DocumentLink.is = is;\r
3853 })(DocumentLink || (DocumentLink = {}));\r
3854 /**\r
3855  * The SelectionRange namespace provides helper function to work with\r
3856  * SelectionRange literals.\r
3857  */\r
3858 var SelectionRange;\r
3859 (function (SelectionRange) {\r
3860     /**\r
3861      * Creates a new SelectionRange\r
3862      * @param range the range.\r
3863      * @param parent an optional parent.\r
3864      */\r
3865     function create(range, parent) {\r
3866         return { range: range, parent: parent };\r
3867     }\r
3868     SelectionRange.create = create;\r
3869     function is(value) {\r
3870         var candidate = value;\r
3871         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
3872     }\r
3873     SelectionRange.is = is;\r
3874 })(SelectionRange || (SelectionRange = {}));\r
3875 var EOL = ['\n', '\r\n', '\r'];\r
3876 /**\r
3877  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
3878  */\r
3879 var TextDocument;\r
3880 (function (TextDocument) {\r
3881     /**\r
3882      * Creates a new ITextDocument literal from the given uri and content.\r
3883      * @param uri The document's uri.\r
3884      * @param languageId  The document's language Id.\r
3885      * @param content The document's content.\r
3886      */\r
3887     function create(uri, languageId, version, content) {\r
3888         return new FullTextDocument(uri, languageId, version, content);\r
3889     }\r
3890     TextDocument.create = create;\r
3891     /**\r
3892      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
3893      */\r
3894     function is(value) {\r
3895         var candidate = value;\r
3896         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
3897             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
3898     }\r
3899     TextDocument.is = is;\r
3900     function applyEdits(document, edits) {\r
3901         var text = document.getText();\r
3902         var sortedEdits = mergeSort(edits, function (a, b) {\r
3903             var diff = a.range.start.line - b.range.start.line;\r
3904             if (diff === 0) {\r
3905                 return a.range.start.character - b.range.start.character;\r
3906             }\r
3907             return diff;\r
3908         });\r
3909         var lastModifiedOffset = text.length;\r
3910         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
3911             var e = sortedEdits[i];\r
3912             var startOffset = document.offsetAt(e.range.start);\r
3913             var endOffset = document.offsetAt(e.range.end);\r
3914             if (endOffset <= lastModifiedOffset) {\r
3915                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
3916             }\r
3917             else {\r
3918                 throw new Error('Overlapping edit');\r
3919             }\r
3920             lastModifiedOffset = startOffset;\r
3921         }\r
3922         return text;\r
3923     }\r
3924     TextDocument.applyEdits = applyEdits;\r
3925     function mergeSort(data, compare) {\r
3926         if (data.length <= 1) {\r
3927             // sorted\r
3928             return data;\r
3929         }\r
3930         var p = (data.length / 2) | 0;\r
3931         var left = data.slice(0, p);\r
3932         var right = data.slice(p);\r
3933         mergeSort(left, compare);\r
3934         mergeSort(right, compare);\r
3935         var leftIdx = 0;\r
3936         var rightIdx = 0;\r
3937         var i = 0;\r
3938         while (leftIdx < left.length && rightIdx < right.length) {\r
3939             var ret = compare(left[leftIdx], right[rightIdx]);\r
3940             if (ret <= 0) {\r
3941                 // smaller_equal -> take left to preserve order\r
3942                 data[i++] = left[leftIdx++];\r
3943             }\r
3944             else {\r
3945                 // greater -> take right\r
3946                 data[i++] = right[rightIdx++];\r
3947             }\r
3948         }\r
3949         while (leftIdx < left.length) {\r
3950             data[i++] = left[leftIdx++];\r
3951         }\r
3952         while (rightIdx < right.length) {\r
3953             data[i++] = right[rightIdx++];\r
3954         }\r
3955         return data;\r
3956     }\r
3957 })(TextDocument || (TextDocument = {}));\r
3958 var FullTextDocument = /** @class */ (function () {\r
3959     function FullTextDocument(uri, languageId, version, content) {\r
3960         this._uri = uri;\r
3961         this._languageId = languageId;\r
3962         this._version = version;\r
3963         this._content = content;\r
3964         this._lineOffsets = undefined;\r
3965     }\r
3966     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
3967         get: function () {\r
3968             return this._uri;\r
3969         },\r
3970         enumerable: true,\r
3971         configurable: true\r
3972     });\r
3973     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
3974         get: function () {\r
3975             return this._languageId;\r
3976         },\r
3977         enumerable: true,\r
3978         configurable: true\r
3979     });\r
3980     Object.defineProperty(FullTextDocument.prototype, "version", {\r
3981         get: function () {\r
3982             return this._version;\r
3983         },\r
3984         enumerable: true,\r
3985         configurable: true\r
3986     });\r
3987     FullTextDocument.prototype.getText = function (range) {\r
3988         if (range) {\r
3989             var start = this.offsetAt(range.start);\r
3990             var end = this.offsetAt(range.end);\r
3991             return this._content.substring(start, end);\r
3992         }\r
3993         return this._content;\r
3994     };\r
3995     FullTextDocument.prototype.update = function (event, version) {\r
3996         this._content = event.text;\r
3997         this._version = version;\r
3998         this._lineOffsets = undefined;\r
3999     };\r
4000     FullTextDocument.prototype.getLineOffsets = function () {\r
4001         if (this._lineOffsets === undefined) {\r
4002             var lineOffsets = [];\r
4003             var text = this._content;\r
4004             var isLineStart = true;\r
4005             for (var i = 0; i < text.length; i++) {\r
4006                 if (isLineStart) {\r
4007                     lineOffsets.push(i);\r
4008                     isLineStart = false;\r
4009                 }\r
4010                 var ch = text.charAt(i);\r
4011                 isLineStart = (ch === '\r' || ch === '\n');\r
4012                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
4013                     i++;\r
4014                 }\r
4015             }\r
4016             if (isLineStart && text.length > 0) {\r
4017                 lineOffsets.push(text.length);\r
4018             }\r
4019             this._lineOffsets = lineOffsets;\r
4020         }\r
4021         return this._lineOffsets;\r
4022     };\r
4023     FullTextDocument.prototype.positionAt = function (offset) {\r
4024         offset = Math.max(Math.min(offset, this._content.length), 0);\r
4025         var lineOffsets = this.getLineOffsets();\r
4026         var low = 0, high = lineOffsets.length;\r
4027         if (high === 0) {\r
4028             return Position.create(0, offset);\r
4029         }\r
4030         while (low < high) {\r
4031             var mid = Math.floor((low + high) / 2);\r
4032             if (lineOffsets[mid] > offset) {\r
4033                 high = mid;\r
4034             }\r
4035             else {\r
4036                 low = mid + 1;\r
4037             }\r
4038         }\r
4039         // low is the least x for which the line offset is larger than the current offset\r
4040         // or array.length if no line offset is larger than the current offset\r
4041         var line = low - 1;\r
4042         return Position.create(line, offset - lineOffsets[line]);\r
4043     };\r
4044     FullTextDocument.prototype.offsetAt = function (position) {\r
4045         var lineOffsets = this.getLineOffsets();\r
4046         if (position.line >= lineOffsets.length) {\r
4047             return this._content.length;\r
4048         }\r
4049         else if (position.line < 0) {\r
4050             return 0;\r
4051         }\r
4052         var lineOffset = lineOffsets[position.line];\r
4053         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
4054         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
4055     };\r
4056     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
4057         get: function () {\r
4058             return this.getLineOffsets().length;\r
4059         },\r
4060         enumerable: true,\r
4061         configurable: true\r
4062     });\r
4063     return FullTextDocument;\r
4064 }());\r
4065 var Is;\r
4066 (function (Is) {\r
4067     var toString = Object.prototype.toString;\r
4068     function defined(value) {\r
4069         return typeof value !== 'undefined';\r
4070     }\r
4071     Is.defined = defined;\r
4072     function undefined(value) {\r
4073         return typeof value === 'undefined';\r
4074     }\r
4075     Is.undefined = undefined;\r
4076     function boolean(value) {\r
4077         return value === true || value === false;\r
4078     }\r
4079     Is.boolean = boolean;\r
4080     function string(value) {\r
4081         return toString.call(value) === '[object String]';\r
4082     }\r
4083     Is.string = string;\r
4084     function number(value) {\r
4085         return toString.call(value) === '[object Number]';\r
4086     }\r
4087     Is.number = number;\r
4088     function func(value) {\r
4089         return toString.call(value) === '[object Function]';\r
4090     }\r
4091     Is.func = func;\r
4092     function objectLiteral(value) {\r
4093         // Strictly speaking class instances pass this check as well. Since the LSP\r
4094         // doesn't use classes we ignore this for now. If we do we need to add something\r
4095         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4096         return value !== null && typeof value === 'object';\r
4097     }\r
4098     Is.objectLiteral = objectLiteral;\r
4099     function typedArray(value, check) {\r
4100         return Array.isArray(value) && value.every(check);\r
4101     }\r
4102     Is.typedArray = typedArray;\r
4103 })(Is || (Is = {}));\r
4104
4105
4106 /***/ }),
4107 /* 19 */
4108 /***/ (function(module, exports, __webpack_require__) {
4109
4110 "use strict";
4111 /* --------------------------------------------------------------------------------------------\r
4112  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4113  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4114  * ------------------------------------------------------------------------------------------ */\r
4115 \r
4116 Object.defineProperty(exports, "__esModule", { value: true });\r
4117 const Is = __webpack_require__(20);\r
4118 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4119 const protocol_implementation_1 = __webpack_require__(21);\r
4120 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
4121 const protocol_typeDefinition_1 = __webpack_require__(22);\r
4122 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
4123 const protocol_workspaceFolders_1 = __webpack_require__(23);\r
4124 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
4125 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
4126 const protocol_configuration_1 = __webpack_require__(24);\r
4127 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
4128 const protocol_colorProvider_1 = __webpack_require__(25);\r
4129 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
4130 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
4131 const protocol_foldingRange_1 = __webpack_require__(26);\r
4132 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
4133 const protocol_declaration_1 = __webpack_require__(27);\r
4134 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
4135 const protocol_selectionRange_1 = __webpack_require__(28);\r
4136 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
4137 const protocol_progress_1 = __webpack_require__(29);\r
4138 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
4139 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
4140 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
4141 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4142 let __noDynamicImport;\r
4143 /**\r
4144  * The DocumentFilter namespace provides helper functions to work with\r
4145  * [DocumentFilter](#DocumentFilter) literals.\r
4146  */\r
4147 var DocumentFilter;\r
4148 (function (DocumentFilter) {\r
4149     function is(value) {\r
4150         const candidate = value;\r
4151         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
4152     }\r
4153     DocumentFilter.is = is;\r
4154 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
4155 /**\r
4156  * The DocumentSelector namespace provides helper functions to work with\r
4157  * [DocumentSelector](#DocumentSelector)s.\r
4158  */\r
4159 var DocumentSelector;\r
4160 (function (DocumentSelector) {\r
4161     function is(value) {\r
4162         if (!Array.isArray(value)) {\r
4163             return false;\r
4164         }\r
4165         for (let elem of value) {\r
4166             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
4167                 return false;\r
4168             }\r
4169         }\r
4170         return true;\r
4171     }\r
4172     DocumentSelector.is = is;\r
4173 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
4174 /**\r
4175  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
4176  * handler on the client side.\r
4177  */\r
4178 var RegistrationRequest;\r
4179 (function (RegistrationRequest) {\r
4180     RegistrationRequest.type = new vscode_jsonrpc_1.RequestType('client/registerCapability');\r
4181 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
4182 /**\r
4183  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
4184  * handler on the client side.\r
4185  */\r
4186 var UnregistrationRequest;\r
4187 (function (UnregistrationRequest) {\r
4188     UnregistrationRequest.type = new vscode_jsonrpc_1.RequestType('client/unregisterCapability');\r
4189 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
4190 var ResourceOperationKind;\r
4191 (function (ResourceOperationKind) {\r
4192     /**\r
4193      * Supports creating new files and folders.\r
4194      */\r
4195     ResourceOperationKind.Create = 'create';\r
4196     /**\r
4197      * Supports renaming existing files and folders.\r
4198      */\r
4199     ResourceOperationKind.Rename = 'rename';\r
4200     /**\r
4201      * Supports deleting existing files and folders.\r
4202      */\r
4203     ResourceOperationKind.Delete = 'delete';\r
4204 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
4205 var FailureHandlingKind;\r
4206 (function (FailureHandlingKind) {\r
4207     /**\r
4208      * Applying the workspace change is simply aborted if one of the changes provided\r
4209      * fails. All operations executed before the failing operation stay executed.\r
4210      */\r
4211     FailureHandlingKind.Abort = 'abort';\r
4212     /**\r
4213      * All operations are executed transactional. That means they either all\r
4214      * succeed or no changes at all are applied to the workspace.\r
4215      */\r
4216     FailureHandlingKind.Transactional = 'transactional';\r
4217     /**\r
4218      * If the workspace edit contains only textual file changes they are executed transactional.\r
4219      * If resource changes (create, rename or delete file) are part of the change the failure\r
4220      * handling startegy is abort.\r
4221      */\r
4222     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
4223     /**\r
4224      * The client tries to undo the operations already executed. But there is no\r
4225      * guaruntee that this is succeeding.\r
4226      */\r
4227     FailureHandlingKind.Undo = 'undo';\r
4228 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
4229 /**\r
4230  * The StaticRegistrationOptions namespace provides helper functions to work with\r
4231  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
4232  */\r
4233 var StaticRegistrationOptions;\r
4234 (function (StaticRegistrationOptions) {\r
4235     function hasId(value) {\r
4236         const candidate = value;\r
4237         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
4238     }\r
4239     StaticRegistrationOptions.hasId = hasId;\r
4240 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
4241 /**\r
4242  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
4243  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
4244  */\r
4245 var TextDocumentRegistrationOptions;\r
4246 (function (TextDocumentRegistrationOptions) {\r
4247     function is(value) {\r
4248         const candidate = value;\r
4249         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
4250     }\r
4251     TextDocumentRegistrationOptions.is = is;\r
4252 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
4253 /**\r
4254  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
4255  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
4256  */\r
4257 var WorkDoneProgressOptions;\r
4258 (function (WorkDoneProgressOptions) {\r
4259     function is(value) {\r
4260         const candidate = value;\r
4261         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
4262     }\r
4263     WorkDoneProgressOptions.is = is;\r
4264     function hasWorkDoneProgress(value) {\r
4265         const candidate = value;\r
4266         return candidate && Is.boolean(candidate.workDoneProgress);\r
4267     }\r
4268     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
4269 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
4270 /**\r
4271  * The initialize request is sent from the client to the server.\r
4272  * It is sent once as the request after starting up the server.\r
4273  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
4274  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
4275  * resolves to such.\r
4276  */\r
4277 var InitializeRequest;\r
4278 (function (InitializeRequest) {\r
4279     InitializeRequest.type = new vscode_jsonrpc_1.RequestType('initialize');\r
4280 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
4281 /**\r
4282  * Known error codes for an `InitializeError`;\r
4283  */\r
4284 var InitializeError;\r
4285 (function (InitializeError) {\r
4286     /**\r
4287      * If the protocol version provided by the client can't be handled by the server.\r
4288      * @deprecated This initialize error got replaced by client capabilities. There is\r
4289      * no version handshake in version 3.0x\r
4290      */\r
4291     InitializeError.unknownProtocolVersion = 1;\r
4292 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
4293 /**\r
4294  * The intialized notification is sent from the client to the\r
4295  * server after the client is fully initialized and the server\r
4296  * is allowed to send requests from the server to the client.\r
4297  */\r
4298 var InitializedNotification;\r
4299 (function (InitializedNotification) {\r
4300     InitializedNotification.type = new vscode_jsonrpc_1.NotificationType('initialized');\r
4301 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
4302 //---- Shutdown Method ----\r
4303 /**\r
4304  * A shutdown request is sent from the client to the server.\r
4305  * It is sent once when the client decides to shutdown the\r
4306  * server. The only notification that is sent after a shutdown request\r
4307  * is the exit event.\r
4308  */\r
4309 var ShutdownRequest;\r
4310 (function (ShutdownRequest) {\r
4311     ShutdownRequest.type = new vscode_jsonrpc_1.RequestType0('shutdown');\r
4312 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
4313 //---- Exit Notification ----\r
4314 /**\r
4315  * The exit event is sent from the client to the server to\r
4316  * ask the server to exit its process.\r
4317  */\r
4318 var ExitNotification;\r
4319 (function (ExitNotification) {\r
4320     ExitNotification.type = new vscode_jsonrpc_1.NotificationType0('exit');\r
4321 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
4322 /**\r
4323  * The configuration change notification is sent from the client to the server\r
4324  * when the client's configuration has changed. The notification contains\r
4325  * the changed configuration as defined by the language client.\r
4326  */\r
4327 var DidChangeConfigurationNotification;\r
4328 (function (DidChangeConfigurationNotification) {\r
4329     DidChangeConfigurationNotification.type = new vscode_jsonrpc_1.NotificationType('workspace/didChangeConfiguration');\r
4330 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
4331 //---- Message show and log notifications ----\r
4332 /**\r
4333  * The message type\r
4334  */\r
4335 var MessageType;\r
4336 (function (MessageType) {\r
4337     /**\r
4338      * An error message.\r
4339      */\r
4340     MessageType.Error = 1;\r
4341     /**\r
4342      * A warning message.\r
4343      */\r
4344     MessageType.Warning = 2;\r
4345     /**\r
4346      * An information message.\r
4347      */\r
4348     MessageType.Info = 3;\r
4349     /**\r
4350      * A log message.\r
4351      */\r
4352     MessageType.Log = 4;\r
4353 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
4354 /**\r
4355  * The show message notification is sent from a server to a client to ask\r
4356  * the client to display a particular message in the user interface.\r
4357  */\r
4358 var ShowMessageNotification;\r
4359 (function (ShowMessageNotification) {\r
4360     ShowMessageNotification.type = new vscode_jsonrpc_1.NotificationType('window/showMessage');\r
4361 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
4362 /**\r
4363  * The show message request is sent from the server to the client to show a message\r
4364  * and a set of options actions to the user.\r
4365  */\r
4366 var ShowMessageRequest;\r
4367 (function (ShowMessageRequest) {\r
4368     ShowMessageRequest.type = new vscode_jsonrpc_1.RequestType('window/showMessageRequest');\r
4369 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
4370 /**\r
4371  * The log message notification is sent from the server to the client to ask\r
4372  * the client to log a particular message.\r
4373  */\r
4374 var LogMessageNotification;\r
4375 (function (LogMessageNotification) {\r
4376     LogMessageNotification.type = new vscode_jsonrpc_1.NotificationType('window/logMessage');\r
4377 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
4378 //---- Telemetry notification\r
4379 /**\r
4380  * The telemetry event notification is sent from the server to the client to ask\r
4381  * the client to log telemetry data.\r
4382  */\r
4383 var TelemetryEventNotification;\r
4384 (function (TelemetryEventNotification) {\r
4385     TelemetryEventNotification.type = new vscode_jsonrpc_1.NotificationType('telemetry/event');\r
4386 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
4387 /**\r
4388  * Defines how the host (editor) should sync\r
4389  * document changes to the language server.\r
4390  */\r
4391 var TextDocumentSyncKind;\r
4392 (function (TextDocumentSyncKind) {\r
4393     /**\r
4394      * Documents should not be synced at all.\r
4395      */\r
4396     TextDocumentSyncKind.None = 0;\r
4397     /**\r
4398      * Documents are synced by always sending the full content\r
4399      * of the document.\r
4400      */\r
4401     TextDocumentSyncKind.Full = 1;\r
4402     /**\r
4403      * Documents are synced by sending the full content on open.\r
4404      * After that only incremental updates to the document are\r
4405      * send.\r
4406      */\r
4407     TextDocumentSyncKind.Incremental = 2;\r
4408 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
4409 /**\r
4410  * The document open notification is sent from the client to the server to signal\r
4411  * newly opened text documents. The document's truth is now managed by the client\r
4412  * and the server must not try to read the document's truth using the document's\r
4413  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
4414  * mean that its content is presented in an editor. An open notification must not\r
4415  * be sent more than once without a corresponding close notification send before.\r
4416  * This means open and close notification must be balanced and the max open count\r
4417  * is one.\r
4418  */\r
4419 var DidOpenTextDocumentNotification;\r
4420 (function (DidOpenTextDocumentNotification) {\r
4421     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
4422     DidOpenTextDocumentNotification.type = new vscode_jsonrpc_1.NotificationType(DidOpenTextDocumentNotification.method);\r
4423 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
4424 /**\r
4425  * The document change notification is sent from the client to the server to signal\r
4426  * changes to a text document.\r
4427  */\r
4428 var DidChangeTextDocumentNotification;\r
4429 (function (DidChangeTextDocumentNotification) {\r
4430     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
4431     DidChangeTextDocumentNotification.type = new vscode_jsonrpc_1.NotificationType(DidChangeTextDocumentNotification.method);\r
4432 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
4433 /**\r
4434  * The document close notification is sent from the client to the server when\r
4435  * the document got closed in the client. The document's truth now exists where\r
4436  * the document's uri points to (e.g. if the document's uri is a file uri the\r
4437  * truth now exists on disk). As with the open notification the close notification\r
4438  * is about managing the document's content. Receiving a close notification\r
4439  * doesn't mean that the document was open in an editor before. A close\r
4440  * notification requires a previous open notification to be sent.\r
4441  */\r
4442 var DidCloseTextDocumentNotification;\r
4443 (function (DidCloseTextDocumentNotification) {\r
4444     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
4445     DidCloseTextDocumentNotification.type = new vscode_jsonrpc_1.NotificationType(DidCloseTextDocumentNotification.method);\r
4446 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
4447 /**\r
4448  * The document save notification is sent from the client to the server when\r
4449  * the document got saved in the client.\r
4450  */\r
4451 var DidSaveTextDocumentNotification;\r
4452 (function (DidSaveTextDocumentNotification) {\r
4453     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
4454     DidSaveTextDocumentNotification.type = new vscode_jsonrpc_1.NotificationType(DidSaveTextDocumentNotification.method);\r
4455 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
4456 /**\r
4457  * Represents reasons why a text document is saved.\r
4458  */\r
4459 var TextDocumentSaveReason;\r
4460 (function (TextDocumentSaveReason) {\r
4461     /**\r
4462      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
4463      * or by an API call.\r
4464      */\r
4465     TextDocumentSaveReason.Manual = 1;\r
4466     /**\r
4467      * Automatic after a delay.\r
4468      */\r
4469     TextDocumentSaveReason.AfterDelay = 2;\r
4470     /**\r
4471      * When the editor lost focus.\r
4472      */\r
4473     TextDocumentSaveReason.FocusOut = 3;\r
4474 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
4475 /**\r
4476  * A document will save notification is sent from the client to the server before\r
4477  * the document is actually saved.\r
4478  */\r
4479 var WillSaveTextDocumentNotification;\r
4480 (function (WillSaveTextDocumentNotification) {\r
4481     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
4482     WillSaveTextDocumentNotification.type = new vscode_jsonrpc_1.NotificationType(WillSaveTextDocumentNotification.method);\r
4483 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
4484 /**\r
4485  * A document will save request is sent from the client to the server before\r
4486  * the document is actually saved. The request can return an array of TextEdits\r
4487  * which will be applied to the text document before it is saved. Please note that\r
4488  * clients might drop results if computing the text edits took too long or if a\r
4489  * server constantly fails on this request. This is done to keep the save fast and\r
4490  * reliable.\r
4491  */\r
4492 var WillSaveTextDocumentWaitUntilRequest;\r
4493 (function (WillSaveTextDocumentWaitUntilRequest) {\r
4494     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
4495     WillSaveTextDocumentWaitUntilRequest.type = new vscode_jsonrpc_1.RequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
4496 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
4497 /**\r
4498  * The watched files notification is sent from the client to the server when\r
4499  * the client detects changes to file watched by the language client.\r
4500  */\r
4501 var DidChangeWatchedFilesNotification;\r
4502 (function (DidChangeWatchedFilesNotification) {\r
4503     DidChangeWatchedFilesNotification.type = new vscode_jsonrpc_1.NotificationType('workspace/didChangeWatchedFiles');\r
4504 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
4505 /**\r
4506  * The file event type\r
4507  */\r
4508 var FileChangeType;\r
4509 (function (FileChangeType) {\r
4510     /**\r
4511      * The file got created.\r
4512      */\r
4513     FileChangeType.Created = 1;\r
4514     /**\r
4515      * The file got changed.\r
4516      */\r
4517     FileChangeType.Changed = 2;\r
4518     /**\r
4519      * The file got deleted.\r
4520      */\r
4521     FileChangeType.Deleted = 3;\r
4522 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
4523 var WatchKind;\r
4524 (function (WatchKind) {\r
4525     /**\r
4526      * Interested in create events.\r
4527      */\r
4528     WatchKind.Create = 1;\r
4529     /**\r
4530      * Interested in change events\r
4531      */\r
4532     WatchKind.Change = 2;\r
4533     /**\r
4534      * Interested in delete events\r
4535      */\r
4536     WatchKind.Delete = 4;\r
4537 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
4538 /**\r
4539  * Diagnostics notification are sent from the server to the client to signal\r
4540  * results of validation runs.\r
4541  */\r
4542 var PublishDiagnosticsNotification;\r
4543 (function (PublishDiagnosticsNotification) {\r
4544     PublishDiagnosticsNotification.type = new vscode_jsonrpc_1.NotificationType('textDocument/publishDiagnostics');\r
4545 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
4546 /**\r
4547  * How a completion was triggered\r
4548  */\r
4549 var CompletionTriggerKind;\r
4550 (function (CompletionTriggerKind) {\r
4551     /**\r
4552      * Completion was triggered by typing an identifier (24x7 code\r
4553      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
4554      */\r
4555     CompletionTriggerKind.Invoked = 1;\r
4556     /**\r
4557      * Completion was triggered by a trigger character specified by\r
4558      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
4559      */\r
4560     CompletionTriggerKind.TriggerCharacter = 2;\r
4561     /**\r
4562      * Completion was re-triggered as current completion list is incomplete\r
4563      */\r
4564     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
4565 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
4566 /**\r
4567  * Request to request completion at a given text document position. The request's\r
4568  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
4569  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
4570  * or a Thenable that resolves to such.\r
4571  *\r
4572  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
4573  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
4574  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
4575  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
4576  */\r
4577 var CompletionRequest;\r
4578 (function (CompletionRequest) {\r
4579     CompletionRequest.method = 'textDocument/completion';\r
4580     CompletionRequest.type = new vscode_jsonrpc_1.RequestType(CompletionRequest.method);\r
4581     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4582 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
4583 /**\r
4584  * Request to resolve additional information for a given completion item.The request's\r
4585  * parameter is of type [CompletionItem](#CompletionItem) the response\r
4586  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
4587  */\r
4588 var CompletionResolveRequest;\r
4589 (function (CompletionResolveRequest) {\r
4590     CompletionResolveRequest.method = 'completionItem/resolve';\r
4591     CompletionResolveRequest.type = new vscode_jsonrpc_1.RequestType(CompletionResolveRequest.method);\r
4592 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
4593 /**\r
4594  * Request to request hover information at a given text document position. The request's\r
4595  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
4596  * type [Hover](#Hover) or a Thenable that resolves to such.\r
4597  */\r
4598 var HoverRequest;\r
4599 (function (HoverRequest) {\r
4600     HoverRequest.method = 'textDocument/hover';\r
4601     HoverRequest.type = new vscode_jsonrpc_1.RequestType(HoverRequest.method);\r
4602 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
4603 /**\r
4604  * How a signature help was triggered.\r
4605  *\r
4606  * @since 3.15.0\r
4607  */\r
4608 var SignatureHelpTriggerKind;\r
4609 (function (SignatureHelpTriggerKind) {\r
4610     /**\r
4611      * Signature help was invoked manually by the user or by a command.\r
4612      */\r
4613     SignatureHelpTriggerKind.Invoked = 1;\r
4614     /**\r
4615      * Signature help was triggered by a trigger character.\r
4616      */\r
4617     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
4618     /**\r
4619      * Signature help was triggered by the cursor moving or by the document content changing.\r
4620      */\r
4621     SignatureHelpTriggerKind.ContentChange = 3;\r
4622 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
4623 var SignatureHelpRequest;\r
4624 (function (SignatureHelpRequest) {\r
4625     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
4626     SignatureHelpRequest.type = new vscode_jsonrpc_1.RequestType(SignatureHelpRequest.method);\r
4627 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
4628 /**\r
4629  * A request to resolve the definition location of a symbol at a given text\r
4630  * document position. The request's parameter is of type [TextDocumentPosition]\r
4631  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
4632  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
4633  * to such.\r
4634  */\r
4635 var DefinitionRequest;\r
4636 (function (DefinitionRequest) {\r
4637     DefinitionRequest.method = 'textDocument/definition';\r
4638     DefinitionRequest.type = new vscode_jsonrpc_1.RequestType(DefinitionRequest.method);\r
4639     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4640 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
4641 /**\r
4642  * A request to resolve project-wide references for the symbol denoted\r
4643  * by the given text document position. The request's parameter is of\r
4644  * type [ReferenceParams](#ReferenceParams) the response is of type\r
4645  * [Location[]](#Location) or a Thenable that resolves to such.\r
4646  */\r
4647 var ReferencesRequest;\r
4648 (function (ReferencesRequest) {\r
4649     ReferencesRequest.method = 'textDocument/references';\r
4650     ReferencesRequest.type = new vscode_jsonrpc_1.RequestType(ReferencesRequest.method);\r
4651     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4652 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
4653 /**\r
4654  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
4655  * text document position. The request's parameter is of type [TextDocumentPosition]\r
4656  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
4657  * (#DocumentHighlight) or a Thenable that resolves to such.\r
4658  */\r
4659 var DocumentHighlightRequest;\r
4660 (function (DocumentHighlightRequest) {\r
4661     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
4662     DocumentHighlightRequest.type = new vscode_jsonrpc_1.RequestType(DocumentHighlightRequest.method);\r
4663     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4664 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
4665 /**\r
4666  * A request to list all symbols found in a given text document. The request's\r
4667  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
4668  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
4669  * that resolves to such.\r
4670  */\r
4671 var DocumentSymbolRequest;\r
4672 (function (DocumentSymbolRequest) {\r
4673     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
4674     DocumentSymbolRequest.type = new vscode_jsonrpc_1.RequestType(DocumentSymbolRequest.method);\r
4675     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4676 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
4677 /**\r
4678  * A request to provide commands for the given text document and range.\r
4679  */\r
4680 var CodeActionRequest;\r
4681 (function (CodeActionRequest) {\r
4682     CodeActionRequest.method = 'textDocument/codeAction';\r
4683     CodeActionRequest.type = new vscode_jsonrpc_1.RequestType(CodeActionRequest.method);\r
4684     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4685 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
4686 /**\r
4687  * A request to list project-wide symbols matching the query string given\r
4688  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
4689  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
4690  * resolves to such.\r
4691  */\r
4692 var WorkspaceSymbolRequest;\r
4693 (function (WorkspaceSymbolRequest) {\r
4694     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
4695     WorkspaceSymbolRequest.type = new vscode_jsonrpc_1.RequestType(WorkspaceSymbolRequest.method);\r
4696     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4697 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
4698 /**\r
4699  * A request to provide code lens for the given text document.\r
4700  */\r
4701 var CodeLensRequest;\r
4702 (function (CodeLensRequest) {\r
4703     CodeLensRequest.type = new vscode_jsonrpc_1.RequestType('textDocument/codeLens');\r
4704     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4705 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
4706 /**\r
4707  * A request to resolve a command for a given code lens.\r
4708  */\r
4709 var CodeLensResolveRequest;\r
4710 (function (CodeLensResolveRequest) {\r
4711     CodeLensResolveRequest.type = new vscode_jsonrpc_1.RequestType('codeLens/resolve');\r
4712 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
4713 /**\r
4714  * A request to provide document links\r
4715  */\r
4716 var DocumentLinkRequest;\r
4717 (function (DocumentLinkRequest) {\r
4718     DocumentLinkRequest.method = 'textDocument/documentLink';\r
4719     DocumentLinkRequest.type = new vscode_jsonrpc_1.RequestType(DocumentLinkRequest.method);\r
4720     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4721 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
4722 /**\r
4723  * Request to resolve additional information for a given document link. The request's\r
4724  * parameter is of type [DocumentLink](#DocumentLink) the response\r
4725  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
4726  */\r
4727 var DocumentLinkResolveRequest;\r
4728 (function (DocumentLinkResolveRequest) {\r
4729     DocumentLinkResolveRequest.type = new vscode_jsonrpc_1.RequestType('documentLink/resolve');\r
4730 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
4731 /**\r
4732  * A request to to format a whole document.\r
4733  */\r
4734 var DocumentFormattingRequest;\r
4735 (function (DocumentFormattingRequest) {\r
4736     DocumentFormattingRequest.method = 'textDocument/formatting';\r
4737     DocumentFormattingRequest.type = new vscode_jsonrpc_1.RequestType(DocumentFormattingRequest.method);\r
4738 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
4739 /**\r
4740  * A request to to format a range in a document.\r
4741  */\r
4742 var DocumentRangeFormattingRequest;\r
4743 (function (DocumentRangeFormattingRequest) {\r
4744     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
4745     DocumentRangeFormattingRequest.type = new vscode_jsonrpc_1.RequestType(DocumentRangeFormattingRequest.method);\r
4746 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
4747 /**\r
4748  * A request to format a document on type.\r
4749  */\r
4750 var DocumentOnTypeFormattingRequest;\r
4751 (function (DocumentOnTypeFormattingRequest) {\r
4752     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
4753     DocumentOnTypeFormattingRequest.type = new vscode_jsonrpc_1.RequestType(DocumentOnTypeFormattingRequest.method);\r
4754 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
4755 /**\r
4756  * A request to rename a symbol.\r
4757  */\r
4758 var RenameRequest;\r
4759 (function (RenameRequest) {\r
4760     RenameRequest.method = 'textDocument/rename';\r
4761     RenameRequest.type = new vscode_jsonrpc_1.RequestType(RenameRequest.method);\r
4762 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
4763 /**\r
4764  * A request to test and perform the setup necessary for a rename.\r
4765  */\r
4766 var PrepareRenameRequest;\r
4767 (function (PrepareRenameRequest) {\r
4768     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
4769     PrepareRenameRequest.type = new vscode_jsonrpc_1.RequestType(PrepareRenameRequest.method);\r
4770 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
4771 /**\r
4772  * A request send from the client to the server to execute a command. The request might return\r
4773  * a workspace edit which the client will apply to the workspace.\r
4774  */\r
4775 var ExecuteCommandRequest;\r
4776 (function (ExecuteCommandRequest) {\r
4777     ExecuteCommandRequest.type = new vscode_jsonrpc_1.RequestType('workspace/executeCommand');\r
4778 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
4779 /**\r
4780  * A request sent from the server to the client to modified certain resources.\r
4781  */\r
4782 var ApplyWorkspaceEditRequest;\r
4783 (function (ApplyWorkspaceEditRequest) {\r
4784     ApplyWorkspaceEditRequest.type = new vscode_jsonrpc_1.RequestType('workspace/applyEdit');\r
4785 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
4786
4787
4788 /***/ }),
4789 /* 20 */
4790 /***/ (function(module, exports, __webpack_require__) {
4791
4792 "use strict";
4793 /* --------------------------------------------------------------------------------------------\r
4794  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4795  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4796  * ------------------------------------------------------------------------------------------ */\r
4797 \r
4798 Object.defineProperty(exports, "__esModule", { value: true });\r
4799 function boolean(value) {\r
4800     return value === true || value === false;\r
4801 }\r
4802 exports.boolean = boolean;\r
4803 function string(value) {\r
4804     return typeof value === 'string' || value instanceof String;\r
4805 }\r
4806 exports.string = string;\r
4807 function number(value) {\r
4808     return typeof value === 'number' || value instanceof Number;\r
4809 }\r
4810 exports.number = number;\r
4811 function error(value) {\r
4812     return value instanceof Error;\r
4813 }\r
4814 exports.error = error;\r
4815 function func(value) {\r
4816     return typeof value === 'function';\r
4817 }\r
4818 exports.func = func;\r
4819 function array(value) {\r
4820     return Array.isArray(value);\r
4821 }\r
4822 exports.array = array;\r
4823 function stringArray(value) {\r
4824     return array(value) && value.every(elem => string(elem));\r
4825 }\r
4826 exports.stringArray = stringArray;\r
4827 function typedArray(value, check) {\r
4828     return Array.isArray(value) && value.every(check);\r
4829 }\r
4830 exports.typedArray = typedArray;\r
4831 function objectLiteral(value) {\r
4832     // Strictly speaking class instances pass this check as well. Since the LSP\r
4833     // doesn't use classes we ignore this for now. If we do we need to add something\r
4834     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4835     return value !== null && typeof value === 'object';\r
4836 }\r
4837 exports.objectLiteral = objectLiteral;\r
4838
4839
4840 /***/ }),
4841 /* 21 */
4842 /***/ (function(module, exports, __webpack_require__) {
4843
4844 "use strict";
4845 /* --------------------------------------------------------------------------------------------\r
4846  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4847  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4848  * ------------------------------------------------------------------------------------------ */\r
4849 \r
4850 Object.defineProperty(exports, "__esModule", { value: true });\r
4851 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4852 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4853 let __noDynamicImport;\r
4854 /**\r
4855  * A request to resolve the implementation locations of a symbol at a given text\r
4856  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
4857  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
4858  * Thenable that resolves to such.\r
4859  */\r
4860 var ImplementationRequest;\r
4861 (function (ImplementationRequest) {\r
4862     ImplementationRequest.method = 'textDocument/implementation';\r
4863     ImplementationRequest.type = new vscode_jsonrpc_1.RequestType(ImplementationRequest.method);\r
4864     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4865 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
4866
4867
4868 /***/ }),
4869 /* 22 */
4870 /***/ (function(module, exports, __webpack_require__) {
4871
4872 "use strict";
4873 /* --------------------------------------------------------------------------------------------\r
4874  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4875  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4876  * ------------------------------------------------------------------------------------------ */\r
4877 \r
4878 Object.defineProperty(exports, "__esModule", { value: true });\r
4879 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4880 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4881 let __noDynamicImport;\r
4882 /**\r
4883  * A request to resolve the type definition locations of a symbol at a given text\r
4884  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
4885  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
4886  * Thenable that resolves to such.\r
4887  */\r
4888 var TypeDefinitionRequest;\r
4889 (function (TypeDefinitionRequest) {\r
4890     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
4891     TypeDefinitionRequest.type = new vscode_jsonrpc_1.RequestType(TypeDefinitionRequest.method);\r
4892     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4893 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
4894
4895
4896 /***/ }),
4897 /* 23 */
4898 /***/ (function(module, exports, __webpack_require__) {
4899
4900 "use strict";
4901 /* --------------------------------------------------------------------------------------------\r
4902  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4903  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4904  * ------------------------------------------------------------------------------------------ */\r
4905 \r
4906 Object.defineProperty(exports, "__esModule", { value: true });\r
4907 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4908 /**\r
4909  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
4910  */\r
4911 var WorkspaceFoldersRequest;\r
4912 (function (WorkspaceFoldersRequest) {\r
4913     WorkspaceFoldersRequest.type = new vscode_jsonrpc_1.RequestType0('workspace/workspaceFolders');\r
4914 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
4915 /**\r
4916  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
4917  * folder configuration changes.\r
4918  */\r
4919 var DidChangeWorkspaceFoldersNotification;\r
4920 (function (DidChangeWorkspaceFoldersNotification) {\r
4921     DidChangeWorkspaceFoldersNotification.type = new vscode_jsonrpc_1.NotificationType('workspace/didChangeWorkspaceFolders');\r
4922 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
4923
4924
4925 /***/ }),
4926 /* 24 */
4927 /***/ (function(module, exports, __webpack_require__) {
4928
4929 "use strict";
4930 /* --------------------------------------------------------------------------------------------\r
4931  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4932  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4933  * ------------------------------------------------------------------------------------------ */\r
4934 \r
4935 Object.defineProperty(exports, "__esModule", { value: true });\r
4936 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4937 /**\r
4938  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
4939  * configuration setting.\r
4940  *\r
4941  * This pull model replaces the old push model were the client signaled configuration change via an\r
4942  * event. If the server still needs to react to configuration changes (since the server caches the\r
4943  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
4944  * change event and empty the cache if such an event is received.\r
4945  */\r
4946 var ConfigurationRequest;\r
4947 (function (ConfigurationRequest) {\r
4948     ConfigurationRequest.type = new vscode_jsonrpc_1.RequestType('workspace/configuration');\r
4949 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
4950
4951
4952 /***/ }),
4953 /* 25 */
4954 /***/ (function(module, exports, __webpack_require__) {
4955
4956 "use strict";
4957 /* --------------------------------------------------------------------------------------------\r
4958  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4959  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4960  * ------------------------------------------------------------------------------------------ */\r
4961 \r
4962 Object.defineProperty(exports, "__esModule", { value: true });\r
4963 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4964 /**\r
4965  * A request to list all color symbols found in a given text document. The request's\r
4966  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
4967  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
4968  * that resolves to such.\r
4969  */\r
4970 var DocumentColorRequest;\r
4971 (function (DocumentColorRequest) {\r
4972     DocumentColorRequest.method = 'textDocument/documentColor';\r
4973     DocumentColorRequest.type = new vscode_jsonrpc_1.RequestType(DocumentColorRequest.method);\r
4974     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4975 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
4976 /**\r
4977  * A request to list all presentation for a color. The request's\r
4978  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
4979  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
4980  * that resolves to such.\r
4981  */\r
4982 var ColorPresentationRequest;\r
4983 (function (ColorPresentationRequest) {\r
4984     ColorPresentationRequest.type = new vscode_jsonrpc_1.RequestType('textDocument/colorPresentation');\r
4985 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
4986
4987
4988 /***/ }),
4989 /* 26 */
4990 /***/ (function(module, exports, __webpack_require__) {
4991
4992 "use strict";
4993 \r
4994 /*---------------------------------------------------------------------------------------------\r
4995  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
4996  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
4997  *--------------------------------------------------------------------------------------------*/\r
4998 Object.defineProperty(exports, "__esModule", { value: true });\r
4999 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5000 /**\r
5001  * Enum of known range kinds\r
5002  */\r
5003 var FoldingRangeKind;\r
5004 (function (FoldingRangeKind) {\r
5005     /**\r
5006      * Folding range for a comment\r
5007      */\r
5008     FoldingRangeKind["Comment"] = "comment";\r
5009     /**\r
5010      * Folding range for a imports or includes\r
5011      */\r
5012     FoldingRangeKind["Imports"] = "imports";\r
5013     /**\r
5014      * Folding range for a region (e.g. `#region`)\r
5015      */\r
5016     FoldingRangeKind["Region"] = "region";\r
5017 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
5018 /**\r
5019  * A request to provide folding ranges in a document. The request's\r
5020  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
5021  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
5022  * that resolves to such.\r
5023  */\r
5024 var FoldingRangeRequest;\r
5025 (function (FoldingRangeRequest) {\r
5026     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
5027     FoldingRangeRequest.type = new vscode_jsonrpc_1.RequestType(FoldingRangeRequest.method);\r
5028     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5029 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
5030
5031
5032 /***/ }),
5033 /* 27 */
5034 /***/ (function(module, exports, __webpack_require__) {
5035
5036 "use strict";
5037 /* --------------------------------------------------------------------------------------------\r
5038  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5039  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5040  * ------------------------------------------------------------------------------------------ */\r
5041 \r
5042 Object.defineProperty(exports, "__esModule", { value: true });\r
5043 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5044 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5045 let __noDynamicImport;\r
5046 /**\r
5047  * A request to resolve the type definition locations of a symbol at a given text\r
5048  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5049  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
5050  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
5051  * to such.\r
5052  */\r
5053 var DeclarationRequest;\r
5054 (function (DeclarationRequest) {\r
5055     DeclarationRequest.method = 'textDocument/declaration';\r
5056     DeclarationRequest.type = new vscode_jsonrpc_1.RequestType(DeclarationRequest.method);\r
5057     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5058 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
5059
5060
5061 /***/ }),
5062 /* 28 */
5063 /***/ (function(module, exports, __webpack_require__) {
5064
5065 "use strict";
5066 \r
5067 /*---------------------------------------------------------------------------------------------\r
5068  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5069  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5070  *--------------------------------------------------------------------------------------------*/\r
5071 Object.defineProperty(exports, "__esModule", { value: true });\r
5072 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5073 /**\r
5074  * A request to provide selection ranges in a document. The request's\r
5075  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
5076  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
5077  * that resolves to such.\r
5078  */\r
5079 var SelectionRangeRequest;\r
5080 (function (SelectionRangeRequest) {\r
5081     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
5082     SelectionRangeRequest.type = new vscode_jsonrpc_1.RequestType(SelectionRangeRequest.method);\r
5083     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5084 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
5085
5086
5087 /***/ }),
5088 /* 29 */
5089 /***/ (function(module, exports, __webpack_require__) {
5090
5091 "use strict";
5092 /* --------------------------------------------------------------------------------------------\r
5093  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5094  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5095  * ------------------------------------------------------------------------------------------ */\r
5096 \r
5097 Object.defineProperty(exports, "__esModule", { value: true });\r
5098 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5099 var WorkDoneProgress;\r
5100 (function (WorkDoneProgress) {\r
5101     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
5102 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
5103 /**\r
5104  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
5105  * reporting from the server.\r
5106  */\r
5107 var WorkDoneProgressCreateRequest;\r
5108 (function (WorkDoneProgressCreateRequest) {\r
5109     WorkDoneProgressCreateRequest.type = new vscode_jsonrpc_1.RequestType('window/workDoneProgress/create');\r
5110 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
5111 /**\r
5112  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
5113  * initiated on the server side.\r
5114  */\r
5115 var WorkDoneProgressCancelNotification;\r
5116 (function (WorkDoneProgressCancelNotification) {\r
5117     WorkDoneProgressCancelNotification.type = new vscode_jsonrpc_1.NotificationType('window/workDoneProgress/cancel');\r
5118 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
5119
5120
5121 /***/ }),
5122 /* 30 */
5123 /***/ (function(module, exports, __webpack_require__) {
5124
5125 "use strict";
5126 /* --------------------------------------------------------------------------------------------\r
5127  * Copyright (c) TypeFox and others. All rights reserved.\r
5128  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5129  * ------------------------------------------------------------------------------------------ */\r
5130 \r
5131 Object.defineProperty(exports, "__esModule", { value: true });\r
5132 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5133 var CallHierarchyPrepareRequest;\r
5134 (function (CallHierarchyPrepareRequest) {\r
5135     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
5136     CallHierarchyPrepareRequest.type = new vscode_jsonrpc_1.RequestType(CallHierarchyPrepareRequest.method);\r
5137 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
5138 var CallHierarchyIncomingCallsRequest;\r
5139 (function (CallHierarchyIncomingCallsRequest) {\r
5140     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
5141     CallHierarchyIncomingCallsRequest.type = new vscode_jsonrpc_1.RequestType(CallHierarchyIncomingCallsRequest.method);\r
5142     CallHierarchyIncomingCallsRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5143 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
5144 var CallHierarchyOutgoingCallsRequest;\r
5145 (function (CallHierarchyOutgoingCallsRequest) {\r
5146     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
5147     CallHierarchyOutgoingCallsRequest.type = new vscode_jsonrpc_1.RequestType(CallHierarchyOutgoingCallsRequest.method);\r
5148     CallHierarchyOutgoingCallsRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5149 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
5150
5151
5152 /***/ }),
5153 /* 31 */,
5154 /* 32 */,
5155 /* 33 */,
5156 /* 34 */,
5157 /* 35 */,
5158 /* 36 */
5159 /***/ (function(module, exports, __webpack_require__) {
5160
5161 "use strict";
5162 /* --------------------------------------------------------------------------------------------
5163  * Copyright (c) Microsoft Corporation. All rights reserved.
5164  * Licensed under the MIT License. See License.txt in the project root for license information.
5165  * ------------------------------------------------------------------------------------------ */
5166
5167 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5168     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5169     return new (P || (P = Promise))(function (resolve, reject) {
5170         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5171         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5172         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5173         step((generator = generator.apply(thisArg, _arguments || [])).next());
5174     });
5175 };
5176 var __importStar = (this && this.__importStar) || function (mod) {
5177     if (mod && mod.__esModule) return mod;
5178     var result = {};
5179     if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
5180     result["default"] = mod;
5181     return result;
5182 };
5183 Object.defineProperty(exports, "__esModule", { value: true });
5184 const os = __importStar(__webpack_require__(14));
5185 const path = __importStar(__webpack_require__(3));
5186 const vscode_languageserver_1 = __webpack_require__(37);
5187 const vscode_uri_1 = __webpack_require__(46);
5188 const types_1 = __webpack_require__(47);
5189 const util_1 = __webpack_require__(48);
5190 const vscode_languageserver_textdocument_1 = __webpack_require__(52);
5191 const requireFunc =  true ? require : undefined;
5192 var CommandIds;
5193 (function (CommandIds) {
5194     CommandIds.applySingleFix = 'eslint.applySingleFix';
5195     CommandIds.applySameFixes = 'eslint.applySameFixes';
5196     CommandIds.applyAllFixes = 'eslint.applyAllFixes';
5197     CommandIds.applyAutoFix = 'eslint.applyAutoFix';
5198     CommandIds.applyDisableLine = 'eslint.applyDisableLine';
5199     CommandIds.applyDisableFile = 'eslint.applyDisableFile';
5200     CommandIds.openRuleDoc = 'eslint.openRuleDoc';
5201 })(CommandIds || (CommandIds = {}));
5202 var OpenESLintDocRequest;
5203 (function (OpenESLintDocRequest) {
5204     OpenESLintDocRequest.type = new vscode_languageserver_1.RequestType('eslint/openDoc');
5205 })(OpenESLintDocRequest || (OpenESLintDocRequest = {}));
5206 var Status;
5207 (function (Status) {
5208     Status[Status["ok"] = 1] = "ok";
5209     Status[Status["warn"] = 2] = "warn";
5210     Status[Status["error"] = 3] = "error";
5211 })(Status || (Status = {}));
5212 var StatusNotification;
5213 (function (StatusNotification) {
5214     StatusNotification.type = new vscode_languageserver_1.NotificationType('eslint/status');
5215 })(StatusNotification || (StatusNotification = {}));
5216 var NoConfigRequest;
5217 (function (NoConfigRequest) {
5218     NoConfigRequest.type = new vscode_languageserver_1.RequestType('eslint/noConfig');
5219 })(NoConfigRequest || (NoConfigRequest = {}));
5220 var NoESLintLibraryRequest;
5221 (function (NoESLintLibraryRequest) {
5222     NoESLintLibraryRequest.type = new vscode_languageserver_1.RequestType('eslint/noLibrary');
5223 })(NoESLintLibraryRequest || (NoESLintLibraryRequest = {}));
5224 class CodeActionResult {
5225     constructor() {
5226         this._actions = new Map();
5227     }
5228     get(ruleId) {
5229         let result = this._actions.get(ruleId);
5230         if (result === undefined) {
5231             result = { fixes: [] };
5232             this._actions.set(ruleId, result);
5233         }
5234         return result;
5235     }
5236     set fixAll(action) {
5237         this._fixAll = action;
5238     }
5239     all() {
5240         let result = [];
5241         for (let actions of this._actions.values()) {
5242             result.push(...actions.fixes);
5243             if (actions.disable) {
5244                 result.push(actions.disable);
5245             }
5246             if (actions.fixAll) {
5247                 result.push(actions.fixAll);
5248             }
5249             if (actions.disableFile) {
5250                 result.push(actions.disableFile);
5251             }
5252             if (actions.showDocumentation) {
5253                 result.push(actions.showDocumentation);
5254             }
5255         }
5256         if (this._fixAll !== undefined) {
5257             result.push(this._fixAll);
5258         }
5259         return result;
5260     }
5261     get length() {
5262         let result = 0;
5263         for (let actions of this._actions.values()) {
5264             result += actions.fixes.length;
5265         }
5266         return result;
5267     }
5268 }
5269 function makeDiagnostic(problem) {
5270     let message = problem.ruleId != null
5271         ? `${problem.message} (${problem.ruleId})`
5272         : `${problem.message}`;
5273     let startLine = Math.max(0, problem.line - 1);
5274     let startChar = Math.max(0, problem.column - 1);
5275     let endLine = problem.endLine != null ? Math.max(0, problem.endLine - 1) : startLine;
5276     let endChar = problem.endColumn != null ? Math.max(0, problem.endColumn - 1) : startChar;
5277     return {
5278         message,
5279         severity: convertSeverity(problem.severity),
5280         source: 'eslint',
5281         range: {
5282             start: { line: startLine, character: startChar },
5283             end: { line: endLine, character: endChar }
5284         },
5285         code: problem.ruleId
5286     };
5287 }
5288 function computeKey(diagnostic) {
5289     let range = diagnostic.range;
5290     return `[${range.start.line},${range.start.character},${range.end.line},${range.end.character}]-${diagnostic.code}`;
5291 }
5292 let codeActions = new Map();
5293 function recordCodeAction(document, diagnostic, problem) {
5294     if (!problem.ruleId) {
5295         return;
5296     }
5297     let uri = document.uri;
5298     let edits = codeActions.get(uri);
5299     if (!edits) {
5300         edits = new Map();
5301         codeActions.set(uri, edits);
5302     }
5303     edits.set(computeKey(diagnostic), { label: `Fix this ${problem.ruleId} problem`, documentVersion: document.version, ruleId: problem.ruleId, edit: problem.fix, line: problem.line });
5304 }
5305 function convertSeverity(severity) {
5306     switch (severity) {
5307         // Eslint 1 is warning
5308         case 1:
5309             return vscode_languageserver_1.DiagnosticSeverity.Warning;
5310         case 2:
5311             return vscode_languageserver_1.DiagnosticSeverity.Error;
5312         default:
5313             return vscode_languageserver_1.DiagnosticSeverity.Error;
5314     }
5315 }
5316 const exitCalled = new vscode_languageserver_1.NotificationType('eslint/exitCalled');
5317 const nodeExit = process.exit;
5318 process.exit = ((code) => {
5319     let stack = new Error('stack');
5320     connection.sendNotification(exitCalled, [code ? code : 0, stack.stack]);
5321     setTimeout(() => {
5322         nodeExit(code);
5323     }, 1000);
5324 });
5325 process.on('uncaughtException', (error) => {
5326     let message;
5327     if (error) {
5328         if (typeof error.stack === 'string') {
5329             message = error.stack;
5330         }
5331         else if (typeof error.message === 'string') {
5332             message = error.message;
5333         }
5334         else if (typeof error === 'string') {
5335             message = error;
5336         }
5337         if (!message) {
5338             try {
5339                 message = JSON.stringify(error, undefined, 4);
5340             }
5341             catch (e) {
5342                 // Should not happen.
5343             }
5344         }
5345     }
5346     connection.console.error(`Uncaught exception recevied.
5347   ${message || ''}`);
5348 });
5349 let connection = vscode_languageserver_1.createConnection();
5350 connection.console.info(`ESLint server running in node ${process.version}`);
5351 let documents = new vscode_languageserver_1.TextDocuments(vscode_languageserver_textdocument_1.TextDocument);
5352 let _globalNpmPath;
5353 function globalNpmPath() {
5354     if (_globalNpmPath === void 0) {
5355         _globalNpmPath = vscode_languageserver_1.Files.resolveGlobalNodePath(trace);
5356         if (_globalNpmPath === void 0) {
5357             _globalNpmPath = null;
5358         }
5359     }
5360     if (_globalNpmPath === null) {
5361         return undefined;
5362     }
5363     return _globalNpmPath;
5364 }
5365 let _globalYarnPath;
5366 function globalYarnPath() {
5367     if (_globalYarnPath === void 0) {
5368         _globalYarnPath = vscode_languageserver_1.Files.resolveGlobalYarnPath(trace);
5369         if (_globalYarnPath === void 0) {
5370             _globalYarnPath = null;
5371         }
5372     }
5373     if (_globalYarnPath === null) {
5374         return undefined;
5375     }
5376     return _globalYarnPath;
5377 }
5378 let path2Library = new Map();
5379 let document2Settings = new Map();
5380 let ruleDocData = {
5381     handled: new Set(),
5382     urls: new Map()
5383 };
5384 function resolveSettings(document) {
5385     let uri = document.uri;
5386     let resultPromise = document2Settings.get(uri);
5387     if (resultPromise) {
5388         return resultPromise;
5389     }
5390     resultPromise = connection.workspace
5391         .getConfiguration({ scopeUri: uri, section: '' })
5392         .then((settings) => {
5393         let nodePath;
5394         if (settings.nodePath) {
5395             nodePath = settings.nodePath;
5396             if (nodePath.startsWith('~')) {
5397                 nodePath = nodePath.replace(/^~/, os.homedir());
5398             }
5399             if (!path.isAbsolute(nodePath)) {
5400                 nodePath = path.join(vscode_uri_1.URI.parse(settings.workspaceFolder.uri).fsPath, nodePath);
5401             }
5402         }
5403         else if (settings.packageManager === 'npm') {
5404             nodePath = globalNpmPath();
5405         }
5406         else if (settings.packageManager === 'yarn') {
5407             nodePath = globalYarnPath();
5408         }
5409         let uri = vscode_uri_1.URI.parse(document.uri);
5410         let promise;
5411         let directory;
5412         if (uri.scheme === 'file') {
5413             directory = path.dirname(uri.fsPath);
5414         }
5415         else {
5416             directory = settings.workspaceFolder ? vscode_uri_1.URI.parse(settings.workspaceFolder.uri).fsPath : undefined;
5417         }
5418         promise = util_1.resolveModule('./eslint', directory, nodePath).catch(() => {
5419             return util_1.resolveModule('eslint', directory, nodePath);
5420         });
5421         return promise.then(path => {
5422             let library = path2Library.get(path);
5423             if (!library) {
5424                 library = requireFunc(path);
5425                 if (!library.CLIEngine) {
5426                     settings.validate = false;
5427                     connection.console.error(`The eslint library loaded from ${path} doesn\'t export a CLIEngine. You need at least eslint@1.0.0`);
5428                 }
5429                 else {
5430                     connection.console.info(`ESLint library loaded from: ${path}`);
5431                     settings.library = library;
5432                 }
5433                 path2Library.set(path, library);
5434             }
5435             else {
5436                 settings.library = library;
5437             }
5438             return settings;
5439         }, () => {
5440             settings.validate = false;
5441             connection.sendRequest(NoESLintLibraryRequest.type, {
5442                 source: { uri: document.uri }
5443             });
5444             return settings;
5445         });
5446     });
5447     document2Settings.set(uri, resultPromise);
5448     return resultPromise;
5449 }
5450 var Request;
5451 (function (Request) {
5452     function is(value) {
5453         let candidate = value;
5454         return (candidate &&
5455             !!candidate.token &&
5456             !!candidate.resolve &&
5457             !!candidate.reject);
5458     }
5459     Request.is = is;
5460 })(Request || (Request = {}));
5461 var Thenable;
5462 (function (Thenable) {
5463     function is(value) {
5464         let candidate = value;
5465         return candidate && typeof candidate.then === 'function';
5466     }
5467     Thenable.is = is;
5468 })(Thenable || (Thenable = {}));
5469 class BufferedMessageQueue {
5470     constructor(connection) {
5471         this.connection = connection;
5472         this.queue = [];
5473         this.requestHandlers = new Map();
5474         this.notificationHandlers = new Map();
5475     }
5476     registerRequest(type, handler, versionProvider) {
5477         this.connection.onRequest(type, (params, token) => {
5478             return new Promise((resolve, reject) => {
5479                 this.queue.push({
5480                     method: type.method,
5481                     params,
5482                     documentVersion: versionProvider
5483                         ? versionProvider(params)
5484                         : undefined,
5485                     resolve,
5486                     reject,
5487                     token
5488                 });
5489                 this.trigger();
5490             });
5491         });
5492         this.requestHandlers.set(type.method, { handler, versionProvider });
5493     }
5494     registerNotification(type, handler, versionProvider) {
5495         connection.onNotification(type, params => {
5496             this.queue.push({
5497                 method: type.method,
5498                 params,
5499                 documentVersion: versionProvider ? versionProvider(params) : undefined
5500             });
5501             this.trigger();
5502         });
5503         this.notificationHandlers.set(type.method, { handler, versionProvider });
5504     }
5505     addNotificationMessage(type, params, version) {
5506         this.queue.push({
5507             method: type.method,
5508             params,
5509             documentVersion: version
5510         });
5511         this.trigger();
5512     }
5513     onNotification(type, handler, versionProvider) {
5514         this.notificationHandlers.set(type.method, { handler, versionProvider });
5515     }
5516     trigger() {
5517         if (this.timer || this.queue.length === 0) {
5518             return;
5519         }
5520         this.timer = setImmediate(() => {
5521             this.timer = undefined;
5522             this.processQueue();
5523         });
5524     }
5525     processQueue() {
5526         let message = this.queue.shift();
5527         if (!message) {
5528             return;
5529         }
5530         if (Request.is(message)) {
5531             let requestMessage = message;
5532             if (requestMessage.token.isCancellationRequested) {
5533                 requestMessage.reject(
5534                 // tslint:disable-next-line: no-inferred-empty-object-type
5535                 new vscode_languageserver_1.ResponseError(vscode_languageserver_1.ErrorCodes.RequestCancelled, 'Request got cancelled'));
5536                 return;
5537             }
5538             let elem = this.requestHandlers.get(requestMessage.method);
5539             if (elem.versionProvider &&
5540                 requestMessage.documentVersion !== void 0 &&
5541                 requestMessage.documentVersion !==
5542                     elem.versionProvider(requestMessage.params)) {
5543                 requestMessage.reject(
5544                 // tslint:disable-next-line: no-inferred-empty-object-type
5545                 new vscode_languageserver_1.ResponseError(vscode_languageserver_1.ErrorCodes.RequestCancelled, 'Request got cancelled'));
5546                 return;
5547             }
5548             let result = elem.handler(requestMessage.params, requestMessage.token);
5549             if (Thenable.is(result)) {
5550                 result.then(value => {
5551                     requestMessage.resolve(value);
5552                 }, error => {
5553                     requestMessage.reject(error);
5554                 });
5555             }
5556             else {
5557                 requestMessage.resolve(result);
5558             }
5559         }
5560         else {
5561             let notificationMessage = message;
5562             let elem = this.notificationHandlers.get(notificationMessage.method);
5563             if (elem.versionProvider &&
5564                 notificationMessage.documentVersion !== void 0 &&
5565                 notificationMessage.documentVersion !==
5566                     elem.versionProvider(notificationMessage.params)) {
5567                 return;
5568             }
5569             elem.handler(notificationMessage.params);
5570         }
5571         this.trigger();
5572     }
5573 }
5574 let messageQueue = new BufferedMessageQueue(connection);
5575 var ValidateNotification;
5576 (function (ValidateNotification) {
5577     ValidateNotification.type = new vscode_languageserver_1.NotificationType('eslint/validate');
5578 })(ValidateNotification || (ValidateNotification = {}));
5579 messageQueue.onNotification(ValidateNotification.type, document => {
5580     validateSingle(document, true);
5581 }, (document) => {
5582     return document.version;
5583 });
5584 // The documents manager listen for text document create, change
5585 // and close on the connection
5586 documents.listen(connection);
5587 documents.onDidOpen(event => {
5588     resolveSettings(event.document).then(settings => {
5589         if (!settings.validate) {
5590             return;
5591         }
5592         if (settings.run === 'onSave') {
5593             messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
5594         }
5595     });
5596 });
5597 // A text document has changed. Validate the document according the run setting.
5598 documents.onDidChangeContent(event => {
5599     resolveSettings(event.document).then(settings => {
5600         if (!settings.validate || settings.run !== 'onType') {
5601             return;
5602         }
5603         messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
5604     });
5605 });
5606 documents.onWillSaveWaitUntil(event => {
5607     if (event.reason === vscode_languageserver_1.TextDocumentSaveReason.AfterDelay) {
5608         return [];
5609     }
5610     let document = event.document;
5611     return resolveSettings(document).then(settings => {
5612         if (!settings.autoFixOnSave) {
5613             return [];
5614         }
5615         // If we validate on save and want to apply fixes on will save
5616         // we need to validate the file.
5617         if (settings.run === 'onSave') {
5618             // Do not queue this since we want to get the fixes as fast as possible.
5619             return validateSingle(document, false).then(() => util_1.getAllFixEdits(document, settings));
5620         }
5621         else {
5622             return util_1.getAllFixEdits(document, settings);
5623         }
5624     });
5625 });
5626 // A text document has been saved. Validate the document according the run setting.
5627 documents.onDidSave(event => {
5628     resolveSettings(event.document).then(settings => {
5629         if (!settings.validate || settings.run !== 'onSave') {
5630             return;
5631         }
5632         messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
5633     });
5634 });
5635 documents.onDidClose(event => {
5636     resolveSettings(event.document).then(settings => {
5637         let uri = event.document.uri;
5638         document2Settings.delete(uri);
5639         codeActions.delete(uri);
5640         if (settings.validate) {
5641             connection.sendDiagnostics({ uri, diagnostics: [] });
5642         }
5643     });
5644 });
5645 function environmentChanged() {
5646     document2Settings.clear();
5647     for (let document of documents.all()) {
5648         messageQueue.addNotificationMessage(ValidateNotification.type, document, document.version);
5649     }
5650 }
5651 function trace(message, verbose) {
5652     connection.tracer.log(message, verbose);
5653 }
5654 connection.onInitialize(_params => {
5655     return {
5656         capabilities: {
5657             textDocumentSync: {
5658                 openClose: true,
5659                 change: vscode_languageserver_1.TextDocumentSyncKind.Full,
5660                 willSaveWaitUntil: true,
5661                 save: {
5662                     includeText: false
5663                 }
5664             },
5665             codeActionProvider: true,
5666             executeCommandProvider: {
5667                 commands: [
5668                     CommandIds.applySingleFix,
5669                     CommandIds.applySameFixes,
5670                     CommandIds.applyAllFixes,
5671                     CommandIds.applyAutoFix,
5672                     CommandIds.applyDisableLine,
5673                     CommandIds.applyDisableFile,
5674                     CommandIds.openRuleDoc,
5675                 ]
5676             }
5677         }
5678     };
5679 });
5680 connection.onInitialized(() => {
5681     connection.client.register(vscode_languageserver_1.DidChangeConfigurationNotification.type, undefined);
5682 });
5683 messageQueue.registerNotification(vscode_languageserver_1.DidChangeConfigurationNotification.type, _params => {
5684     environmentChanged();
5685 });
5686 // messageQueue.registerNotification(
5687 //   DidChangeWorkspaceFoldersNotification.type,
5688 //   _params => {
5689 //     environmentChanged()
5690 //   }
5691 // )
5692 const singleErrorHandlers = [
5693     tryHandleNoConfig,
5694     tryHandleConfigError,
5695     tryHandleMissingModule,
5696     showErrorMessage
5697 ];
5698 function validateSingle(document, publishDiagnostics = true) {
5699     // We validate document in a queue but open / close documents directly. So we need to deal with the
5700     // fact that a document might be gone from the server.
5701     if (!documents.get(document.uri)) {
5702         return Promise.resolve(undefined);
5703     }
5704     return resolveSettings(document).then(settings => {
5705         if (!settings.validate) {
5706             return;
5707         }
5708         try {
5709             validate(document, settings, publishDiagnostics);
5710             connection.sendNotification(StatusNotification.type, { state: Status.ok });
5711         }
5712         catch (err) {
5713             let status;
5714             for (let handler of singleErrorHandlers) {
5715                 status = handler(err, document, settings.library);
5716                 if (status) {
5717                     break;
5718                 }
5719             }
5720             status = status || Status.error;
5721             connection.sendNotification(StatusNotification.type, { state: status });
5722         }
5723     });
5724 }
5725 function validateMany(documents) {
5726     documents.forEach(document => {
5727         messageQueue.addNotificationMessage(ValidateNotification.type, document, document.version);
5728     });
5729 }
5730 function getMessage(err, document) {
5731     let result = null;
5732     if (typeof err.message === 'string' || err.message instanceof String) {
5733         result = err.message;
5734         result = result.replace(/\r?\n/g, ' ');
5735         if (/^CLI: /.test(result)) {
5736             result = result.substr(5);
5737         }
5738     }
5739     else {
5740         result = `An unknown error occured while validating document: ${document.uri}`;
5741     }
5742     return result;
5743 }
5744 function validate(document, settings, publishDiagnostics = true) {
5745     const uri = document.uri;
5746     const content = document.getText();
5747     const newOptions = Object.assign(Object.create(null), settings.options);
5748     util_1.executeInWorkspaceDirectory(document, settings, newOptions, (file, options) => {
5749         const cli = new settings.library.CLIEngine(options);
5750         // Clean previously computed code actions.
5751         codeActions.delete(uri);
5752         const report = cli.executeOnText(content, file);
5753         const diagnostics = [];
5754         if (report && report.results && Array.isArray(report.results) && report.results.length > 0) {
5755             const docReport = report.results[0];
5756             if (docReport.messages && Array.isArray(docReport.messages)) {
5757                 docReport.messages.forEach(problem => {
5758                     if (problem) {
5759                         const isWarning = convertSeverity(problem.severity) === vscode_languageserver_1.DiagnosticSeverity.Warning;
5760                         if (settings.quiet && isWarning) {
5761                             // Filter out warnings when quiet mode is enabled
5762                             return;
5763                         }
5764                         const diagnostic = makeDiagnostic(problem);
5765                         diagnostics.push(diagnostic);
5766                         if (settings.autoFix) {
5767                             if (typeof cli.getRules === 'function' && problem.ruleId !== undefined && problem.fix !== undefined) {
5768                                 const rule = cli.getRules().get(problem.ruleId);
5769                                 if (rule !== undefined && rule.meta && typeof rule.meta.fixable == 'string') {
5770                                     recordCodeAction(document, diagnostic, problem);
5771                                 }
5772                             }
5773                             else {
5774                                 recordCodeAction(document, diagnostic, problem);
5775                             }
5776                         }
5777                     }
5778                 });
5779             }
5780         }
5781         if (publishDiagnostics) {
5782             connection.sendDiagnostics({ uri, diagnostics });
5783         }
5784         // cache documentation urls for all rules
5785         if (typeof cli.getRules === 'function' && !ruleDocData.handled.has(uri)) {
5786             ruleDocData.handled.add(uri);
5787             cli.getRules().forEach((rule, key) => {
5788                 if (rule.meta && rule.meta.docs && types_1.Is.string(rule.meta.docs.url)) {
5789                     ruleDocData.urls.set(key, rule.meta.docs.url);
5790                 }
5791             });
5792         }
5793     });
5794 }
5795 let noConfigReported = new Map();
5796 function isNoConfigFoundError(error) {
5797     let candidate = error;
5798     return (candidate.messageTemplate === 'no-config-found' ||
5799         candidate.message === 'No ESLint configuration found.');
5800 }
5801 function tryHandleNoConfig(error, document, library) {
5802     if (!isNoConfigFoundError(error)) {
5803         return undefined;
5804     }
5805     if (!noConfigReported.has(document.uri)) {
5806         connection
5807             .sendRequest(NoConfigRequest.type, {
5808             message: getMessage(error, document),
5809             document: {
5810                 uri: document.uri
5811             }
5812         })
5813             .then(undefined, () => {
5814             // noop
5815         });
5816         noConfigReported.set(document.uri, library);
5817     }
5818     return Status.warn;
5819 }
5820 let configErrorReported = new Map();
5821 function tryHandleConfigError(error, document, library) {
5822     if (!error.message) {
5823         return undefined;
5824     }
5825     function handleFileName(filename) {
5826         if (!configErrorReported.has(filename)) {
5827             connection.console.error(getMessage(error, document));
5828             if (!documents.get(vscode_uri_1.URI.file(filename).toString())) {
5829                 connection.window.showInformationMessage(getMessage(error, document));
5830             }
5831             configErrorReported.set(filename, library);
5832         }
5833         return Status.warn;
5834     }
5835     let matches = /Cannot read config file:\s+(.*)\nError:\s+(.*)/.exec(error.message);
5836     if (matches && matches.length === 3) {
5837         return handleFileName(matches[1]);
5838     }
5839     matches = /(.*):\n\s*Configuration for rule \"(.*)\" is /.exec(error.message);
5840     if (matches && matches.length === 3) {
5841         return handleFileName(matches[1]);
5842     }
5843     matches = /Cannot find module '([^']*)'\nReferenced from:\s+(.*)/.exec(error.message);
5844     if (matches && matches.length === 3) {
5845         return handleFileName(matches[2]);
5846     }
5847     return undefined;
5848 }
5849 let missingModuleReported = new Map();
5850 function tryHandleMissingModule(error, document, library) {
5851     if (!error.message) {
5852         return undefined;
5853     }
5854     function handleMissingModule(plugin, module, error) {
5855         if (!missingModuleReported.has(plugin)) {
5856             let fsPath = util_1.getFilePath(document);
5857             missingModuleReported.set(plugin, library);
5858             if (error.messageTemplate === 'plugin-missing') {
5859                 connection.console.error([
5860                     '',
5861                     `${error.message.toString()}`,
5862                     `Happened while validating ${fsPath ? fsPath : document.uri}`,
5863                     `This can happen for a couple of reasons:`,
5864                     `1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).`,
5865                     `2. If ESLint is installed globally, then make sure ${module} is installed globally as well.`,
5866                     `3. If ESLint is installed locally, then ${module} isn't installed correctly.`,
5867                     '',
5868                     `Consider running eslint --debug ${fsPath ? fsPath : document.uri} from a terminal to obtain a trace about the configuration files used.`
5869                 ].join('\n'));
5870             }
5871             else {
5872                 connection.console.error([
5873                     `${error.message.toString()}`,
5874                     `Happend while validating ${fsPath ? fsPath : document.uri}`
5875                 ].join('\n'));
5876             }
5877         }
5878         return Status.warn;
5879     }
5880     let matches = /Failed to load plugin (.*): Cannot find module (.*)/.exec(error.message);
5881     if (matches && matches.length === 3) {
5882         return handleMissingModule(matches[1], matches[2], error);
5883     }
5884     return undefined;
5885 }
5886 function showErrorMessage(error, document) {
5887     connection.window.showErrorMessage(`ESLint: ${getMessage(error, document)}. Please see the 'ESLint' output channel for details.`);
5888     if (types_1.Is.string(error.stack)) {
5889         connection.console.error('ESLint stack trace:');
5890         connection.console.error(error.stack);
5891     }
5892     return Status.error;
5893 }
5894 messageQueue.registerNotification(vscode_languageserver_1.DidChangeWatchedFilesNotification.type, params => {
5895     // A .eslintrc has change. No smartness here.
5896     // Simply revalidate all file.
5897     noConfigReported = new Map();
5898     missingModuleReported = new Map();
5899     params.changes.forEach(change => {
5900         let fsPath = util_1.getFilePath(change.uri);
5901         if (!fsPath || util_1.isUNC(fsPath)) {
5902             return;
5903         }
5904         let dirname = path.dirname(fsPath);
5905         if (dirname) {
5906             let library = configErrorReported.get(fsPath);
5907             if (library) {
5908                 let cli = new library.CLIEngine({});
5909                 try {
5910                     cli.executeOnText('', path.join(dirname, '___test___.js'));
5911                     configErrorReported.delete(fsPath);
5912                 }
5913                 catch (error) {
5914                     // noop
5915                 }
5916             }
5917         }
5918     });
5919     validateMany(documents.all());
5920 });
5921 class Fixes {
5922     constructor(edits) {
5923         this.edits = edits;
5924     }
5925     static overlaps(lastEdit, newEdit) {
5926         return !!lastEdit && lastEdit.edit.range[1] > newEdit.edit.range[0];
5927     }
5928     isEmpty() {
5929         return this.edits.size === 0;
5930     }
5931     getDocumentVersion() {
5932         if (this.isEmpty()) {
5933             throw new Error('No edits recorded.');
5934         }
5935         return this.edits.values().next().value.documentVersion;
5936     }
5937     getScoped(diagnostics) {
5938         let result = [];
5939         for (let diagnostic of diagnostics) {
5940             let key = computeKey(diagnostic);
5941             let editInfo = this.edits.get(key);
5942             if (editInfo) {
5943                 result.push(editInfo);
5944             }
5945         }
5946         return result;
5947     }
5948     getAllSorted() {
5949         let result = [];
5950         this.edits.forEach(value => result.push(value));
5951         return result.sort((a, b) => {
5952             let d = a.edit.range[0] - b.edit.range[0];
5953             if (d !== 0) {
5954                 return d;
5955             }
5956             if (a.edit.range[1] === 0) {
5957                 return -1;
5958             }
5959             if (b.edit.range[1] === 0) {
5960                 return 1;
5961             }
5962             return a.edit.range[1] - b.edit.range[1];
5963         });
5964     }
5965     getOverlapFree() {
5966         let sorted = this.getAllSorted();
5967         if (sorted.length <= 1) {
5968             return sorted;
5969         }
5970         let result = [];
5971         let last = sorted[0];
5972         result.push(last);
5973         for (let i = 1; i < sorted.length; i++) {
5974             let current = sorted[i];
5975             if (!Fixes.overlaps(last, current)) {
5976                 result.push(current);
5977                 last = current;
5978             }
5979         }
5980         return result;
5981     }
5982 }
5983 let commands;
5984 messageQueue.registerRequest(vscode_languageserver_1.CodeActionRequest.type, params => {
5985     commands = new Map();
5986     let result = new CodeActionResult();
5987     let uri = params.textDocument.uri;
5988     let edits = codeActions.get(uri);
5989     if (!edits)
5990         return [];
5991     let fixes = new Fixes(edits);
5992     if (fixes.isEmpty())
5993         return [];
5994     let textDocument = documents.get(uri);
5995     let documentVersion = -1;
5996     let allFixableRuleIds = [];
5997     function createTextEdit(editInfo) {
5998         return vscode_languageserver_1.TextEdit.replace(vscode_languageserver_1.Range.create(textDocument.positionAt(editInfo.edit.range[0]), textDocument.positionAt(editInfo.edit.range[1])), editInfo.edit.text || '');
5999     }
6000     function createDisableLineTextEdit(editInfo, indentationText) {
6001         return vscode_languageserver_1.TextEdit.insert(vscode_languageserver_1.Position.create(editInfo.line - 1, 0), `${indentationText}// eslint-disable-next-line ${editInfo.ruleId}\n`);
6002     }
6003     function createDisableSameLineTextEdit(editInfo) {
6004         return vscode_languageserver_1.TextEdit.insert(vscode_languageserver_1.Position.create(editInfo.line - 1, Number.MAX_VALUE), ` // eslint-disable-line ${editInfo.ruleId}`);
6005     }
6006     function createDisableFileTextEdit(editInfo) {
6007         return vscode_languageserver_1.TextEdit.insert(vscode_languageserver_1.Position.create(0, 0), `/* eslint-disable ${editInfo.ruleId} */\n`);
6008     }
6009     function getLastEdit(array) {
6010         let length = array.length;
6011         if (length === 0) {
6012             return undefined;
6013         }
6014         return array[length - 1];
6015     }
6016     return resolveSettings(textDocument).then(settings => {
6017         for (let editInfo of fixes.getScoped(params.context.diagnostics)) {
6018             documentVersion = editInfo.documentVersion;
6019             let ruleId = editInfo.ruleId;
6020             allFixableRuleIds.push(ruleId);
6021             if (!!editInfo.edit) {
6022                 let workspaceChange = new vscode_languageserver_1.WorkspaceChange();
6023                 workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createTextEdit(editInfo));
6024                 commands.set(`${CommandIds.applySingleFix}:${ruleId}`, workspaceChange);
6025                 result.get(ruleId).fixes.push(vscode_languageserver_1.CodeAction.create(editInfo.label, vscode_languageserver_1.Command.create(editInfo.label, CommandIds.applySingleFix, ruleId), vscode_languageserver_1.CodeActionKind.QuickFix));
6026             }
6027             if (settings.codeAction.disableRuleComment.enable) {
6028                 let workspaceChange = new vscode_languageserver_1.WorkspaceChange();
6029                 if (settings.codeAction.disableRuleComment.location === 'sameLine') {
6030                     workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createDisableSameLineTextEdit(editInfo));
6031                 }
6032                 else {
6033                     let lineText = textDocument.getText(vscode_languageserver_1.Range.create(vscode_languageserver_1.Position.create(editInfo.line - 1, 0), vscode_languageserver_1.Position.create(editInfo.line - 1, Number.MAX_VALUE)));
6034                     let indentationText = /^([ \t]*)/.exec(lineText)[1];
6035                     workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createDisableLineTextEdit(editInfo, indentationText));
6036                 }
6037                 commands.set(`${CommandIds.applyDisableLine}:${ruleId}`, workspaceChange);
6038                 let title = `Disable ${ruleId} for this line`;
6039                 result.get(ruleId).disable = vscode_languageserver_1.CodeAction.create(title, vscode_languageserver_1.Command.create(title, CommandIds.applyDisableLine, ruleId), vscode_languageserver_1.CodeActionKind.QuickFix);
6040                 if (result.get(ruleId).disableFile === undefined) {
6041                     workspaceChange = new vscode_languageserver_1.WorkspaceChange();
6042                     workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createDisableFileTextEdit(editInfo));
6043                     commands.set(`${CommandIds.applyDisableFile}:${ruleId}`, workspaceChange);
6044                     title = `Disable ${ruleId} for the entire file`;
6045                     result.get(ruleId).disableFile = vscode_languageserver_1.CodeAction.create(title, vscode_languageserver_1.Command.create(title, CommandIds.applyDisableFile, ruleId), vscode_languageserver_1.CodeActionKind.QuickFix);
6046                 }
6047             }
6048             if (settings.codeAction.showDocumentation.enable && result.get(ruleId).showDocumentation === undefined) {
6049                 if (ruleDocData.urls.has(ruleId)) {
6050                     let title = `Show documentation for ${ruleId}`;
6051                     result.get(ruleId).showDocumentation = vscode_languageserver_1.CodeAction.create(title, vscode_languageserver_1.Command.create(title, CommandIds.openRuleDoc, ruleId), vscode_languageserver_1.CodeActionKind.QuickFix);
6052                 }
6053             }
6054         }
6055         if (result.length > 0) {
6056             let sameProblems = new Map(allFixableRuleIds.map(s => [s, []]));
6057             let all = [];
6058             for (let editInfo of fixes.getAllSorted()) {
6059                 if (documentVersion === -1) {
6060                     documentVersion = editInfo.documentVersion;
6061                 }
6062                 if (sameProblems.has(editInfo.ruleId)) {
6063                     let same = sameProblems.get(editInfo.ruleId);
6064                     if (!Fixes.overlaps(getLastEdit(same), editInfo)) {
6065                         same.push(editInfo);
6066                     }
6067                 }
6068                 if (!Fixes.overlaps(getLastEdit(all), editInfo)) {
6069                     all.push(editInfo);
6070                 }
6071             }
6072             sameProblems.forEach((same, ruleId) => {
6073                 if (same.length > 1) {
6074                     let sameFixes = new vscode_languageserver_1.WorkspaceChange();
6075                     let sameTextChange = sameFixes.getTextEditChange({ uri, version: documentVersion });
6076                     same.map(createTextEdit).forEach(edit => sameTextChange.add(edit));
6077                     commands.set(CommandIds.applySameFixes, sameFixes);
6078                     let title = `Fix all ${ruleId} problems`;
6079                     let command = vscode_languageserver_1.Command.create(title, CommandIds.applySameFixes);
6080                     result.get(ruleId).fixAll = vscode_languageserver_1.CodeAction.create(title, command, vscode_languageserver_1.CodeActionKind.QuickFix);
6081                 }
6082             });
6083             if (all.length > 1) {
6084                 let allFixes = new vscode_languageserver_1.WorkspaceChange();
6085                 let allTextChange = allFixes.getTextEditChange({ uri, version: documentVersion });
6086                 all.map(createTextEdit).forEach(edit => allTextChange.add(edit));
6087                 commands.set(CommandIds.applyAllFixes, allFixes);
6088                 let title = `Fix all auto-fixable problems`;
6089                 let command = vscode_languageserver_1.Command.create(title, CommandIds.applyAllFixes);
6090                 result.fixAll = vscode_languageserver_1.CodeAction.create(title, command, vscode_languageserver_1.CodeActionKind.SourceFixAll);
6091             }
6092         }
6093         return result.all();
6094     });
6095 }, (params) => {
6096     let document = documents.get(params.textDocument.uri);
6097     return document ? document.version : undefined;
6098 });
6099 messageQueue.registerRequest(vscode_languageserver_1.ExecuteCommandRequest.type, (params) => __awaiter(void 0, void 0, void 0, function* () {
6100     let workspaceChange;
6101     if (params.command === CommandIds.applyAutoFix) {
6102         let identifier = params.arguments[0];
6103         if (!identifier.uri.startsWith('file:')) {
6104             return {};
6105         }
6106         let textDocument = documents.get(identifier.uri);
6107         let settings = yield Promise.resolve(resolveSettings(textDocument));
6108         let edits = util_1.getAllFixEdits(textDocument, settings);
6109         if (edits && edits.length) {
6110             workspaceChange = new vscode_languageserver_1.WorkspaceChange();
6111             let textChange = workspaceChange.getTextEditChange(identifier);
6112             edits.forEach(edit => textChange.add(edit));
6113         }
6114     }
6115     else {
6116         if ([CommandIds.applySingleFix, CommandIds.applyDisableLine, CommandIds.applyDisableFile].indexOf(params.command) !== -1) {
6117             let ruleId = params.arguments[0];
6118             workspaceChange = commands.get(`${params.command}:${ruleId}`);
6119         }
6120         else if (params.command === CommandIds.openRuleDoc) {
6121             let ruleId = params.arguments[0];
6122             let url = ruleDocData.urls.get(ruleId);
6123             if (url) {
6124                 yield connection.sendRequest(OpenESLintDocRequest.type, { url });
6125             }
6126         }
6127         else {
6128             workspaceChange = commands.get(params.command);
6129         }
6130     }
6131     if (!workspaceChange) {
6132         return {};
6133     }
6134     try {
6135         let response = yield Promise.resolve(connection.workspace.applyEdit(workspaceChange.edit));
6136         if (!response.applied) {
6137             connection.console.error(`Failed to apply command: ${params.command}`);
6138         }
6139     }
6140     catch (e) {
6141         connection.console.error(`Failed to apply command: ${params.command}`);
6142     }
6143     return {};
6144 }), (params) => {
6145     if (params.command === CommandIds.applyAutoFix) {
6146         let identifier = params.arguments[0];
6147         return identifier.version;
6148     }
6149     else {
6150         return undefined;
6151     }
6152 });
6153 connection.tracer.connection.listen();
6154
6155
6156 /***/ }),
6157 /* 37 */
6158 /***/ (function(module, exports, __webpack_require__) {
6159
6160 "use strict";
6161 /* --------------------------------------------------------------------------------------------\r
6162  * Copyright (c) Microsoft Corporation. All rights reserved.\r
6163  * Licensed under the MIT License. See License.txt in the project root for license information.\r
6164  * ------------------------------------------------------------------------------------------ */\r
6165 /// <reference path="../typings/thenable.d.ts" />\r
6166 \r
6167 function __export(m) {\r
6168     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
6169 }\r
6170 Object.defineProperty(exports, "__esModule", { value: true });\r
6171 const vscode_languageserver_protocol_1 = __webpack_require__(4);\r
6172 exports.Event = vscode_languageserver_protocol_1.Event;\r
6173 const configuration_1 = __webpack_require__(38);\r
6174 const workspaceFolders_1 = __webpack_require__(40);\r
6175 const progress_1 = __webpack_require__(41);\r
6176 const Is = __webpack_require__(39);\r
6177 const UUID = __webpack_require__(42);\r
6178 // ------------- Reexport the API surface of the language worker API ----------------------\r
6179 __export(__webpack_require__(4));\r
6180 const fm = __webpack_require__(43);\r
6181 var Files;\r
6182 (function (Files) {\r
6183     Files.uriToFilePath = fm.uriToFilePath;\r
6184     Files.resolveGlobalNodePath = fm.resolveGlobalNodePath;\r
6185     Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;\r
6186     Files.resolve = fm.resolve;\r
6187     Files.resolveModulePath = fm.resolveModulePath;\r
6188 })(Files = exports.Files || (exports.Files = {}));\r
6189 let shutdownReceived = false;\r
6190 let exitTimer = undefined;\r
6191 function setupExitTimer() {\r
6192     const argName = '--clientProcessId';\r
6193     function runTimer(value) {\r
6194         try {\r
6195             let processId = parseInt(value);\r
6196             if (!isNaN(processId)) {\r
6197                 exitTimer = setInterval(() => {\r
6198                     try {\r
6199                         process.kill(processId, 0);\r
6200                     }\r
6201                     catch (ex) {\r
6202                         // Parent process doesn't exist anymore. Exit the server.\r
6203                         process.exit(shutdownReceived ? 0 : 1);\r
6204                     }\r
6205                 }, 3000);\r
6206             }\r
6207         }\r
6208         catch (e) {\r
6209             // Ignore errors;\r
6210         }\r
6211     }\r
6212     for (let i = 2; i < process.argv.length; i++) {\r
6213         let arg = process.argv[i];\r
6214         if (arg === argName && i + 1 < process.argv.length) {\r
6215             runTimer(process.argv[i + 1]);\r
6216             return;\r
6217         }\r
6218         else {\r
6219             let args = arg.split('=');\r
6220             if (args[0] === argName) {\r
6221                 runTimer(args[1]);\r
6222             }\r
6223         }\r
6224     }\r
6225 }\r
6226 setupExitTimer();\r
6227 function null2Undefined(value) {\r
6228     if (value === null) {\r
6229         return void 0;\r
6230     }\r
6231     return value;\r
6232 }\r
6233 /**\r
6234  * A manager for simple text documents\r
6235  */\r
6236 class TextDocuments {\r
6237     /**\r
6238      * Create a new text document manager.\r
6239      */\r
6240     constructor(configuration) {\r
6241         this._documents = Object.create(null);\r
6242         this._configuration = configuration;\r
6243         this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();\r
6244         this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();\r
6245         this._onDidClose = new vscode_languageserver_protocol_1.Emitter();\r
6246         this._onDidSave = new vscode_languageserver_protocol_1.Emitter();\r
6247         this._onWillSave = new vscode_languageserver_protocol_1.Emitter();\r
6248     }\r
6249     /**\r
6250      * An event that fires when a text document managed by this manager\r
6251      * has been opened or the content changes.\r
6252      */\r
6253     get onDidChangeContent() {\r
6254         return this._onDidChangeContent.event;\r
6255     }\r
6256     /**\r
6257      * An event that fires when a text document managed by this manager\r
6258      * has been opened.\r
6259      */\r
6260     get onDidOpen() {\r
6261         return this._onDidOpen.event;\r
6262     }\r
6263     /**\r
6264      * An event that fires when a text document managed by this manager\r
6265      * will be saved.\r
6266      */\r
6267     get onWillSave() {\r
6268         return this._onWillSave.event;\r
6269     }\r
6270     /**\r
6271      * Sets a handler that will be called if a participant wants to provide\r
6272      * edits during a text document save.\r
6273      */\r
6274     onWillSaveWaitUntil(handler) {\r
6275         this._willSaveWaitUntil = handler;\r
6276     }\r
6277     /**\r
6278      * An event that fires when a text document managed by this manager\r
6279      * has been saved.\r
6280      */\r
6281     get onDidSave() {\r
6282         return this._onDidSave.event;\r
6283     }\r
6284     /**\r
6285      * An event that fires when a text document managed by this manager\r
6286      * has been closed.\r
6287      */\r
6288     get onDidClose() {\r
6289         return this._onDidClose.event;\r
6290     }\r
6291     /**\r
6292      * Returns the document for the given URI. Returns undefined if\r
6293      * the document is not mananged by this instance.\r
6294      *\r
6295      * @param uri The text document's URI to retrieve.\r
6296      * @return the text document or `undefined`.\r
6297      */\r
6298     get(uri) {\r
6299         return this._documents[uri];\r
6300     }\r
6301     /**\r
6302      * Returns all text documents managed by this instance.\r
6303      *\r
6304      * @return all text documents.\r
6305      */\r
6306     all() {\r
6307         return Object.keys(this._documents).map(key => this._documents[key]);\r
6308     }\r
6309     /**\r
6310      * Returns the URIs of all text documents managed by this instance.\r
6311      *\r
6312      * @return the URI's of all text documents.\r
6313      */\r
6314     keys() {\r
6315         return Object.keys(this._documents);\r
6316     }\r
6317     /**\r
6318      * Listens for `low level` notification on the given connection to\r
6319      * update the text documents managed by this instance.\r
6320      *\r
6321      * @param connection The connection to listen on.\r
6322      */\r
6323     listen(connection) {\r
6324         connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;\r
6325         connection.onDidOpenTextDocument((event) => {\r
6326             let td = event.textDocument;\r
6327             let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\r
6328             this._documents[td.uri] = document;\r
6329             let toFire = Object.freeze({ document });\r
6330             this._onDidOpen.fire(toFire);\r
6331             this._onDidChangeContent.fire(toFire);\r
6332         });\r
6333         connection.onDidChangeTextDocument((event) => {\r
6334             let td = event.textDocument;\r
6335             let changes = event.contentChanges;\r
6336             if (changes.length === 0) {\r
6337                 return;\r
6338             }\r
6339             let document = this._documents[td.uri];\r
6340             const { version } = td;\r
6341             if (version === null || version === void 0) {\r
6342                 throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\r
6343             }\r
6344             document = this._configuration.update(document, changes, version);\r
6345             this._documents[td.uri] = document;\r
6346             this._onDidChangeContent.fire(Object.freeze({ document }));\r
6347         });\r
6348         connection.onDidCloseTextDocument((event) => {\r
6349             let document = this._documents[event.textDocument.uri];\r
6350             if (document) {\r
6351                 delete this._documents[event.textDocument.uri];\r
6352                 this._onDidClose.fire(Object.freeze({ document }));\r
6353             }\r
6354         });\r
6355         connection.onWillSaveTextDocument((event) => {\r
6356             let document = this._documents[event.textDocument.uri];\r
6357             if (document) {\r
6358                 this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));\r
6359             }\r
6360         });\r
6361         connection.onWillSaveTextDocumentWaitUntil((event, token) => {\r
6362             let document = this._documents[event.textDocument.uri];\r
6363             if (document && this._willSaveWaitUntil) {\r
6364                 return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);\r
6365             }\r
6366             else {\r
6367                 return [];\r
6368             }\r
6369         });\r
6370         connection.onDidSaveTextDocument((event) => {\r
6371             let document = this._documents[event.textDocument.uri];\r
6372             if (document) {\r
6373                 this._onDidSave.fire(Object.freeze({ document }));\r
6374             }\r
6375         });\r
6376     }\r
6377 }\r
6378 exports.TextDocuments = TextDocuments;\r
6379 /**\r
6380  * Helps tracking error message. Equal occurences of the same\r
6381  * message are only stored once. This class is for example\r
6382  * useful if text documents are validated in a loop and equal\r
6383  * error message should be folded into one.\r
6384  */\r
6385 class ErrorMessageTracker {\r
6386     constructor() {\r
6387         this._messages = Object.create(null);\r
6388     }\r
6389     /**\r
6390      * Add a message to the tracker.\r
6391      *\r
6392      * @param message The message to add.\r
6393      */\r
6394     add(message) {\r
6395         let count = this._messages[message];\r
6396         if (!count) {\r
6397             count = 0;\r
6398         }\r
6399         count++;\r
6400         this._messages[message] = count;\r
6401     }\r
6402     /**\r
6403      * Send all tracked messages to the connection's window.\r
6404      *\r
6405      * @param connection The connection established between client and server.\r
6406      */\r
6407     sendErrors(connection) {\r
6408         Object.keys(this._messages).forEach(message => {\r
6409             connection.window.showErrorMessage(message);\r
6410         });\r
6411     }\r
6412 }\r
6413 exports.ErrorMessageTracker = ErrorMessageTracker;\r
6414 var BulkRegistration;\r
6415 (function (BulkRegistration) {\r
6416     /**\r
6417      * Creates a new bulk registration.\r
6418      * @return an empty bulk registration.\r
6419      */\r
6420     function create() {\r
6421         return new BulkRegistrationImpl();\r
6422     }\r
6423     BulkRegistration.create = create;\r
6424 })(BulkRegistration = exports.BulkRegistration || (exports.BulkRegistration = {}));\r
6425 class BulkRegistrationImpl {\r
6426     constructor() {\r
6427         this._registrations = [];\r
6428         this._registered = new Set();\r
6429     }\r
6430     add(type, registerOptions) {\r
6431         const method = Is.string(type) ? type : type.method;\r
6432         if (this._registered.has(method)) {\r
6433             throw new Error(`${method} is already added to this registration`);\r
6434         }\r
6435         const id = UUID.generateUuid();\r
6436         this._registrations.push({\r
6437             id: id,\r
6438             method: method,\r
6439             registerOptions: registerOptions || {}\r
6440         });\r
6441         this._registered.add(method);\r
6442     }\r
6443     asRegistrationParams() {\r
6444         return {\r
6445             registrations: this._registrations\r
6446         };\r
6447     }\r
6448 }\r
6449 var BulkUnregistration;\r
6450 (function (BulkUnregistration) {\r
6451     function create() {\r
6452         return new BulkUnregistrationImpl(undefined, []);\r
6453     }\r
6454     BulkUnregistration.create = create;\r
6455 })(BulkUnregistration = exports.BulkUnregistration || (exports.BulkUnregistration = {}));\r
6456 class BulkUnregistrationImpl {\r
6457     constructor(_connection, unregistrations) {\r
6458         this._connection = _connection;\r
6459         this._unregistrations = new Map();\r
6460         unregistrations.forEach(unregistration => {\r
6461             this._unregistrations.set(unregistration.method, unregistration);\r
6462         });\r
6463     }\r
6464     get isAttached() {\r
6465         return !!this._connection;\r
6466     }\r
6467     attach(connection) {\r
6468         this._connection = connection;\r
6469     }\r
6470     add(unregistration) {\r
6471         this._unregistrations.set(unregistration.method, unregistration);\r
6472     }\r
6473     dispose() {\r
6474         let unregistrations = [];\r
6475         for (let unregistration of this._unregistrations.values()) {\r
6476             unregistrations.push(unregistration);\r
6477         }\r
6478         let params = {\r
6479             unregisterations: unregistrations\r
6480         };\r
6481         this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {\r
6482             this._connection.console.info(`Bulk unregistration failed.`);\r
6483         });\r
6484     }\r
6485     disposeSingle(arg) {\r
6486         const method = Is.string(arg) ? arg : arg.method;\r
6487         const unregistration = this._unregistrations.get(method);\r
6488         if (!unregistration) {\r
6489             return false;\r
6490         }\r
6491         let params = {\r
6492             unregisterations: [unregistration]\r
6493         };\r
6494         this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => {\r
6495             this._unregistrations.delete(method);\r
6496         }, (_error) => {\r
6497             this._connection.console.info(`Unregistering request handler for ${unregistration.id} failed.`);\r
6498         });\r
6499         return true;\r
6500     }\r
6501 }\r
6502 class ConnectionLogger {\r
6503     constructor() {\r
6504     }\r
6505     rawAttach(connection) {\r
6506         this._rawConnection = connection;\r
6507     }\r
6508     attach(connection) {\r
6509         this._connection = connection;\r
6510     }\r
6511     get connection() {\r
6512         if (!this._connection) {\r
6513             throw new Error('Remote is not attached to a connection yet.');\r
6514         }\r
6515         return this._connection;\r
6516     }\r
6517     fillServerCapabilities(_capabilities) {\r
6518     }\r
6519     initialize(_capabilities) {\r
6520     }\r
6521     error(message) {\r
6522         this.send(vscode_languageserver_protocol_1.MessageType.Error, message);\r
6523     }\r
6524     warn(message) {\r
6525         this.send(vscode_languageserver_protocol_1.MessageType.Warning, message);\r
6526     }\r
6527     info(message) {\r
6528         this.send(vscode_languageserver_protocol_1.MessageType.Info, message);\r
6529     }\r
6530     log(message) {\r
6531         this.send(vscode_languageserver_protocol_1.MessageType.Log, message);\r
6532     }\r
6533     send(type, message) {\r
6534         if (this._rawConnection) {\r
6535             this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message });\r
6536         }\r
6537     }\r
6538 }\r
6539 class _RemoteWindowImpl {\r
6540     constructor() {\r
6541     }\r
6542     attach(connection) {\r
6543         this._connection = connection;\r
6544     }\r
6545     get connection() {\r
6546         if (!this._connection) {\r
6547             throw new Error('Remote is not attached to a connection yet.');\r
6548         }\r
6549         return this._connection;\r
6550     }\r
6551     initialize(_capabilities) {\r
6552     }\r
6553     fillServerCapabilities(_capabilities) {\r
6554     }\r
6555     showErrorMessage(message, ...actions) {\r
6556         let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions };\r
6557         return this._connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\r
6558     }\r
6559     showWarningMessage(message, ...actions) {\r
6560         let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions };\r
6561         return this._connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\r
6562     }\r
6563     showInformationMessage(message, ...actions) {\r
6564         let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions };\r
6565         return this._connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\r
6566     }\r
6567 }\r
6568 const RemoteWindowImpl = progress_1.ProgressFeature(_RemoteWindowImpl);\r
6569 class RemoteClientImpl {\r
6570     attach(connection) {\r
6571         this._connection = connection;\r
6572     }\r
6573     get connection() {\r
6574         if (!this._connection) {\r
6575             throw new Error('Remote is not attached to a connection yet.');\r
6576         }\r
6577         return this._connection;\r
6578     }\r
6579     initialize(_capabilities) {\r
6580     }\r
6581     fillServerCapabilities(_capabilities) {\r
6582     }\r
6583     register(typeOrRegistrations, registerOptionsOrType, registerOptions) {\r
6584         if (typeOrRegistrations instanceof BulkRegistrationImpl) {\r
6585             return this.registerMany(typeOrRegistrations);\r
6586         }\r
6587         else if (typeOrRegistrations instanceof BulkUnregistrationImpl) {\r
6588             return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions);\r
6589         }\r
6590         else {\r
6591             return this.registerSingle2(typeOrRegistrations, registerOptionsOrType);\r
6592         }\r
6593     }\r
6594     registerSingle1(unregistration, type, registerOptions) {\r
6595         const method = Is.string(type) ? type : type.method;\r
6596         const id = UUID.generateUuid();\r
6597         let params = {\r
6598             registrations: [{ id, method, registerOptions: registerOptions || {} }]\r
6599         };\r
6600         if (!unregistration.isAttached) {\r
6601             unregistration.attach(this._connection);\r
6602         }\r
6603         return this._connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {\r
6604             unregistration.add({ id: id, method: method });\r
6605             return unregistration;\r
6606         }, (_error) => {\r
6607             this.connection.console.info(`Registering request handler for ${method} failed.`);\r
6608             return Promise.reject(_error);\r
6609         });\r
6610     }\r
6611     registerSingle2(type, registerOptions) {\r
6612         const method = Is.string(type) ? type : type.method;\r
6613         const id = UUID.generateUuid();\r
6614         let params = {\r
6615             registrations: [{ id, method, registerOptions: registerOptions || {} }]\r
6616         };\r
6617         return this._connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {\r
6618             return vscode_languageserver_protocol_1.Disposable.create(() => {\r
6619                 this.unregisterSingle(id, method);\r
6620             });\r
6621         }, (_error) => {\r
6622             this.connection.console.info(`Registering request handler for ${method} failed.`);\r
6623             return Promise.reject(_error);\r
6624         });\r
6625     }\r
6626     unregisterSingle(id, method) {\r
6627         let params = {\r
6628             unregisterations: [{ id, method }]\r
6629         };\r
6630         return this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {\r
6631             this.connection.console.info(`Unregistering request handler for ${id} failed.`);\r
6632         });\r
6633     }\r
6634     registerMany(registrations) {\r
6635         let params = registrations.asRegistrationParams();\r
6636         return this._connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => {\r
6637             return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; }));\r
6638         }, (_error) => {\r
6639             this.connection.console.info(`Bulk registration failed.`);\r
6640             return Promise.reject(_error);\r
6641         });\r
6642     }\r
6643 }\r
6644 class _RemoteWorkspaceImpl {\r
6645     constructor() {\r
6646     }\r
6647     attach(connection) {\r
6648         this._connection = connection;\r
6649     }\r
6650     get connection() {\r
6651         if (!this._connection) {\r
6652             throw new Error('Remote is not attached to a connection yet.');\r
6653         }\r
6654         return this._connection;\r
6655     }\r
6656     initialize(_capabilities) {\r
6657     }\r
6658     fillServerCapabilities(_capabilities) {\r
6659     }\r
6660     applyEdit(paramOrEdit) {\r
6661         function isApplyWorkspaceEditParams(value) {\r
6662             return value && !!value.edit;\r
6663         }\r
6664         let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit };\r
6665         return this._connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params);\r
6666     }\r
6667 }\r
6668 const RemoteWorkspaceImpl = workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl));\r
6669 class TracerImpl {\r
6670     constructor() {\r
6671         this._trace = vscode_languageserver_protocol_1.Trace.Off;\r
6672     }\r
6673     attach(connection) {\r
6674         this._connection = connection;\r
6675     }\r
6676     get connection() {\r
6677         if (!this._connection) {\r
6678             throw new Error('Remote is not attached to a connection yet.');\r
6679         }\r
6680         return this._connection;\r
6681     }\r
6682     initialize(_capabilities) {\r
6683     }\r
6684     fillServerCapabilities(_capabilities) {\r
6685     }\r
6686     set trace(value) {\r
6687         this._trace = value;\r
6688     }\r
6689     log(message, verbose) {\r
6690         if (this._trace === vscode_languageserver_protocol_1.Trace.Off) {\r
6691             return;\r
6692         }\r
6693         this._connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, {\r
6694             message: message,\r
6695             verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined\r
6696         });\r
6697     }\r
6698 }\r
6699 class TelemetryImpl {\r
6700     constructor() {\r
6701     }\r
6702     attach(connection) {\r
6703         this._connection = connection;\r
6704     }\r
6705     get connection() {\r
6706         if (!this._connection) {\r
6707             throw new Error('Remote is not attached to a connection yet.');\r
6708         }\r
6709         return this._connection;\r
6710     }\r
6711     initialize(_capabilities) {\r
6712     }\r
6713     fillServerCapabilities(_capabilities) {\r
6714     }\r
6715     logEvent(data) {\r
6716         this._connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data);\r
6717     }\r
6718 }\r
6719 function combineConsoleFeatures(one, two) {\r
6720     return function (Base) {\r
6721         return two(one(Base));\r
6722     };\r
6723 }\r
6724 exports.combineConsoleFeatures = combineConsoleFeatures;\r
6725 function combineTelemetryFeatures(one, two) {\r
6726     return function (Base) {\r
6727         return two(one(Base));\r
6728     };\r
6729 }\r
6730 exports.combineTelemetryFeatures = combineTelemetryFeatures;\r
6731 function combineTracerFeatures(one, two) {\r
6732     return function (Base) {\r
6733         return two(one(Base));\r
6734     };\r
6735 }\r
6736 exports.combineTracerFeatures = combineTracerFeatures;\r
6737 function combineClientFeatures(one, two) {\r
6738     return function (Base) {\r
6739         return two(one(Base));\r
6740     };\r
6741 }\r
6742 exports.combineClientFeatures = combineClientFeatures;\r
6743 function combineWindowFeatures(one, two) {\r
6744     return function (Base) {\r
6745         return two(one(Base));\r
6746     };\r
6747 }\r
6748 exports.combineWindowFeatures = combineWindowFeatures;\r
6749 function combineWorkspaceFeatures(one, two) {\r
6750     return function (Base) {\r
6751         return two(one(Base));\r
6752     };\r
6753 }\r
6754 exports.combineWorkspaceFeatures = combineWorkspaceFeatures;\r
6755 function combineFeatures(one, two) {\r
6756     function combine(one, two, func) {\r
6757         if (one && two) {\r
6758             return func(one, two);\r
6759         }\r
6760         else if (one) {\r
6761             return one;\r
6762         }\r
6763         else {\r
6764             return two;\r
6765         }\r
6766     }\r
6767     let result = {\r
6768         __brand: 'features',\r
6769         console: combine(one.console, two.console, combineConsoleFeatures),\r
6770         tracer: combine(one.tracer, two.tracer, combineTracerFeatures),\r
6771         telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures),\r
6772         client: combine(one.client, two.client, combineClientFeatures),\r
6773         window: combine(one.window, two.window, combineWindowFeatures),\r
6774         workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures)\r
6775     };\r
6776     return result;\r
6777 }\r
6778 exports.combineFeatures = combineFeatures;\r
6779 function createConnection(arg1, arg2, arg3, arg4) {\r
6780     let factories;\r
6781     let input;\r
6782     let output;\r
6783     let strategy;\r
6784     if (arg1 !== void 0 && arg1.__brand === 'features') {\r
6785         factories = arg1;\r
6786         arg1 = arg2;\r
6787         arg2 = arg3;\r
6788         arg3 = arg4;\r
6789     }\r
6790     if (vscode_languageserver_protocol_1.ConnectionStrategy.is(arg1)) {\r
6791         strategy = arg1;\r
6792     }\r
6793     else {\r
6794         input = arg1;\r
6795         output = arg2;\r
6796         strategy = arg3;\r
6797     }\r
6798     return _createConnection(input, output, strategy, factories);\r
6799 }\r
6800 exports.createConnection = createConnection;\r
6801 function _createConnection(input, output, strategy, factories) {\r
6802     if (!input && !output && process.argv.length > 2) {\r
6803         let port = void 0;\r
6804         let pipeName = void 0;\r
6805         let argv = process.argv.slice(2);\r
6806         for (let i = 0; i < argv.length; i++) {\r
6807             let arg = argv[i];\r
6808             if (arg === '--node-ipc') {\r
6809                 input = new vscode_languageserver_protocol_1.IPCMessageReader(process);\r
6810                 output = new vscode_languageserver_protocol_1.IPCMessageWriter(process);\r
6811                 break;\r
6812             }\r
6813             else if (arg === '--stdio') {\r
6814                 input = process.stdin;\r
6815                 output = process.stdout;\r
6816                 break;\r
6817             }\r
6818             else if (arg === '--socket') {\r
6819                 port = parseInt(argv[i + 1]);\r
6820                 break;\r
6821             }\r
6822             else if (arg === '--pipe') {\r
6823                 pipeName = argv[i + 1];\r
6824                 break;\r
6825             }\r
6826             else {\r
6827                 var args = arg.split('=');\r
6828                 if (args[0] === '--socket') {\r
6829                     port = parseInt(args[1]);\r
6830                     break;\r
6831                 }\r
6832                 else if (args[0] === '--pipe') {\r
6833                     pipeName = args[1];\r
6834                     break;\r
6835                 }\r
6836             }\r
6837         }\r
6838         if (port) {\r
6839             let transport = vscode_languageserver_protocol_1.createServerSocketTransport(port);\r
6840             input = transport[0];\r
6841             output = transport[1];\r
6842         }\r
6843         else if (pipeName) {\r
6844             let transport = vscode_languageserver_protocol_1.createServerPipeTransport(pipeName);\r
6845             input = transport[0];\r
6846             output = transport[1];\r
6847         }\r
6848     }\r
6849     var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\'';\r
6850     if (!input) {\r
6851         throw new Error('Connection input stream is not set. ' + commandLineMessage);\r
6852     }\r
6853     if (!output) {\r
6854         throw new Error('Connection output stream is not set. ' + commandLineMessage);\r
6855     }\r
6856     // Backwards compatibility\r
6857     if (Is.func(input.read) && Is.func(input.on)) {\r
6858         let inputStream = input;\r
6859         inputStream.on('end', () => {\r
6860             process.exit(shutdownReceived ? 0 : 1);\r
6861         });\r
6862         inputStream.on('close', () => {\r
6863             process.exit(shutdownReceived ? 0 : 1);\r
6864         });\r
6865     }\r
6866     const logger = (factories && factories.console ? new (factories.console(ConnectionLogger))() : new ConnectionLogger());\r
6867     const connection = vscode_languageserver_protocol_1.createProtocolConnection(input, output, logger, strategy);\r
6868     logger.rawAttach(connection);\r
6869     const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl());\r
6870     const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl());\r
6871     const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl());\r
6872     const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl());\r
6873     const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl());\r
6874     const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace];\r
6875     function asPromise(value) {\r
6876         if (value instanceof Promise) {\r
6877             return value;\r
6878         }\r
6879         else if (Is.thenable(value)) {\r
6880             return new Promise((resolve, reject) => {\r
6881                 value.then((resolved) => resolve(resolved), (error) => reject(error));\r
6882             });\r
6883         }\r
6884         else {\r
6885             return Promise.resolve(value);\r
6886         }\r
6887     }\r
6888     let shutdownHandler = undefined;\r
6889     let initializeHandler = undefined;\r
6890     let exitHandler = undefined;\r
6891     let protocolConnection = {\r
6892         listen: () => connection.listen(),\r
6893         sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params),\r
6894         onRequest: (type, handler) => connection.onRequest(type, handler),\r
6895         sendNotification: (type, param) => {\r
6896             const method = Is.string(type) ? type : type.method;\r
6897             if (arguments.length === 1) {\r
6898                 connection.sendNotification(method);\r
6899             }\r
6900             else {\r
6901                 connection.sendNotification(method, param);\r
6902             }\r
6903         },\r
6904         onNotification: (type, handler) => connection.onNotification(type, handler),\r
6905         onProgress: connection.onProgress,\r
6906         sendProgress: connection.sendProgress,\r
6907         onInitialize: (handler) => initializeHandler = handler,\r
6908         onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler),\r
6909         onShutdown: (handler) => shutdownHandler = handler,\r
6910         onExit: (handler) => exitHandler = handler,\r
6911         get console() { return logger; },\r
6912         get telemetry() { return telemetry; },\r
6913         get tracer() { return tracer; },\r
6914         get client() { return client; },\r
6915         get window() { return remoteWindow; },\r
6916         get workspace() { return workspace; },\r
6917         onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler),\r
6918         onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler),\r
6919         __textDocumentSync: undefined,\r
6920         onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler),\r
6921         onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler),\r
6922         onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler),\r
6923         onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler),\r
6924         onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler),\r
6925         onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler),\r
6926         sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params),\r
6927         onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => {\r
6928             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6929         }),\r
6930         onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => {\r
6931             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6932         }),\r
6933         onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler),\r
6934         onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => {\r
6935             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6936         }),\r
6937         onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => {\r
6938             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6939         }),\r
6940         onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => {\r
6941             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6942         }),\r
6943         onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => {\r
6944             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6945         }),\r
6946         onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => {\r
6947             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6948         }),\r
6949         onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => {\r
6950             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6951         }),\r
6952         onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => {\r
6953             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6954         }),\r
6955         onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => {\r
6956             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6957         }),\r
6958         onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => {\r
6959             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6960         }),\r
6961         onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => {\r
6962             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6963         }),\r
6964         onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => {\r
6965             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6966         }),\r
6967         onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, handler),\r
6968         onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => {\r
6969             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6970         }),\r
6971         onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => {\r
6972             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6973         }),\r
6974         onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, handler),\r
6975         onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => {\r
6976             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6977         }),\r
6978         onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => {\r
6979             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6980         }),\r
6981         onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => {\r
6982             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6983         }),\r
6984         onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, handler),\r
6985         onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => {\r
6986             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6987         }),\r
6988         onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => {\r
6989             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6990         }),\r
6991         onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => {\r
6992             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6993         }),\r
6994         onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => {\r
6995             return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));\r
6996         }),\r
6997         onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => {\r
6998             return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);\r
6999         }),\r
7000         dispose: () => connection.dispose()\r
7001     };\r
7002     for (let remote of allRemotes) {\r
7003         remote.attach(protocolConnection);\r
7004     }\r
7005     connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => {\r
7006         const processId = params.processId;\r
7007         if (Is.number(processId) && exitTimer === void 0) {\r
7008             // We received a parent process id. Set up a timer to periodically check\r
7009             // if the parent is still alive.\r
7010             setInterval(() => {\r
7011                 try {\r
7012                     process.kill(processId, 0);\r
7013                 }\r
7014                 catch (ex) {\r
7015                     // Parent process doesn't exist anymore. Exit the server.\r
7016                     process.exit(shutdownReceived ? 0 : 1);\r
7017                 }\r
7018             }, 3000);\r
7019         }\r
7020         if (Is.string(params.trace)) {\r
7021             tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace);\r
7022         }\r
7023         for (let remote of allRemotes) {\r
7024             remote.initialize(params.capabilities);\r
7025         }\r
7026         if (initializeHandler) {\r
7027             let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, progress_1.attachWorkDone(connection, params), undefined);\r
7028             return asPromise(result).then((value) => {\r
7029                 if (value instanceof vscode_languageserver_protocol_1.ResponseError) {\r
7030                     return value;\r
7031                 }\r
7032                 let result = value;\r
7033                 if (!result) {\r
7034                     result = { capabilities: {} };\r
7035                 }\r
7036                 let capabilities = result.capabilities;\r
7037                 if (!capabilities) {\r
7038                     capabilities = {};\r
7039                     result.capabilities = capabilities;\r
7040                 }\r
7041                 if (capabilities.textDocumentSync === void 0 || capabilities.textDocumentSync === null) {\r
7042                     capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;\r
7043                 }\r
7044                 else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) {\r
7045                     capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;\r
7046                 }\r
7047                 for (let remote of allRemotes) {\r
7048                     remote.fillServerCapabilities(capabilities);\r
7049                 }\r
7050                 return result;\r
7051             });\r
7052         }\r
7053         else {\r
7054             let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } };\r
7055             for (let remote of allRemotes) {\r
7056                 remote.fillServerCapabilities(result.capabilities);\r
7057             }\r
7058             return result;\r
7059         }\r
7060     });\r
7061     connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => {\r
7062         shutdownReceived = true;\r
7063         if (shutdownHandler) {\r
7064             return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token);\r
7065         }\r
7066         else {\r
7067             return undefined;\r
7068         }\r
7069     });\r
7070     connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => {\r
7071         try {\r
7072             if (exitHandler) {\r
7073                 exitHandler();\r
7074             }\r
7075         }\r
7076         finally {\r
7077             if (shutdownReceived) {\r
7078                 process.exit(0);\r
7079             }\r
7080             else {\r
7081                 process.exit(1);\r
7082             }\r
7083         }\r
7084     });\r
7085     connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => {\r
7086         tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value);\r
7087     });\r
7088     return protocolConnection;\r
7089 }\r
7090 // Export the protocol currently in proposed state.\r
7091 var ProposedFeatures;\r
7092 (function (ProposedFeatures) {\r
7093     ProposedFeatures.all = {\r
7094         __brand: 'features'\r
7095     };\r
7096 })(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {}));\r
7097 //# sourceMappingURL=main.js.map
7098
7099 /***/ }),
7100 /* 38 */
7101 /***/ (function(module, exports, __webpack_require__) {
7102
7103 "use strict";
7104 /* --------------------------------------------------------------------------------------------\r
7105  * Copyright (c) Microsoft Corporation. All rights reserved.\r
7106  * Licensed under the MIT License. See License.txt in the project root for license information.\r
7107  * ------------------------------------------------------------------------------------------ */\r
7108 \r
7109 Object.defineProperty(exports, "__esModule", { value: true });\r
7110 const vscode_languageserver_protocol_1 = __webpack_require__(4);\r
7111 const Is = __webpack_require__(39);\r
7112 exports.ConfigurationFeature = (Base) => {\r
7113     return class extends Base {\r
7114         getConfiguration(arg) {\r
7115             if (!arg) {\r
7116                 return this._getConfiguration({});\r
7117             }\r
7118             else if (Is.string(arg)) {\r
7119                 return this._getConfiguration({ section: arg });\r
7120             }\r
7121             else {\r
7122                 return this._getConfiguration(arg);\r
7123             }\r
7124         }\r
7125         _getConfiguration(arg) {\r
7126             let params = {\r
7127                 items: Array.isArray(arg) ? arg : [arg]\r
7128             };\r
7129             return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {\r
7130                 return Array.isArray(arg) ? result : result[0];\r
7131             });\r
7132         }\r
7133     };\r
7134 };\r
7135 //# sourceMappingURL=configuration.js.map
7136
7137 /***/ }),
7138 /* 39 */
7139 /***/ (function(module, exports, __webpack_require__) {
7140
7141 "use strict";
7142 /* --------------------------------------------------------------------------------------------\r
7143  * Copyright (c) Microsoft Corporation. All rights reserved.\r
7144  * Licensed under the MIT License. See License.txt in the project root for license information.\r
7145  * ------------------------------------------------------------------------------------------ */\r
7146 \r
7147 Object.defineProperty(exports, "__esModule", { value: true });\r
7148 function boolean(value) {\r
7149     return value === true || value === false;\r
7150 }\r
7151 exports.boolean = boolean;\r
7152 function string(value) {\r
7153     return typeof value === 'string' || value instanceof String;\r
7154 }\r
7155 exports.string = string;\r
7156 function number(value) {\r
7157     return typeof value === 'number' || value instanceof Number;\r
7158 }\r
7159 exports.number = number;\r
7160 function error(value) {\r
7161     return value instanceof Error;\r
7162 }\r
7163 exports.error = error;\r
7164 function func(value) {\r
7165     return typeof value === 'function';\r
7166 }\r
7167 exports.func = func;\r
7168 function array(value) {\r
7169     return Array.isArray(value);\r
7170 }\r
7171 exports.array = array;\r
7172 function stringArray(value) {\r
7173     return array(value) && value.every(elem => string(elem));\r
7174 }\r
7175 exports.stringArray = stringArray;\r
7176 function typedArray(value, check) {\r
7177     return Array.isArray(value) && value.every(check);\r
7178 }\r
7179 exports.typedArray = typedArray;\r
7180 function thenable(value) {\r
7181     return value && func(value.then);\r
7182 }\r
7183 exports.thenable = thenable;\r
7184 //# sourceMappingURL=is.js.map
7185
7186 /***/ }),
7187 /* 40 */
7188 /***/ (function(module, exports, __webpack_require__) {
7189
7190 "use strict";
7191 /* --------------------------------------------------------------------------------------------\r
7192  * Copyright (c) Microsoft Corporation. All rights reserved.\r
7193  * Licensed under the MIT License. See License.txt in the project root for license information.\r
7194  * ------------------------------------------------------------------------------------------ */\r
7195 \r
7196 Object.defineProperty(exports, "__esModule", { value: true });\r
7197 const vscode_languageserver_protocol_1 = __webpack_require__(4);\r
7198 exports.WorkspaceFoldersFeature = (Base) => {\r
7199     return class extends Base {\r
7200         initialize(capabilities) {\r
7201             let workspaceCapabilities = capabilities.workspace;\r
7202             if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {\r
7203                 this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();\r
7204                 this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {\r
7205                     this._onDidChangeWorkspaceFolders.fire(params.event);\r
7206                 });\r
7207             }\r
7208         }\r
7209         getWorkspaceFolders() {\r
7210             return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);\r
7211         }\r
7212         get onDidChangeWorkspaceFolders() {\r
7213             if (!this._onDidChangeWorkspaceFolders) {\r
7214                 throw new Error('Client doesn\'t support sending workspace folder change events.');\r
7215             }\r
7216             if (!this._unregistration) {\r
7217                 this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);\r
7218             }\r
7219             return this._onDidChangeWorkspaceFolders.event;\r
7220         }\r
7221     };\r
7222 };\r
7223 //# sourceMappingURL=workspaceFolders.js.map
7224
7225 /***/ }),
7226 /* 41 */
7227 /***/ (function(module, exports, __webpack_require__) {
7228
7229 "use strict";
7230 /* --------------------------------------------------------------------------------------------\r
7231  * Copyright (c) Microsoft Corporation. All rights reserved.\r
7232  * Licensed under the MIT License. See License.txt in the project root for license information.\r
7233  * ------------------------------------------------------------------------------------------ */\r
7234 \r
7235 Object.defineProperty(exports, "__esModule", { value: true });\r
7236 const vscode_languageserver_protocol_1 = __webpack_require__(4);\r
7237 const uuid_1 = __webpack_require__(42);\r
7238 class WorkDoneProgressImpl {\r
7239     constructor(_connection, _token) {\r
7240         this._connection = _connection;\r
7241         this._token = _token;\r
7242         WorkDoneProgressImpl.Instances.set(this._token, this);\r
7243         this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();\r
7244     }\r
7245     get token() {\r
7246         return this._source.token;\r
7247     }\r
7248     begin(title, percentage, message, cancellable) {\r
7249         let param = {\r
7250             kind: 'begin',\r
7251             title,\r
7252             percentage,\r
7253             message,\r
7254             cancellable\r
7255         };\r
7256         this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);\r
7257     }\r
7258     report(arg0, arg1) {\r
7259         let param = {\r
7260             kind: 'report'\r
7261         };\r
7262         if (typeof arg0 === 'number') {\r
7263             param.percentage = arg0;\r
7264             if (arg1 !== undefined) {\r
7265                 param.message = arg1;\r
7266             }\r
7267         }\r
7268         else {\r
7269             param.message = arg0;\r
7270         }\r
7271         this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);\r
7272     }\r
7273     done() {\r
7274         WorkDoneProgressImpl.Instances.delete(this._token);\r
7275         this._source.dispose();\r
7276         this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' });\r
7277     }\r
7278     cancel() {\r
7279         this._source.cancel();\r
7280     }\r
7281 }\r
7282 WorkDoneProgressImpl.Instances = new Map();\r
7283 class NullProgress {\r
7284     constructor() {\r
7285         this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();\r
7286     }\r
7287     get token() {\r
7288         return this._source.token;\r
7289     }\r
7290     begin() {\r
7291     }\r
7292     report() {\r
7293     }\r
7294     done() {\r
7295     }\r
7296 }\r
7297 function attachWorkDone(connection, params) {\r
7298     if (params === undefined || params.workDoneToken === undefined) {\r
7299         return new NullProgress();\r
7300     }\r
7301     const token = params.workDoneToken;\r
7302     delete params.workDoneToken;\r
7303     return new WorkDoneProgressImpl(connection, token);\r
7304 }\r
7305 exports.attachWorkDone = attachWorkDone;\r
7306 exports.ProgressFeature = (Base) => {\r
7307     return class extends Base {\r
7308         initialize(capabilities) {\r
7309             var _a, _b;\r
7310             if (((_b = (_a = capabilities) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.workDoneProgress) === true) {\r
7311                 this._progressSupported = true;\r
7312                 this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => {\r
7313                     let progress = WorkDoneProgressImpl.Instances.get(params.token);\r
7314                     if (progress !== undefined) {\r
7315                         progress.cancel();\r
7316                     }\r
7317                 });\r
7318             }\r
7319         }\r
7320         attachWorkDoneProgress(token) {\r
7321             if (token === undefined) {\r
7322                 return new NullProgress();\r
7323             }\r
7324             else {\r
7325                 return new WorkDoneProgressImpl(this.connection, token);\r
7326             }\r
7327         }\r
7328         createWorkDoneProgress() {\r
7329             if (this._progressSupported) {\r
7330                 const token = uuid_1.generateUuid();\r
7331                 return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => {\r
7332                     const result = new WorkDoneProgressImpl(this.connection, token);\r
7333                     return result;\r
7334                 });\r
7335             }\r
7336             else {\r
7337                 return Promise.resolve(new NullProgress());\r
7338             }\r
7339         }\r
7340     };\r
7341 };\r
7342 var ResultProgress;\r
7343 (function (ResultProgress) {\r
7344     ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType();\r
7345 })(ResultProgress || (ResultProgress = {}));\r
7346 class ResultProgressImpl {\r
7347     constructor(_connection, _token) {\r
7348         this._connection = _connection;\r
7349         this._token = _token;\r
7350     }\r
7351     report(data) {\r
7352         this._connection.sendProgress(ResultProgress.type, this._token, data);\r
7353     }\r
7354 }\r
7355 function attachPartialResult(connection, params) {\r
7356     if (params === undefined || params.partialResultToken === undefined) {\r
7357         return undefined;\r
7358     }\r
7359     const token = params.partialResultToken;\r
7360     delete params.partialResultToken;\r
7361     return new ResultProgressImpl(connection, token);\r
7362 }\r
7363 exports.attachPartialResult = attachPartialResult;\r
7364 //# sourceMappingURL=progress.js.map
7365
7366 /***/ }),
7367 /* 42 */
7368 /***/ (function(module, exports, __webpack_require__) {
7369
7370 "use strict";
7371 /*---------------------------------------------------------------------------------------------\r
7372  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
7373  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
7374  *--------------------------------------------------------------------------------------------*/\r
7375 \r
7376 Object.defineProperty(exports, "__esModule", { value: true });\r
7377 class ValueUUID {\r
7378     constructor(_value) {\r
7379         this._value = _value;\r
7380         // empty\r
7381     }\r
7382     asHex() {\r
7383         return this._value;\r
7384     }\r
7385     equals(other) {\r
7386         return this.asHex() === other.asHex();\r
7387     }\r
7388 }\r
7389 class V4UUID extends ValueUUID {\r
7390     constructor() {\r
7391         super([\r
7392             V4UUID._randomHex(),\r
7393             V4UUID._randomHex(),\r
7394             V4UUID._randomHex(),\r
7395             V4UUID._randomHex(),\r
7396             V4UUID._randomHex(),\r
7397             V4UUID._randomHex(),\r
7398             V4UUID._randomHex(),\r
7399             V4UUID._randomHex(),\r
7400             '-',\r
7401             V4UUID._randomHex(),\r
7402             V4UUID._randomHex(),\r
7403             V4UUID._randomHex(),\r
7404             V4UUID._randomHex(),\r
7405             '-',\r
7406             '4',\r
7407             V4UUID._randomHex(),\r
7408             V4UUID._randomHex(),\r
7409             V4UUID._randomHex(),\r
7410             '-',\r
7411             V4UUID._oneOf(V4UUID._timeHighBits),\r
7412             V4UUID._randomHex(),\r
7413             V4UUID._randomHex(),\r
7414             V4UUID._randomHex(),\r
7415             '-',\r
7416             V4UUID._randomHex(),\r
7417             V4UUID._randomHex(),\r
7418             V4UUID._randomHex(),\r
7419             V4UUID._randomHex(),\r
7420             V4UUID._randomHex(),\r
7421             V4UUID._randomHex(),\r
7422             V4UUID._randomHex(),\r
7423             V4UUID._randomHex(),\r
7424             V4UUID._randomHex(),\r
7425             V4UUID._randomHex(),\r
7426             V4UUID._randomHex(),\r
7427             V4UUID._randomHex(),\r
7428         ].join(''));\r
7429     }\r
7430     static _oneOf(array) {\r
7431         return array[Math.floor(array.length * Math.random())];\r
7432     }\r
7433     static _randomHex() {\r
7434         return V4UUID._oneOf(V4UUID._chars);\r
7435     }\r
7436 }\r
7437 V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\r
7438 V4UUID._timeHighBits = ['8', '9', 'a', 'b'];\r
7439 /**\r
7440  * An empty UUID that contains only zeros.\r
7441  */\r
7442 exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');\r
7443 function v4() {\r
7444     return new V4UUID();\r
7445 }\r
7446 exports.v4 = v4;\r
7447 const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\r
7448 function isUUID(value) {\r
7449     return _UUIDPattern.test(value);\r
7450 }\r
7451 exports.isUUID = isUUID;\r
7452 /**\r
7453  * Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.\r
7454  * @param value A uuid string.\r
7455  */\r
7456 function parse(value) {\r
7457     if (!isUUID(value)) {\r
7458         throw new Error('invalid uuid');\r
7459     }\r
7460     return new ValueUUID(value);\r
7461 }\r
7462 exports.parse = parse;\r
7463 function generateUuid() {\r
7464     return v4().asHex();\r
7465 }\r
7466 exports.generateUuid = generateUuid;\r
7467 //# sourceMappingURL=uuid.js.map
7468
7469 /***/ }),
7470 /* 43 */
7471 /***/ (function(module, exports, __webpack_require__) {
7472
7473 "use strict";
7474 /* WEBPACK VAR INJECTION */(function(__filename) {/* --------------------------------------------------------------------------------------------\r
7475  * Copyright (c) Microsoft Corporation. All rights reserved.\r
7476  * Licensed under the MIT License. See License.txt in the project root for license information.\r
7477  * ------------------------------------------------------------------------------------------ */\r
7478 \r
7479 Object.defineProperty(exports, "__esModule", { value: true });\r
7480 const url = __webpack_require__(44);\r
7481 const path = __webpack_require__(3);\r
7482 const fs = __webpack_require__(2);\r
7483 const child_process_1 = __webpack_require__(45);\r
7484 /**\r
7485  * @deprecated Use the `vscode-uri` npm module which provides a more\r
7486  * complete implementation of handling VS Code URIs.\r
7487  */\r
7488 function uriToFilePath(uri) {\r
7489     let parsed = url.parse(uri);\r
7490     if (parsed.protocol !== 'file:' || !parsed.path) {\r
7491         return undefined;\r
7492     }\r
7493     let segments = parsed.path.split('/');\r
7494     for (var i = 0, len = segments.length; i < len; i++) {\r
7495         segments[i] = decodeURIComponent(segments[i]);\r
7496     }\r
7497     if (process.platform === 'win32' && segments.length > 1) {\r
7498         let first = segments[0];\r
7499         let second = segments[1];\r
7500         // Do we have a drive letter and we started with a / which is the\r
7501         // case if the first segement is empty (see split above)\r
7502         if (first.length === 0 && second.length > 1 && second[1] === ':') {\r
7503             // Remove first slash\r
7504             segments.shift();\r
7505         }\r
7506     }\r
7507     return path.normalize(segments.join('/'));\r
7508 }\r
7509 exports.uriToFilePath = uriToFilePath;\r
7510 function isWindows() {\r
7511     return process.platform === 'win32';\r
7512 }\r
7513 function resolve(moduleName, nodePath, cwd, tracer) {\r
7514     const nodePathKey = 'NODE_PATH';\r
7515     const app = [\r
7516         'var p = process;',\r
7517         'p.on(\'message\',function(m){',\r
7518         'if(m.c===\'e\'){',\r
7519         'p.exit(0);',\r
7520         '}',\r
7521         'else if(m.c===\'rs\'){',\r
7522         'try{',\r
7523         'var r=require.resolve(m.a);',\r
7524         'p.send({c:\'r\',s:true,r:r});',\r
7525         '}',\r
7526         'catch(err){',\r
7527         'p.send({c:\'r\',s:false});',\r
7528         '}',\r
7529         '}',\r
7530         '});'\r
7531     ].join('');\r
7532     return new Promise((resolve, reject) => {\r
7533         let env = process.env;\r
7534         let newEnv = Object.create(null);\r
7535         Object.keys(env).forEach(key => newEnv[key] = env[key]);\r
7536         if (nodePath && fs.existsSync(nodePath) /* see issue 545 */) {\r
7537             if (newEnv[nodePathKey]) {\r
7538                 newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey];\r
7539             }\r
7540             else {\r
7541                 newEnv[nodePathKey] = nodePath;\r
7542             }\r
7543             if (tracer) {\r
7544                 tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`);\r
7545             }\r
7546         }\r
7547         newEnv['ELECTRON_RUN_AS_NODE'] = '1';\r
7548         try {\r
7549             let cp = child_process_1.fork('', [], {\r
7550                 cwd: cwd,\r
7551                 env: newEnv,\r
7552                 execArgv: ['-e', app]\r
7553             });\r
7554             if (cp.pid === void 0) {\r
7555                 reject(new Error(`Starting process to resolve node module  ${moduleName} failed`));\r
7556                 return;\r
7557             }\r
7558             cp.on('error', (error) => {\r
7559                 reject(error);\r
7560             });\r
7561             cp.on('message', (message) => {\r
7562                 if (message.c === 'r') {\r
7563                     cp.send({ c: 'e' });\r
7564                     if (message.s) {\r
7565                         resolve(message.r);\r
7566                     }\r
7567                     else {\r
7568                         reject(new Error(`Failed to resolve module: ${moduleName}`));\r
7569                     }\r
7570                 }\r
7571             });\r
7572             let message = {\r
7573                 c: 'rs',\r
7574                 a: moduleName\r
7575             };\r
7576             cp.send(message);\r
7577         }\r
7578         catch (error) {\r
7579             reject(error);\r
7580         }\r
7581     });\r
7582 }\r
7583 exports.resolve = resolve;\r
7584 /**\r
7585  * Resolve the global npm package path.\r
7586  * @deprecated Since this depends on the used package manager and their version the best is that servers\r
7587  * implement this themselves since they know best what kind of package managers to support.\r
7588  * @param tracer the tracer to use\r
7589  */\r
7590 function resolveGlobalNodePath(tracer) {\r
7591     let npmCommand = 'npm';\r
7592     const env = Object.create(null);\r
7593     Object.keys(process.env).forEach(key => env[key] = process.env[key]);\r
7594     env['NO_UPDATE_NOTIFIER'] = 'true';\r
7595     const options = {\r
7596         encoding: 'utf8',\r
7597         env\r
7598     };\r
7599     if (isWindows()) {\r
7600         npmCommand = 'npm.cmd';\r
7601         options.shell = true;\r
7602     }\r
7603     let handler = () => { };\r
7604     try {\r
7605         process.on('SIGPIPE', handler);\r
7606         let stdout = child_process_1.spawnSync(npmCommand, ['config', 'get', 'prefix'], options).stdout;\r
7607         if (!stdout) {\r
7608             if (tracer) {\r
7609                 tracer(`'npm config get prefix' didn't return a value.`);\r
7610             }\r
7611             return undefined;\r
7612         }\r
7613         let prefix = stdout.trim();\r
7614         if (tracer) {\r
7615             tracer(`'npm config get prefix' value is: ${prefix}`);\r
7616         }\r
7617         if (prefix.length > 0) {\r
7618             if (isWindows()) {\r
7619                 return path.join(prefix, 'node_modules');\r
7620             }\r
7621             else {\r
7622                 return path.join(prefix, 'lib', 'node_modules');\r
7623             }\r
7624         }\r
7625         return undefined;\r
7626     }\r
7627     catch (err) {\r
7628         return undefined;\r
7629     }\r
7630     finally {\r
7631         process.removeListener('SIGPIPE', handler);\r
7632     }\r
7633 }\r
7634 exports.resolveGlobalNodePath = resolveGlobalNodePath;\r
7635 /*\r
7636  * Resolve the global yarn pakage path.\r
7637  * @deprecated Since this depends on the used package manager and their version the best is that servers\r
7638  * implement this themselves since they know best what kind of package managers to support.\r
7639  * @param tracer the tracer to use\r
7640  */\r
7641 function resolveGlobalYarnPath(tracer) {\r
7642     let yarnCommand = 'yarn';\r
7643     let options = {\r
7644         encoding: 'utf8'\r
7645     };\r
7646     if (isWindows()) {\r
7647         yarnCommand = 'yarn.cmd';\r
7648         options.shell = true;\r
7649     }\r
7650     let handler = () => { };\r
7651     try {\r
7652         process.on('SIGPIPE', handler);\r
7653         let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options);\r
7654         let stdout = results.stdout;\r
7655         if (!stdout) {\r
7656             if (tracer) {\r
7657                 tracer(`'yarn global dir' didn't return a value.`);\r
7658                 if (results.stderr) {\r
7659                     tracer(results.stderr);\r
7660                 }\r
7661             }\r
7662             return undefined;\r
7663         }\r
7664         let lines = stdout.trim().split(/\r?\n/);\r
7665         for (let line of lines) {\r
7666             try {\r
7667                 let yarn = JSON.parse(line);\r
7668                 if (yarn.type === 'log') {\r
7669                     return path.join(yarn.data, 'node_modules');\r
7670                 }\r
7671             }\r
7672             catch (e) {\r
7673                 // Do nothing. Ignore the line\r
7674             }\r
7675         }\r
7676         return undefined;\r
7677     }\r
7678     catch (err) {\r
7679         return undefined;\r
7680     }\r
7681     finally {\r
7682         process.removeListener('SIGPIPE', handler);\r
7683     }\r
7684 }\r
7685 exports.resolveGlobalYarnPath = resolveGlobalYarnPath;\r
7686 var FileSystem;\r
7687 (function (FileSystem) {\r
7688     let _isCaseSensitive = undefined;\r
7689     function isCaseSensitive() {\r
7690         if (_isCaseSensitive !== void 0) {\r
7691             return _isCaseSensitive;\r
7692         }\r
7693         if (process.platform === 'win32') {\r
7694             _isCaseSensitive = false;\r
7695         }\r
7696         else {\r
7697             // convert current file name to upper case / lower case and check if file exists\r
7698             // (guards against cases when name is already all uppercase or lowercase)\r
7699             _isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase());\r
7700         }\r
7701         return _isCaseSensitive;\r
7702     }\r
7703     FileSystem.isCaseSensitive = isCaseSensitive;\r
7704     function isParent(parent, child) {\r
7705         if (isCaseSensitive()) {\r
7706             return path.normalize(child).indexOf(path.normalize(parent)) === 0;\r
7707         }\r
7708         else {\r
7709             return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0;\r
7710         }\r
7711     }\r
7712     FileSystem.isParent = isParent;\r
7713 })(FileSystem = exports.FileSystem || (exports.FileSystem = {}));\r
7714 function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {\r
7715     if (nodePath) {\r
7716         if (!path.isAbsolute(nodePath)) {\r
7717             nodePath = path.join(workspaceRoot, nodePath);\r
7718         }\r
7719         return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {\r
7720             if (FileSystem.isParent(nodePath, value)) {\r
7721                 return value;\r
7722             }\r
7723             else {\r
7724                 return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));\r
7725             }\r
7726         }).then(undefined, (_error) => {\r
7727             return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);\r
7728         });\r
7729     }\r
7730     else {\r
7731         return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);\r
7732     }\r
7733 }\r
7734 exports.resolveModulePath = resolveModulePath;\r
7735 //# sourceMappingURL=files.js.map
7736 /* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
7737
7738 /***/ }),
7739 /* 44 */
7740 /***/ (function(module, exports) {
7741
7742 module.exports = require("url");
7743
7744 /***/ }),
7745 /* 45 */
7746 /***/ (function(module, exports) {
7747
7748 module.exports = require("child_process");
7749
7750 /***/ }),
7751 /* 46 */
7752 /***/ (function(module, __webpack_exports__, __webpack_require__) {
7753
7754 "use strict";
7755 __webpack_require__.r(__webpack_exports__);
7756 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "URI", function() { return URI; });
7757 /*---------------------------------------------------------------------------------------------
7758  *  Copyright (c) Microsoft Corporation. All rights reserved.
7759  *  Licensed under the MIT License. See License.txt in the project root for license information.
7760  *--------------------------------------------------------------------------------------------*/
7761
7762 var __extends = (undefined && undefined.__extends) || (function () {
7763     var extendStatics = function (d, b) {
7764         extendStatics = Object.setPrototypeOf ||
7765             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7766             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7767         return extendStatics(d, b);
7768     };
7769     return function (d, b) {
7770         extendStatics(d, b);
7771         function __() { this.constructor = d; }
7772         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7773     };
7774 })();
7775 var _a;
7776 var isWindows;
7777 if (typeof process === 'object') {
7778     isWindows = process.platform === 'win32';
7779 }
7780 else if (typeof navigator === 'object') {
7781     var userAgent = navigator.userAgent;
7782     isWindows = userAgent.indexOf('Windows') >= 0;
7783 }
7784 function isHighSurrogate(charCode) {
7785     return (0xD800 <= charCode && charCode <= 0xDBFF);
7786 }
7787 function isLowSurrogate(charCode) {
7788     return (0xDC00 <= charCode && charCode <= 0xDFFF);
7789 }
7790 function isLowerAsciiHex(code) {
7791     return code >= 97 /* a */ && code <= 102 /* f */;
7792 }
7793 function isLowerAsciiLetter(code) {
7794     return code >= 97 /* a */ && code <= 122 /* z */;
7795 }
7796 function isUpperAsciiLetter(code) {
7797     return code >= 65 /* A */ && code <= 90 /* Z */;
7798 }
7799 function isAsciiLetter(code) {
7800     return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);
7801 }
7802 //#endregion
7803 var _schemePattern = /^\w[\w\d+.-]*$/;
7804 var _singleSlashStart = /^\//;
7805 var _doubleSlashStart = /^\/\//;
7806 function _validateUri(ret, _strict) {
7807     // scheme, must be set
7808     if (!ret.scheme && _strict) {
7809         throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}");
7810     }
7811     // scheme, https://tools.ietf.org/html/rfc3986#section-3.1
7812     // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
7813     if (ret.scheme && !_schemePattern.test(ret.scheme)) {
7814         throw new Error('[UriError]: Scheme contains illegal characters.');
7815     }
7816     // path, http://tools.ietf.org/html/rfc3986#section-3.3
7817     // If a URI contains an authority component, then the path component
7818     // must either be empty or begin with a slash ("/") character.  If a URI
7819     // does not contain an authority component, then the path cannot begin
7820     // with two slash characters ("//").
7821     if (ret.path) {
7822         if (ret.authority) {
7823             if (!_singleSlashStart.test(ret.path)) {
7824                 throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
7825             }
7826         }
7827         else {
7828             if (_doubleSlashStart.test(ret.path)) {
7829                 throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
7830             }
7831         }
7832     }
7833 }
7834 // for a while we allowed uris *without* schemes and this is the migration
7835 // for them, e.g. an uri without scheme and without strict-mode warns and falls
7836 // back to the file-scheme. that should cause the least carnage and still be a
7837 // clear warning
7838 function _schemeFix(scheme, _strict) {
7839     if (!scheme && !_strict) {
7840         return 'file';
7841     }
7842     return scheme;
7843 }
7844 // implements a bit of https://tools.ietf.org/html/rfc3986#section-5
7845 function _referenceResolution(scheme, path) {
7846     // the slash-character is our 'default base' as we don't
7847     // support constructing URIs relative to other URIs. This
7848     // also means that we alter and potentially break paths.
7849     // see https://tools.ietf.org/html/rfc3986#section-5.1.4
7850     switch (scheme) {
7851         case 'https':
7852         case 'http':
7853         case 'file':
7854             if (!path) {
7855                 path = _slash;
7856             }
7857             else if (path[0] !== _slash) {
7858                 path = _slash + path;
7859             }
7860             break;
7861     }
7862     return path;
7863 }
7864 var _empty = '';
7865 var _slash = '/';
7866 var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
7867 /**
7868  * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
7869  * This class is a simple parser which creates the basic component parts
7870  * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
7871  * and encoding.
7872  *
7873  *       foo://example.com:8042/over/there?name=ferret#nose
7874  *       \_/   \______________/\_________/ \_________/ \__/
7875  *        |           |            |            |        |
7876  *     scheme     authority       path        query   fragment
7877  *        |   _____________________|__
7878  *       / \ /                        \
7879  *       urn:example:animal:ferret:nose
7880  */
7881 var URI = /** @class */ (function () {
7882     /**
7883      * @internal
7884      */
7885     function URI(schemeOrData, authority, path, query, fragment, _strict) {
7886         if (_strict === void 0) { _strict = false; }
7887         if (typeof schemeOrData === 'object') {
7888             this.scheme = schemeOrData.scheme || _empty;
7889             this.authority = schemeOrData.authority || _empty;
7890             this.path = schemeOrData.path || _empty;
7891             this.query = schemeOrData.query || _empty;
7892             this.fragment = schemeOrData.fragment || _empty;
7893             // no validation because it's this URI
7894             // that creates uri components.
7895             // _validateUri(this);
7896         }
7897         else {
7898             this.scheme = _schemeFix(schemeOrData, _strict);
7899             this.authority = authority || _empty;
7900             this.path = _referenceResolution(this.scheme, path || _empty);
7901             this.query = query || _empty;
7902             this.fragment = fragment || _empty;
7903             _validateUri(this, _strict);
7904         }
7905     }
7906     URI.isUri = function (thing) {
7907         if (thing instanceof URI) {
7908             return true;
7909         }
7910         if (!thing) {
7911             return false;
7912         }
7913         return typeof thing.authority === 'string'
7914             && typeof thing.fragment === 'string'
7915             && typeof thing.path === 'string'
7916             && typeof thing.query === 'string'
7917             && typeof thing.scheme === 'string'
7918             && typeof thing.fsPath === 'function'
7919             && typeof thing.with === 'function'
7920             && typeof thing.toString === 'function';
7921     };
7922     Object.defineProperty(URI.prototype, "fsPath", {
7923         // ---- filesystem path -----------------------
7924         /**
7925          * Returns a string representing the corresponding file system path of this URI.
7926          * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
7927          * platform specific path separator.
7928          *
7929          * * Will *not* validate the path for invalid characters and semantics.
7930          * * Will *not* look at the scheme of this URI.
7931          * * The result shall *not* be used for display purposes but for accessing a file on disk.
7932          *
7933          *
7934          * The *difference* to `URI#path` is the use of the platform specific separator and the handling
7935          * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
7936          *
7937          * ```ts
7938             const u = URI.parse('file://server/c$/folder/file.txt')
7939             u.authority === 'server'
7940             u.path === '/shares/c$/file.txt'
7941             u.fsPath === '\\server\c$\folder\file.txt'
7942         ```
7943          *
7944          * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
7945          * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
7946          * with URIs that represent files on disk (`file` scheme).
7947          */
7948         get: function () {
7949             // if (this.scheme !== 'file') {
7950             //  console.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);
7951             // }
7952             return _makeFsPath(this);
7953         },
7954         enumerable: true,
7955         configurable: true
7956     });
7957     // ---- modify to new -------------------------
7958     URI.prototype.with = function (change) {
7959         if (!change) {
7960             return this;
7961         }
7962         var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment;
7963         if (scheme === undefined) {
7964             scheme = this.scheme;
7965         }
7966         else if (scheme === null) {
7967             scheme = _empty;
7968         }
7969         if (authority === undefined) {
7970             authority = this.authority;
7971         }
7972         else if (authority === null) {
7973             authority = _empty;
7974         }
7975         if (path === undefined) {
7976             path = this.path;
7977         }
7978         else if (path === null) {
7979             path = _empty;
7980         }
7981         if (query === undefined) {
7982             query = this.query;
7983         }
7984         else if (query === null) {
7985             query = _empty;
7986         }
7987         if (fragment === undefined) {
7988             fragment = this.fragment;
7989         }
7990         else if (fragment === null) {
7991             fragment = _empty;
7992         }
7993         if (scheme === this.scheme
7994             && authority === this.authority
7995             && path === this.path
7996             && query === this.query
7997             && fragment === this.fragment) {
7998             return this;
7999         }
8000         return new _URI(scheme, authority, path, query, fragment);
8001     };
8002     // ---- parse & validate ------------------------
8003     /**
8004      * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,
8005      * `file:///usr/home`, or `scheme:with/path`.
8006      *
8007      * @param value A string which represents an URI (see `URI#toString`).
8008      */
8009     URI.parse = function (value, _strict) {
8010         if (_strict === void 0) { _strict = false; }
8011         var match = _regexp.exec(value);
8012         if (!match) {
8013             return new _URI(_empty, _empty, _empty, _empty, _empty);
8014         }
8015         return new _URI(match[2] || _empty, decodeURIComponent(match[4] || _empty), decodeURIComponent(match[5] || _empty), decodeURIComponent(match[7] || _empty), decodeURIComponent(match[9] || _empty), _strict);
8016     };
8017     /**
8018      * Creates a new URI from a file system path, e.g. `c:\my\files`,
8019      * `/usr/home`, or `\\server\share\some\path`.
8020      *
8021      * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
8022      * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
8023      * `URI.parse('file://' + path)` because the path might contain characters that are
8024      * interpreted (# and ?). See the following sample:
8025      * ```ts
8026     const good = URI.file('/coding/c#/project1');
8027     good.scheme === 'file';
8028     good.path === '/coding/c#/project1';
8029     good.fragment === '';
8030     const bad = URI.parse('file://' + '/coding/c#/project1');
8031     bad.scheme === 'file';
8032     bad.path === '/coding/c'; // path is now broken
8033     bad.fragment === '/project1';
8034     ```
8035      *
8036      * @param path A file system path (see `URI#fsPath`)
8037      */
8038     URI.file = function (path) {
8039         var authority = _empty;
8040         // normalize to fwd-slashes on windows,
8041         // on other systems bwd-slashes are valid
8042         // filename character, eg /f\oo/ba\r.txt
8043         if (isWindows) {
8044             path = path.replace(/\\/g, _slash);
8045         }
8046         // check for authority as used in UNC shares
8047         // or use the path as given
8048         if (path[0] === _slash && path[1] === _slash) {
8049             var idx = path.indexOf(_slash, 2);
8050             if (idx === -1) {
8051                 authority = path.substring(2);
8052                 path = _slash;
8053             }
8054             else {
8055                 authority = path.substring(2, idx);
8056                 path = path.substring(idx) || _slash;
8057             }
8058         }
8059         return new _URI('file', authority, path, _empty, _empty);
8060     };
8061     URI.from = function (components) {
8062         return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment);
8063     };
8064     // ---- printing/externalize ---------------------------
8065     /**
8066      * Creates a string representation for this URI. It's guaranteed that calling
8067      * `URI.parse` with the result of this function creates an URI which is equal
8068      * to this URI.
8069      *
8070      * * The result shall *not* be used for display purposes but for externalization or transport.
8071      * * The result will be encoded using the percentage encoding and encoding happens mostly
8072      * ignore the scheme-specific encoding rules.
8073      *
8074      * @param skipEncoding Do not encode the result, default is `false`
8075      */
8076     URI.prototype.toString = function (skipEncoding) {
8077         if (skipEncoding === void 0) { skipEncoding = false; }
8078         return _asFormatted(this, skipEncoding);
8079     };
8080     URI.prototype.toJSON = function () {
8081         return this;
8082     };
8083     URI.revive = function (data) {
8084         if (!data) {
8085             return data;
8086         }
8087         else if (data instanceof URI) {
8088             return data;
8089         }
8090         else {
8091             var result = new _URI(data);
8092             result._formatted = data.external;
8093             result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null;
8094             return result;
8095         }
8096     };
8097     return URI;
8098 }());
8099
8100 var _pathSepMarker = isWindows ? 1 : undefined;
8101 // tslint:disable-next-line:class-name
8102 var _URI = /** @class */ (function (_super) {
8103     __extends(_URI, _super);
8104     function _URI() {
8105         var _this = _super !== null && _super.apply(this, arguments) || this;
8106         _this._formatted = null;
8107         _this._fsPath = null;
8108         return _this;
8109     }
8110     Object.defineProperty(_URI.prototype, "fsPath", {
8111         get: function () {
8112             if (!this._fsPath) {
8113                 this._fsPath = _makeFsPath(this);
8114             }
8115             return this._fsPath;
8116         },
8117         enumerable: true,
8118         configurable: true
8119     });
8120     _URI.prototype.toString = function (skipEncoding) {
8121         if (skipEncoding === void 0) { skipEncoding = false; }
8122         if (!skipEncoding) {
8123             if (!this._formatted) {
8124                 this._formatted = _asFormatted(this, false);
8125             }
8126             return this._formatted;
8127         }
8128         else {
8129             // we don't cache that
8130             return _asFormatted(this, true);
8131         }
8132     };
8133     _URI.prototype.toJSON = function () {
8134         var res = {
8135             $mid: 1
8136         };
8137         // cached state
8138         if (this._fsPath) {
8139             res.fsPath = this._fsPath;
8140             res._sep = _pathSepMarker;
8141         }
8142         if (this._formatted) {
8143             res.external = this._formatted;
8144         }
8145         // uri components
8146         if (this.path) {
8147             res.path = this.path;
8148         }
8149         if (this.scheme) {
8150             res.scheme = this.scheme;
8151         }
8152         if (this.authority) {
8153             res.authority = this.authority;
8154         }
8155         if (this.query) {
8156             res.query = this.query;
8157         }
8158         if (this.fragment) {
8159             res.fragment = this.fragment;
8160         }
8161         return res;
8162     };
8163     return _URI;
8164 }(URI));
8165 // reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2
8166 var encodeTable = (_a = {},
8167     _a[58 /* Colon */] = '%3A',
8168     _a[47 /* Slash */] = '%2F',
8169     _a[63 /* QuestionMark */] = '%3F',
8170     _a[35 /* Hash */] = '%23',
8171     _a[91 /* OpenSquareBracket */] = '%5B',
8172     _a[93 /* CloseSquareBracket */] = '%5D',
8173     _a[64 /* AtSign */] = '%40',
8174     _a[33 /* ExclamationMark */] = '%21',
8175     _a[36 /* DollarSign */] = '%24',
8176     _a[38 /* Ampersand */] = '%26',
8177     _a[39 /* SingleQuote */] = '%27',
8178     _a[40 /* OpenParen */] = '%28',
8179     _a[41 /* CloseParen */] = '%29',
8180     _a[42 /* Asterisk */] = '%2A',
8181     _a[43 /* Plus */] = '%2B',
8182     _a[44 /* Comma */] = '%2C',
8183     _a[59 /* Semicolon */] = '%3B',
8184     _a[61 /* Equals */] = '%3D',
8185     _a[32 /* Space */] = '%20',
8186     _a);
8187 function encodeURIComponentFast(uriComponent, allowSlash) {
8188     var res = undefined;
8189     var nativeEncodePos = -1;
8190     for (var pos = 0; pos < uriComponent.length; pos++) {
8191         var code = uriComponent.charCodeAt(pos);
8192         // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3
8193         if ((code >= 97 /* a */ && code <= 122 /* z */)
8194             || (code >= 65 /* A */ && code <= 90 /* Z */)
8195             || (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */)
8196             || code === 45 /* Dash */
8197             || code === 46 /* Period */
8198             || code === 95 /* Underline */
8199             || code === 126 /* Tilde */
8200             || (allowSlash && code === 47 /* Slash */)) {
8201             // check if we are delaying native encode
8202             if (nativeEncodePos !== -1) {
8203                 res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
8204                 nativeEncodePos = -1;
8205             }
8206             // check if we write into a new string (by default we try to return the param)
8207             if (res !== undefined) {
8208                 res += uriComponent.charAt(pos);
8209             }
8210         }
8211         else {
8212             // encoding needed, we need to allocate a new string
8213             if (res === undefined) {
8214                 res = uriComponent.substr(0, pos);
8215             }
8216             // check with default table first
8217             var escaped = encodeTable[code];
8218             if (escaped !== undefined) {
8219                 // check if we are delaying native encode
8220                 if (nativeEncodePos !== -1) {
8221                     res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
8222                     nativeEncodePos = -1;
8223                 }
8224                 // append escaped variant to result
8225                 res += escaped;
8226             }
8227             else if (nativeEncodePos === -1) {
8228                 // use native encode only when needed
8229                 nativeEncodePos = pos;
8230             }
8231         }
8232     }
8233     if (nativeEncodePos !== -1) {
8234         res += encodeURIComponent(uriComponent.substring(nativeEncodePos));
8235     }
8236     return res !== undefined ? res : uriComponent;
8237 }
8238 function encodeURIComponentMinimal(path) {
8239     var res = undefined;
8240     for (var pos = 0; pos < path.length; pos++) {
8241         var code = path.charCodeAt(pos);
8242         if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) {
8243             if (res === undefined) {
8244                 res = path.substr(0, pos);
8245             }
8246             res += encodeTable[code];
8247         }
8248         else {
8249             if (res !== undefined) {
8250                 res += path[pos];
8251             }
8252         }
8253     }
8254     return res !== undefined ? res : path;
8255 }
8256 /**
8257  * Compute `fsPath` for the given uri
8258  */
8259 function _makeFsPath(uri) {
8260     var value;
8261     if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {
8262         // unc path: file://shares/c$/far/boo
8263         value = "//" + uri.authority + uri.path;
8264     }
8265     else if (uri.path.charCodeAt(0) === 47 /* Slash */
8266         && (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */)
8267         && uri.path.charCodeAt(2) === 58 /* Colon */) {
8268         // windows drive letter: file:///c:/far/boo
8269         value = uri.path[1].toLowerCase() + uri.path.substr(2);
8270     }
8271     else {
8272         // other path
8273         value = uri.path;
8274     }
8275     if (isWindows) {
8276         value = value.replace(/\//g, '\\');
8277     }
8278     return value;
8279 }
8280 /**
8281  * Create the external version of a uri
8282  */
8283 function _asFormatted(uri, skipEncoding) {
8284     var encoder = !skipEncoding
8285         ? encodeURIComponentFast
8286         : encodeURIComponentMinimal;
8287     var res = '';
8288     var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment;
8289     if (scheme) {
8290         res += scheme;
8291         res += ':';
8292     }
8293     if (authority || scheme === 'file') {
8294         res += _slash;
8295         res += _slash;
8296     }
8297     if (authority) {
8298         var idx = authority.indexOf('@');
8299         if (idx !== -1) {
8300             // <user>@<auth>
8301             var userinfo = authority.substr(0, idx);
8302             authority = authority.substr(idx + 1);
8303             idx = userinfo.indexOf(':');
8304             if (idx === -1) {
8305                 res += encoder(userinfo, false);
8306             }
8307             else {
8308                 // <user>:<pass>@<auth>
8309                 res += encoder(userinfo.substr(0, idx), false);
8310                 res += ':';
8311                 res += encoder(userinfo.substr(idx + 1), false);
8312             }
8313             res += '@';
8314         }
8315         authority = authority.toLowerCase();
8316         idx = authority.indexOf(':');
8317         if (idx === -1) {
8318             res += encoder(authority, false);
8319         }
8320         else {
8321             // <auth>:<port>
8322             res += encoder(authority.substr(0, idx), false);
8323             res += authority.substr(idx);
8324         }
8325     }
8326     if (path) {
8327         // lower-case windows drive letters in /C:/fff or C:/fff
8328         if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) {
8329             var code = path.charCodeAt(1);
8330             if (code >= 65 /* A */ && code <= 90 /* Z */) {
8331                 path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3); // "/c:".length === 3
8332             }
8333         }
8334         else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) {
8335             var code = path.charCodeAt(0);
8336             if (code >= 65 /* A */ && code <= 90 /* Z */) {
8337                 path = String.fromCharCode(code + 32) + ":" + path.substr(2); // "/c:".length === 3
8338             }
8339         }
8340         // encode the rest of the path
8341         res += encoder(path, true);
8342     }
8343     if (query) {
8344         res += '?';
8345         res += encoder(query, false);
8346     }
8347     if (fragment) {
8348         res += '#';
8349         res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;
8350     }
8351     return res;
8352 }
8353
8354
8355 /***/ }),
8356 /* 47 */
8357 /***/ (function(module, exports, __webpack_require__) {
8358
8359 "use strict";
8360
8361 Object.defineProperty(exports, "__esModule", { value: true });
8362 var Is;
8363 (function (Is) {
8364     const toString = Object.prototype.toString;
8365     function boolean(value) {
8366         return value === true || value === false;
8367     }
8368     Is.boolean = boolean;
8369     function string(value) {
8370         return toString.call(value) === '[object String]';
8371     }
8372     Is.string = string;
8373 })(Is = exports.Is || (exports.Is = {}));
8374 var DirectoryItem;
8375 (function (DirectoryItem) {
8376     function is(item) {
8377         let candidate = item;
8378         return (candidate &&
8379             Is.string(candidate.directory) &&
8380             (Is.boolean(candidate.changeProcessCWD) ||
8381                 candidate.changeProcessCWD === void 0));
8382     }
8383     DirectoryItem.is = is;
8384 })(DirectoryItem = exports.DirectoryItem || (exports.DirectoryItem = {}));
8385
8386
8387 /***/ }),
8388 /* 48 */
8389 /***/ (function(module, exports, __webpack_require__) {
8390
8391 "use strict";
8392
8393 var __importStar = (this && this.__importStar) || function (mod) {
8394     if (mod && mod.__esModule) return mod;
8395     var result = {};
8396     if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
8397     result["default"] = mod;
8398     return result;
8399 };
8400 var __importDefault = (this && this.__importDefault) || function (mod) {
8401     return (mod && mod.__esModule) ? mod : { "default": mod };
8402 };
8403 Object.defineProperty(exports, "__esModule", { value: true });
8404 const path = __importStar(__webpack_require__(3));
8405 const fast_diff_1 = __importDefault(__webpack_require__(49));
8406 const types_1 = __webpack_require__(47);
8407 const vscode_uri_1 = __webpack_require__(46);
8408 const resolve_from_1 = __importDefault(__webpack_require__(50));
8409 /**
8410  * Check if the path follows this pattern: `\\hostname\sharename`.
8411  *
8412  * @see https://msdn.microsoft.com/en-us/library/gg465305.aspx
8413  * @return A boolean indication if the path is a UNC path, on none-windows
8414  * always false.
8415  */
8416 function isUNC(path) {
8417     if (process.platform !== 'win32') {
8418         // UNC is a windows concept
8419         return false;
8420     }
8421     if (!path || path.length < 5) {
8422         // at least \\a\b
8423         return false;
8424     }
8425     let code = path.charCodeAt(0);
8426     if (code !== 92 /* Backslash */) {
8427         return false;
8428     }
8429     code = path.charCodeAt(1);
8430     if (code !== 92 /* Backslash */) {
8431         return false;
8432     }
8433     let pos = 2;
8434     let start = pos;
8435     for (; pos < path.length; pos++) {
8436         code = path.charCodeAt(pos);
8437         if (code === 92 /* Backslash */) {
8438             break;
8439         }
8440     }
8441     if (start === pos) {
8442         return false;
8443     }
8444     code = path.charCodeAt(pos + 1);
8445     if (isNaN(code) || code === 92 /* Backslash */) {
8446         return false;
8447     }
8448     return true;
8449 }
8450 exports.isUNC = isUNC;
8451 function getFileSystemPath(uri) {
8452     let result = uri.fsPath;
8453     if (process.platform === 'win32' && result.length >= 2 && result[1] === ':') {
8454         // Node by default uses an upper case drive letter and ESLint uses
8455         // === to compare pathes which results in the equal check failing
8456         // if the drive letter is lower case in th URI. Ensure upper case.
8457         return result[0].toUpperCase() + result.substr(1);
8458     }
8459     else {
8460         return result;
8461     }
8462 }
8463 function getFilePath(documentOrUri) {
8464     if (!documentOrUri) {
8465         return undefined;
8466     }
8467     let uri = types_1.Is.string(documentOrUri)
8468         ? vscode_uri_1.URI.parse(documentOrUri)
8469         : vscode_uri_1.URI.parse(documentOrUri.uri);
8470     if (uri.scheme !== 'file') {
8471         return undefined;
8472     }
8473     return getFileSystemPath(uri);
8474 }
8475 exports.getFilePath = getFilePath;
8476 function getAllFixEdits(document, settings) {
8477     const uri = vscode_uri_1.URI.parse(document.uri);
8478     if (uri.scheme != 'file')
8479         return [];
8480     const content = document.getText();
8481     const newOptions = Object.assign(Object.assign({}, settings.options), { fix: true });
8482     return executeInWorkspaceDirectory(document, settings, newOptions, (filename, options) => {
8483         if (!settings.validate) {
8484             return [];
8485         }
8486         const engine = new settings.library.CLIEngine(options);
8487         const res = engine.executeOnText(content, filename);
8488         if (!res.results.length)
8489             return [];
8490         const { output } = res.results[0];
8491         if (output == null)
8492             return [];
8493         const change = getChange(content, output);
8494         return [{
8495                 range: {
8496                     start: document.positionAt(change.start),
8497                     end: document.positionAt(change.end)
8498                 },
8499                 newText: change.newText
8500             }];
8501     });
8502 }
8503 exports.getAllFixEdits = getAllFixEdits;
8504 function getChange(oldStr, newStr) {
8505     let result = fast_diff_1.default(oldStr, newStr, 1);
8506     let curr = 0;
8507     let start = -1;
8508     let end = -1;
8509     let newText = '';
8510     let remain = '';
8511     for (let item of result) {
8512         let [t, str] = item;
8513         // equal
8514         if (t == 0) {
8515             curr = curr + str.length;
8516             if (start != -1)
8517                 remain = remain + str;
8518         }
8519         else {
8520             if (start == -1)
8521                 start = curr;
8522             if (t == 1) {
8523                 newText = newText + remain + str;
8524                 end = curr;
8525             }
8526             else {
8527                 newText = newText + remain;
8528                 end = curr + str.length;
8529             }
8530             remain = '';
8531             if (t == -1)
8532                 curr = curr + str.length;
8533         }
8534     }
8535     return { start, end, newText };
8536 }
8537 exports.getChange = getChange;
8538 function resolveModule(name, localPath, globalPath) {
8539     if (localPath) {
8540         let path = resolve_from_1.default.silent(localPath, name);
8541         if (path)
8542             return Promise.resolve(path);
8543     }
8544     try {
8545         let path = resolve_from_1.default(globalPath, name);
8546         return Promise.resolve(path);
8547     }
8548     catch (e) {
8549         return Promise.reject(e);
8550     }
8551 }
8552 exports.resolveModule = resolveModule;
8553 function executeInWorkspaceDirectory(document, settings, newOptions, callback) {
8554     const filename = getFilePath(document);
8555     const cwd = process.cwd();
8556     try {
8557         if (filename) {
8558             if (settings.workingDirectory) {
8559                 newOptions.cwd = settings.workingDirectory.directory;
8560                 if (settings.workingDirectory.changeProcessCWD) {
8561                     process.chdir(settings.workingDirectory.directory);
8562                 }
8563             }
8564             else if (settings.workspaceFolder) {
8565                 const workspaceFolderUri = vscode_uri_1.URI.parse(settings.workspaceFolder.uri);
8566                 if (workspaceFolderUri.scheme === 'file') {
8567                     const fsPath = getFileSystemPath(workspaceFolderUri);
8568                     newOptions.cwd = fsPath;
8569                     process.chdir(fsPath);
8570                 }
8571             }
8572             else if (!settings.workspaceFolder && !isUNC(filename)) {
8573                 const directory = path.dirname(filename);
8574                 if (directory && path.isAbsolute(directory))
8575                     newOptions.cwd = directory;
8576             }
8577         }
8578         return callback(filename, newOptions);
8579     }
8580     finally {
8581         if (cwd !== process.cwd())
8582             process.chdir(cwd);
8583     }
8584 }
8585 exports.executeInWorkspaceDirectory = executeInWorkspaceDirectory;
8586
8587
8588 /***/ }),
8589 /* 49 */
8590 /***/ (function(module, exports) {
8591
8592 /**
8593  * This library modifies the diff-patch-match library by Neil Fraser
8594  * by removing the patch and match functionality and certain advanced
8595  * options in the diff function. The original license is as follows:
8596  *
8597  * ===
8598  *
8599  * Diff Match and Patch
8600  *
8601  * Copyright 2006 Google Inc.
8602  * http://code.google.com/p/google-diff-match-patch/
8603  *
8604  * Licensed under the Apache License, Version 2.0 (the "License");
8605  * you may not use this file except in compliance with the License.
8606  * You may obtain a copy of the License at
8607  *
8608  *   http://www.apache.org/licenses/LICENSE-2.0
8609  *
8610  * Unless required by applicable law or agreed to in writing, software
8611  * distributed under the License is distributed on an "AS IS" BASIS,
8612  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8613  * See the License for the specific language governing permissions and
8614  * limitations under the License.
8615  */
8616
8617
8618 /**
8619  * The data structure representing a diff is an array of tuples:
8620  * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
8621  * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
8622  */
8623 var DIFF_DELETE = -1;
8624 var DIFF_INSERT = 1;
8625 var DIFF_EQUAL = 0;
8626
8627
8628 /**
8629  * Find the differences between two texts.  Simplifies the problem by stripping
8630  * any common prefix or suffix off the texts before diffing.
8631  * @param {string} text1 Old string to be diffed.
8632  * @param {string} text2 New string to be diffed.
8633  * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info
8634  * @return {Array} Array of diff tuples.
8635  */
8636 function diff_main(text1, text2, cursor_pos, _fix_unicode) {
8637   // Check for equality
8638   if (text1 === text2) {
8639     if (text1) {
8640       return [[DIFF_EQUAL, text1]];
8641     }
8642     return [];
8643   }
8644
8645   if (cursor_pos != null) {
8646     var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
8647     if (editdiff) {
8648       return editdiff;
8649     }
8650   }
8651
8652   // Trim off common prefix (speedup).
8653   var commonlength = diff_commonPrefix(text1, text2);
8654   var commonprefix = text1.substring(0, commonlength);
8655   text1 = text1.substring(commonlength);
8656   text2 = text2.substring(commonlength);
8657
8658   // Trim off common suffix (speedup).
8659   commonlength = diff_commonSuffix(text1, text2);
8660   var commonsuffix = text1.substring(text1.length - commonlength);
8661   text1 = text1.substring(0, text1.length - commonlength);
8662   text2 = text2.substring(0, text2.length - commonlength);
8663
8664   // Compute the diff on the middle block.
8665   var diffs = diff_compute_(text1, text2);
8666
8667   // Restore the prefix and suffix.
8668   if (commonprefix) {
8669     diffs.unshift([DIFF_EQUAL, commonprefix]);
8670   }
8671   if (commonsuffix) {
8672     diffs.push([DIFF_EQUAL, commonsuffix]);
8673   }
8674   diff_cleanupMerge(diffs, _fix_unicode);
8675   return diffs;
8676 };
8677
8678
8679 /**
8680  * Find the differences between two texts.  Assumes that the texts do not
8681  * have any common prefix or suffix.
8682  * @param {string} text1 Old string to be diffed.
8683  * @param {string} text2 New string to be diffed.
8684  * @return {Array} Array of diff tuples.
8685  */
8686 function diff_compute_(text1, text2) {
8687   var diffs;
8688
8689   if (!text1) {
8690     // Just add some text (speedup).
8691     return [[DIFF_INSERT, text2]];
8692   }
8693
8694   if (!text2) {
8695     // Just delete some text (speedup).
8696     return [[DIFF_DELETE, text1]];
8697   }
8698
8699   var longtext = text1.length > text2.length ? text1 : text2;
8700   var shorttext = text1.length > text2.length ? text2 : text1;
8701   var i = longtext.indexOf(shorttext);
8702   if (i !== -1) {
8703     // Shorter text is inside the longer text (speedup).
8704     diffs = [
8705       [DIFF_INSERT, longtext.substring(0, i)],
8706       [DIFF_EQUAL, shorttext],
8707       [DIFF_INSERT, longtext.substring(i + shorttext.length)]
8708     ];
8709     // Swap insertions for deletions if diff is reversed.
8710     if (text1.length > text2.length) {
8711       diffs[0][0] = diffs[2][0] = DIFF_DELETE;
8712     }
8713     return diffs;
8714   }
8715
8716   if (shorttext.length === 1) {
8717     // Single character string.
8718     // After the previous speedup, the character can't be an equality.
8719     return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
8720   }
8721
8722   // Check to see if the problem can be split in two.
8723   var hm = diff_halfMatch_(text1, text2);
8724   if (hm) {
8725     // A half-match was found, sort out the return data.
8726     var text1_a = hm[0];
8727     var text1_b = hm[1];
8728     var text2_a = hm[2];
8729     var text2_b = hm[3];
8730     var mid_common = hm[4];
8731     // Send both pairs off for separate processing.
8732     var diffs_a = diff_main(text1_a, text2_a);
8733     var diffs_b = diff_main(text1_b, text2_b);
8734     // Merge the results.
8735     return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
8736   }
8737
8738   return diff_bisect_(text1, text2);
8739 };
8740
8741
8742 /**
8743  * Find the 'middle snake' of a diff, split the problem in two
8744  * and return the recursively constructed diff.
8745  * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
8746  * @param {string} text1 Old string to be diffed.
8747  * @param {string} text2 New string to be diffed.
8748  * @return {Array} Array of diff tuples.
8749  * @private
8750  */
8751 function diff_bisect_(text1, text2) {
8752   // Cache the text lengths to prevent multiple calls.
8753   var text1_length = text1.length;
8754   var text2_length = text2.length;
8755   var max_d = Math.ceil((text1_length + text2_length) / 2);
8756   var v_offset = max_d;
8757   var v_length = 2 * max_d;
8758   var v1 = new Array(v_length);
8759   var v2 = new Array(v_length);
8760   // Setting all elements to -1 is faster in Chrome & Firefox than mixing
8761   // integers and undefined.
8762   for (var x = 0; x < v_length; x++) {
8763     v1[x] = -1;
8764     v2[x] = -1;
8765   }
8766   v1[v_offset + 1] = 0;
8767   v2[v_offset + 1] = 0;
8768   var delta = text1_length - text2_length;
8769   // If the total number of characters is odd, then the front path will collide
8770   // with the reverse path.
8771   var front = (delta % 2 !== 0);
8772   // Offsets for start and end of k loop.
8773   // Prevents mapping of space beyond the grid.
8774   var k1start = 0;
8775   var k1end = 0;
8776   var k2start = 0;
8777   var k2end = 0;
8778   for (var d = 0; d < max_d; d++) {
8779     // Walk the front path one step.
8780     for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
8781       var k1_offset = v_offset + k1;
8782       var x1;
8783       if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
8784         x1 = v1[k1_offset + 1];
8785       } else {
8786         x1 = v1[k1_offset - 1] + 1;
8787       }
8788       var y1 = x1 - k1;
8789       while (
8790         x1 < text1_length && y1 < text2_length &&
8791         text1.charAt(x1) === text2.charAt(y1)
8792       ) {
8793         x1++;
8794         y1++;
8795       }
8796       v1[k1_offset] = x1;
8797       if (x1 > text1_length) {
8798         // Ran off the right of the graph.
8799         k1end += 2;
8800       } else if (y1 > text2_length) {
8801         // Ran off the bottom of the graph.
8802         k1start += 2;
8803       } else if (front) {
8804         var k2_offset = v_offset + delta - k1;
8805         if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
8806           // Mirror x2 onto top-left coordinate system.
8807           var x2 = text1_length - v2[k2_offset];
8808           if (x1 >= x2) {
8809             // Overlap detected.
8810             return diff_bisectSplit_(text1, text2, x1, y1);
8811           }
8812         }
8813       }
8814     }
8815
8816     // Walk the reverse path one step.
8817     for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
8818       var k2_offset = v_offset + k2;
8819       var x2;
8820       if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
8821         x2 = v2[k2_offset + 1];
8822       } else {
8823         x2 = v2[k2_offset - 1] + 1;
8824       }
8825       var y2 = x2 - k2;
8826       while (
8827         x2 < text1_length && y2 < text2_length &&
8828         text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)
8829       ) {
8830         x2++;
8831         y2++;
8832       }
8833       v2[k2_offset] = x2;
8834       if (x2 > text1_length) {
8835         // Ran off the left of the graph.
8836         k2end += 2;
8837       } else if (y2 > text2_length) {
8838         // Ran off the top of the graph.
8839         k2start += 2;
8840       } else if (!front) {
8841         var k1_offset = v_offset + delta - k2;
8842         if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {
8843           var x1 = v1[k1_offset];
8844           var y1 = v_offset + x1 - k1_offset;
8845           // Mirror x2 onto top-left coordinate system.
8846           x2 = text1_length - x2;
8847           if (x1 >= x2) {
8848             // Overlap detected.
8849             return diff_bisectSplit_(text1, text2, x1, y1);
8850           }
8851         }
8852       }
8853     }
8854   }
8855   // Diff took too long and hit the deadline or
8856   // number of diffs equals number of characters, no commonality at all.
8857   return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
8858 };
8859
8860
8861 /**
8862  * Given the location of the 'middle snake', split the diff in two parts
8863  * and recurse.
8864  * @param {string} text1 Old string to be diffed.
8865  * @param {string} text2 New string to be diffed.
8866  * @param {number} x Index of split point in text1.
8867  * @param {number} y Index of split point in text2.
8868  * @return {Array} Array of diff tuples.
8869  */
8870 function diff_bisectSplit_(text1, text2, x, y) {
8871   var text1a = text1.substring(0, x);
8872   var text2a = text2.substring(0, y);
8873   var text1b = text1.substring(x);
8874   var text2b = text2.substring(y);
8875
8876   // Compute both diffs serially.
8877   var diffs = diff_main(text1a, text2a);
8878   var diffsb = diff_main(text1b, text2b);
8879
8880   return diffs.concat(diffsb);
8881 };
8882
8883
8884 /**
8885  * Determine the common prefix of two strings.
8886  * @param {string} text1 First string.
8887  * @param {string} text2 Second string.
8888  * @return {number} The number of characters common to the start of each
8889  *     string.
8890  */
8891 function diff_commonPrefix(text1, text2) {
8892   // Quick check for common null cases.
8893   if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
8894     return 0;
8895   }
8896   // Binary search.
8897   // Performance analysis: http://neil.fraser.name/news/2007/10/09/
8898   var pointermin = 0;
8899   var pointermax = Math.min(text1.length, text2.length);
8900   var pointermid = pointermax;
8901   var pointerstart = 0;
8902   while (pointermin < pointermid) {
8903     if (
8904       text1.substring(pointerstart, pointermid) ==
8905       text2.substring(pointerstart, pointermid)
8906     ) {
8907       pointermin = pointermid;
8908       pointerstart = pointermin;
8909     } else {
8910       pointermax = pointermid;
8911     }
8912     pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
8913   }
8914
8915   if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
8916     pointermid--;
8917   }
8918
8919   return pointermid;
8920 };
8921
8922
8923 /**
8924  * Determine the common suffix of two strings.
8925  * @param {string} text1 First string.
8926  * @param {string} text2 Second string.
8927  * @return {number} The number of characters common to the end of each string.
8928  */
8929 function diff_commonSuffix(text1, text2) {
8930   // Quick check for common null cases.
8931   if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
8932     return 0;
8933   }
8934   // Binary search.
8935   // Performance analysis: http://neil.fraser.name/news/2007/10/09/
8936   var pointermin = 0;
8937   var pointermax = Math.min(text1.length, text2.length);
8938   var pointermid = pointermax;
8939   var pointerend = 0;
8940   while (pointermin < pointermid) {
8941     if (
8942       text1.substring(text1.length - pointermid, text1.length - pointerend) ==
8943       text2.substring(text2.length - pointermid, text2.length - pointerend)
8944     ) {
8945       pointermin = pointermid;
8946       pointerend = pointermin;
8947     } else {
8948       pointermax = pointermid;
8949     }
8950     pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
8951   }
8952
8953   if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
8954     pointermid--;
8955   }
8956
8957   return pointermid;
8958 };
8959
8960
8961 /**
8962  * Do the two texts share a substring which is at least half the length of the
8963  * longer text?
8964  * This speedup can produce non-minimal diffs.
8965  * @param {string} text1 First string.
8966  * @param {string} text2 Second string.
8967  * @return {Array.<string>} Five element Array, containing the prefix of
8968  *     text1, the suffix of text1, the prefix of text2, the suffix of
8969  *     text2 and the common middle.  Or null if there was no match.
8970  */
8971 function diff_halfMatch_(text1, text2) {
8972   var longtext = text1.length > text2.length ? text1 : text2;
8973   var shorttext = text1.length > text2.length ? text2 : text1;
8974   if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
8975     return null;  // Pointless.
8976   }
8977
8978   /**
8979    * Does a substring of shorttext exist within longtext such that the substring
8980    * is at least half the length of longtext?
8981    * Closure, but does not reference any external variables.
8982    * @param {string} longtext Longer string.
8983    * @param {string} shorttext Shorter string.
8984    * @param {number} i Start index of quarter length substring within longtext.
8985    * @return {Array.<string>} Five element Array, containing the prefix of
8986    *     longtext, the suffix of longtext, the prefix of shorttext, the suffix
8987    *     of shorttext and the common middle.  Or null if there was no match.
8988    * @private
8989    */
8990   function diff_halfMatchI_(longtext, shorttext, i) {
8991     // Start with a 1/4 length substring at position i as a seed.
8992     var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
8993     var j = -1;
8994     var best_common = '';
8995     var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
8996     while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
8997       var prefixLength = diff_commonPrefix(
8998         longtext.substring(i), shorttext.substring(j));
8999       var suffixLength = diff_commonSuffix(
9000         longtext.substring(0, i), shorttext.substring(0, j));
9001       if (best_common.length < suffixLength + prefixLength) {
9002         best_common = shorttext.substring(
9003           j - suffixLength, j) + shorttext.substring(j, j + prefixLength);
9004         best_longtext_a = longtext.substring(0, i - suffixLength);
9005         best_longtext_b = longtext.substring(i + prefixLength);
9006         best_shorttext_a = shorttext.substring(0, j - suffixLength);
9007         best_shorttext_b = shorttext.substring(j + prefixLength);
9008       }
9009     }
9010     if (best_common.length * 2 >= longtext.length) {
9011       return [
9012         best_longtext_a, best_longtext_b,
9013         best_shorttext_a, best_shorttext_b, best_common
9014       ];
9015     } else {
9016       return null;
9017     }
9018   }
9019
9020   // First check if the second quarter is the seed for a half-match.
9021   var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));
9022   // Check again based on the third quarter.
9023   var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
9024   var hm;
9025   if (!hm1 && !hm2) {
9026     return null;
9027   } else if (!hm2) {
9028     hm = hm1;
9029   } else if (!hm1) {
9030     hm = hm2;
9031   } else {
9032     // Both matched.  Select the longest.
9033     hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
9034   }
9035
9036   // A half-match was found, sort out the return data.
9037   var text1_a, text1_b, text2_a, text2_b;
9038   if (text1.length > text2.length) {
9039     text1_a = hm[0];
9040     text1_b = hm[1];
9041     text2_a = hm[2];
9042     text2_b = hm[3];
9043   } else {
9044     text2_a = hm[0];
9045     text2_b = hm[1];
9046     text1_a = hm[2];
9047     text1_b = hm[3];
9048   }
9049   var mid_common = hm[4];
9050   return [text1_a, text1_b, text2_a, text2_b, mid_common];
9051 };
9052
9053
9054 /**
9055  * Reorder and merge like edit sections.  Merge equalities.
9056  * Any edit section can move as long as it doesn't cross an equality.
9057  * @param {Array} diffs Array of diff tuples.
9058  * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff
9059  */
9060 function diff_cleanupMerge(diffs, fix_unicode) {
9061   diffs.push([DIFF_EQUAL, '']);  // Add a dummy entry at the end.
9062   var pointer = 0;
9063   var count_delete = 0;
9064   var count_insert = 0;
9065   var text_delete = '';
9066   var text_insert = '';
9067   var commonlength;
9068   while (pointer < diffs.length) {
9069     if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
9070       diffs.splice(pointer, 1);
9071       continue;
9072     }
9073     switch (diffs[pointer][0]) {
9074       case DIFF_INSERT:
9075
9076         count_insert++;
9077         text_insert += diffs[pointer][1];
9078         pointer++;
9079         break;
9080       case DIFF_DELETE:
9081         count_delete++;
9082         text_delete += diffs[pointer][1];
9083         pointer++;
9084         break;
9085       case DIFF_EQUAL:
9086         var previous_equality = pointer - count_insert - count_delete - 1;
9087         if (fix_unicode) {
9088           // prevent splitting of unicode surrogate pairs.  when fix_unicode is true,
9089           // we assume that the old and new text in the diff are complete and correct
9090           // unicode-encoded JS strings, but the tuple boundaries may fall between
9091           // surrogate pairs.  we fix this by shaving off stray surrogates from the end
9092           // of the previous equality and the beginning of this equality.  this may create
9093           // empty equalities or a common prefix or suffix.  for example, if AB and AC are
9094           // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and
9095           // inserting 'AC', and then the common suffix 'AC' will be eliminated.  in this
9096           // particular case, both equalities go away, we absorb any previous inequalities,
9097           // and we keep scanning for the next equality before rewriting the tuples.
9098           if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
9099             var stray = diffs[previous_equality][1].slice(-1);
9100             diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
9101             text_delete = stray + text_delete;
9102             text_insert = stray + text_insert;
9103             if (!diffs[previous_equality][1]) {
9104               // emptied out previous equality, so delete it and include previous delete/insert
9105               diffs.splice(previous_equality, 1);
9106               pointer--;
9107               var k = previous_equality - 1;
9108               if (diffs[k] && diffs[k][0] === DIFF_INSERT) {
9109                 count_insert++;
9110                 text_insert = diffs[k][1] + text_insert;
9111                 k--;
9112               }
9113               if (diffs[k] && diffs[k][0] === DIFF_DELETE) {
9114                 count_delete++;
9115                 text_delete = diffs[k][1] + text_delete;
9116                 k--;
9117               }
9118               previous_equality = k;
9119             }
9120           }
9121           if (starts_with_pair_end(diffs[pointer][1])) {
9122             var stray = diffs[pointer][1].charAt(0);
9123             diffs[pointer][1] = diffs[pointer][1].slice(1);
9124             text_delete += stray;
9125             text_insert += stray;
9126           }
9127         }
9128         if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
9129           // for empty equality not at end, wait for next equality
9130           diffs.splice(pointer, 1);
9131           break;
9132         }
9133         if (text_delete.length > 0 || text_insert.length > 0) {
9134           // note that diff_commonPrefix and diff_commonSuffix are unicode-aware
9135           if (text_delete.length > 0 && text_insert.length > 0) {
9136             // Factor out any common prefixes.
9137             commonlength = diff_commonPrefix(text_insert, text_delete);
9138             if (commonlength !== 0) {
9139               if (previous_equality >= 0) {
9140                 diffs[previous_equality][1] += text_insert.substring(0, commonlength);
9141               } else {
9142                 diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);
9143                 pointer++;
9144               }
9145               text_insert = text_insert.substring(commonlength);
9146               text_delete = text_delete.substring(commonlength);
9147             }
9148             // Factor out any common suffixes.
9149             commonlength = diff_commonSuffix(text_insert, text_delete);
9150             if (commonlength !== 0) {
9151               diffs[pointer][1] =
9152                 text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
9153               text_insert = text_insert.substring(0, text_insert.length - commonlength);
9154               text_delete = text_delete.substring(0, text_delete.length - commonlength);
9155             }
9156           }
9157           // Delete the offending records and add the merged ones.
9158           var n = count_insert + count_delete;
9159           if (text_delete.length === 0 && text_insert.length === 0) {
9160             diffs.splice(pointer - n, n);
9161             pointer = pointer - n;
9162           } else if (text_delete.length === 0) {
9163             diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);
9164             pointer = pointer - n + 1;
9165           } else if (text_insert.length === 0) {
9166             diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);
9167             pointer = pointer - n + 1;
9168           } else {
9169             diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
9170             pointer = pointer - n + 2;
9171           }
9172         }
9173         if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
9174           // Merge this equality with the previous one.
9175           diffs[pointer - 1][1] += diffs[pointer][1];
9176           diffs.splice(pointer, 1);
9177         } else {
9178           pointer++;
9179         }
9180         count_insert = 0;
9181         count_delete = 0;
9182         text_delete = '';
9183         text_insert = '';
9184         break;
9185     }
9186   }
9187   if (diffs[diffs.length - 1][1] === '') {
9188     diffs.pop();  // Remove the dummy entry at the end.
9189   }
9190
9191   // Second pass: look for single edits surrounded on both sides by equalities
9192   // which can be shifted sideways to eliminate an equality.
9193   // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
9194   var changes = false;
9195   pointer = 1;
9196   // Intentionally ignore the first and last element (don't need checking).
9197   while (pointer < diffs.length - 1) {
9198     if (diffs[pointer - 1][0] === DIFF_EQUAL &&
9199       diffs[pointer + 1][0] === DIFF_EQUAL) {
9200       // This is a single edit surrounded by equalities.
9201       if (diffs[pointer][1].substring(diffs[pointer][1].length -
9202         diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
9203         // Shift the edit over the previous equality.
9204         diffs[pointer][1] = diffs[pointer - 1][1] +
9205           diffs[pointer][1].substring(0, diffs[pointer][1].length -
9206             diffs[pointer - 1][1].length);
9207         diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
9208         diffs.splice(pointer - 1, 1);
9209         changes = true;
9210       } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
9211         diffs[pointer + 1][1]) {
9212         // Shift the edit over the next equality.
9213         diffs[pointer - 1][1] += diffs[pointer + 1][1];
9214         diffs[pointer][1] =
9215           diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
9216           diffs[pointer + 1][1];
9217         diffs.splice(pointer + 1, 1);
9218         changes = true;
9219       }
9220     }
9221     pointer++;
9222   }
9223   // If shifts were made, the diff needs reordering and another shift sweep.
9224   if (changes) {
9225     diff_cleanupMerge(diffs, fix_unicode);
9226   }
9227 };
9228
9229 function is_surrogate_pair_start(charCode) {
9230   return charCode >= 0xD800 && charCode <= 0xDBFF;
9231 }
9232
9233 function is_surrogate_pair_end(charCode) {
9234   return charCode >= 0xDC00 && charCode <= 0xDFFF;
9235 }
9236
9237 function starts_with_pair_end(str) {
9238   return is_surrogate_pair_end(str.charCodeAt(0));
9239 }
9240
9241 function ends_with_pair_start(str) {
9242   return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
9243 }
9244
9245 function remove_empty_tuples(tuples) {
9246   var ret = [];
9247   for (var i = 0; i < tuples.length; i++) {
9248     if (tuples[i][1].length > 0) {
9249       ret.push(tuples[i]);
9250     }
9251   }
9252   return ret;
9253 }
9254
9255 function make_edit_splice(before, oldMiddle, newMiddle, after) {
9256   if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
9257     return null;
9258   }
9259   return remove_empty_tuples([
9260     [DIFF_EQUAL, before],
9261     [DIFF_DELETE, oldMiddle],
9262     [DIFF_INSERT, newMiddle],
9263     [DIFF_EQUAL, after]
9264   ]);
9265 }
9266
9267 function find_cursor_edit_diff(oldText, newText, cursor_pos) {
9268   // note: this runs after equality check has ruled out exact equality
9269   var oldRange = typeof cursor_pos === 'number' ?
9270     { index: cursor_pos, length: 0 } : cursor_pos.oldRange;
9271   var newRange = typeof cursor_pos === 'number' ?
9272     null : cursor_pos.newRange;
9273   // take into account the old and new selection to generate the best diff
9274   // possible for a text edit.  for example, a text change from "xxx" to "xx"
9275   // could be a delete or forwards-delete of any one of the x's, or the
9276   // result of selecting two of the x's and typing "x".
9277   var oldLength = oldText.length;
9278   var newLength = newText.length;
9279   if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
9280     // see if we have an insert or delete before or after cursor
9281     var oldCursor = oldRange.index;
9282     var oldBefore = oldText.slice(0, oldCursor);
9283     var oldAfter = oldText.slice(oldCursor);
9284     var maybeNewCursor = newRange ? newRange.index : null;
9285     editBefore: {
9286       // is this an insert or delete right before oldCursor?
9287       var newCursor = oldCursor + newLength - oldLength;
9288       if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
9289         break editBefore;
9290       }
9291       if (newCursor < 0 || newCursor > newLength) {
9292         break editBefore;
9293       }
9294       var newBefore = newText.slice(0, newCursor);
9295       var newAfter = newText.slice(newCursor);
9296       if (newAfter !== oldAfter) {
9297         break editBefore;
9298       }
9299       var prefixLength = Math.min(oldCursor, newCursor);
9300       var oldPrefix = oldBefore.slice(0, prefixLength);
9301       var newPrefix = newBefore.slice(0, prefixLength);
9302       if (oldPrefix !== newPrefix) {
9303         break editBefore;
9304       }
9305       var oldMiddle = oldBefore.slice(prefixLength);
9306       var newMiddle = newBefore.slice(prefixLength);
9307       return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
9308     }
9309     editAfter: {
9310       // is this an insert or delete right after oldCursor?
9311       if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
9312         break editAfter;
9313       }
9314       var cursor = oldCursor;
9315       var newBefore = newText.slice(0, cursor);
9316       var newAfter = newText.slice(cursor);
9317       if (newBefore !== oldBefore) {
9318         break editAfter;
9319       }
9320       var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
9321       var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
9322       var newSuffix = newAfter.slice(newAfter.length - suffixLength);
9323       if (oldSuffix !== newSuffix) {
9324         break editAfter;
9325       }
9326       var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
9327       var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);
9328       return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);
9329     }
9330   }
9331   if (oldRange.length > 0 && newRange && newRange.length === 0) {
9332     replaceRange: {
9333       // see if diff could be a splice of the old selection range
9334       var oldPrefix = oldText.slice(0, oldRange.index);
9335       var oldSuffix = oldText.slice(oldRange.index + oldRange.length);
9336       var prefixLength = oldPrefix.length;
9337       var suffixLength = oldSuffix.length;
9338       if (newLength < prefixLength + suffixLength) {
9339         break replaceRange;
9340       }
9341       var newPrefix = newText.slice(0, prefixLength);
9342       var newSuffix = newText.slice(newLength - suffixLength);
9343       if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {
9344         break replaceRange;
9345       }
9346       var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);
9347       var newMiddle = newText.slice(prefixLength, newLength - suffixLength);
9348       return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);
9349     }
9350   }
9351
9352   return null;
9353 }
9354
9355 function diff(text1, text2, cursor_pos) {
9356   // only pass fix_unicode=true at the top level, not when diff_main is
9357   // recursively invoked
9358   return diff_main(text1, text2, cursor_pos, true);
9359 }
9360
9361 diff.INSERT = DIFF_INSERT;
9362 diff.DELETE = DIFF_DELETE;
9363 diff.EQUAL = DIFF_EQUAL;
9364
9365 module.exports = diff;
9366
9367
9368 /***/ }),
9369 /* 50 */
9370 /***/ (function(module, exports, __webpack_require__) {
9371
9372 "use strict";
9373
9374 const path = __webpack_require__(3);
9375 const Module = __webpack_require__(51);
9376 const fs = __webpack_require__(2);
9377
9378 const resolveFrom = (fromDirectory, moduleId, silent) => {
9379         if (typeof fromDirectory !== 'string') {
9380                 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
9381         }
9382
9383         if (typeof moduleId !== 'string') {
9384                 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
9385         }
9386
9387         try {
9388                 fromDirectory = fs.realpathSync(fromDirectory);
9389         } catch (error) {
9390                 if (error.code === 'ENOENT') {
9391                         fromDirectory = path.resolve(fromDirectory);
9392                 } else if (silent) {
9393                         return;
9394                 } else {
9395                         throw error;
9396                 }
9397         }
9398
9399         const fromFile = path.join(fromDirectory, 'noop.js');
9400
9401         const resolveFileName = () => Module._resolveFilename(moduleId, {
9402                 id: fromFile,
9403                 filename: fromFile,
9404                 paths: Module._nodeModulePaths(fromDirectory)
9405         });
9406
9407         if (silent) {
9408                 try {
9409                         return resolveFileName();
9410                 } catch (error) {
9411                         return;
9412                 }
9413         }
9414
9415         return resolveFileName();
9416 };
9417
9418 module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
9419 module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);
9420
9421
9422 /***/ }),
9423 /* 51 */
9424 /***/ (function(module, exports) {
9425
9426 module.exports = require("module");
9427
9428 /***/ }),
9429 /* 52 */
9430 /***/ (function(module, __webpack_exports__, __webpack_require__) {
9431
9432 "use strict";
9433 __webpack_require__.r(__webpack_exports__);
9434 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
9435 /* --------------------------------------------------------------------------------------------\r
9436  * Copyright (c) Microsoft Corporation. All rights reserved.\r
9437  * Licensed under the MIT License. See License.txt in the project root for license information.\r
9438  * ------------------------------------------------------------------------------------------ */\r
9439 \r
9440 var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {\r
9441     for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r
9442     for (var r = Array(s), k = 0, i = 0; i < il; i++)\r
9443         for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r
9444             r[k] = a[j];\r
9445     return r;\r
9446 };\r
9447 var FullTextDocument = /** @class */ (function () {\r
9448     function FullTextDocument(uri, languageId, version, content) {\r
9449         this._uri = uri;\r
9450         this._languageId = languageId;\r
9451         this._version = version;\r
9452         this._content = content;\r
9453         this._lineOffsets = undefined;\r
9454     }\r
9455     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
9456         get: function () {\r
9457             return this._uri;\r
9458         },\r
9459         enumerable: true,\r
9460         configurable: true\r
9461     });\r
9462     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
9463         get: function () {\r
9464             return this._languageId;\r
9465         },\r
9466         enumerable: true,\r
9467         configurable: true\r
9468     });\r
9469     Object.defineProperty(FullTextDocument.prototype, "version", {\r
9470         get: function () {\r
9471             return this._version;\r
9472         },\r
9473         enumerable: true,\r
9474         configurable: true\r
9475     });\r
9476     FullTextDocument.prototype.getText = function (range) {\r
9477         if (range) {\r
9478             var start = this.offsetAt(range.start);\r
9479             var end = this.offsetAt(range.end);\r
9480             return this._content.substring(start, end);\r
9481         }\r
9482         return this._content;\r
9483     };\r
9484     FullTextDocument.prototype.update = function (changes, version) {\r
9485         for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {\r
9486             var change = changes_1[_i];\r
9487             if (FullTextDocument.isIncremental(change)) {\r
9488                 // makes sure start is before end\r
9489                 var range = getWellformedRange(change.range);\r
9490                 // update content\r
9491                 var startOffset = this.offsetAt(range.start);\r
9492                 var endOffset = this.offsetAt(range.end);\r
9493                 this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);\r
9494                 // update the offsets\r
9495                 var startLine = Math.max(range.start.line, 0);\r
9496                 var endLine = Math.max(range.end.line, 0);\r
9497                 var lineOffsets = this._lineOffsets;\r
9498                 var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);\r
9499                 if (endLine - startLine === addedLineOffsets.length) {\r
9500                     for (var i = 0, len = addedLineOffsets.length; i < len; i++) {\r
9501                         lineOffsets[i + startLine + 1] = addedLineOffsets[i];\r
9502                     }\r
9503                 }\r
9504                 else {\r
9505                     if (addedLineOffsets.length < 10000) {\r
9506                         lineOffsets.splice.apply(lineOffsets, __spreadArrays([startLine + 1, endLine - startLine], addedLineOffsets));\r
9507                     }\r
9508                     else { // avoid too many arguments for splice\r
9509                         this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));\r
9510                     }\r
9511                 }\r
9512                 var diff = change.text.length - (endOffset - startOffset);\r
9513                 if (diff !== 0) {\r
9514                     for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {\r
9515                         lineOffsets[i] = lineOffsets[i] + diff;\r
9516                     }\r
9517                 }\r
9518             }\r
9519             else if (FullTextDocument.isFull(change)) {\r
9520                 this._content = change.text;\r
9521                 this._lineOffsets = undefined;\r
9522             }\r
9523             else {\r
9524                 throw new Error('Unknown change event received');\r
9525             }\r
9526         }\r
9527         this._version = version;\r
9528     };\r
9529     FullTextDocument.prototype.getLineOffsets = function () {\r
9530         if (this._lineOffsets === undefined) {\r
9531             this._lineOffsets = computeLineOffsets(this._content, true);\r
9532         }\r
9533         return this._lineOffsets;\r
9534     };\r
9535     FullTextDocument.prototype.positionAt = function (offset) {\r
9536         offset = Math.max(Math.min(offset, this._content.length), 0);\r
9537         var lineOffsets = this.getLineOffsets();\r
9538         var low = 0, high = lineOffsets.length;\r
9539         if (high === 0) {\r
9540             return { line: 0, character: offset };\r
9541         }\r
9542         while (low < high) {\r
9543             var mid = Math.floor((low + high) / 2);\r
9544             if (lineOffsets[mid] > offset) {\r
9545                 high = mid;\r
9546             }\r
9547             else {\r
9548                 low = mid + 1;\r
9549             }\r
9550         }\r
9551         // low is the least x for which the line offset is larger than the current offset\r
9552         // or array.length if no line offset is larger than the current offset\r
9553         var line = low - 1;\r
9554         return { line: line, character: offset - lineOffsets[line] };\r
9555     };\r
9556     FullTextDocument.prototype.offsetAt = function (position) {\r
9557         var lineOffsets = this.getLineOffsets();\r
9558         if (position.line >= lineOffsets.length) {\r
9559             return this._content.length;\r
9560         }\r
9561         else if (position.line < 0) {\r
9562             return 0;\r
9563         }\r
9564         var lineOffset = lineOffsets[position.line];\r
9565         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
9566         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
9567     };\r
9568     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
9569         get: function () {\r
9570             return this.getLineOffsets().length;\r
9571         },\r
9572         enumerable: true,\r
9573         configurable: true\r
9574     });\r
9575     FullTextDocument.isIncremental = function (event) {\r
9576         var candidate = event;\r
9577         return candidate !== undefined && candidate !== null &&\r
9578             typeof candidate.text === 'string' && candidate.range !== undefined &&\r
9579             (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');\r
9580     };\r
9581     FullTextDocument.isFull = function (event) {\r
9582         var candidate = event;\r
9583         return candidate !== undefined && candidate !== null &&\r
9584             typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;\r
9585     };\r
9586     return FullTextDocument;\r
9587 }());\r
9588 var TextDocument;\r
9589 (function (TextDocument) {\r
9590     /**\r
9591      * Creates a new text document.\r
9592      *\r
9593      * @param uri The document's uri.\r
9594      * @param languageId  The document's language Id.\r
9595      * @param version The document's initial version number.\r
9596      * @param content The document's content.\r
9597      */\r
9598     function create(uri, languageId, version, content) {\r
9599         return new FullTextDocument(uri, languageId, version, content);\r
9600     }\r
9601     TextDocument.create = create;\r
9602     /**\r
9603      * Updates a TextDocument by modifing its content.\r
9604      *\r
9605      * @param document the document to update. Only documents created by TextDocument.create are valid inputs.\r
9606      * @param changes the changes to apply to the document.\r
9607      * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.\r
9608      *\r
9609      */\r
9610     function update(document, changes, version) {\r
9611         if (document instanceof FullTextDocument) {\r
9612             document.update(changes, version);\r
9613             return document;\r
9614         }\r
9615         else {\r
9616             throw new Error('TextDocument.update: document must be created by TextDocument.create');\r
9617         }\r
9618     }\r
9619     TextDocument.update = update;\r
9620     function applyEdits(document, edits) {\r
9621         var text = document.getText();\r
9622         var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {\r
9623             var diff = a.range.start.line - b.range.start.line;\r
9624             if (diff === 0) {\r
9625                 return a.range.start.character - b.range.start.character;\r
9626             }\r
9627             return diff;\r
9628         });\r
9629         var lastModifiedOffset = text.length;\r
9630         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
9631             var e = sortedEdits[i];\r
9632             var startOffset = document.offsetAt(e.range.start);\r
9633             var endOffset = document.offsetAt(e.range.end);\r
9634             if (endOffset <= lastModifiedOffset) {\r
9635                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
9636             }\r
9637             else {\r
9638                 throw new Error('Overlapping edit');\r
9639             }\r
9640             lastModifiedOffset = startOffset;\r
9641         }\r
9642         return text;\r
9643     }\r
9644     TextDocument.applyEdits = applyEdits;\r
9645 })(TextDocument || (TextDocument = {}));\r
9646 function mergeSort(data, compare) {\r
9647     if (data.length <= 1) {\r
9648         // sorted\r
9649         return data;\r
9650     }\r
9651     var p = (data.length / 2) | 0;\r
9652     var left = data.slice(0, p);\r
9653     var right = data.slice(p);\r
9654     mergeSort(left, compare);\r
9655     mergeSort(right, compare);\r
9656     var leftIdx = 0;\r
9657     var rightIdx = 0;\r
9658     var i = 0;\r
9659     while (leftIdx < left.length && rightIdx < right.length) {\r
9660         var ret = compare(left[leftIdx], right[rightIdx]);\r
9661         if (ret <= 0) {\r
9662             // smaller_equal -> take left to preserve order\r
9663             data[i++] = left[leftIdx++];\r
9664         }\r
9665         else {\r
9666             // greater -> take right\r
9667             data[i++] = right[rightIdx++];\r
9668         }\r
9669     }\r
9670     while (leftIdx < left.length) {\r
9671         data[i++] = left[leftIdx++];\r
9672     }\r
9673     while (rightIdx < right.length) {\r
9674         data[i++] = right[rightIdx++];\r
9675     }\r
9676     return data;\r
9677 }\r
9678 function computeLineOffsets(text, isAtLineStart, textOffset) {\r
9679     if (textOffset === void 0) { textOffset = 0; }\r
9680     var result = isAtLineStart ? [textOffset] : [];\r
9681     for (var i = 0; i < text.length; i++) {\r
9682         var ch = text.charCodeAt(i);\r
9683         if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {\r
9684             if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {\r
9685                 i++;\r
9686             }\r
9687             result.push(textOffset + i + 1);\r
9688         }\r
9689     }\r
9690     return result;\r
9691 }\r
9692 function getWellformedRange(range) {\r
9693     var start = range.start;\r
9694     var end = range.end;\r
9695     if (start.line > end.line || (start.line === end.line && start.character > end.character)) {\r
9696         return { start: end, end: start };\r
9697     }\r
9698     return range;\r
9699 }\r
9700 function getWellformedEdit(textEdit) {\r
9701     var range = getWellformedRange(textEdit.range);\r
9702     if (range !== textEdit.range) {\r
9703         return { newText: textEdit.newText, range: range };\r
9704     }\r
9705     return textEdit;\r
9706 }\r
9707
9708
9709 /***/ })
9710 /******/ ])));