f49148cdaf5b8b83c798ae8ef919ad8dc9018a6b
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-css / lib / index.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 = 0);
85 /******/ })
86 /************************************************************************/
87 /******/ ([
88 /* 0 */
89 /***/ (function(module, exports, __webpack_require__) {
90
91 "use strict";
92
93 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
94     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
95     return new (P || (P = Promise))(function (resolve, reject) {
96         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
97         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
98         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
99         step((generator = generator.apply(thisArg, _arguments || [])).next());
100     });
101 };
102 Object.defineProperty(exports, "__esModule", { value: true });
103 exports.activate = void 0;
104 const coc_nvim_1 = __webpack_require__(1);
105 const customData_1 = __webpack_require__(2);
106 const vscode_languageserver_protocol_1 = __webpack_require__(4);
107 var CustomDataChangedNotification;
108 (function (CustomDataChangedNotification) {
109     CustomDataChangedNotification.type = new vscode_languageserver_protocol_1.NotificationType('css/customDataChanged');
110 })(CustomDataChangedNotification || (CustomDataChangedNotification = {}));
111 function activate(context) {
112     return __awaiter(this, void 0, void 0, function* () {
113         let { subscriptions } = context;
114         const config = coc_nvim_1.workspace.getConfiguration().get('css', {});
115         if (!config.enable)
116             return;
117         const file = context.asAbsolutePath('./lib/server.js');
118         const selector = ['css', 'less', 'scss', 'wxss'];
119         const customDataSource = customData_1.getCustomDataSource(context.subscriptions);
120         let serverOptions = {
121             module: file,
122             transport: coc_nvim_1.TransportKind.ipc,
123             options: {
124                 cwd: coc_nvim_1.workspace.root,
125                 execArgv: config.execArgv || []
126             }
127         };
128         let clientOptions = {
129             documentSelector: selector,
130             synchronize: {
131                 configurationSection: ['css', 'less', 'scss', 'wxss']
132             },
133             outputChannelName: 'css',
134             initializationOptions: {
135                 handledSchemas: ['file']
136             },
137             middleware: {}
138         };
139         let client = new coc_nvim_1.LanguageClient('css', 'Css language server', serverOptions, clientOptions);
140         // tslint:disable-next-line: no-floating-promises
141         client.onReady().then(() => {
142             client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
143             customDataSource.onDidChange(() => {
144                 client.sendNotification(CustomDataChangedNotification.type, customDataSource.uris);
145             });
146         });
147         subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
148     });
149 }
150 exports.activate = activate;
151
152
153 /***/ }),
154 /* 1 */
155 /***/ (function(module, exports) {
156
157 module.exports = require("coc.nvim");
158
159 /***/ }),
160 /* 2 */
161 /***/ (function(module, exports, __webpack_require__) {
162
163 "use strict";
164
165 /*---------------------------------------------------------------------------------------------
166  *  Copyright (c) Microsoft Corporation. All rights reserved.
167  *  Licensed under the MIT License. See License.txt in the project root for license information.
168  *--------------------------------------------------------------------------------------------*/
169 var __importDefault = (this && this.__importDefault) || function (mod) {
170     return (mod && mod.__esModule) ? mod : { "default": mod };
171 };
172 Object.defineProperty(exports, "__esModule", { value: true });
173 exports.getCustomDataSource = void 0;
174 const coc_nvim_1 = __webpack_require__(1);
175 const path_1 = __importDefault(__webpack_require__(3));
176 const vscode_languageserver_protocol_1 = __webpack_require__(4);
177 const requests_1 = __webpack_require__(33);
178 function getCustomDataSource(toDispose) {
179     let pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
180     let pathsInExtensions = getCustomDataPathsFromAllExtensions();
181     const onChange = new vscode_languageserver_protocol_1.Emitter();
182     toDispose.push(coc_nvim_1.extensions.onDidActiveExtension(_ => {
183         const newPathsInExtensions = getCustomDataPathsFromAllExtensions();
184         if (newPathsInExtensions.length !== pathsInExtensions.length || !newPathsInExtensions.every((val, idx) => val === pathsInExtensions[idx])) {
185             pathsInExtensions = newPathsInExtensions;
186             onChange.fire();
187         }
188     }));
189     toDispose.push(coc_nvim_1.workspace.onDidChangeConfiguration(e => {
190         if (e.affectsConfiguration('css.customData')) {
191             pathsInWorkspace = getCustomDataPathsInAllWorkspaces();
192             onChange.fire();
193         }
194     }));
195     return {
196         get uris() {
197             return pathsInWorkspace.concat(pathsInExtensions);
198         },
199         get onDidChange() {
200             return onChange.event;
201         }
202     };
203 }
204 exports.getCustomDataSource = getCustomDataSource;
205 function getCustomDataPathsInAllWorkspaces() {
206     const workspaceFolders = coc_nvim_1.workspace.workspaceFolders;
207     const dataPaths = [];
208     if (!workspaceFolders) {
209         return dataPaths;
210     }
211     const collect = (paths, rootFolder) => {
212         if (Array.isArray(paths)) {
213             for (const path of paths) {
214                 if (typeof path === 'string') {
215                     dataPaths.push(requests_1.resolvePath(rootFolder, path).toString());
216                 }
217             }
218         }
219     };
220     for (let i = 0; i < workspaceFolders.length; i++) {
221         const folderUri = workspaceFolders[i].uri;
222         const allCssConfig = coc_nvim_1.workspace.getConfiguration('css', folderUri);
223         const customDataInspect = allCssConfig.inspect('customData');
224         if (customDataInspect) {
225             collect(customDataInspect.workspaceValue, coc_nvim_1.Uri.parse(folderUri));
226             if (i === 0) {
227                 collect(customDataInspect.globalValue, coc_nvim_1.Uri.parse(folderUri));
228             }
229         }
230     }
231     return dataPaths;
232 }
233 function getCustomDataPathsFromAllExtensions() {
234     var _a, _b, _c;
235     const dataPaths = [];
236     for (const extension of coc_nvim_1.extensions.all) {
237         const customData = (_c = (_b = (_a = extension.packageJSON) === null || _a === void 0 ? void 0 : _a.contributes) === null || _b === void 0 ? void 0 : _b.css) === null || _c === void 0 ? void 0 : _c.customData;
238         if (Array.isArray(customData)) {
239             for (const rp of customData) {
240                 dataPaths.push(path_1.default.join(extension.extensionPath, rp).toString());
241             }
242         }
243     }
244     return dataPaths;
245 }
246
247
248 /***/ }),
249 /* 3 */
250 /***/ (function(module, exports) {
251
252 module.exports = require("path");
253
254 /***/ }),
255 /* 4 */
256 /***/ (function(module, exports, __webpack_require__) {
257
258 "use strict";
259 /* --------------------------------------------------------------------------------------------\r
260  * Copyright (c) Microsoft Corporation. All rights reserved.\r
261  * Licensed under the MIT License. See License.txt in the project root for license information.\r
262  * ------------------------------------------------------------------------------------------ */\r
263 \r
264 function __export(m) {\r
265     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
266 }\r
267 Object.defineProperty(exports, "__esModule", { value: true });\r
268 const vscode_jsonrpc_1 = __webpack_require__(5);\r
269 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
270 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
271 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
272 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
273 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
274 exports.Event = vscode_jsonrpc_1.Event;\r
275 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
276 exports.Trace = vscode_jsonrpc_1.Trace;\r
277 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
278 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
279 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
280 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
281 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
282 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
283 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
284 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
285 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
286 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
287 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
288 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
289 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
290 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
291 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
292 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
293 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
294 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
295 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
296 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
297 __export(__webpack_require__(18));\r
298 __export(__webpack_require__(19));\r
299 const callHierarchy = __webpack_require__(31);\r
300 const st = __webpack_require__(32);\r
301 var Proposed;\r
302 (function (Proposed) {\r
303     let CallHierarchyPrepareRequest;\r
304     (function (CallHierarchyPrepareRequest) {\r
305         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
306         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
307     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
308     let CallHierarchyIncomingCallsRequest;\r
309     (function (CallHierarchyIncomingCallsRequest) {\r
310         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
311         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
312     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
313     let CallHierarchyOutgoingCallsRequest;\r
314     (function (CallHierarchyOutgoingCallsRequest) {\r
315         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
316         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
317     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
318     Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
319     Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
320     Proposed.SemanticTokens = st.SemanticTokens;\r
321     let SemanticTokensRequest;\r
322     (function (SemanticTokensRequest) {\r
323         SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
324         SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
325     })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
326     let SemanticTokensEditsRequest;\r
327     (function (SemanticTokensEditsRequest) {\r
328         SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
329         SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
330     })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
331     let SemanticTokensRangeRequest;\r
332     (function (SemanticTokensRangeRequest) {\r
333         SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
334         SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
335     })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
336 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
337 function createProtocolConnection(reader, writer, logger, strategy) {\r
338     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
339 }\r
340 exports.createProtocolConnection = createProtocolConnection;\r
341
342
343 /***/ }),
344 /* 5 */
345 /***/ (function(module, exports, __webpack_require__) {
346
347 "use strict";
348 /* --------------------------------------------------------------------------------------------\r
349  * Copyright (c) Microsoft Corporation. All rights reserved.\r
350  * Licensed under the MIT License. See License.txt in the project root for license information.\r
351  * ------------------------------------------------------------------------------------------ */\r
352 /// <reference path="../typings/thenable.d.ts" />\r
353 \r
354 function __export(m) {\r
355     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
356 }\r
357 Object.defineProperty(exports, "__esModule", { value: true });\r
358 const Is = __webpack_require__(6);\r
359 const messages_1 = __webpack_require__(7);\r
360 exports.RequestType = messages_1.RequestType;\r
361 exports.RequestType0 = messages_1.RequestType0;\r
362 exports.RequestType1 = messages_1.RequestType1;\r
363 exports.RequestType2 = messages_1.RequestType2;\r
364 exports.RequestType3 = messages_1.RequestType3;\r
365 exports.RequestType4 = messages_1.RequestType4;\r
366 exports.RequestType5 = messages_1.RequestType5;\r
367 exports.RequestType6 = messages_1.RequestType6;\r
368 exports.RequestType7 = messages_1.RequestType7;\r
369 exports.RequestType8 = messages_1.RequestType8;\r
370 exports.RequestType9 = messages_1.RequestType9;\r
371 exports.ResponseError = messages_1.ResponseError;\r
372 exports.ErrorCodes = messages_1.ErrorCodes;\r
373 exports.NotificationType = messages_1.NotificationType;\r
374 exports.NotificationType0 = messages_1.NotificationType0;\r
375 exports.NotificationType1 = messages_1.NotificationType1;\r
376 exports.NotificationType2 = messages_1.NotificationType2;\r
377 exports.NotificationType3 = messages_1.NotificationType3;\r
378 exports.NotificationType4 = messages_1.NotificationType4;\r
379 exports.NotificationType5 = messages_1.NotificationType5;\r
380 exports.NotificationType6 = messages_1.NotificationType6;\r
381 exports.NotificationType7 = messages_1.NotificationType7;\r
382 exports.NotificationType8 = messages_1.NotificationType8;\r
383 exports.NotificationType9 = messages_1.NotificationType9;\r
384 const messageReader_1 = __webpack_require__(8);\r
385 exports.MessageReader = messageReader_1.MessageReader;\r
386 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
387 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
388 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
389 const messageWriter_1 = __webpack_require__(10);\r
390 exports.MessageWriter = messageWriter_1.MessageWriter;\r
391 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
392 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
393 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
394 const events_1 = __webpack_require__(9);\r
395 exports.Disposable = events_1.Disposable;\r
396 exports.Event = events_1.Event;\r
397 exports.Emitter = events_1.Emitter;\r
398 const cancellation_1 = __webpack_require__(11);\r
399 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
400 exports.CancellationToken = cancellation_1.CancellationToken;\r
401 const linkedMap_1 = __webpack_require__(12);\r
402 __export(__webpack_require__(13));\r
403 __export(__webpack_require__(17));\r
404 var CancelNotification;\r
405 (function (CancelNotification) {\r
406     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
407 })(CancelNotification || (CancelNotification = {}));\r
408 var ProgressNotification;\r
409 (function (ProgressNotification) {\r
410     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
411 })(ProgressNotification || (ProgressNotification = {}));\r
412 class ProgressType {\r
413     constructor() {\r
414     }\r
415 }\r
416 exports.ProgressType = ProgressType;\r
417 exports.NullLogger = Object.freeze({\r
418     error: () => { },\r
419     warn: () => { },\r
420     info: () => { },\r
421     log: () => { }\r
422 });\r
423 var Trace;\r
424 (function (Trace) {\r
425     Trace[Trace["Off"] = 0] = "Off";\r
426     Trace[Trace["Messages"] = 1] = "Messages";\r
427     Trace[Trace["Verbose"] = 2] = "Verbose";\r
428 })(Trace = exports.Trace || (exports.Trace = {}));\r
429 (function (Trace) {\r
430     function fromString(value) {\r
431         if (!Is.string(value)) {\r
432             return Trace.Off;\r
433         }\r
434         value = value.toLowerCase();\r
435         switch (value) {\r
436             case 'off':\r
437                 return Trace.Off;\r
438             case 'messages':\r
439                 return Trace.Messages;\r
440             case 'verbose':\r
441                 return Trace.Verbose;\r
442             default:\r
443                 return Trace.Off;\r
444         }\r
445     }\r
446     Trace.fromString = fromString;\r
447     function toString(value) {\r
448         switch (value) {\r
449             case Trace.Off:\r
450                 return 'off';\r
451             case Trace.Messages:\r
452                 return 'messages';\r
453             case Trace.Verbose:\r
454                 return 'verbose';\r
455             default:\r
456                 return 'off';\r
457         }\r
458     }\r
459     Trace.toString = toString;\r
460 })(Trace = exports.Trace || (exports.Trace = {}));\r
461 var TraceFormat;\r
462 (function (TraceFormat) {\r
463     TraceFormat["Text"] = "text";\r
464     TraceFormat["JSON"] = "json";\r
465 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
466 (function (TraceFormat) {\r
467     function fromString(value) {\r
468         value = value.toLowerCase();\r
469         if (value === 'json') {\r
470             return TraceFormat.JSON;\r
471         }\r
472         else {\r
473             return TraceFormat.Text;\r
474         }\r
475     }\r
476     TraceFormat.fromString = fromString;\r
477 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
478 var SetTraceNotification;\r
479 (function (SetTraceNotification) {\r
480     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
481 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
482 var LogTraceNotification;\r
483 (function (LogTraceNotification) {\r
484     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
485 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
486 var ConnectionErrors;\r
487 (function (ConnectionErrors) {\r
488     /**\r
489      * The connection is closed.\r
490      */\r
491     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
492     /**\r
493      * The connection got disposed.\r
494      */\r
495     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
496     /**\r
497      * The connection is already in listening mode.\r
498      */\r
499     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
500 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
501 class ConnectionError extends Error {\r
502     constructor(code, message) {\r
503         super(message);\r
504         this.code = code;\r
505         Object.setPrototypeOf(this, ConnectionError.prototype);\r
506     }\r
507 }\r
508 exports.ConnectionError = ConnectionError;\r
509 var ConnectionStrategy;\r
510 (function (ConnectionStrategy) {\r
511     function is(value) {\r
512         let candidate = value;\r
513         return candidate && Is.func(candidate.cancelUndispatched);\r
514     }\r
515     ConnectionStrategy.is = is;\r
516 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
517 var ConnectionState;\r
518 (function (ConnectionState) {\r
519     ConnectionState[ConnectionState["New"] = 1] = "New";\r
520     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
521     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
522     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
523 })(ConnectionState || (ConnectionState = {}));\r
524 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
525     let sequenceNumber = 0;\r
526     let notificationSquenceNumber = 0;\r
527     let unknownResponseSquenceNumber = 0;\r
528     const version = '2.0';\r
529     let starRequestHandler = undefined;\r
530     let requestHandlers = Object.create(null);\r
531     let starNotificationHandler = undefined;\r
532     let notificationHandlers = Object.create(null);\r
533     let progressHandlers = new Map();\r
534     let timer;\r
535     let messageQueue = new linkedMap_1.LinkedMap();\r
536     let responsePromises = Object.create(null);\r
537     let requestTokens = Object.create(null);\r
538     let trace = Trace.Off;\r
539     let traceFormat = TraceFormat.Text;\r
540     let tracer;\r
541     let state = ConnectionState.New;\r
542     let errorEmitter = new events_1.Emitter();\r
543     let closeEmitter = new events_1.Emitter();\r
544     let unhandledNotificationEmitter = new events_1.Emitter();\r
545     let unhandledProgressEmitter = new events_1.Emitter();\r
546     let disposeEmitter = new events_1.Emitter();\r
547     function createRequestQueueKey(id) {\r
548         return 'req-' + id.toString();\r
549     }\r
550     function createResponseQueueKey(id) {\r
551         if (id === null) {\r
552             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
553         }\r
554         else {\r
555             return 'res-' + id.toString();\r
556         }\r
557     }\r
558     function createNotificationQueueKey() {\r
559         return 'not-' + (++notificationSquenceNumber).toString();\r
560     }\r
561     function addMessageToQueue(queue, message) {\r
562         if (messages_1.isRequestMessage(message)) {\r
563             queue.set(createRequestQueueKey(message.id), message);\r
564         }\r
565         else if (messages_1.isResponseMessage(message)) {\r
566             queue.set(createResponseQueueKey(message.id), message);\r
567         }\r
568         else {\r
569             queue.set(createNotificationQueueKey(), message);\r
570         }\r
571     }\r
572     function cancelUndispatched(_message) {\r
573         return undefined;\r
574     }\r
575     function isListening() {\r
576         return state === ConnectionState.Listening;\r
577     }\r
578     function isClosed() {\r
579         return state === ConnectionState.Closed;\r
580     }\r
581     function isDisposed() {\r
582         return state === ConnectionState.Disposed;\r
583     }\r
584     function closeHandler() {\r
585         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
586             state = ConnectionState.Closed;\r
587             closeEmitter.fire(undefined);\r
588         }\r
589         // If the connection is disposed don't sent close events.\r
590     }\r
591     function readErrorHandler(error) {\r
592         errorEmitter.fire([error, undefined, undefined]);\r
593     }\r
594     function writeErrorHandler(data) {\r
595         errorEmitter.fire(data);\r
596     }\r
597     messageReader.onClose(closeHandler);\r
598     messageReader.onError(readErrorHandler);\r
599     messageWriter.onClose(closeHandler);\r
600     messageWriter.onError(writeErrorHandler);\r
601     function triggerMessageQueue() {\r
602         if (timer || messageQueue.size === 0) {\r
603             return;\r
604         }\r
605         timer = setImmediate(() => {\r
606             timer = undefined;\r
607             processMessageQueue();\r
608         });\r
609     }\r
610     function processMessageQueue() {\r
611         if (messageQueue.size === 0) {\r
612             return;\r
613         }\r
614         let message = messageQueue.shift();\r
615         try {\r
616             if (messages_1.isRequestMessage(message)) {\r
617                 handleRequest(message);\r
618             }\r
619             else if (messages_1.isNotificationMessage(message)) {\r
620                 handleNotification(message);\r
621             }\r
622             else if (messages_1.isResponseMessage(message)) {\r
623                 handleResponse(message);\r
624             }\r
625             else {\r
626                 handleInvalidMessage(message);\r
627             }\r
628         }\r
629         finally {\r
630             triggerMessageQueue();\r
631         }\r
632     }\r
633     let callback = (message) => {\r
634         try {\r
635             // We have received a cancellation message. Check if the message is still in the queue\r
636             // and cancel it if allowed to do so.\r
637             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
638                 let key = createRequestQueueKey(message.params.id);\r
639                 let toCancel = messageQueue.get(key);\r
640                 if (messages_1.isRequestMessage(toCancel)) {\r
641                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
642                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
643                         messageQueue.delete(key);\r
644                         response.id = toCancel.id;\r
645                         traceSendingResponse(response, message.method, Date.now());\r
646                         messageWriter.write(response);\r
647                         return;\r
648                     }\r
649                 }\r
650             }\r
651             addMessageToQueue(messageQueue, message);\r
652         }\r
653         finally {\r
654             triggerMessageQueue();\r
655         }\r
656     };\r
657     function handleRequest(requestMessage) {\r
658         if (isDisposed()) {\r
659             // we return here silently since we fired an event when the\r
660             // connection got disposed.\r
661             return;\r
662         }\r
663         function reply(resultOrError, method, startTime) {\r
664             let message = {\r
665                 jsonrpc: version,\r
666                 id: requestMessage.id\r
667             };\r
668             if (resultOrError instanceof messages_1.ResponseError) {\r
669                 message.error = resultOrError.toJson();\r
670             }\r
671             else {\r
672                 message.result = resultOrError === void 0 ? null : resultOrError;\r
673             }\r
674             traceSendingResponse(message, method, startTime);\r
675             messageWriter.write(message);\r
676         }\r
677         function replyError(error, method, startTime) {\r
678             let message = {\r
679                 jsonrpc: version,\r
680                 id: requestMessage.id,\r
681                 error: error.toJson()\r
682             };\r
683             traceSendingResponse(message, method, startTime);\r
684             messageWriter.write(message);\r
685         }\r
686         function replySuccess(result, method, startTime) {\r
687             // The JSON RPC defines that a response must either have a result or an error\r
688             // So we can't treat undefined as a valid response result.\r
689             if (result === void 0) {\r
690                 result = null;\r
691             }\r
692             let message = {\r
693                 jsonrpc: version,\r
694                 id: requestMessage.id,\r
695                 result: result\r
696             };\r
697             traceSendingResponse(message, method, startTime);\r
698             messageWriter.write(message);\r
699         }\r
700         traceReceivedRequest(requestMessage);\r
701         let element = requestHandlers[requestMessage.method];\r
702         let type;\r
703         let requestHandler;\r
704         if (element) {\r
705             type = element.type;\r
706             requestHandler = element.handler;\r
707         }\r
708         let startTime = Date.now();\r
709         if (requestHandler || starRequestHandler) {\r
710             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
711             let tokenKey = String(requestMessage.id);\r
712             requestTokens[tokenKey] = cancellationSource;\r
713             try {\r
714                 let handlerResult;\r
715                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
716                     handlerResult = requestHandler\r
717                         ? requestHandler(cancellationSource.token)\r
718                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
719                 }\r
720                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
721                     handlerResult = requestHandler\r
722                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
723                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
724                 }\r
725                 else {\r
726                     handlerResult = requestHandler\r
727                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
728                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
729                 }\r
730                 let promise = handlerResult;\r
731                 if (!handlerResult) {\r
732                     delete requestTokens[tokenKey];\r
733                     replySuccess(handlerResult, requestMessage.method, startTime);\r
734                 }\r
735                 else if (promise.then) {\r
736                     promise.then((resultOrError) => {\r
737                         delete requestTokens[tokenKey];\r
738                         reply(resultOrError, requestMessage.method, startTime);\r
739                     }, error => {\r
740                         delete requestTokens[tokenKey];\r
741                         if (error instanceof messages_1.ResponseError) {\r
742                             replyError(error, requestMessage.method, startTime);\r
743                         }\r
744                         else if (error && Is.string(error.message)) {\r
745                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
746                         }\r
747                         else {\r
748                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
749                         }\r
750                     });\r
751                 }\r
752                 else {\r
753                     delete requestTokens[tokenKey];\r
754                     reply(handlerResult, requestMessage.method, startTime);\r
755                 }\r
756             }\r
757             catch (error) {\r
758                 delete requestTokens[tokenKey];\r
759                 if (error instanceof messages_1.ResponseError) {\r
760                     reply(error, requestMessage.method, startTime);\r
761                 }\r
762                 else if (error && Is.string(error.message)) {\r
763                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
764                 }\r
765                 else {\r
766                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
767                 }\r
768             }\r
769         }\r
770         else {\r
771             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
772         }\r
773     }\r
774     function handleResponse(responseMessage) {\r
775         if (isDisposed()) {\r
776             // See handle request.\r
777             return;\r
778         }\r
779         if (responseMessage.id === null) {\r
780             if (responseMessage.error) {\r
781                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
782             }\r
783             else {\r
784                 logger.error(`Received response message without id. No further error information provided.`);\r
785             }\r
786         }\r
787         else {\r
788             let key = String(responseMessage.id);\r
789             let responsePromise = responsePromises[key];\r
790             traceReceivedResponse(responseMessage, responsePromise);\r
791             if (responsePromise) {\r
792                 delete responsePromises[key];\r
793                 try {\r
794                     if (responseMessage.error) {\r
795                         let error = responseMessage.error;\r
796                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
797                     }\r
798                     else if (responseMessage.result !== void 0) {\r
799                         responsePromise.resolve(responseMessage.result);\r
800                     }\r
801                     else {\r
802                         throw new Error('Should never happen.');\r
803                     }\r
804                 }\r
805                 catch (error) {\r
806                     if (error.message) {\r
807                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
808                     }\r
809                     else {\r
810                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
811                     }\r
812                 }\r
813             }\r
814         }\r
815     }\r
816     function handleNotification(message) {\r
817         if (isDisposed()) {\r
818             // See handle request.\r
819             return;\r
820         }\r
821         let type = undefined;\r
822         let notificationHandler;\r
823         if (message.method === CancelNotification.type.method) {\r
824             notificationHandler = (params) => {\r
825                 let id = params.id;\r
826                 let source = requestTokens[String(id)];\r
827                 if (source) {\r
828                     source.cancel();\r
829                 }\r
830             };\r
831         }\r
832         else {\r
833             let element = notificationHandlers[message.method];\r
834             if (element) {\r
835                 notificationHandler = element.handler;\r
836                 type = element.type;\r
837             }\r
838         }\r
839         if (notificationHandler || starNotificationHandler) {\r
840             try {\r
841                 traceReceivedNotification(message);\r
842                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
843                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
844                 }\r
845                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
846                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
847                 }\r
848                 else {\r
849                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
850                 }\r
851             }\r
852             catch (error) {\r
853                 if (error.message) {\r
854                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
855                 }\r
856                 else {\r
857                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
858                 }\r
859             }\r
860         }\r
861         else {\r
862             unhandledNotificationEmitter.fire(message);\r
863         }\r
864     }\r
865     function handleInvalidMessage(message) {\r
866         if (!message) {\r
867             logger.error('Received empty message.');\r
868             return;\r
869         }\r
870         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
871         // Test whether we find an id to reject the promise\r
872         let responseMessage = message;\r
873         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
874             let key = String(responseMessage.id);\r
875             let responseHandler = responsePromises[key];\r
876             if (responseHandler) {\r
877                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
878             }\r
879         }\r
880     }\r
881     function traceSendingRequest(message) {\r
882         if (trace === Trace.Off || !tracer) {\r
883             return;\r
884         }\r
885         if (traceFormat === TraceFormat.Text) {\r
886             let data = undefined;\r
887             if (trace === Trace.Verbose && message.params) {\r
888                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
889             }\r
890             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
891         }\r
892         else {\r
893             logLSPMessage('send-request', message);\r
894         }\r
895     }\r
896     function traceSendingNotification(message) {\r
897         if (trace === Trace.Off || !tracer) {\r
898             return;\r
899         }\r
900         if (traceFormat === TraceFormat.Text) {\r
901             let data = undefined;\r
902             if (trace === Trace.Verbose) {\r
903                 if (message.params) {\r
904                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
905                 }\r
906                 else {\r
907                     data = 'No parameters provided.\n\n';\r
908                 }\r
909             }\r
910             tracer.log(`Sending notification '${message.method}'.`, data);\r
911         }\r
912         else {\r
913             logLSPMessage('send-notification', message);\r
914         }\r
915     }\r
916     function traceSendingResponse(message, method, startTime) {\r
917         if (trace === Trace.Off || !tracer) {\r
918             return;\r
919         }\r
920         if (traceFormat === TraceFormat.Text) {\r
921             let data = undefined;\r
922             if (trace === Trace.Verbose) {\r
923                 if (message.error && message.error.data) {\r
924                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
925                 }\r
926                 else {\r
927                     if (message.result) {\r
928                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
929                     }\r
930                     else if (message.error === void 0) {\r
931                         data = 'No result returned.\n\n';\r
932                     }\r
933                 }\r
934             }\r
935             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
936         }\r
937         else {\r
938             logLSPMessage('send-response', message);\r
939         }\r
940     }\r
941     function traceReceivedRequest(message) {\r
942         if (trace === Trace.Off || !tracer) {\r
943             return;\r
944         }\r
945         if (traceFormat === TraceFormat.Text) {\r
946             let data = undefined;\r
947             if (trace === Trace.Verbose && message.params) {\r
948                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
949             }\r
950             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
951         }\r
952         else {\r
953             logLSPMessage('receive-request', message);\r
954         }\r
955     }\r
956     function traceReceivedNotification(message) {\r
957         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
958             return;\r
959         }\r
960         if (traceFormat === TraceFormat.Text) {\r
961             let data = undefined;\r
962             if (trace === Trace.Verbose) {\r
963                 if (message.params) {\r
964                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
965                 }\r
966                 else {\r
967                     data = 'No parameters provided.\n\n';\r
968                 }\r
969             }\r
970             tracer.log(`Received notification '${message.method}'.`, data);\r
971         }\r
972         else {\r
973             logLSPMessage('receive-notification', message);\r
974         }\r
975     }\r
976     function traceReceivedResponse(message, responsePromise) {\r
977         if (trace === Trace.Off || !tracer) {\r
978             return;\r
979         }\r
980         if (traceFormat === TraceFormat.Text) {\r
981             let data = undefined;\r
982             if (trace === Trace.Verbose) {\r
983                 if (message.error && message.error.data) {\r
984                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
985                 }\r
986                 else {\r
987                     if (message.result) {\r
988                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
989                     }\r
990                     else if (message.error === void 0) {\r
991                         data = 'No result returned.\n\n';\r
992                     }\r
993                 }\r
994             }\r
995             if (responsePromise) {\r
996                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
997                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
998             }\r
999             else {\r
1000                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
1001             }\r
1002         }\r
1003         else {\r
1004             logLSPMessage('receive-response', message);\r
1005         }\r
1006     }\r
1007     function logLSPMessage(type, message) {\r
1008         if (!tracer || trace === Trace.Off) {\r
1009             return;\r
1010         }\r
1011         const lspMessage = {\r
1012             isLSPMessage: true,\r
1013             type,\r
1014             message,\r
1015             timestamp: Date.now()\r
1016         };\r
1017         tracer.log(lspMessage);\r
1018     }\r
1019     function throwIfClosedOrDisposed() {\r
1020         if (isClosed()) {\r
1021             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
1022         }\r
1023         if (isDisposed()) {\r
1024             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
1025         }\r
1026     }\r
1027     function throwIfListening() {\r
1028         if (isListening()) {\r
1029             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
1030         }\r
1031     }\r
1032     function throwIfNotListening() {\r
1033         if (!isListening()) {\r
1034             throw new Error('Call listen() first.');\r
1035         }\r
1036     }\r
1037     function undefinedToNull(param) {\r
1038         if (param === void 0) {\r
1039             return null;\r
1040         }\r
1041         else {\r
1042             return param;\r
1043         }\r
1044     }\r
1045     function computeMessageParams(type, params) {\r
1046         let result;\r
1047         let numberOfParams = type.numberOfParams;\r
1048         switch (numberOfParams) {\r
1049             case 0:\r
1050                 result = null;\r
1051                 break;\r
1052             case 1:\r
1053                 result = undefinedToNull(params[0]);\r
1054                 break;\r
1055             default:\r
1056                 result = [];\r
1057                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
1058                     result.push(undefinedToNull(params[i]));\r
1059                 }\r
1060                 if (params.length < numberOfParams) {\r
1061                     for (let i = params.length; i < numberOfParams; i++) {\r
1062                         result.push(null);\r
1063                     }\r
1064                 }\r
1065                 break;\r
1066         }\r
1067         return result;\r
1068     }\r
1069     let connection = {\r
1070         sendNotification: (type, ...params) => {\r
1071             throwIfClosedOrDisposed();\r
1072             let method;\r
1073             let messageParams;\r
1074             if (Is.string(type)) {\r
1075                 method = type;\r
1076                 switch (params.length) {\r
1077                     case 0:\r
1078                         messageParams = null;\r
1079                         break;\r
1080                     case 1:\r
1081                         messageParams = params[0];\r
1082                         break;\r
1083                     default:\r
1084                         messageParams = params;\r
1085                         break;\r
1086                 }\r
1087             }\r
1088             else {\r
1089                 method = type.method;\r
1090                 messageParams = computeMessageParams(type, params);\r
1091             }\r
1092             let notificationMessage = {\r
1093                 jsonrpc: version,\r
1094                 method: method,\r
1095                 params: messageParams\r
1096             };\r
1097             traceSendingNotification(notificationMessage);\r
1098             messageWriter.write(notificationMessage);\r
1099         },\r
1100         onNotification: (type, handler) => {\r
1101             throwIfClosedOrDisposed();\r
1102             if (Is.func(type)) {\r
1103                 starNotificationHandler = type;\r
1104             }\r
1105             else if (handler) {\r
1106                 if (Is.string(type)) {\r
1107                     notificationHandlers[type] = { type: undefined, handler };\r
1108                 }\r
1109                 else {\r
1110                     notificationHandlers[type.method] = { type, handler };\r
1111                 }\r
1112             }\r
1113         },\r
1114         onProgress: (_type, token, handler) => {\r
1115             if (progressHandlers.has(token)) {\r
1116                 throw new Error(`Progress handler for token ${token} already registered`);\r
1117             }\r
1118             progressHandlers.set(token, handler);\r
1119             return {\r
1120                 dispose: () => {\r
1121                     progressHandlers.delete(token);\r
1122                 }\r
1123             };\r
1124         },\r
1125         sendProgress: (_type, token, value) => {\r
1126             connection.sendNotification(ProgressNotification.type, { token, value });\r
1127         },\r
1128         onUnhandledProgress: unhandledProgressEmitter.event,\r
1129         sendRequest: (type, ...params) => {\r
1130             throwIfClosedOrDisposed();\r
1131             throwIfNotListening();\r
1132             let method;\r
1133             let messageParams;\r
1134             let token = undefined;\r
1135             if (Is.string(type)) {\r
1136                 method = type;\r
1137                 switch (params.length) {\r
1138                     case 0:\r
1139                         messageParams = null;\r
1140                         break;\r
1141                     case 1:\r
1142                         // The cancellation token is optional so it can also be undefined.\r
1143                         if (cancellation_1.CancellationToken.is(params[0])) {\r
1144                             messageParams = null;\r
1145                             token = params[0];\r
1146                         }\r
1147                         else {\r
1148                             messageParams = undefinedToNull(params[0]);\r
1149                         }\r
1150                         break;\r
1151                     default:\r
1152                         const last = params.length - 1;\r
1153                         if (cancellation_1.CancellationToken.is(params[last])) {\r
1154                             token = params[last];\r
1155                             if (params.length === 2) {\r
1156                                 messageParams = undefinedToNull(params[0]);\r
1157                             }\r
1158                             else {\r
1159                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
1160                             }\r
1161                         }\r
1162                         else {\r
1163                             messageParams = params.map(value => undefinedToNull(value));\r
1164                         }\r
1165                         break;\r
1166                 }\r
1167             }\r
1168             else {\r
1169                 method = type.method;\r
1170                 messageParams = computeMessageParams(type, params);\r
1171                 let numberOfParams = type.numberOfParams;\r
1172                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
1173             }\r
1174             let id = sequenceNumber++;\r
1175             let result = new Promise((resolve, reject) => {\r
1176                 let requestMessage = {\r
1177                     jsonrpc: version,\r
1178                     id: id,\r
1179                     method: method,\r
1180                     params: messageParams\r
1181                 };\r
1182                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
1183                 traceSendingRequest(requestMessage);\r
1184                 try {\r
1185                     messageWriter.write(requestMessage);\r
1186                 }\r
1187                 catch (e) {\r
1188                     // Writing the message failed. So we need to reject the promise.\r
1189                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
1190                     responsePromise = null;\r
1191                 }\r
1192                 if (responsePromise) {\r
1193                     responsePromises[String(id)] = responsePromise;\r
1194                 }\r
1195             });\r
1196             if (token) {\r
1197                 token.onCancellationRequested(() => {\r
1198                     connection.sendNotification(CancelNotification.type, { id });\r
1199                 });\r
1200             }\r
1201             return result;\r
1202         },\r
1203         onRequest: (type, handler) => {\r
1204             throwIfClosedOrDisposed();\r
1205             if (Is.func(type)) {\r
1206                 starRequestHandler = type;\r
1207             }\r
1208             else if (handler) {\r
1209                 if (Is.string(type)) {\r
1210                     requestHandlers[type] = { type: undefined, handler };\r
1211                 }\r
1212                 else {\r
1213                     requestHandlers[type.method] = { type, handler };\r
1214                 }\r
1215             }\r
1216         },\r
1217         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
1218             let _sendNotification = false;\r
1219             let _traceFormat = TraceFormat.Text;\r
1220             if (sendNotificationOrTraceOptions !== void 0) {\r
1221                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
1222                     _sendNotification = sendNotificationOrTraceOptions;\r
1223                 }\r
1224                 else {\r
1225                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
1226                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
1227                 }\r
1228             }\r
1229             trace = _value;\r
1230             traceFormat = _traceFormat;\r
1231             if (trace === Trace.Off) {\r
1232                 tracer = undefined;\r
1233             }\r
1234             else {\r
1235                 tracer = _tracer;\r
1236             }\r
1237             if (_sendNotification && !isClosed() && !isDisposed()) {\r
1238                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
1239             }\r
1240         },\r
1241         onError: errorEmitter.event,\r
1242         onClose: closeEmitter.event,\r
1243         onUnhandledNotification: unhandledNotificationEmitter.event,\r
1244         onDispose: disposeEmitter.event,\r
1245         dispose: () => {\r
1246             if (isDisposed()) {\r
1247                 return;\r
1248             }\r
1249             state = ConnectionState.Disposed;\r
1250             disposeEmitter.fire(undefined);\r
1251             let error = new Error('Connection got disposed.');\r
1252             Object.keys(responsePromises).forEach((key) => {\r
1253                 responsePromises[key].reject(error);\r
1254             });\r
1255             responsePromises = Object.create(null);\r
1256             requestTokens = Object.create(null);\r
1257             messageQueue = new linkedMap_1.LinkedMap();\r
1258             // Test for backwards compatibility\r
1259             if (Is.func(messageWriter.dispose)) {\r
1260                 messageWriter.dispose();\r
1261             }\r
1262             if (Is.func(messageReader.dispose)) {\r
1263                 messageReader.dispose();\r
1264             }\r
1265         },\r
1266         listen: () => {\r
1267             throwIfClosedOrDisposed();\r
1268             throwIfListening();\r
1269             state = ConnectionState.Listening;\r
1270             messageReader.listen(callback);\r
1271         },\r
1272         inspect: () => {\r
1273             // eslint-disable-next-line no-console\r
1274             console.log('inspect');\r
1275         }\r
1276     };\r
1277     connection.onNotification(LogTraceNotification.type, (params) => {\r
1278         if (trace === Trace.Off || !tracer) {\r
1279             return;\r
1280         }\r
1281         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
1282     });\r
1283     connection.onNotification(ProgressNotification.type, (params) => {\r
1284         const handler = progressHandlers.get(params.token);\r
1285         if (handler) {\r
1286             handler(params.value);\r
1287         }\r
1288         else {\r
1289             unhandledProgressEmitter.fire(params);\r
1290         }\r
1291     });\r
1292     return connection;\r
1293 }\r
1294 function isMessageReader(value) {\r
1295     return value.listen !== void 0 && value.read === void 0;\r
1296 }\r
1297 function isMessageWriter(value) {\r
1298     return value.write !== void 0 && value.end === void 0;\r
1299 }\r
1300 function createMessageConnection(input, output, logger, strategy) {\r
1301     if (!logger) {\r
1302         logger = exports.NullLogger;\r
1303     }\r
1304     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
1305     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
1306     return _createMessageConnection(reader, writer, logger, strategy);\r
1307 }\r
1308 exports.createMessageConnection = createMessageConnection;\r
1309
1310
1311 /***/ }),
1312 /* 6 */
1313 /***/ (function(module, exports, __webpack_require__) {
1314
1315 "use strict";
1316 /* --------------------------------------------------------------------------------------------\r
1317  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1318  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1319  * ------------------------------------------------------------------------------------------ */\r
1320 \r
1321 Object.defineProperty(exports, "__esModule", { value: true });\r
1322 function boolean(value) {\r
1323     return value === true || value === false;\r
1324 }\r
1325 exports.boolean = boolean;\r
1326 function string(value) {\r
1327     return typeof value === 'string' || value instanceof String;\r
1328 }\r
1329 exports.string = string;\r
1330 function number(value) {\r
1331     return typeof value === 'number' || value instanceof Number;\r
1332 }\r
1333 exports.number = number;\r
1334 function error(value) {\r
1335     return value instanceof Error;\r
1336 }\r
1337 exports.error = error;\r
1338 function func(value) {\r
1339     return typeof value === 'function';\r
1340 }\r
1341 exports.func = func;\r
1342 function array(value) {\r
1343     return Array.isArray(value);\r
1344 }\r
1345 exports.array = array;\r
1346 function stringArray(value) {\r
1347     return array(value) && value.every(elem => string(elem));\r
1348 }\r
1349 exports.stringArray = stringArray;\r
1350
1351
1352 /***/ }),
1353 /* 7 */
1354 /***/ (function(module, exports, __webpack_require__) {
1355
1356 "use strict";
1357 /* --------------------------------------------------------------------------------------------\r
1358  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1359  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1360  * ------------------------------------------------------------------------------------------ */\r
1361 \r
1362 Object.defineProperty(exports, "__esModule", { value: true });\r
1363 const is = __webpack_require__(6);\r
1364 /**\r
1365  * Predefined error codes.\r
1366  */\r
1367 var ErrorCodes;\r
1368 (function (ErrorCodes) {\r
1369     // Defined by JSON RPC\r
1370     ErrorCodes.ParseError = -32700;\r
1371     ErrorCodes.InvalidRequest = -32600;\r
1372     ErrorCodes.MethodNotFound = -32601;\r
1373     ErrorCodes.InvalidParams = -32602;\r
1374     ErrorCodes.InternalError = -32603;\r
1375     ErrorCodes.serverErrorStart = -32099;\r
1376     ErrorCodes.serverErrorEnd = -32000;\r
1377     ErrorCodes.ServerNotInitialized = -32002;\r
1378     ErrorCodes.UnknownErrorCode = -32001;\r
1379     // Defined by the protocol.\r
1380     ErrorCodes.RequestCancelled = -32800;\r
1381     ErrorCodes.ContentModified = -32801;\r
1382     // Defined by VSCode library.\r
1383     ErrorCodes.MessageWriteError = 1;\r
1384     ErrorCodes.MessageReadError = 2;\r
1385 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
1386 /**\r
1387  * An error object return in a response in case a request\r
1388  * has failed.\r
1389  */\r
1390 class ResponseError extends Error {\r
1391     constructor(code, message, data) {\r
1392         super(message);\r
1393         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
1394         this.data = data;\r
1395         Object.setPrototypeOf(this, ResponseError.prototype);\r
1396     }\r
1397     toJson() {\r
1398         return {\r
1399             code: this.code,\r
1400             message: this.message,\r
1401             data: this.data,\r
1402         };\r
1403     }\r
1404 }\r
1405 exports.ResponseError = ResponseError;\r
1406 /**\r
1407  * An abstract implementation of a MessageType.\r
1408  */\r
1409 class AbstractMessageType {\r
1410     constructor(_method, _numberOfParams) {\r
1411         this._method = _method;\r
1412         this._numberOfParams = _numberOfParams;\r
1413     }\r
1414     get method() {\r
1415         return this._method;\r
1416     }\r
1417     get numberOfParams() {\r
1418         return this._numberOfParams;\r
1419     }\r
1420 }\r
1421 exports.AbstractMessageType = AbstractMessageType;\r
1422 /**\r
1423  * Classes to type request response pairs\r
1424  *\r
1425  * The type parameter RO will be removed in the next major version\r
1426  * of the JSON RPC library since it is a LSP concept and doesn't\r
1427  * belong here. For now it is tagged as default never.\r
1428  */\r
1429 class RequestType0 extends AbstractMessageType {\r
1430     constructor(method) {\r
1431         super(method, 0);\r
1432     }\r
1433 }\r
1434 exports.RequestType0 = RequestType0;\r
1435 class RequestType extends AbstractMessageType {\r
1436     constructor(method) {\r
1437         super(method, 1);\r
1438     }\r
1439 }\r
1440 exports.RequestType = RequestType;\r
1441 class RequestType1 extends AbstractMessageType {\r
1442     constructor(method) {\r
1443         super(method, 1);\r
1444     }\r
1445 }\r
1446 exports.RequestType1 = RequestType1;\r
1447 class RequestType2 extends AbstractMessageType {\r
1448     constructor(method) {\r
1449         super(method, 2);\r
1450     }\r
1451 }\r
1452 exports.RequestType2 = RequestType2;\r
1453 class RequestType3 extends AbstractMessageType {\r
1454     constructor(method) {\r
1455         super(method, 3);\r
1456     }\r
1457 }\r
1458 exports.RequestType3 = RequestType3;\r
1459 class RequestType4 extends AbstractMessageType {\r
1460     constructor(method) {\r
1461         super(method, 4);\r
1462     }\r
1463 }\r
1464 exports.RequestType4 = RequestType4;\r
1465 class RequestType5 extends AbstractMessageType {\r
1466     constructor(method) {\r
1467         super(method, 5);\r
1468     }\r
1469 }\r
1470 exports.RequestType5 = RequestType5;\r
1471 class RequestType6 extends AbstractMessageType {\r
1472     constructor(method) {\r
1473         super(method, 6);\r
1474     }\r
1475 }\r
1476 exports.RequestType6 = RequestType6;\r
1477 class RequestType7 extends AbstractMessageType {\r
1478     constructor(method) {\r
1479         super(method, 7);\r
1480     }\r
1481 }\r
1482 exports.RequestType7 = RequestType7;\r
1483 class RequestType8 extends AbstractMessageType {\r
1484     constructor(method) {\r
1485         super(method, 8);\r
1486     }\r
1487 }\r
1488 exports.RequestType8 = RequestType8;\r
1489 class RequestType9 extends AbstractMessageType {\r
1490     constructor(method) {\r
1491         super(method, 9);\r
1492     }\r
1493 }\r
1494 exports.RequestType9 = RequestType9;\r
1495 /**\r
1496  * The type parameter RO will be removed in the next major version\r
1497  * of the JSON RPC library since it is a LSP concept and doesn't\r
1498  * belong here. For now it is tagged as default never.\r
1499  */\r
1500 class NotificationType extends AbstractMessageType {\r
1501     constructor(method) {\r
1502         super(method, 1);\r
1503         this._ = undefined;\r
1504     }\r
1505 }\r
1506 exports.NotificationType = NotificationType;\r
1507 class NotificationType0 extends AbstractMessageType {\r
1508     constructor(method) {\r
1509         super(method, 0);\r
1510     }\r
1511 }\r
1512 exports.NotificationType0 = NotificationType0;\r
1513 class NotificationType1 extends AbstractMessageType {\r
1514     constructor(method) {\r
1515         super(method, 1);\r
1516     }\r
1517 }\r
1518 exports.NotificationType1 = NotificationType1;\r
1519 class NotificationType2 extends AbstractMessageType {\r
1520     constructor(method) {\r
1521         super(method, 2);\r
1522     }\r
1523 }\r
1524 exports.NotificationType2 = NotificationType2;\r
1525 class NotificationType3 extends AbstractMessageType {\r
1526     constructor(method) {\r
1527         super(method, 3);\r
1528     }\r
1529 }\r
1530 exports.NotificationType3 = NotificationType3;\r
1531 class NotificationType4 extends AbstractMessageType {\r
1532     constructor(method) {\r
1533         super(method, 4);\r
1534     }\r
1535 }\r
1536 exports.NotificationType4 = NotificationType4;\r
1537 class NotificationType5 extends AbstractMessageType {\r
1538     constructor(method) {\r
1539         super(method, 5);\r
1540     }\r
1541 }\r
1542 exports.NotificationType5 = NotificationType5;\r
1543 class NotificationType6 extends AbstractMessageType {\r
1544     constructor(method) {\r
1545         super(method, 6);\r
1546     }\r
1547 }\r
1548 exports.NotificationType6 = NotificationType6;\r
1549 class NotificationType7 extends AbstractMessageType {\r
1550     constructor(method) {\r
1551         super(method, 7);\r
1552     }\r
1553 }\r
1554 exports.NotificationType7 = NotificationType7;\r
1555 class NotificationType8 extends AbstractMessageType {\r
1556     constructor(method) {\r
1557         super(method, 8);\r
1558     }\r
1559 }\r
1560 exports.NotificationType8 = NotificationType8;\r
1561 class NotificationType9 extends AbstractMessageType {\r
1562     constructor(method) {\r
1563         super(method, 9);\r
1564     }\r
1565 }\r
1566 exports.NotificationType9 = NotificationType9;\r
1567 /**\r
1568  * Tests if the given message is a request message\r
1569  */\r
1570 function isRequestMessage(message) {\r
1571     let candidate = message;\r
1572     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
1573 }\r
1574 exports.isRequestMessage = isRequestMessage;\r
1575 /**\r
1576  * Tests if the given message is a notification message\r
1577  */\r
1578 function isNotificationMessage(message) {\r
1579     let candidate = message;\r
1580     return candidate && is.string(candidate.method) && message.id === void 0;\r
1581 }\r
1582 exports.isNotificationMessage = isNotificationMessage;\r
1583 /**\r
1584  * Tests if the given message is a response message\r
1585  */\r
1586 function isResponseMessage(message) {\r
1587     let candidate = message;\r
1588     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
1589 }\r
1590 exports.isResponseMessage = isResponseMessage;\r
1591
1592
1593 /***/ }),
1594 /* 8 */
1595 /***/ (function(module, exports, __webpack_require__) {
1596
1597 "use strict";
1598 /* --------------------------------------------------------------------------------------------\r
1599  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1600  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1601  * ------------------------------------------------------------------------------------------ */\r
1602 \r
1603 Object.defineProperty(exports, "__esModule", { value: true });\r
1604 const events_1 = __webpack_require__(9);\r
1605 const Is = __webpack_require__(6);\r
1606 let DefaultSize = 8192;\r
1607 let CR = Buffer.from('\r', 'ascii')[0];\r
1608 let LF = Buffer.from('\n', 'ascii')[0];\r
1609 let CRLF = '\r\n';\r
1610 class MessageBuffer {\r
1611     constructor(encoding = 'utf8') {\r
1612         this.encoding = encoding;\r
1613         this.index = 0;\r
1614         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
1615     }\r
1616     append(chunk) {\r
1617         var toAppend = chunk;\r
1618         if (typeof (chunk) === 'string') {\r
1619             var str = chunk;\r
1620             var bufferLen = Buffer.byteLength(str, this.encoding);\r
1621             toAppend = Buffer.allocUnsafe(bufferLen);\r
1622             toAppend.write(str, 0, bufferLen, this.encoding);\r
1623         }\r
1624         if (this.buffer.length - this.index >= toAppend.length) {\r
1625             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
1626         }\r
1627         else {\r
1628             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
1629             if (this.index === 0) {\r
1630                 this.buffer = Buffer.allocUnsafe(newSize);\r
1631                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
1632             }\r
1633             else {\r
1634                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
1635             }\r
1636         }\r
1637         this.index += toAppend.length;\r
1638     }\r
1639     tryReadHeaders() {\r
1640         let result = undefined;\r
1641         let current = 0;\r
1642         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
1643             current++;\r
1644         }\r
1645         // No header / body separator found (e.g CRLFCRLF)\r
1646         if (current + 3 >= this.index) {\r
1647             return result;\r
1648         }\r
1649         result = Object.create(null);\r
1650         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
1651         headers.forEach((header) => {\r
1652             let index = header.indexOf(':');\r
1653             if (index === -1) {\r
1654                 throw new Error('Message header must separate key and value using :');\r
1655             }\r
1656             let key = header.substr(0, index);\r
1657             let value = header.substr(index + 1).trim();\r
1658             result[key] = value;\r
1659         });\r
1660         let nextStart = current + 4;\r
1661         this.buffer = this.buffer.slice(nextStart);\r
1662         this.index = this.index - nextStart;\r
1663         return result;\r
1664     }\r
1665     tryReadContent(length) {\r
1666         if (this.index < length) {\r
1667             return null;\r
1668         }\r
1669         let result = this.buffer.toString(this.encoding, 0, length);\r
1670         let nextStart = length;\r
1671         this.buffer.copy(this.buffer, 0, nextStart);\r
1672         this.index = this.index - nextStart;\r
1673         return result;\r
1674     }\r
1675     get numberOfBytes() {\r
1676         return this.index;\r
1677     }\r
1678 }\r
1679 var MessageReader;\r
1680 (function (MessageReader) {\r
1681     function is(value) {\r
1682         let candidate = value;\r
1683         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
1684             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
1685     }\r
1686     MessageReader.is = is;\r
1687 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
1688 class AbstractMessageReader {\r
1689     constructor() {\r
1690         this.errorEmitter = new events_1.Emitter();\r
1691         this.closeEmitter = new events_1.Emitter();\r
1692         this.partialMessageEmitter = new events_1.Emitter();\r
1693     }\r
1694     dispose() {\r
1695         this.errorEmitter.dispose();\r
1696         this.closeEmitter.dispose();\r
1697     }\r
1698     get onError() {\r
1699         return this.errorEmitter.event;\r
1700     }\r
1701     fireError(error) {\r
1702         this.errorEmitter.fire(this.asError(error));\r
1703     }\r
1704     get onClose() {\r
1705         return this.closeEmitter.event;\r
1706     }\r
1707     fireClose() {\r
1708         this.closeEmitter.fire(undefined);\r
1709     }\r
1710     get onPartialMessage() {\r
1711         return this.partialMessageEmitter.event;\r
1712     }\r
1713     firePartialMessage(info) {\r
1714         this.partialMessageEmitter.fire(info);\r
1715     }\r
1716     asError(error) {\r
1717         if (error instanceof Error) {\r
1718             return error;\r
1719         }\r
1720         else {\r
1721             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1722         }\r
1723     }\r
1724 }\r
1725 exports.AbstractMessageReader = AbstractMessageReader;\r
1726 class StreamMessageReader extends AbstractMessageReader {\r
1727     constructor(readable, encoding = 'utf8') {\r
1728         super();\r
1729         this.readable = readable;\r
1730         this.buffer = new MessageBuffer(encoding);\r
1731         this._partialMessageTimeout = 10000;\r
1732     }\r
1733     set partialMessageTimeout(timeout) {\r
1734         this._partialMessageTimeout = timeout;\r
1735     }\r
1736     get partialMessageTimeout() {\r
1737         return this._partialMessageTimeout;\r
1738     }\r
1739     listen(callback) {\r
1740         this.nextMessageLength = -1;\r
1741         this.messageToken = 0;\r
1742         this.partialMessageTimer = undefined;\r
1743         this.callback = callback;\r
1744         this.readable.on('data', (data) => {\r
1745             this.onData(data);\r
1746         });\r
1747         this.readable.on('error', (error) => this.fireError(error));\r
1748         this.readable.on('close', () => this.fireClose());\r
1749     }\r
1750     onData(data) {\r
1751         this.buffer.append(data);\r
1752         while (true) {\r
1753             if (this.nextMessageLength === -1) {\r
1754                 let headers = this.buffer.tryReadHeaders();\r
1755                 if (!headers) {\r
1756                     return;\r
1757                 }\r
1758                 let contentLength = headers['Content-Length'];\r
1759                 if (!contentLength) {\r
1760                     throw new Error('Header must provide a Content-Length property.');\r
1761                 }\r
1762                 let length = parseInt(contentLength);\r
1763                 if (isNaN(length)) {\r
1764                     throw new Error('Content-Length value must be a number.');\r
1765                 }\r
1766                 this.nextMessageLength = length;\r
1767                 // Take the encoding form the header. For compatibility\r
1768                 // treat both utf-8 and utf8 as node utf8\r
1769             }\r
1770             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
1771             if (msg === null) {\r
1772                 /** We haven't received the full message yet. */\r
1773                 this.setPartialMessageTimer();\r
1774                 return;\r
1775             }\r
1776             this.clearPartialMessageTimer();\r
1777             this.nextMessageLength = -1;\r
1778             this.messageToken++;\r
1779             var json = JSON.parse(msg);\r
1780             this.callback(json);\r
1781         }\r
1782     }\r
1783     clearPartialMessageTimer() {\r
1784         if (this.partialMessageTimer) {\r
1785             clearTimeout(this.partialMessageTimer);\r
1786             this.partialMessageTimer = undefined;\r
1787         }\r
1788     }\r
1789     setPartialMessageTimer() {\r
1790         this.clearPartialMessageTimer();\r
1791         if (this._partialMessageTimeout <= 0) {\r
1792             return;\r
1793         }\r
1794         this.partialMessageTimer = setTimeout((token, timeout) => {\r
1795             this.partialMessageTimer = undefined;\r
1796             if (token === this.messageToken) {\r
1797                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
1798                 this.setPartialMessageTimer();\r
1799             }\r
1800         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
1801     }\r
1802 }\r
1803 exports.StreamMessageReader = StreamMessageReader;\r
1804 class IPCMessageReader extends AbstractMessageReader {\r
1805     constructor(process) {\r
1806         super();\r
1807         this.process = process;\r
1808         let eventEmitter = this.process;\r
1809         eventEmitter.on('error', (error) => this.fireError(error));\r
1810         eventEmitter.on('close', () => this.fireClose());\r
1811     }\r
1812     listen(callback) {\r
1813         this.process.on('message', callback);\r
1814     }\r
1815 }\r
1816 exports.IPCMessageReader = IPCMessageReader;\r
1817 class SocketMessageReader extends StreamMessageReader {\r
1818     constructor(socket, encoding = 'utf-8') {\r
1819         super(socket, encoding);\r
1820     }\r
1821 }\r
1822 exports.SocketMessageReader = SocketMessageReader;\r
1823
1824
1825 /***/ }),
1826 /* 9 */
1827 /***/ (function(module, exports, __webpack_require__) {
1828
1829 "use strict";
1830 /* --------------------------------------------------------------------------------------------\r
1831  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1832  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1833  * ------------------------------------------------------------------------------------------ */\r
1834 \r
1835 Object.defineProperty(exports, "__esModule", { value: true });\r
1836 var Disposable;\r
1837 (function (Disposable) {\r
1838     function create(func) {\r
1839         return {\r
1840             dispose: func\r
1841         };\r
1842     }\r
1843     Disposable.create = create;\r
1844 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
1845 var Event;\r
1846 (function (Event) {\r
1847     const _disposable = { dispose() { } };\r
1848     Event.None = function () { return _disposable; };\r
1849 })(Event = exports.Event || (exports.Event = {}));\r
1850 class CallbackList {\r
1851     add(callback, context = null, bucket) {\r
1852         if (!this._callbacks) {\r
1853             this._callbacks = [];\r
1854             this._contexts = [];\r
1855         }\r
1856         this._callbacks.push(callback);\r
1857         this._contexts.push(context);\r
1858         if (Array.isArray(bucket)) {\r
1859             bucket.push({ dispose: () => this.remove(callback, context) });\r
1860         }\r
1861     }\r
1862     remove(callback, context = null) {\r
1863         if (!this._callbacks) {\r
1864             return;\r
1865         }\r
1866         var foundCallbackWithDifferentContext = false;\r
1867         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
1868             if (this._callbacks[i] === callback) {\r
1869                 if (this._contexts[i] === context) {\r
1870                     // callback & context match => remove it\r
1871                     this._callbacks.splice(i, 1);\r
1872                     this._contexts.splice(i, 1);\r
1873                     return;\r
1874                 }\r
1875                 else {\r
1876                     foundCallbackWithDifferentContext = true;\r
1877                 }\r
1878             }\r
1879         }\r
1880         if (foundCallbackWithDifferentContext) {\r
1881             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
1882         }\r
1883     }\r
1884     invoke(...args) {\r
1885         if (!this._callbacks) {\r
1886             return [];\r
1887         }\r
1888         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
1889         for (var i = 0, len = callbacks.length; i < len; i++) {\r
1890             try {\r
1891                 ret.push(callbacks[i].apply(contexts[i], args));\r
1892             }\r
1893             catch (e) {\r
1894                 // eslint-disable-next-line no-console\r
1895                 console.error(e);\r
1896             }\r
1897         }\r
1898         return ret;\r
1899     }\r
1900     isEmpty() {\r
1901         return !this._callbacks || this._callbacks.length === 0;\r
1902     }\r
1903     dispose() {\r
1904         this._callbacks = undefined;\r
1905         this._contexts = undefined;\r
1906     }\r
1907 }\r
1908 class Emitter {\r
1909     constructor(_options) {\r
1910         this._options = _options;\r
1911     }\r
1912     /**\r
1913      * For the public to allow to subscribe\r
1914      * to events from this Emitter\r
1915      */\r
1916     get event() {\r
1917         if (!this._event) {\r
1918             this._event = (listener, thisArgs, disposables) => {\r
1919                 if (!this._callbacks) {\r
1920                     this._callbacks = new CallbackList();\r
1921                 }\r
1922                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
1923                     this._options.onFirstListenerAdd(this);\r
1924                 }\r
1925                 this._callbacks.add(listener, thisArgs);\r
1926                 let result;\r
1927                 result = {\r
1928                     dispose: () => {\r
1929                         this._callbacks.remove(listener, thisArgs);\r
1930                         result.dispose = Emitter._noop;\r
1931                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
1932                             this._options.onLastListenerRemove(this);\r
1933                         }\r
1934                     }\r
1935                 };\r
1936                 if (Array.isArray(disposables)) {\r
1937                     disposables.push(result);\r
1938                 }\r
1939                 return result;\r
1940             };\r
1941         }\r
1942         return this._event;\r
1943     }\r
1944     /**\r
1945      * To be kept private to fire an event to\r
1946      * subscribers\r
1947      */\r
1948     fire(event) {\r
1949         if (this._callbacks) {\r
1950             this._callbacks.invoke.call(this._callbacks, event);\r
1951         }\r
1952     }\r
1953     dispose() {\r
1954         if (this._callbacks) {\r
1955             this._callbacks.dispose();\r
1956             this._callbacks = undefined;\r
1957         }\r
1958     }\r
1959 }\r
1960 exports.Emitter = Emitter;\r
1961 Emitter._noop = function () { };\r
1962
1963
1964 /***/ }),
1965 /* 10 */
1966 /***/ (function(module, exports, __webpack_require__) {
1967
1968 "use strict";
1969 /* --------------------------------------------------------------------------------------------\r
1970  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1971  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1972  * ------------------------------------------------------------------------------------------ */\r
1973 \r
1974 Object.defineProperty(exports, "__esModule", { value: true });\r
1975 const events_1 = __webpack_require__(9);\r
1976 const Is = __webpack_require__(6);\r
1977 let ContentLength = 'Content-Length: ';\r
1978 let CRLF = '\r\n';\r
1979 var MessageWriter;\r
1980 (function (MessageWriter) {\r
1981     function is(value) {\r
1982         let candidate = value;\r
1983         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
1984             Is.func(candidate.onError) && Is.func(candidate.write);\r
1985     }\r
1986     MessageWriter.is = is;\r
1987 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
1988 class AbstractMessageWriter {\r
1989     constructor() {\r
1990         this.errorEmitter = new events_1.Emitter();\r
1991         this.closeEmitter = new events_1.Emitter();\r
1992     }\r
1993     dispose() {\r
1994         this.errorEmitter.dispose();\r
1995         this.closeEmitter.dispose();\r
1996     }\r
1997     get onError() {\r
1998         return this.errorEmitter.event;\r
1999     }\r
2000     fireError(error, message, count) {\r
2001         this.errorEmitter.fire([this.asError(error), message, count]);\r
2002     }\r
2003     get onClose() {\r
2004         return this.closeEmitter.event;\r
2005     }\r
2006     fireClose() {\r
2007         this.closeEmitter.fire(undefined);\r
2008     }\r
2009     asError(error) {\r
2010         if (error instanceof Error) {\r
2011             return error;\r
2012         }\r
2013         else {\r
2014             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
2015         }\r
2016     }\r
2017 }\r
2018 exports.AbstractMessageWriter = AbstractMessageWriter;\r
2019 class StreamMessageWriter extends AbstractMessageWriter {\r
2020     constructor(writable, encoding = 'utf8') {\r
2021         super();\r
2022         this.writable = writable;\r
2023         this.encoding = encoding;\r
2024         this.errorCount = 0;\r
2025         this.writable.on('error', (error) => this.fireError(error));\r
2026         this.writable.on('close', () => this.fireClose());\r
2027     }\r
2028     write(msg) {\r
2029         let json = JSON.stringify(msg);\r
2030         let contentLength = Buffer.byteLength(json, this.encoding);\r
2031         let headers = [\r
2032             ContentLength, contentLength.toString(), CRLF,\r
2033             CRLF\r
2034         ];\r
2035         try {\r
2036             // Header must be written in ASCII encoding\r
2037             this.writable.write(headers.join(''), 'ascii');\r
2038             // Now write the content. This can be written in any encoding\r
2039             this.writable.write(json, this.encoding);\r
2040             this.errorCount = 0;\r
2041         }\r
2042         catch (error) {\r
2043             this.errorCount++;\r
2044             this.fireError(error, msg, this.errorCount);\r
2045         }\r
2046     }\r
2047 }\r
2048 exports.StreamMessageWriter = StreamMessageWriter;\r
2049 class IPCMessageWriter extends AbstractMessageWriter {\r
2050     constructor(process) {\r
2051         super();\r
2052         this.process = process;\r
2053         this.errorCount = 0;\r
2054         this.queue = [];\r
2055         this.sending = false;\r
2056         let eventEmitter = this.process;\r
2057         eventEmitter.on('error', (error) => this.fireError(error));\r
2058         eventEmitter.on('close', () => this.fireClose);\r
2059     }\r
2060     write(msg) {\r
2061         if (!this.sending && this.queue.length === 0) {\r
2062             // See https://github.com/nodejs/node/issues/7657\r
2063             this.doWriteMessage(msg);\r
2064         }\r
2065         else {\r
2066             this.queue.push(msg);\r
2067         }\r
2068     }\r
2069     doWriteMessage(msg) {\r
2070         try {\r
2071             if (this.process.send) {\r
2072                 this.sending = true;\r
2073                 this.process.send(msg, undefined, undefined, (error) => {\r
2074                     this.sending = false;\r
2075                     if (error) {\r
2076                         this.errorCount++;\r
2077                         this.fireError(error, msg, this.errorCount);\r
2078                     }\r
2079                     else {\r
2080                         this.errorCount = 0;\r
2081                     }\r
2082                     if (this.queue.length > 0) {\r
2083                         this.doWriteMessage(this.queue.shift());\r
2084                     }\r
2085                 });\r
2086             }\r
2087         }\r
2088         catch (error) {\r
2089             this.errorCount++;\r
2090             this.fireError(error, msg, this.errorCount);\r
2091         }\r
2092     }\r
2093 }\r
2094 exports.IPCMessageWriter = IPCMessageWriter;\r
2095 class SocketMessageWriter extends AbstractMessageWriter {\r
2096     constructor(socket, encoding = 'utf8') {\r
2097         super();\r
2098         this.socket = socket;\r
2099         this.queue = [];\r
2100         this.sending = false;\r
2101         this.encoding = encoding;\r
2102         this.errorCount = 0;\r
2103         this.socket.on('error', (error) => this.fireError(error));\r
2104         this.socket.on('close', () => this.fireClose());\r
2105     }\r
2106     dispose() {\r
2107         super.dispose();\r
2108         this.socket.destroy();\r
2109     }\r
2110     write(msg) {\r
2111         if (!this.sending && this.queue.length === 0) {\r
2112             // See https://github.com/nodejs/node/issues/7657\r
2113             this.doWriteMessage(msg);\r
2114         }\r
2115         else {\r
2116             this.queue.push(msg);\r
2117         }\r
2118     }\r
2119     doWriteMessage(msg) {\r
2120         let json = JSON.stringify(msg);\r
2121         let contentLength = Buffer.byteLength(json, this.encoding);\r
2122         let headers = [\r
2123             ContentLength, contentLength.toString(), CRLF,\r
2124             CRLF\r
2125         ];\r
2126         try {\r
2127             // Header must be written in ASCII encoding\r
2128             this.sending = true;\r
2129             this.socket.write(headers.join(''), 'ascii', (error) => {\r
2130                 if (error) {\r
2131                     this.handleError(error, msg);\r
2132                 }\r
2133                 try {\r
2134                     // Now write the content. This can be written in any encoding\r
2135                     this.socket.write(json, this.encoding, (error) => {\r
2136                         this.sending = false;\r
2137                         if (error) {\r
2138                             this.handleError(error, msg);\r
2139                         }\r
2140                         else {\r
2141                             this.errorCount = 0;\r
2142                         }\r
2143                         if (this.queue.length > 0) {\r
2144                             this.doWriteMessage(this.queue.shift());\r
2145                         }\r
2146                     });\r
2147                 }\r
2148                 catch (error) {\r
2149                     this.handleError(error, msg);\r
2150                 }\r
2151             });\r
2152         }\r
2153         catch (error) {\r
2154             this.handleError(error, msg);\r
2155         }\r
2156     }\r
2157     handleError(error, msg) {\r
2158         this.errorCount++;\r
2159         this.fireError(error, msg, this.errorCount);\r
2160     }\r
2161 }\r
2162 exports.SocketMessageWriter = SocketMessageWriter;\r
2163
2164
2165 /***/ }),
2166 /* 11 */
2167 /***/ (function(module, exports, __webpack_require__) {
2168
2169 "use strict";
2170 /*---------------------------------------------------------------------------------------------\r
2171  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2172  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2173  *--------------------------------------------------------------------------------------------*/\r
2174 \r
2175 Object.defineProperty(exports, "__esModule", { value: true });\r
2176 const events_1 = __webpack_require__(9);\r
2177 const Is = __webpack_require__(6);\r
2178 var CancellationToken;\r
2179 (function (CancellationToken) {\r
2180     CancellationToken.None = Object.freeze({\r
2181         isCancellationRequested: false,\r
2182         onCancellationRequested: events_1.Event.None\r
2183     });\r
2184     CancellationToken.Cancelled = Object.freeze({\r
2185         isCancellationRequested: true,\r
2186         onCancellationRequested: events_1.Event.None\r
2187     });\r
2188     function is(value) {\r
2189         let candidate = value;\r
2190         return candidate && (candidate === CancellationToken.None\r
2191             || candidate === CancellationToken.Cancelled\r
2192             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
2193     }\r
2194     CancellationToken.is = is;\r
2195 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
2196 const shortcutEvent = Object.freeze(function (callback, context) {\r
2197     let handle = setTimeout(callback.bind(context), 0);\r
2198     return { dispose() { clearTimeout(handle); } };\r
2199 });\r
2200 class MutableToken {\r
2201     constructor() {\r
2202         this._isCancelled = false;\r
2203     }\r
2204     cancel() {\r
2205         if (!this._isCancelled) {\r
2206             this._isCancelled = true;\r
2207             if (this._emitter) {\r
2208                 this._emitter.fire(undefined);\r
2209                 this.dispose();\r
2210             }\r
2211         }\r
2212     }\r
2213     get isCancellationRequested() {\r
2214         return this._isCancelled;\r
2215     }\r
2216     get onCancellationRequested() {\r
2217         if (this._isCancelled) {\r
2218             return shortcutEvent;\r
2219         }\r
2220         if (!this._emitter) {\r
2221             this._emitter = new events_1.Emitter();\r
2222         }\r
2223         return this._emitter.event;\r
2224     }\r
2225     dispose() {\r
2226         if (this._emitter) {\r
2227             this._emitter.dispose();\r
2228             this._emitter = undefined;\r
2229         }\r
2230     }\r
2231 }\r
2232 class CancellationTokenSource {\r
2233     get token() {\r
2234         if (!this._token) {\r
2235             // be lazy and create the token only when\r
2236             // actually needed\r
2237             this._token = new MutableToken();\r
2238         }\r
2239         return this._token;\r
2240     }\r
2241     cancel() {\r
2242         if (!this._token) {\r
2243             // save an object by returning the default\r
2244             // cancelled token when cancellation happens\r
2245             // before someone asks for the token\r
2246             this._token = CancellationToken.Cancelled;\r
2247         }\r
2248         else {\r
2249             this._token.cancel();\r
2250         }\r
2251     }\r
2252     dispose() {\r
2253         if (!this._token) {\r
2254             // ensure to initialize with an empty token if we had none\r
2255             this._token = CancellationToken.None;\r
2256         }\r
2257         else if (this._token instanceof MutableToken) {\r
2258             // actually dispose\r
2259             this._token.dispose();\r
2260         }\r
2261     }\r
2262 }\r
2263 exports.CancellationTokenSource = CancellationTokenSource;\r
2264
2265
2266 /***/ }),
2267 /* 12 */
2268 /***/ (function(module, exports, __webpack_require__) {
2269
2270 "use strict";
2271 \r
2272 /*---------------------------------------------------------------------------------------------\r
2273  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2274  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2275  *--------------------------------------------------------------------------------------------*/\r
2276 Object.defineProperty(exports, "__esModule", { value: true });\r
2277 var Touch;\r
2278 (function (Touch) {\r
2279     Touch.None = 0;\r
2280     Touch.First = 1;\r
2281     Touch.Last = 2;\r
2282 })(Touch = exports.Touch || (exports.Touch = {}));\r
2283 class LinkedMap {\r
2284     constructor() {\r
2285         this._map = new Map();\r
2286         this._head = undefined;\r
2287         this._tail = undefined;\r
2288         this._size = 0;\r
2289     }\r
2290     clear() {\r
2291         this._map.clear();\r
2292         this._head = undefined;\r
2293         this._tail = undefined;\r
2294         this._size = 0;\r
2295     }\r
2296     isEmpty() {\r
2297         return !this._head && !this._tail;\r
2298     }\r
2299     get size() {\r
2300         return this._size;\r
2301     }\r
2302     has(key) {\r
2303         return this._map.has(key);\r
2304     }\r
2305     get(key) {\r
2306         const item = this._map.get(key);\r
2307         if (!item) {\r
2308             return undefined;\r
2309         }\r
2310         return item.value;\r
2311     }\r
2312     set(key, value, touch = Touch.None) {\r
2313         let item = this._map.get(key);\r
2314         if (item) {\r
2315             item.value = value;\r
2316             if (touch !== Touch.None) {\r
2317                 this.touch(item, touch);\r
2318             }\r
2319         }\r
2320         else {\r
2321             item = { key, value, next: undefined, previous: undefined };\r
2322             switch (touch) {\r
2323                 case Touch.None:\r
2324                     this.addItemLast(item);\r
2325                     break;\r
2326                 case Touch.First:\r
2327                     this.addItemFirst(item);\r
2328                     break;\r
2329                 case Touch.Last:\r
2330                     this.addItemLast(item);\r
2331                     break;\r
2332                 default:\r
2333                     this.addItemLast(item);\r
2334                     break;\r
2335             }\r
2336             this._map.set(key, item);\r
2337             this._size++;\r
2338         }\r
2339     }\r
2340     delete(key) {\r
2341         const item = this._map.get(key);\r
2342         if (!item) {\r
2343             return false;\r
2344         }\r
2345         this._map.delete(key);\r
2346         this.removeItem(item);\r
2347         this._size--;\r
2348         return true;\r
2349     }\r
2350     shift() {\r
2351         if (!this._head && !this._tail) {\r
2352             return undefined;\r
2353         }\r
2354         if (!this._head || !this._tail) {\r
2355             throw new Error('Invalid list');\r
2356         }\r
2357         const item = this._head;\r
2358         this._map.delete(item.key);\r
2359         this.removeItem(item);\r
2360         this._size--;\r
2361         return item.value;\r
2362     }\r
2363     forEach(callbackfn, thisArg) {\r
2364         let current = this._head;\r
2365         while (current) {\r
2366             if (thisArg) {\r
2367                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2368             }\r
2369             else {\r
2370                 callbackfn(current.value, current.key, this);\r
2371             }\r
2372             current = current.next;\r
2373         }\r
2374     }\r
2375     forEachReverse(callbackfn, thisArg) {\r
2376         let current = this._tail;\r
2377         while (current) {\r
2378             if (thisArg) {\r
2379                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2380             }\r
2381             else {\r
2382                 callbackfn(current.value, current.key, this);\r
2383             }\r
2384             current = current.previous;\r
2385         }\r
2386     }\r
2387     values() {\r
2388         let result = [];\r
2389         let current = this._head;\r
2390         while (current) {\r
2391             result.push(current.value);\r
2392             current = current.next;\r
2393         }\r
2394         return result;\r
2395     }\r
2396     keys() {\r
2397         let result = [];\r
2398         let current = this._head;\r
2399         while (current) {\r
2400             result.push(current.key);\r
2401             current = current.next;\r
2402         }\r
2403         return result;\r
2404     }\r
2405     /* JSON RPC run on es5 which has no Symbol.iterator\r
2406     public keys(): IterableIterator<K> {\r
2407         let current = this._head;\r
2408         let iterator: IterableIterator<K> = {\r
2409             [Symbol.iterator]() {\r
2410                 return iterator;\r
2411             },\r
2412             next():IteratorResult<K> {\r
2413                 if (current) {\r
2414                     let result = { value: current.key, done: false };\r
2415                     current = current.next;\r
2416                     return result;\r
2417                 } else {\r
2418                     return { value: undefined, done: true };\r
2419                 }\r
2420             }\r
2421         };\r
2422         return iterator;\r
2423     }\r
2424 \r
2425     public values(): IterableIterator<V> {\r
2426         let current = this._head;\r
2427         let iterator: IterableIterator<V> = {\r
2428             [Symbol.iterator]() {\r
2429                 return iterator;\r
2430             },\r
2431             next():IteratorResult<V> {\r
2432                 if (current) {\r
2433                     let result = { value: current.value, done: false };\r
2434                     current = current.next;\r
2435                     return result;\r
2436                 } else {\r
2437                     return { value: undefined, done: true };\r
2438                 }\r
2439             }\r
2440         };\r
2441         return iterator;\r
2442     }\r
2443     */\r
2444     addItemFirst(item) {\r
2445         // First time Insert\r
2446         if (!this._head && !this._tail) {\r
2447             this._tail = item;\r
2448         }\r
2449         else if (!this._head) {\r
2450             throw new Error('Invalid list');\r
2451         }\r
2452         else {\r
2453             item.next = this._head;\r
2454             this._head.previous = item;\r
2455         }\r
2456         this._head = item;\r
2457     }\r
2458     addItemLast(item) {\r
2459         // First time Insert\r
2460         if (!this._head && !this._tail) {\r
2461             this._head = item;\r
2462         }\r
2463         else if (!this._tail) {\r
2464             throw new Error('Invalid list');\r
2465         }\r
2466         else {\r
2467             item.previous = this._tail;\r
2468             this._tail.next = item;\r
2469         }\r
2470         this._tail = item;\r
2471     }\r
2472     removeItem(item) {\r
2473         if (item === this._head && item === this._tail) {\r
2474             this._head = undefined;\r
2475             this._tail = undefined;\r
2476         }\r
2477         else if (item === this._head) {\r
2478             this._head = item.next;\r
2479         }\r
2480         else if (item === this._tail) {\r
2481             this._tail = item.previous;\r
2482         }\r
2483         else {\r
2484             const next = item.next;\r
2485             const previous = item.previous;\r
2486             if (!next || !previous) {\r
2487                 throw new Error('Invalid list');\r
2488             }\r
2489             next.previous = previous;\r
2490             previous.next = next;\r
2491         }\r
2492     }\r
2493     touch(item, touch) {\r
2494         if (!this._head || !this._tail) {\r
2495             throw new Error('Invalid list');\r
2496         }\r
2497         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
2498             return;\r
2499         }\r
2500         if (touch === Touch.First) {\r
2501             if (item === this._head) {\r
2502                 return;\r
2503             }\r
2504             const next = item.next;\r
2505             const previous = item.previous;\r
2506             // Unlink the item\r
2507             if (item === this._tail) {\r
2508                 // previous must be defined since item was not head but is tail\r
2509                 // So there are more than on item in the map\r
2510                 previous.next = undefined;\r
2511                 this._tail = previous;\r
2512             }\r
2513             else {\r
2514                 // Both next and previous are not undefined since item was neither head nor tail.\r
2515                 next.previous = previous;\r
2516                 previous.next = next;\r
2517             }\r
2518             // Insert the node at head\r
2519             item.previous = undefined;\r
2520             item.next = this._head;\r
2521             this._head.previous = item;\r
2522             this._head = item;\r
2523         }\r
2524         else if (touch === Touch.Last) {\r
2525             if (item === this._tail) {\r
2526                 return;\r
2527             }\r
2528             const next = item.next;\r
2529             const previous = item.previous;\r
2530             // Unlink the item.\r
2531             if (item === this._head) {\r
2532                 // next must be defined since item was not tail but is head\r
2533                 // So there are more than on item in the map\r
2534                 next.previous = undefined;\r
2535                 this._head = next;\r
2536             }\r
2537             else {\r
2538                 // Both next and previous are not undefined since item was neither head nor tail.\r
2539                 next.previous = previous;\r
2540                 previous.next = next;\r
2541             }\r
2542             item.next = undefined;\r
2543             item.previous = this._tail;\r
2544             this._tail.next = item;\r
2545             this._tail = item;\r
2546         }\r
2547     }\r
2548 }\r
2549 exports.LinkedMap = LinkedMap;\r
2550
2551
2552 /***/ }),
2553 /* 13 */
2554 /***/ (function(module, exports, __webpack_require__) {
2555
2556 "use strict";
2557 /* --------------------------------------------------------------------------------------------\r
2558  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2559  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2560  * ------------------------------------------------------------------------------------------ */\r
2561 \r
2562 Object.defineProperty(exports, "__esModule", { value: true });\r
2563 const path_1 = __webpack_require__(3);\r
2564 const os_1 = __webpack_require__(14);\r
2565 const crypto_1 = __webpack_require__(15);\r
2566 const net_1 = __webpack_require__(16);\r
2567 const messageReader_1 = __webpack_require__(8);\r
2568 const messageWriter_1 = __webpack_require__(10);\r
2569 function generateRandomPipeName() {\r
2570     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
2571     if (process.platform === 'win32') {\r
2572         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
2573     }\r
2574     else {\r
2575         // Mac/Unix: use socket file\r
2576         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
2577     }\r
2578 }\r
2579 exports.generateRandomPipeName = generateRandomPipeName;\r
2580 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
2581     let connectResolve;\r
2582     let connected = new Promise((resolve, _reject) => {\r
2583         connectResolve = resolve;\r
2584     });\r
2585     return new Promise((resolve, reject) => {\r
2586         let server = net_1.createServer((socket) => {\r
2587             server.close();\r
2588             connectResolve([\r
2589                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2590                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2591             ]);\r
2592         });\r
2593         server.on('error', reject);\r
2594         server.listen(pipeName, () => {\r
2595             server.removeListener('error', reject);\r
2596             resolve({\r
2597                 onConnected: () => { return connected; }\r
2598             });\r
2599         });\r
2600     });\r
2601 }\r
2602 exports.createClientPipeTransport = createClientPipeTransport;\r
2603 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
2604     const socket = net_1.createConnection(pipeName);\r
2605     return [\r
2606         new messageReader_1.SocketMessageReader(socket, encoding),\r
2607         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2608     ];\r
2609 }\r
2610 exports.createServerPipeTransport = createServerPipeTransport;\r
2611
2612
2613 /***/ }),
2614 /* 14 */
2615 /***/ (function(module, exports) {
2616
2617 module.exports = require("os");
2618
2619 /***/ }),
2620 /* 15 */
2621 /***/ (function(module, exports) {
2622
2623 module.exports = require("crypto");
2624
2625 /***/ }),
2626 /* 16 */
2627 /***/ (function(module, exports) {
2628
2629 module.exports = require("net");
2630
2631 /***/ }),
2632 /* 17 */
2633 /***/ (function(module, exports, __webpack_require__) {
2634
2635 "use strict";
2636 /* --------------------------------------------------------------------------------------------\r
2637  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2638  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2639  * ------------------------------------------------------------------------------------------ */\r
2640 \r
2641 Object.defineProperty(exports, "__esModule", { value: true });\r
2642 const net_1 = __webpack_require__(16);\r
2643 const messageReader_1 = __webpack_require__(8);\r
2644 const messageWriter_1 = __webpack_require__(10);\r
2645 function createClientSocketTransport(port, encoding = 'utf-8') {\r
2646     let connectResolve;\r
2647     let connected = new Promise((resolve, _reject) => {\r
2648         connectResolve = resolve;\r
2649     });\r
2650     return new Promise((resolve, reject) => {\r
2651         let server = net_1.createServer((socket) => {\r
2652             server.close();\r
2653             connectResolve([\r
2654                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2655                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2656             ]);\r
2657         });\r
2658         server.on('error', reject);\r
2659         server.listen(port, '127.0.0.1', () => {\r
2660             server.removeListener('error', reject);\r
2661             resolve({\r
2662                 onConnected: () => { return connected; }\r
2663             });\r
2664         });\r
2665     });\r
2666 }\r
2667 exports.createClientSocketTransport = createClientSocketTransport;\r
2668 function createServerSocketTransport(port, encoding = 'utf-8') {\r
2669     const socket = net_1.createConnection(port, '127.0.0.1');\r
2670     return [\r
2671         new messageReader_1.SocketMessageReader(socket, encoding),\r
2672         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2673     ];\r
2674 }\r
2675 exports.createServerSocketTransport = createServerSocketTransport;\r
2676
2677
2678 /***/ }),
2679 /* 18 */
2680 /***/ (function(module, __webpack_exports__, __webpack_require__) {
2681
2682 "use strict";
2683 __webpack_require__.r(__webpack_exports__);
2684 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
2685 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
2686 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
2687 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
2688 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
2689 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
2690 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
2691 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
2692 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
2693 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
2694 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
2695 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
2696 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
2697 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
2698 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
2699 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
2700 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
2701 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
2702 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
2703 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
2704 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
2705 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
2706 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
2707 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
2708 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
2709 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
2710 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
2711 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
2712 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
2713 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
2714 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
2715 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
2716 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
2717 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
2718 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
2719 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
2720 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
2721 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
2722 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
2723 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
2724 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
2725 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
2726 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
2727 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
2728 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
2729 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
2730 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
2731 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
2732 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
2733 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
2734 /* --------------------------------------------------------------------------------------------\r
2735  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2736  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2737  * ------------------------------------------------------------------------------------------ */\r
2738 \r
2739 /**\r
2740  * The Position namespace provides helper functions to work with\r
2741  * [Position](#Position) literals.\r
2742  */\r
2743 var Position;\r
2744 (function (Position) {\r
2745     /**\r
2746      * Creates a new Position literal from the given line and character.\r
2747      * @param line The position's line.\r
2748      * @param character The position's character.\r
2749      */\r
2750     function create(line, character) {\r
2751         return { line: line, character: character };\r
2752     }\r
2753     Position.create = create;\r
2754     /**\r
2755      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
2756      */\r
2757     function is(value) {\r
2758         var candidate = value;\r
2759         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
2760     }\r
2761     Position.is = is;\r
2762 })(Position || (Position = {}));\r
2763 /**\r
2764  * The Range namespace provides helper functions to work with\r
2765  * [Range](#Range) literals.\r
2766  */\r
2767 var Range;\r
2768 (function (Range) {\r
2769     function create(one, two, three, four) {\r
2770         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
2771             return { start: Position.create(one, two), end: Position.create(three, four) };\r
2772         }\r
2773         else if (Position.is(one) && Position.is(two)) {\r
2774             return { start: one, end: two };\r
2775         }\r
2776         else {\r
2777             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
2778         }\r
2779     }\r
2780     Range.create = create;\r
2781     /**\r
2782      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
2783      */\r
2784     function is(value) {\r
2785         var candidate = value;\r
2786         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
2787     }\r
2788     Range.is = is;\r
2789 })(Range || (Range = {}));\r
2790 /**\r
2791  * The Location namespace provides helper functions to work with\r
2792  * [Location](#Location) literals.\r
2793  */\r
2794 var Location;\r
2795 (function (Location) {\r
2796     /**\r
2797      * Creates a Location literal.\r
2798      * @param uri The location's uri.\r
2799      * @param range The location's range.\r
2800      */\r
2801     function create(uri, range) {\r
2802         return { uri: uri, range: range };\r
2803     }\r
2804     Location.create = create;\r
2805     /**\r
2806      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
2807      */\r
2808     function is(value) {\r
2809         var candidate = value;\r
2810         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
2811     }\r
2812     Location.is = is;\r
2813 })(Location || (Location = {}));\r
2814 /**\r
2815  * The LocationLink namespace provides helper functions to work with\r
2816  * [LocationLink](#LocationLink) literals.\r
2817  */\r
2818 var LocationLink;\r
2819 (function (LocationLink) {\r
2820     /**\r
2821      * Creates a LocationLink literal.\r
2822      * @param targetUri The definition's uri.\r
2823      * @param targetRange The full range of the definition.\r
2824      * @param targetSelectionRange The span of the symbol definition at the target.\r
2825      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
2826      */\r
2827     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
2828         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
2829     }\r
2830     LocationLink.create = create;\r
2831     /**\r
2832      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
2833      */\r
2834     function is(value) {\r
2835         var candidate = value;\r
2836         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
2837             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
2838             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
2839     }\r
2840     LocationLink.is = is;\r
2841 })(LocationLink || (LocationLink = {}));\r
2842 /**\r
2843  * The Color namespace provides helper functions to work with\r
2844  * [Color](#Color) literals.\r
2845  */\r
2846 var Color;\r
2847 (function (Color) {\r
2848     /**\r
2849      * Creates a new Color literal.\r
2850      */\r
2851     function create(red, green, blue, alpha) {\r
2852         return {\r
2853             red: red,\r
2854             green: green,\r
2855             blue: blue,\r
2856             alpha: alpha,\r
2857         };\r
2858     }\r
2859     Color.create = create;\r
2860     /**\r
2861      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
2862      */\r
2863     function is(value) {\r
2864         var candidate = value;\r
2865         return Is.number(candidate.red)\r
2866             && Is.number(candidate.green)\r
2867             && Is.number(candidate.blue)\r
2868             && Is.number(candidate.alpha);\r
2869     }\r
2870     Color.is = is;\r
2871 })(Color || (Color = {}));\r
2872 /**\r
2873  * The ColorInformation namespace provides helper functions to work with\r
2874  * [ColorInformation](#ColorInformation) literals.\r
2875  */\r
2876 var ColorInformation;\r
2877 (function (ColorInformation) {\r
2878     /**\r
2879      * Creates a new ColorInformation literal.\r
2880      */\r
2881     function create(range, color) {\r
2882         return {\r
2883             range: range,\r
2884             color: color,\r
2885         };\r
2886     }\r
2887     ColorInformation.create = create;\r
2888     /**\r
2889      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2890      */\r
2891     function is(value) {\r
2892         var candidate = value;\r
2893         return Range.is(candidate.range) && Color.is(candidate.color);\r
2894     }\r
2895     ColorInformation.is = is;\r
2896 })(ColorInformation || (ColorInformation = {}));\r
2897 /**\r
2898  * The Color namespace provides helper functions to work with\r
2899  * [ColorPresentation](#ColorPresentation) literals.\r
2900  */\r
2901 var ColorPresentation;\r
2902 (function (ColorPresentation) {\r
2903     /**\r
2904      * Creates a new ColorInformation literal.\r
2905      */\r
2906     function create(label, textEdit, additionalTextEdits) {\r
2907         return {\r
2908             label: label,\r
2909             textEdit: textEdit,\r
2910             additionalTextEdits: additionalTextEdits,\r
2911         };\r
2912     }\r
2913     ColorPresentation.create = create;\r
2914     /**\r
2915      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2916      */\r
2917     function is(value) {\r
2918         var candidate = value;\r
2919         return Is.string(candidate.label)\r
2920             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
2921             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
2922     }\r
2923     ColorPresentation.is = is;\r
2924 })(ColorPresentation || (ColorPresentation = {}));\r
2925 /**\r
2926  * Enum of known range kinds\r
2927  */\r
2928 var FoldingRangeKind;\r
2929 (function (FoldingRangeKind) {\r
2930     /**\r
2931      * Folding range for a comment\r
2932      */\r
2933     FoldingRangeKind["Comment"] = "comment";\r
2934     /**\r
2935      * Folding range for a imports or includes\r
2936      */\r
2937     FoldingRangeKind["Imports"] = "imports";\r
2938     /**\r
2939      * Folding range for a region (e.g. `#region`)\r
2940      */\r
2941     FoldingRangeKind["Region"] = "region";\r
2942 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
2943 /**\r
2944  * The folding range namespace provides helper functions to work with\r
2945  * [FoldingRange](#FoldingRange) literals.\r
2946  */\r
2947 var FoldingRange;\r
2948 (function (FoldingRange) {\r
2949     /**\r
2950      * Creates a new FoldingRange literal.\r
2951      */\r
2952     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
2953         var result = {\r
2954             startLine: startLine,\r
2955             endLine: endLine\r
2956         };\r
2957         if (Is.defined(startCharacter)) {\r
2958             result.startCharacter = startCharacter;\r
2959         }\r
2960         if (Is.defined(endCharacter)) {\r
2961             result.endCharacter = endCharacter;\r
2962         }\r
2963         if (Is.defined(kind)) {\r
2964             result.kind = kind;\r
2965         }\r
2966         return result;\r
2967     }\r
2968     FoldingRange.create = create;\r
2969     /**\r
2970      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
2971      */\r
2972     function is(value) {\r
2973         var candidate = value;\r
2974         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
2975             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
2976             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
2977             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
2978     }\r
2979     FoldingRange.is = is;\r
2980 })(FoldingRange || (FoldingRange = {}));\r
2981 /**\r
2982  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
2983  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
2984  */\r
2985 var DiagnosticRelatedInformation;\r
2986 (function (DiagnosticRelatedInformation) {\r
2987     /**\r
2988      * Creates a new DiagnosticRelatedInformation literal.\r
2989      */\r
2990     function create(location, message) {\r
2991         return {\r
2992             location: location,\r
2993             message: message\r
2994         };\r
2995     }\r
2996     DiagnosticRelatedInformation.create = create;\r
2997     /**\r
2998      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
2999      */\r
3000     function is(value) {\r
3001         var candidate = value;\r
3002         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
3003     }\r
3004     DiagnosticRelatedInformation.is = is;\r
3005 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
3006 /**\r
3007  * The diagnostic's severity.\r
3008  */\r
3009 var DiagnosticSeverity;\r
3010 (function (DiagnosticSeverity) {\r
3011     /**\r
3012      * Reports an error.\r
3013      */\r
3014     DiagnosticSeverity.Error = 1;\r
3015     /**\r
3016      * Reports a warning.\r
3017      */\r
3018     DiagnosticSeverity.Warning = 2;\r
3019     /**\r
3020      * Reports an information.\r
3021      */\r
3022     DiagnosticSeverity.Information = 3;\r
3023     /**\r
3024      * Reports a hint.\r
3025      */\r
3026     DiagnosticSeverity.Hint = 4;\r
3027 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
3028 /**\r
3029  * The diagnostic tags.\r
3030  *\r
3031  * @since 3.15.0\r
3032  */\r
3033 var DiagnosticTag;\r
3034 (function (DiagnosticTag) {\r
3035     /**\r
3036      * Unused or unnecessary code.\r
3037      *\r
3038      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
3039      * an error squiggle.\r
3040      */\r
3041     DiagnosticTag.Unnecessary = 1;\r
3042     /**\r
3043      * Deprecated or obsolete code.\r
3044      *\r
3045      * Clients are allowed to rendered diagnostics with this tag strike through.\r
3046      */\r
3047     DiagnosticTag.Deprecated = 2;\r
3048 })(DiagnosticTag || (DiagnosticTag = {}));\r
3049 /**\r
3050  * The Diagnostic namespace provides helper functions to work with\r
3051  * [Diagnostic](#Diagnostic) literals.\r
3052  */\r
3053 var Diagnostic;\r
3054 (function (Diagnostic) {\r
3055     /**\r
3056      * Creates a new Diagnostic literal.\r
3057      */\r
3058     function create(range, message, severity, code, source, relatedInformation) {\r
3059         var result = { range: range, message: message };\r
3060         if (Is.defined(severity)) {\r
3061             result.severity = severity;\r
3062         }\r
3063         if (Is.defined(code)) {\r
3064             result.code = code;\r
3065         }\r
3066         if (Is.defined(source)) {\r
3067             result.source = source;\r
3068         }\r
3069         if (Is.defined(relatedInformation)) {\r
3070             result.relatedInformation = relatedInformation;\r
3071         }\r
3072         return result;\r
3073     }\r
3074     Diagnostic.create = create;\r
3075     /**\r
3076      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
3077      */\r
3078     function is(value) {\r
3079         var candidate = value;\r
3080         return Is.defined(candidate)\r
3081             && Range.is(candidate.range)\r
3082             && Is.string(candidate.message)\r
3083             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
3084             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
3085             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
3086             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
3087     }\r
3088     Diagnostic.is = is;\r
3089 })(Diagnostic || (Diagnostic = {}));\r
3090 /**\r
3091  * The Command namespace provides helper functions to work with\r
3092  * [Command](#Command) literals.\r
3093  */\r
3094 var Command;\r
3095 (function (Command) {\r
3096     /**\r
3097      * Creates a new Command literal.\r
3098      */\r
3099     function create(title, command) {\r
3100         var args = [];\r
3101         for (var _i = 2; _i < arguments.length; _i++) {\r
3102             args[_i - 2] = arguments[_i];\r
3103         }\r
3104         var result = { title: title, command: command };\r
3105         if (Is.defined(args) && args.length > 0) {\r
3106             result.arguments = args;\r
3107         }\r
3108         return result;\r
3109     }\r
3110     Command.create = create;\r
3111     /**\r
3112      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
3113      */\r
3114     function is(value) {\r
3115         var candidate = value;\r
3116         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
3117     }\r
3118     Command.is = is;\r
3119 })(Command || (Command = {}));\r
3120 /**\r
3121  * The TextEdit namespace provides helper function to create replace,\r
3122  * insert and delete edits more easily.\r
3123  */\r
3124 var TextEdit;\r
3125 (function (TextEdit) {\r
3126     /**\r
3127      * Creates a replace text edit.\r
3128      * @param range The range of text to be replaced.\r
3129      * @param newText The new text.\r
3130      */\r
3131     function replace(range, newText) {\r
3132         return { range: range, newText: newText };\r
3133     }\r
3134     TextEdit.replace = replace;\r
3135     /**\r
3136      * Creates a insert text edit.\r
3137      * @param position The position to insert the text at.\r
3138      * @param newText The text to be inserted.\r
3139      */\r
3140     function insert(position, newText) {\r
3141         return { range: { start: position, end: position }, newText: newText };\r
3142     }\r
3143     TextEdit.insert = insert;\r
3144     /**\r
3145      * Creates a delete text edit.\r
3146      * @param range The range of text to be deleted.\r
3147      */\r
3148     function del(range) {\r
3149         return { range: range, newText: '' };\r
3150     }\r
3151     TextEdit.del = del;\r
3152     function is(value) {\r
3153         var candidate = value;\r
3154         return Is.objectLiteral(candidate)\r
3155             && Is.string(candidate.newText)\r
3156             && Range.is(candidate.range);\r
3157     }\r
3158     TextEdit.is = is;\r
3159 })(TextEdit || (TextEdit = {}));\r
3160 /**\r
3161  * The TextDocumentEdit namespace provides helper function to create\r
3162  * an edit that manipulates a text document.\r
3163  */\r
3164 var TextDocumentEdit;\r
3165 (function (TextDocumentEdit) {\r
3166     /**\r
3167      * Creates a new `TextDocumentEdit`\r
3168      */\r
3169     function create(textDocument, edits) {\r
3170         return { textDocument: textDocument, edits: edits };\r
3171     }\r
3172     TextDocumentEdit.create = create;\r
3173     function is(value) {\r
3174         var candidate = value;\r
3175         return Is.defined(candidate)\r
3176             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
3177             && Array.isArray(candidate.edits);\r
3178     }\r
3179     TextDocumentEdit.is = is;\r
3180 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
3181 var CreateFile;\r
3182 (function (CreateFile) {\r
3183     function create(uri, options) {\r
3184         var result = {\r
3185             kind: 'create',\r
3186             uri: uri\r
3187         };\r
3188         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3189             result.options = options;\r
3190         }\r
3191         return result;\r
3192     }\r
3193     CreateFile.create = create;\r
3194     function is(value) {\r
3195         var candidate = value;\r
3196         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
3197             (candidate.options === void 0 ||\r
3198                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3199     }\r
3200     CreateFile.is = is;\r
3201 })(CreateFile || (CreateFile = {}));\r
3202 var RenameFile;\r
3203 (function (RenameFile) {\r
3204     function create(oldUri, newUri, options) {\r
3205         var result = {\r
3206             kind: 'rename',\r
3207             oldUri: oldUri,\r
3208             newUri: newUri\r
3209         };\r
3210         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3211             result.options = options;\r
3212         }\r
3213         return result;\r
3214     }\r
3215     RenameFile.create = create;\r
3216     function is(value) {\r
3217         var candidate = value;\r
3218         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
3219             (candidate.options === void 0 ||\r
3220                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3221     }\r
3222     RenameFile.is = is;\r
3223 })(RenameFile || (RenameFile = {}));\r
3224 var DeleteFile;\r
3225 (function (DeleteFile) {\r
3226     function create(uri, options) {\r
3227         var result = {\r
3228             kind: 'delete',\r
3229             uri: uri\r
3230         };\r
3231         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
3232             result.options = options;\r
3233         }\r
3234         return result;\r
3235     }\r
3236     DeleteFile.create = create;\r
3237     function is(value) {\r
3238         var candidate = value;\r
3239         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
3240             (candidate.options === void 0 ||\r
3241                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
3242     }\r
3243     DeleteFile.is = is;\r
3244 })(DeleteFile || (DeleteFile = {}));\r
3245 var WorkspaceEdit;\r
3246 (function (WorkspaceEdit) {\r
3247     function is(value) {\r
3248         var candidate = value;\r
3249         return candidate &&\r
3250             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
3251             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
3252                 if (Is.string(change.kind)) {\r
3253                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
3254                 }\r
3255                 else {\r
3256                     return TextDocumentEdit.is(change);\r
3257                 }\r
3258             }));\r
3259     }\r
3260     WorkspaceEdit.is = is;\r
3261 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
3262 var TextEditChangeImpl = /** @class */ (function () {\r
3263     function TextEditChangeImpl(edits) {\r
3264         this.edits = edits;\r
3265     }\r
3266     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
3267         this.edits.push(TextEdit.insert(position, newText));\r
3268     };\r
3269     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
3270         this.edits.push(TextEdit.replace(range, newText));\r
3271     };\r
3272     TextEditChangeImpl.prototype.delete = function (range) {\r
3273         this.edits.push(TextEdit.del(range));\r
3274     };\r
3275     TextEditChangeImpl.prototype.add = function (edit) {\r
3276         this.edits.push(edit);\r
3277     };\r
3278     TextEditChangeImpl.prototype.all = function () {\r
3279         return this.edits;\r
3280     };\r
3281     TextEditChangeImpl.prototype.clear = function () {\r
3282         this.edits.splice(0, this.edits.length);\r
3283     };\r
3284     return TextEditChangeImpl;\r
3285 }());\r
3286 /**\r
3287  * A workspace change helps constructing changes to a workspace.\r
3288  */\r
3289 var WorkspaceChange = /** @class */ (function () {\r
3290     function WorkspaceChange(workspaceEdit) {\r
3291         var _this = this;\r
3292         this._textEditChanges = Object.create(null);\r
3293         if (workspaceEdit) {\r
3294             this._workspaceEdit = workspaceEdit;\r
3295             if (workspaceEdit.documentChanges) {\r
3296                 workspaceEdit.documentChanges.forEach(function (change) {\r
3297                     if (TextDocumentEdit.is(change)) {\r
3298                         var textEditChange = new TextEditChangeImpl(change.edits);\r
3299                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
3300                     }\r
3301                 });\r
3302             }\r
3303             else if (workspaceEdit.changes) {\r
3304                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
3305                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
3306                     _this._textEditChanges[key] = textEditChange;\r
3307                 });\r
3308             }\r
3309         }\r
3310     }\r
3311     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
3312         /**\r
3313          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
3314          * use to be returned from a workspace edit operation like rename.\r
3315          */\r
3316         get: function () {\r
3317             return this._workspaceEdit;\r
3318         },\r
3319         enumerable: true,\r
3320         configurable: true\r
3321     });\r
3322     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
3323         if (VersionedTextDocumentIdentifier.is(key)) {\r
3324             if (!this._workspaceEdit) {\r
3325                 this._workspaceEdit = {\r
3326                     documentChanges: []\r
3327                 };\r
3328             }\r
3329             if (!this._workspaceEdit.documentChanges) {\r
3330                 throw new Error('Workspace edit is not configured for document changes.');\r
3331             }\r
3332             var textDocument = key;\r
3333             var result = this._textEditChanges[textDocument.uri];\r
3334             if (!result) {\r
3335                 var edits = [];\r
3336                 var textDocumentEdit = {\r
3337                     textDocument: textDocument,\r
3338                     edits: edits\r
3339                 };\r
3340                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
3341                 result = new TextEditChangeImpl(edits);\r
3342                 this._textEditChanges[textDocument.uri] = result;\r
3343             }\r
3344             return result;\r
3345         }\r
3346         else {\r
3347             if (!this._workspaceEdit) {\r
3348                 this._workspaceEdit = {\r
3349                     changes: Object.create(null)\r
3350                 };\r
3351             }\r
3352             if (!this._workspaceEdit.changes) {\r
3353                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
3354             }\r
3355             var result = this._textEditChanges[key];\r
3356             if (!result) {\r
3357                 var edits = [];\r
3358                 this._workspaceEdit.changes[key] = edits;\r
3359                 result = new TextEditChangeImpl(edits);\r
3360                 this._textEditChanges[key] = result;\r
3361             }\r
3362             return result;\r
3363         }\r
3364     };\r
3365     WorkspaceChange.prototype.createFile = function (uri, options) {\r
3366         this.checkDocumentChanges();\r
3367         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
3368     };\r
3369     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
3370         this.checkDocumentChanges();\r
3371         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
3372     };\r
3373     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
3374         this.checkDocumentChanges();\r
3375         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
3376     };\r
3377     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
3378         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
3379             throw new Error('Workspace edit is not configured for document changes.');\r
3380         }\r
3381     };\r
3382     return WorkspaceChange;\r
3383 }());\r
3384 \r
3385 /**\r
3386  * The TextDocumentIdentifier namespace provides helper functions to work with\r
3387  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
3388  */\r
3389 var TextDocumentIdentifier;\r
3390 (function (TextDocumentIdentifier) {\r
3391     /**\r
3392      * Creates a new TextDocumentIdentifier literal.\r
3393      * @param uri The document's uri.\r
3394      */\r
3395     function create(uri) {\r
3396         return { uri: uri };\r
3397     }\r
3398     TextDocumentIdentifier.create = create;\r
3399     /**\r
3400      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
3401      */\r
3402     function is(value) {\r
3403         var candidate = value;\r
3404         return Is.defined(candidate) && Is.string(candidate.uri);\r
3405     }\r
3406     TextDocumentIdentifier.is = is;\r
3407 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
3408 /**\r
3409  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
3410  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
3411  */\r
3412 var VersionedTextDocumentIdentifier;\r
3413 (function (VersionedTextDocumentIdentifier) {\r
3414     /**\r
3415      * Creates a new VersionedTextDocumentIdentifier literal.\r
3416      * @param uri The document's uri.\r
3417      * @param uri The document's text.\r
3418      */\r
3419     function create(uri, version) {\r
3420         return { uri: uri, version: version };\r
3421     }\r
3422     VersionedTextDocumentIdentifier.create = create;\r
3423     /**\r
3424      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
3425      */\r
3426     function is(value) {\r
3427         var candidate = value;\r
3428         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
3429     }\r
3430     VersionedTextDocumentIdentifier.is = is;\r
3431 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
3432 /**\r
3433  * The TextDocumentItem namespace provides helper functions to work with\r
3434  * [TextDocumentItem](#TextDocumentItem) literals.\r
3435  */\r
3436 var TextDocumentItem;\r
3437 (function (TextDocumentItem) {\r
3438     /**\r
3439      * Creates a new TextDocumentItem literal.\r
3440      * @param uri The document's uri.\r
3441      * @param languageId The document's language identifier.\r
3442      * @param version The document's version number.\r
3443      * @param text The document's text.\r
3444      */\r
3445     function create(uri, languageId, version, text) {\r
3446         return { uri: uri, languageId: languageId, version: version, text: text };\r
3447     }\r
3448     TextDocumentItem.create = create;\r
3449     /**\r
3450      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
3451      */\r
3452     function is(value) {\r
3453         var candidate = value;\r
3454         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
3455     }\r
3456     TextDocumentItem.is = is;\r
3457 })(TextDocumentItem || (TextDocumentItem = {}));\r
3458 /**\r
3459  * Describes the content type that a client supports in various\r
3460  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
3461  *\r
3462  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
3463  * are reserved for internal usage.\r
3464  */\r
3465 var MarkupKind;\r
3466 (function (MarkupKind) {\r
3467     /**\r
3468      * Plain text is supported as a content format\r
3469      */\r
3470     MarkupKind.PlainText = 'plaintext';\r
3471     /**\r
3472      * Markdown is supported as a content format\r
3473      */\r
3474     MarkupKind.Markdown = 'markdown';\r
3475 })(MarkupKind || (MarkupKind = {}));\r
3476 (function (MarkupKind) {\r
3477     /**\r
3478      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
3479      */\r
3480     function is(value) {\r
3481         var candidate = value;\r
3482         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
3483     }\r
3484     MarkupKind.is = is;\r
3485 })(MarkupKind || (MarkupKind = {}));\r
3486 var MarkupContent;\r
3487 (function (MarkupContent) {\r
3488     /**\r
3489      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
3490      */\r
3491     function is(value) {\r
3492         var candidate = value;\r
3493         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
3494     }\r
3495     MarkupContent.is = is;\r
3496 })(MarkupContent || (MarkupContent = {}));\r
3497 /**\r
3498  * The kind of a completion entry.\r
3499  */\r
3500 var CompletionItemKind;\r
3501 (function (CompletionItemKind) {\r
3502     CompletionItemKind.Text = 1;\r
3503     CompletionItemKind.Method = 2;\r
3504     CompletionItemKind.Function = 3;\r
3505     CompletionItemKind.Constructor = 4;\r
3506     CompletionItemKind.Field = 5;\r
3507     CompletionItemKind.Variable = 6;\r
3508     CompletionItemKind.Class = 7;\r
3509     CompletionItemKind.Interface = 8;\r
3510     CompletionItemKind.Module = 9;\r
3511     CompletionItemKind.Property = 10;\r
3512     CompletionItemKind.Unit = 11;\r
3513     CompletionItemKind.Value = 12;\r
3514     CompletionItemKind.Enum = 13;\r
3515     CompletionItemKind.Keyword = 14;\r
3516     CompletionItemKind.Snippet = 15;\r
3517     CompletionItemKind.Color = 16;\r
3518     CompletionItemKind.File = 17;\r
3519     CompletionItemKind.Reference = 18;\r
3520     CompletionItemKind.Folder = 19;\r
3521     CompletionItemKind.EnumMember = 20;\r
3522     CompletionItemKind.Constant = 21;\r
3523     CompletionItemKind.Struct = 22;\r
3524     CompletionItemKind.Event = 23;\r
3525     CompletionItemKind.Operator = 24;\r
3526     CompletionItemKind.TypeParameter = 25;\r
3527 })(CompletionItemKind || (CompletionItemKind = {}));\r
3528 /**\r
3529  * Defines whether the insert text in a completion item should be interpreted as\r
3530  * plain text or a snippet.\r
3531  */\r
3532 var InsertTextFormat;\r
3533 (function (InsertTextFormat) {\r
3534     /**\r
3535      * The primary text to be inserted is treated as a plain string.\r
3536      */\r
3537     InsertTextFormat.PlainText = 1;\r
3538     /**\r
3539      * The primary text to be inserted is treated as a snippet.\r
3540      *\r
3541      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
3542      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
3543      * the end of the snippet. Placeholders with equal identifiers are linked,\r
3544      * that is typing in one will update others too.\r
3545      *\r
3546      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
3547      */\r
3548     InsertTextFormat.Snippet = 2;\r
3549 })(InsertTextFormat || (InsertTextFormat = {}));\r
3550 /**\r
3551  * Completion item tags are extra annotations that tweak the rendering of a completion\r
3552  * item.\r
3553  *\r
3554  * @since 3.15.0\r
3555  */\r
3556 var CompletionItemTag;\r
3557 (function (CompletionItemTag) {\r
3558     /**\r
3559      * Render a completion as obsolete, usually using a strike-out.\r
3560      */\r
3561     CompletionItemTag.Deprecated = 1;\r
3562 })(CompletionItemTag || (CompletionItemTag = {}));\r
3563 /**\r
3564  * The CompletionItem namespace provides functions to deal with\r
3565  * completion items.\r
3566  */\r
3567 var CompletionItem;\r
3568 (function (CompletionItem) {\r
3569     /**\r
3570      * Create a completion item and seed it with a label.\r
3571      * @param label The completion item's label\r
3572      */\r
3573     function create(label) {\r
3574         return { label: label };\r
3575     }\r
3576     CompletionItem.create = create;\r
3577 })(CompletionItem || (CompletionItem = {}));\r
3578 /**\r
3579  * The CompletionList namespace provides functions to deal with\r
3580  * completion lists.\r
3581  */\r
3582 var CompletionList;\r
3583 (function (CompletionList) {\r
3584     /**\r
3585      * Creates a new completion list.\r
3586      *\r
3587      * @param items The completion items.\r
3588      * @param isIncomplete The list is not complete.\r
3589      */\r
3590     function create(items, isIncomplete) {\r
3591         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
3592     }\r
3593     CompletionList.create = create;\r
3594 })(CompletionList || (CompletionList = {}));\r
3595 var MarkedString;\r
3596 (function (MarkedString) {\r
3597     /**\r
3598      * Creates a marked string from plain text.\r
3599      *\r
3600      * @param plainText The plain text.\r
3601      */\r
3602     function fromPlainText(plainText) {\r
3603         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
3604     }\r
3605     MarkedString.fromPlainText = fromPlainText;\r
3606     /**\r
3607      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
3608      */\r
3609     function is(value) {\r
3610         var candidate = value;\r
3611         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
3612     }\r
3613     MarkedString.is = is;\r
3614 })(MarkedString || (MarkedString = {}));\r
3615 var Hover;\r
3616 (function (Hover) {\r
3617     /**\r
3618      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
3619      */\r
3620     function is(value) {\r
3621         var candidate = value;\r
3622         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
3623             MarkedString.is(candidate.contents) ||\r
3624             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
3625     }\r
3626     Hover.is = is;\r
3627 })(Hover || (Hover = {}));\r
3628 /**\r
3629  * The ParameterInformation namespace provides helper functions to work with\r
3630  * [ParameterInformation](#ParameterInformation) literals.\r
3631  */\r
3632 var ParameterInformation;\r
3633 (function (ParameterInformation) {\r
3634     /**\r
3635      * Creates a new parameter information literal.\r
3636      *\r
3637      * @param label A label string.\r
3638      * @param documentation A doc string.\r
3639      */\r
3640     function create(label, documentation) {\r
3641         return documentation ? { label: label, documentation: documentation } : { label: label };\r
3642     }\r
3643     ParameterInformation.create = create;\r
3644 })(ParameterInformation || (ParameterInformation = {}));\r
3645 /**\r
3646  * The SignatureInformation namespace provides helper functions to work with\r
3647  * [SignatureInformation](#SignatureInformation) literals.\r
3648  */\r
3649 var SignatureInformation;\r
3650 (function (SignatureInformation) {\r
3651     function create(label, documentation) {\r
3652         var parameters = [];\r
3653         for (var _i = 2; _i < arguments.length; _i++) {\r
3654             parameters[_i - 2] = arguments[_i];\r
3655         }\r
3656         var result = { label: label };\r
3657         if (Is.defined(documentation)) {\r
3658             result.documentation = documentation;\r
3659         }\r
3660         if (Is.defined(parameters)) {\r
3661             result.parameters = parameters;\r
3662         }\r
3663         else {\r
3664             result.parameters = [];\r
3665         }\r
3666         return result;\r
3667     }\r
3668     SignatureInformation.create = create;\r
3669 })(SignatureInformation || (SignatureInformation = {}));\r
3670 /**\r
3671  * A document highlight kind.\r
3672  */\r
3673 var DocumentHighlightKind;\r
3674 (function (DocumentHighlightKind) {\r
3675     /**\r
3676      * A textual occurrence.\r
3677      */\r
3678     DocumentHighlightKind.Text = 1;\r
3679     /**\r
3680      * Read-access of a symbol, like reading a variable.\r
3681      */\r
3682     DocumentHighlightKind.Read = 2;\r
3683     /**\r
3684      * Write-access of a symbol, like writing to a variable.\r
3685      */\r
3686     DocumentHighlightKind.Write = 3;\r
3687 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
3688 /**\r
3689  * DocumentHighlight namespace to provide helper functions to work with\r
3690  * [DocumentHighlight](#DocumentHighlight) literals.\r
3691  */\r
3692 var DocumentHighlight;\r
3693 (function (DocumentHighlight) {\r
3694     /**\r
3695      * Create a DocumentHighlight object.\r
3696      * @param range The range the highlight applies to.\r
3697      */\r
3698     function create(range, kind) {\r
3699         var result = { range: range };\r
3700         if (Is.number(kind)) {\r
3701             result.kind = kind;\r
3702         }\r
3703         return result;\r
3704     }\r
3705     DocumentHighlight.create = create;\r
3706 })(DocumentHighlight || (DocumentHighlight = {}));\r
3707 /**\r
3708  * A symbol kind.\r
3709  */\r
3710 var SymbolKind;\r
3711 (function (SymbolKind) {\r
3712     SymbolKind.File = 1;\r
3713     SymbolKind.Module = 2;\r
3714     SymbolKind.Namespace = 3;\r
3715     SymbolKind.Package = 4;\r
3716     SymbolKind.Class = 5;\r
3717     SymbolKind.Method = 6;\r
3718     SymbolKind.Property = 7;\r
3719     SymbolKind.Field = 8;\r
3720     SymbolKind.Constructor = 9;\r
3721     SymbolKind.Enum = 10;\r
3722     SymbolKind.Interface = 11;\r
3723     SymbolKind.Function = 12;\r
3724     SymbolKind.Variable = 13;\r
3725     SymbolKind.Constant = 14;\r
3726     SymbolKind.String = 15;\r
3727     SymbolKind.Number = 16;\r
3728     SymbolKind.Boolean = 17;\r
3729     SymbolKind.Array = 18;\r
3730     SymbolKind.Object = 19;\r
3731     SymbolKind.Key = 20;\r
3732     SymbolKind.Null = 21;\r
3733     SymbolKind.EnumMember = 22;\r
3734     SymbolKind.Struct = 23;\r
3735     SymbolKind.Event = 24;\r
3736     SymbolKind.Operator = 25;\r
3737     SymbolKind.TypeParameter = 26;\r
3738 })(SymbolKind || (SymbolKind = {}));\r
3739 /**\r
3740  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
3741  * @since 3.15\r
3742  */\r
3743 var SymbolTag;\r
3744 (function (SymbolTag) {\r
3745     /**\r
3746      * Render a symbol as obsolete, usually using a strike-out.\r
3747      */\r
3748     SymbolTag.Deprecated = 1;\r
3749 })(SymbolTag || (SymbolTag = {}));\r
3750 var SymbolInformation;\r
3751 (function (SymbolInformation) {\r
3752     /**\r
3753      * Creates a new symbol information literal.\r
3754      *\r
3755      * @param name The name of the symbol.\r
3756      * @param kind The kind of the symbol.\r
3757      * @param range The range of the location of the symbol.\r
3758      * @param uri The resource of the location of symbol, defaults to the current document.\r
3759      * @param containerName The name of the symbol containing the symbol.\r
3760      */\r
3761     function create(name, kind, range, uri, containerName) {\r
3762         var result = {\r
3763             name: name,\r
3764             kind: kind,\r
3765             location: { uri: uri, range: range }\r
3766         };\r
3767         if (containerName) {\r
3768             result.containerName = containerName;\r
3769         }\r
3770         return result;\r
3771     }\r
3772     SymbolInformation.create = create;\r
3773 })(SymbolInformation || (SymbolInformation = {}));\r
3774 var DocumentSymbol;\r
3775 (function (DocumentSymbol) {\r
3776     /**\r
3777      * Creates a new symbol information literal.\r
3778      *\r
3779      * @param name The name of the symbol.\r
3780      * @param detail The detail of the symbol.\r
3781      * @param kind The kind of the symbol.\r
3782      * @param range The range of the symbol.\r
3783      * @param selectionRange The selectionRange of the symbol.\r
3784      * @param children Children of the symbol.\r
3785      */\r
3786     function create(name, detail, kind, range, selectionRange, children) {\r
3787         var result = {\r
3788             name: name,\r
3789             detail: detail,\r
3790             kind: kind,\r
3791             range: range,\r
3792             selectionRange: selectionRange\r
3793         };\r
3794         if (children !== void 0) {\r
3795             result.children = children;\r
3796         }\r
3797         return result;\r
3798     }\r
3799     DocumentSymbol.create = create;\r
3800     /**\r
3801      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
3802      */\r
3803     function is(value) {\r
3804         var candidate = value;\r
3805         return candidate &&\r
3806             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
3807             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
3808             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
3809             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
3810             (candidate.children === void 0 || Array.isArray(candidate.children));\r
3811     }\r
3812     DocumentSymbol.is = is;\r
3813 })(DocumentSymbol || (DocumentSymbol = {}));\r
3814 /**\r
3815  * A set of predefined code action kinds\r
3816  */\r
3817 var CodeActionKind;\r
3818 (function (CodeActionKind) {\r
3819     /**\r
3820      * Empty kind.\r
3821      */\r
3822     CodeActionKind.Empty = '';\r
3823     /**\r
3824      * Base kind for quickfix actions: 'quickfix'\r
3825      */\r
3826     CodeActionKind.QuickFix = 'quickfix';\r
3827     /**\r
3828      * Base kind for refactoring actions: 'refactor'\r
3829      */\r
3830     CodeActionKind.Refactor = 'refactor';\r
3831     /**\r
3832      * Base kind for refactoring extraction actions: 'refactor.extract'\r
3833      *\r
3834      * Example extract actions:\r
3835      *\r
3836      * - Extract method\r
3837      * - Extract function\r
3838      * - Extract variable\r
3839      * - Extract interface from class\r
3840      * - ...\r
3841      */\r
3842     CodeActionKind.RefactorExtract = 'refactor.extract';\r
3843     /**\r
3844      * Base kind for refactoring inline actions: 'refactor.inline'\r
3845      *\r
3846      * Example inline actions:\r
3847      *\r
3848      * - Inline function\r
3849      * - Inline variable\r
3850      * - Inline constant\r
3851      * - ...\r
3852      */\r
3853     CodeActionKind.RefactorInline = 'refactor.inline';\r
3854     /**\r
3855      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
3856      *\r
3857      * Example rewrite actions:\r
3858      *\r
3859      * - Convert JavaScript function to class\r
3860      * - Add or remove parameter\r
3861      * - Encapsulate field\r
3862      * - Make method static\r
3863      * - Move method to base class\r
3864      * - ...\r
3865      */\r
3866     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
3867     /**\r
3868      * Base kind for source actions: `source`\r
3869      *\r
3870      * Source code actions apply to the entire file.\r
3871      */\r
3872     CodeActionKind.Source = 'source';\r
3873     /**\r
3874      * Base kind for an organize imports source action: `source.organizeImports`\r
3875      */\r
3876     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
3877     /**\r
3878      * Base kind for auto-fix source actions: `source.fixAll`.\r
3879      *\r
3880      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
3881      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
3882      *\r
3883      * @since 3.15.0\r
3884      */\r
3885     CodeActionKind.SourceFixAll = 'source.fixAll';\r
3886 })(CodeActionKind || (CodeActionKind = {}));\r
3887 /**\r
3888  * The CodeActionContext namespace provides helper functions to work with\r
3889  * [CodeActionContext](#CodeActionContext) literals.\r
3890  */\r
3891 var CodeActionContext;\r
3892 (function (CodeActionContext) {\r
3893     /**\r
3894      * Creates a new CodeActionContext literal.\r
3895      */\r
3896     function create(diagnostics, only) {\r
3897         var result = { diagnostics: diagnostics };\r
3898         if (only !== void 0 && only !== null) {\r
3899             result.only = only;\r
3900         }\r
3901         return result;\r
3902     }\r
3903     CodeActionContext.create = create;\r
3904     /**\r
3905      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
3906      */\r
3907     function is(value) {\r
3908         var candidate = value;\r
3909         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
3910     }\r
3911     CodeActionContext.is = is;\r
3912 })(CodeActionContext || (CodeActionContext = {}));\r
3913 var CodeAction;\r
3914 (function (CodeAction) {\r
3915     function create(title, commandOrEdit, kind) {\r
3916         var result = { title: title };\r
3917         if (Command.is(commandOrEdit)) {\r
3918             result.command = commandOrEdit;\r
3919         }\r
3920         else {\r
3921             result.edit = commandOrEdit;\r
3922         }\r
3923         if (kind !== void 0) {\r
3924             result.kind = kind;\r
3925         }\r
3926         return result;\r
3927     }\r
3928     CodeAction.create = create;\r
3929     function is(value) {\r
3930         var candidate = value;\r
3931         return candidate && Is.string(candidate.title) &&\r
3932             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
3933             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
3934             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
3935             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
3936             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
3937             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
3938     }\r
3939     CodeAction.is = is;\r
3940 })(CodeAction || (CodeAction = {}));\r
3941 /**\r
3942  * The CodeLens namespace provides helper functions to work with\r
3943  * [CodeLens](#CodeLens) literals.\r
3944  */\r
3945 var CodeLens;\r
3946 (function (CodeLens) {\r
3947     /**\r
3948      * Creates a new CodeLens literal.\r
3949      */\r
3950     function create(range, data) {\r
3951         var result = { range: range };\r
3952         if (Is.defined(data)) {\r
3953             result.data = data;\r
3954         }\r
3955         return result;\r
3956     }\r
3957     CodeLens.create = create;\r
3958     /**\r
3959      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
3960      */\r
3961     function is(value) {\r
3962         var candidate = value;\r
3963         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
3964     }\r
3965     CodeLens.is = is;\r
3966 })(CodeLens || (CodeLens = {}));\r
3967 /**\r
3968  * The FormattingOptions namespace provides helper functions to work with\r
3969  * [FormattingOptions](#FormattingOptions) literals.\r
3970  */\r
3971 var FormattingOptions;\r
3972 (function (FormattingOptions) {\r
3973     /**\r
3974      * Creates a new FormattingOptions literal.\r
3975      */\r
3976     function create(tabSize, insertSpaces) {\r
3977         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
3978     }\r
3979     FormattingOptions.create = create;\r
3980     /**\r
3981      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
3982      */\r
3983     function is(value) {\r
3984         var candidate = value;\r
3985         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
3986     }\r
3987     FormattingOptions.is = is;\r
3988 })(FormattingOptions || (FormattingOptions = {}));\r
3989 /**\r
3990  * The DocumentLink namespace provides helper functions to work with\r
3991  * [DocumentLink](#DocumentLink) literals.\r
3992  */\r
3993 var DocumentLink;\r
3994 (function (DocumentLink) {\r
3995     /**\r
3996      * Creates a new DocumentLink literal.\r
3997      */\r
3998     function create(range, target, data) {\r
3999         return { range: range, target: target, data: data };\r
4000     }\r
4001     DocumentLink.create = create;\r
4002     /**\r
4003      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
4004      */\r
4005     function is(value) {\r
4006         var candidate = value;\r
4007         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
4008     }\r
4009     DocumentLink.is = is;\r
4010 })(DocumentLink || (DocumentLink = {}));\r
4011 /**\r
4012  * The SelectionRange namespace provides helper function to work with\r
4013  * SelectionRange literals.\r
4014  */\r
4015 var SelectionRange;\r
4016 (function (SelectionRange) {\r
4017     /**\r
4018      * Creates a new SelectionRange\r
4019      * @param range the range.\r
4020      * @param parent an optional parent.\r
4021      */\r
4022     function create(range, parent) {\r
4023         return { range: range, parent: parent };\r
4024     }\r
4025     SelectionRange.create = create;\r
4026     function is(value) {\r
4027         var candidate = value;\r
4028         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
4029     }\r
4030     SelectionRange.is = is;\r
4031 })(SelectionRange || (SelectionRange = {}));\r
4032 var EOL = ['\n', '\r\n', '\r'];\r
4033 /**\r
4034  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
4035  */\r
4036 var TextDocument;\r
4037 (function (TextDocument) {\r
4038     /**\r
4039      * Creates a new ITextDocument literal from the given uri and content.\r
4040      * @param uri The document's uri.\r
4041      * @param languageId  The document's language Id.\r
4042      * @param content The document's content.\r
4043      */\r
4044     function create(uri, languageId, version, content) {\r
4045         return new FullTextDocument(uri, languageId, version, content);\r
4046     }\r
4047     TextDocument.create = create;\r
4048     /**\r
4049      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
4050      */\r
4051     function is(value) {\r
4052         var candidate = value;\r
4053         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
4054             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
4055     }\r
4056     TextDocument.is = is;\r
4057     function applyEdits(document, edits) {\r
4058         var text = document.getText();\r
4059         var sortedEdits = mergeSort(edits, function (a, b) {\r
4060             var diff = a.range.start.line - b.range.start.line;\r
4061             if (diff === 0) {\r
4062                 return a.range.start.character - b.range.start.character;\r
4063             }\r
4064             return diff;\r
4065         });\r
4066         var lastModifiedOffset = text.length;\r
4067         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
4068             var e = sortedEdits[i];\r
4069             var startOffset = document.offsetAt(e.range.start);\r
4070             var endOffset = document.offsetAt(e.range.end);\r
4071             if (endOffset <= lastModifiedOffset) {\r
4072                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
4073             }\r
4074             else {\r
4075                 throw new Error('Overlapping edit');\r
4076             }\r
4077             lastModifiedOffset = startOffset;\r
4078         }\r
4079         return text;\r
4080     }\r
4081     TextDocument.applyEdits = applyEdits;\r
4082     function mergeSort(data, compare) {\r
4083         if (data.length <= 1) {\r
4084             // sorted\r
4085             return data;\r
4086         }\r
4087         var p = (data.length / 2) | 0;\r
4088         var left = data.slice(0, p);\r
4089         var right = data.slice(p);\r
4090         mergeSort(left, compare);\r
4091         mergeSort(right, compare);\r
4092         var leftIdx = 0;\r
4093         var rightIdx = 0;\r
4094         var i = 0;\r
4095         while (leftIdx < left.length && rightIdx < right.length) {\r
4096             var ret = compare(left[leftIdx], right[rightIdx]);\r
4097             if (ret <= 0) {\r
4098                 // smaller_equal -> take left to preserve order\r
4099                 data[i++] = left[leftIdx++];\r
4100             }\r
4101             else {\r
4102                 // greater -> take right\r
4103                 data[i++] = right[rightIdx++];\r
4104             }\r
4105         }\r
4106         while (leftIdx < left.length) {\r
4107             data[i++] = left[leftIdx++];\r
4108         }\r
4109         while (rightIdx < right.length) {\r
4110             data[i++] = right[rightIdx++];\r
4111         }\r
4112         return data;\r
4113     }\r
4114 })(TextDocument || (TextDocument = {}));\r
4115 var FullTextDocument = /** @class */ (function () {\r
4116     function FullTextDocument(uri, languageId, version, content) {\r
4117         this._uri = uri;\r
4118         this._languageId = languageId;\r
4119         this._version = version;\r
4120         this._content = content;\r
4121         this._lineOffsets = undefined;\r
4122     }\r
4123     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
4124         get: function () {\r
4125             return this._uri;\r
4126         },\r
4127         enumerable: true,\r
4128         configurable: true\r
4129     });\r
4130     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
4131         get: function () {\r
4132             return this._languageId;\r
4133         },\r
4134         enumerable: true,\r
4135         configurable: true\r
4136     });\r
4137     Object.defineProperty(FullTextDocument.prototype, "version", {\r
4138         get: function () {\r
4139             return this._version;\r
4140         },\r
4141         enumerable: true,\r
4142         configurable: true\r
4143     });\r
4144     FullTextDocument.prototype.getText = function (range) {\r
4145         if (range) {\r
4146             var start = this.offsetAt(range.start);\r
4147             var end = this.offsetAt(range.end);\r
4148             return this._content.substring(start, end);\r
4149         }\r
4150         return this._content;\r
4151     };\r
4152     FullTextDocument.prototype.update = function (event, version) {\r
4153         this._content = event.text;\r
4154         this._version = version;\r
4155         this._lineOffsets = undefined;\r
4156     };\r
4157     FullTextDocument.prototype.getLineOffsets = function () {\r
4158         if (this._lineOffsets === undefined) {\r
4159             var lineOffsets = [];\r
4160             var text = this._content;\r
4161             var isLineStart = true;\r
4162             for (var i = 0; i < text.length; i++) {\r
4163                 if (isLineStart) {\r
4164                     lineOffsets.push(i);\r
4165                     isLineStart = false;\r
4166                 }\r
4167                 var ch = text.charAt(i);\r
4168                 isLineStart = (ch === '\r' || ch === '\n');\r
4169                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
4170                     i++;\r
4171                 }\r
4172             }\r
4173             if (isLineStart && text.length > 0) {\r
4174                 lineOffsets.push(text.length);\r
4175             }\r
4176             this._lineOffsets = lineOffsets;\r
4177         }\r
4178         return this._lineOffsets;\r
4179     };\r
4180     FullTextDocument.prototype.positionAt = function (offset) {\r
4181         offset = Math.max(Math.min(offset, this._content.length), 0);\r
4182         var lineOffsets = this.getLineOffsets();\r
4183         var low = 0, high = lineOffsets.length;\r
4184         if (high === 0) {\r
4185             return Position.create(0, offset);\r
4186         }\r
4187         while (low < high) {\r
4188             var mid = Math.floor((low + high) / 2);\r
4189             if (lineOffsets[mid] > offset) {\r
4190                 high = mid;\r
4191             }\r
4192             else {\r
4193                 low = mid + 1;\r
4194             }\r
4195         }\r
4196         // low is the least x for which the line offset is larger than the current offset\r
4197         // or array.length if no line offset is larger than the current offset\r
4198         var line = low - 1;\r
4199         return Position.create(line, offset - lineOffsets[line]);\r
4200     };\r
4201     FullTextDocument.prototype.offsetAt = function (position) {\r
4202         var lineOffsets = this.getLineOffsets();\r
4203         if (position.line >= lineOffsets.length) {\r
4204             return this._content.length;\r
4205         }\r
4206         else if (position.line < 0) {\r
4207             return 0;\r
4208         }\r
4209         var lineOffset = lineOffsets[position.line];\r
4210         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
4211         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
4212     };\r
4213     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
4214         get: function () {\r
4215             return this.getLineOffsets().length;\r
4216         },\r
4217         enumerable: true,\r
4218         configurable: true\r
4219     });\r
4220     return FullTextDocument;\r
4221 }());\r
4222 var Is;\r
4223 (function (Is) {\r
4224     var toString = Object.prototype.toString;\r
4225     function defined(value) {\r
4226         return typeof value !== 'undefined';\r
4227     }\r
4228     Is.defined = defined;\r
4229     function undefined(value) {\r
4230         return typeof value === 'undefined';\r
4231     }\r
4232     Is.undefined = undefined;\r
4233     function boolean(value) {\r
4234         return value === true || value === false;\r
4235     }\r
4236     Is.boolean = boolean;\r
4237     function string(value) {\r
4238         return toString.call(value) === '[object String]';\r
4239     }\r
4240     Is.string = string;\r
4241     function number(value) {\r
4242         return toString.call(value) === '[object Number]';\r
4243     }\r
4244     Is.number = number;\r
4245     function func(value) {\r
4246         return toString.call(value) === '[object Function]';\r
4247     }\r
4248     Is.func = func;\r
4249     function objectLiteral(value) {\r
4250         // Strictly speaking class instances pass this check as well. Since the LSP\r
4251         // doesn't use classes we ignore this for now. If we do we need to add something\r
4252         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4253         return value !== null && typeof value === 'object';\r
4254     }\r
4255     Is.objectLiteral = objectLiteral;\r
4256     function typedArray(value, check) {\r
4257         return Array.isArray(value) && value.every(check);\r
4258     }\r
4259     Is.typedArray = typedArray;\r
4260 })(Is || (Is = {}));\r
4261
4262
4263 /***/ }),
4264 /* 19 */
4265 /***/ (function(module, exports, __webpack_require__) {
4266
4267 "use strict";
4268 /* --------------------------------------------------------------------------------------------\r
4269  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4270  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4271  * ------------------------------------------------------------------------------------------ */\r
4272 \r
4273 Object.defineProperty(exports, "__esModule", { value: true });\r
4274 const Is = __webpack_require__(20);\r
4275 const vscode_jsonrpc_1 = __webpack_require__(5);\r
4276 const messages_1 = __webpack_require__(21);\r
4277 const protocol_implementation_1 = __webpack_require__(22);\r
4278 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
4279 const protocol_typeDefinition_1 = __webpack_require__(23);\r
4280 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
4281 const protocol_workspaceFolders_1 = __webpack_require__(24);\r
4282 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
4283 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
4284 const protocol_configuration_1 = __webpack_require__(25);\r
4285 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
4286 const protocol_colorProvider_1 = __webpack_require__(26);\r
4287 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
4288 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
4289 const protocol_foldingRange_1 = __webpack_require__(27);\r
4290 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
4291 const protocol_declaration_1 = __webpack_require__(28);\r
4292 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
4293 const protocol_selectionRange_1 = __webpack_require__(29);\r
4294 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
4295 const protocol_progress_1 = __webpack_require__(30);\r
4296 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
4297 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
4298 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
4299 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4300 let __noDynamicImport;\r
4301 /**\r
4302  * The DocumentFilter namespace provides helper functions to work with\r
4303  * [DocumentFilter](#DocumentFilter) literals.\r
4304  */\r
4305 var DocumentFilter;\r
4306 (function (DocumentFilter) {\r
4307     function is(value) {\r
4308         const candidate = value;\r
4309         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
4310     }\r
4311     DocumentFilter.is = is;\r
4312 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
4313 /**\r
4314  * The DocumentSelector namespace provides helper functions to work with\r
4315  * [DocumentSelector](#DocumentSelector)s.\r
4316  */\r
4317 var DocumentSelector;\r
4318 (function (DocumentSelector) {\r
4319     function is(value) {\r
4320         if (!Array.isArray(value)) {\r
4321             return false;\r
4322         }\r
4323         for (let elem of value) {\r
4324             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
4325                 return false;\r
4326             }\r
4327         }\r
4328         return true;\r
4329     }\r
4330     DocumentSelector.is = is;\r
4331 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
4332 /**\r
4333  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
4334  * handler on the client side.\r
4335  */\r
4336 var RegistrationRequest;\r
4337 (function (RegistrationRequest) {\r
4338     RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
4339 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
4340 /**\r
4341  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
4342  * handler on the client side.\r
4343  */\r
4344 var UnregistrationRequest;\r
4345 (function (UnregistrationRequest) {\r
4346     UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
4347 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
4348 var ResourceOperationKind;\r
4349 (function (ResourceOperationKind) {\r
4350     /**\r
4351      * Supports creating new files and folders.\r
4352      */\r
4353     ResourceOperationKind.Create = 'create';\r
4354     /**\r
4355      * Supports renaming existing files and folders.\r
4356      */\r
4357     ResourceOperationKind.Rename = 'rename';\r
4358     /**\r
4359      * Supports deleting existing files and folders.\r
4360      */\r
4361     ResourceOperationKind.Delete = 'delete';\r
4362 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
4363 var FailureHandlingKind;\r
4364 (function (FailureHandlingKind) {\r
4365     /**\r
4366      * Applying the workspace change is simply aborted if one of the changes provided\r
4367      * fails. All operations executed before the failing operation stay executed.\r
4368      */\r
4369     FailureHandlingKind.Abort = 'abort';\r
4370     /**\r
4371      * All operations are executed transactional. That means they either all\r
4372      * succeed or no changes at all are applied to the workspace.\r
4373      */\r
4374     FailureHandlingKind.Transactional = 'transactional';\r
4375     /**\r
4376      * If the workspace edit contains only textual file changes they are executed transactional.\r
4377      * If resource changes (create, rename or delete file) are part of the change the failure\r
4378      * handling startegy is abort.\r
4379      */\r
4380     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
4381     /**\r
4382      * The client tries to undo the operations already executed. But there is no\r
4383      * guarantee that this is succeeding.\r
4384      */\r
4385     FailureHandlingKind.Undo = 'undo';\r
4386 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
4387 /**\r
4388  * The StaticRegistrationOptions namespace provides helper functions to work with\r
4389  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
4390  */\r
4391 var StaticRegistrationOptions;\r
4392 (function (StaticRegistrationOptions) {\r
4393     function hasId(value) {\r
4394         const candidate = value;\r
4395         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
4396     }\r
4397     StaticRegistrationOptions.hasId = hasId;\r
4398 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
4399 /**\r
4400  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
4401  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
4402  */\r
4403 var TextDocumentRegistrationOptions;\r
4404 (function (TextDocumentRegistrationOptions) {\r
4405     function is(value) {\r
4406         const candidate = value;\r
4407         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
4408     }\r
4409     TextDocumentRegistrationOptions.is = is;\r
4410 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
4411 /**\r
4412  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
4413  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
4414  */\r
4415 var WorkDoneProgressOptions;\r
4416 (function (WorkDoneProgressOptions) {\r
4417     function is(value) {\r
4418         const candidate = value;\r
4419         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
4420     }\r
4421     WorkDoneProgressOptions.is = is;\r
4422     function hasWorkDoneProgress(value) {\r
4423         const candidate = value;\r
4424         return candidate && Is.boolean(candidate.workDoneProgress);\r
4425     }\r
4426     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
4427 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
4428 /**\r
4429  * The initialize request is sent from the client to the server.\r
4430  * It is sent once as the request after starting up the server.\r
4431  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
4432  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
4433  * resolves to such.\r
4434  */\r
4435 var InitializeRequest;\r
4436 (function (InitializeRequest) {\r
4437     InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
4438 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
4439 /**\r
4440  * Known error codes for an `InitializeError`;\r
4441  */\r
4442 var InitializeError;\r
4443 (function (InitializeError) {\r
4444     /**\r
4445      * If the protocol version provided by the client can't be handled by the server.\r
4446      * @deprecated This initialize error got replaced by client capabilities. There is\r
4447      * no version handshake in version 3.0x\r
4448      */\r
4449     InitializeError.unknownProtocolVersion = 1;\r
4450 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
4451 /**\r
4452  * The intialized notification is sent from the client to the\r
4453  * server after the client is fully initialized and the server\r
4454  * is allowed to send requests from the server to the client.\r
4455  */\r
4456 var InitializedNotification;\r
4457 (function (InitializedNotification) {\r
4458     InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
4459 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
4460 //---- Shutdown Method ----\r
4461 /**\r
4462  * A shutdown request is sent from the client to the server.\r
4463  * It is sent once when the client decides to shutdown the\r
4464  * server. The only notification that is sent after a shutdown request\r
4465  * is the exit event.\r
4466  */\r
4467 var ShutdownRequest;\r
4468 (function (ShutdownRequest) {\r
4469     ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
4470 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
4471 //---- Exit Notification ----\r
4472 /**\r
4473  * The exit event is sent from the client to the server to\r
4474  * ask the server to exit its process.\r
4475  */\r
4476 var ExitNotification;\r
4477 (function (ExitNotification) {\r
4478     ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
4479 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
4480 /**\r
4481  * The configuration change notification is sent from the client to the server\r
4482  * when the client's configuration has changed. The notification contains\r
4483  * the changed configuration as defined by the language client.\r
4484  */\r
4485 var DidChangeConfigurationNotification;\r
4486 (function (DidChangeConfigurationNotification) {\r
4487     DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
4488 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
4489 //---- Message show and log notifications ----\r
4490 /**\r
4491  * The message type\r
4492  */\r
4493 var MessageType;\r
4494 (function (MessageType) {\r
4495     /**\r
4496      * An error message.\r
4497      */\r
4498     MessageType.Error = 1;\r
4499     /**\r
4500      * A warning message.\r
4501      */\r
4502     MessageType.Warning = 2;\r
4503     /**\r
4504      * An information message.\r
4505      */\r
4506     MessageType.Info = 3;\r
4507     /**\r
4508      * A log message.\r
4509      */\r
4510     MessageType.Log = 4;\r
4511 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
4512 /**\r
4513  * The show message notification is sent from a server to a client to ask\r
4514  * the client to display a particular message in the user interface.\r
4515  */\r
4516 var ShowMessageNotification;\r
4517 (function (ShowMessageNotification) {\r
4518     ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
4519 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
4520 /**\r
4521  * The show message request is sent from the server to the client to show a message\r
4522  * and a set of options actions to the user.\r
4523  */\r
4524 var ShowMessageRequest;\r
4525 (function (ShowMessageRequest) {\r
4526     ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
4527 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
4528 /**\r
4529  * The log message notification is sent from the server to the client to ask\r
4530  * the client to log a particular message.\r
4531  */\r
4532 var LogMessageNotification;\r
4533 (function (LogMessageNotification) {\r
4534     LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
4535 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
4536 //---- Telemetry notification\r
4537 /**\r
4538  * The telemetry event notification is sent from the server to the client to ask\r
4539  * the client to log telemetry data.\r
4540  */\r
4541 var TelemetryEventNotification;\r
4542 (function (TelemetryEventNotification) {\r
4543     TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
4544 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
4545 /**\r
4546  * Defines how the host (editor) should sync\r
4547  * document changes to the language server.\r
4548  */\r
4549 var TextDocumentSyncKind;\r
4550 (function (TextDocumentSyncKind) {\r
4551     /**\r
4552      * Documents should not be synced at all.\r
4553      */\r
4554     TextDocumentSyncKind.None = 0;\r
4555     /**\r
4556      * Documents are synced by always sending the full content\r
4557      * of the document.\r
4558      */\r
4559     TextDocumentSyncKind.Full = 1;\r
4560     /**\r
4561      * Documents are synced by sending the full content on open.\r
4562      * After that only incremental updates to the document are\r
4563      * send.\r
4564      */\r
4565     TextDocumentSyncKind.Incremental = 2;\r
4566 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
4567 /**\r
4568  * The document open notification is sent from the client to the server to signal\r
4569  * newly opened text documents. The document's truth is now managed by the client\r
4570  * and the server must not try to read the document's truth using the document's\r
4571  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
4572  * mean that its content is presented in an editor. An open notification must not\r
4573  * be sent more than once without a corresponding close notification send before.\r
4574  * This means open and close notification must be balanced and the max open count\r
4575  * is one.\r
4576  */\r
4577 var DidOpenTextDocumentNotification;\r
4578 (function (DidOpenTextDocumentNotification) {\r
4579     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
4580     DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
4581 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
4582 /**\r
4583  * The document change notification is sent from the client to the server to signal\r
4584  * changes to a text document.\r
4585  */\r
4586 var DidChangeTextDocumentNotification;\r
4587 (function (DidChangeTextDocumentNotification) {\r
4588     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
4589     DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
4590 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
4591 /**\r
4592  * The document close notification is sent from the client to the server when\r
4593  * the document got closed in the client. The document's truth now exists where\r
4594  * the document's uri points to (e.g. if the document's uri is a file uri the\r
4595  * truth now exists on disk). As with the open notification the close notification\r
4596  * is about managing the document's content. Receiving a close notification\r
4597  * doesn't mean that the document was open in an editor before. A close\r
4598  * notification requires a previous open notification to be sent.\r
4599  */\r
4600 var DidCloseTextDocumentNotification;\r
4601 (function (DidCloseTextDocumentNotification) {\r
4602     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
4603     DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
4604 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
4605 /**\r
4606  * The document save notification is sent from the client to the server when\r
4607  * the document got saved in the client.\r
4608  */\r
4609 var DidSaveTextDocumentNotification;\r
4610 (function (DidSaveTextDocumentNotification) {\r
4611     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
4612     DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
4613 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
4614 /**\r
4615  * Represents reasons why a text document is saved.\r
4616  */\r
4617 var TextDocumentSaveReason;\r
4618 (function (TextDocumentSaveReason) {\r
4619     /**\r
4620      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
4621      * or by an API call.\r
4622      */\r
4623     TextDocumentSaveReason.Manual = 1;\r
4624     /**\r
4625      * Automatic after a delay.\r
4626      */\r
4627     TextDocumentSaveReason.AfterDelay = 2;\r
4628     /**\r
4629      * When the editor lost focus.\r
4630      */\r
4631     TextDocumentSaveReason.FocusOut = 3;\r
4632 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
4633 /**\r
4634  * A document will save notification is sent from the client to the server before\r
4635  * the document is actually saved.\r
4636  */\r
4637 var WillSaveTextDocumentNotification;\r
4638 (function (WillSaveTextDocumentNotification) {\r
4639     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
4640     WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
4641 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
4642 /**\r
4643  * A document will save request is sent from the client to the server before\r
4644  * the document is actually saved. The request can return an array of TextEdits\r
4645  * which will be applied to the text document before it is saved. Please note that\r
4646  * clients might drop results if computing the text edits took too long or if a\r
4647  * server constantly fails on this request. This is done to keep the save fast and\r
4648  * reliable.\r
4649  */\r
4650 var WillSaveTextDocumentWaitUntilRequest;\r
4651 (function (WillSaveTextDocumentWaitUntilRequest) {\r
4652     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
4653     WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
4654 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
4655 /**\r
4656  * The watched files notification is sent from the client to the server when\r
4657  * the client detects changes to file watched by the language client.\r
4658  */\r
4659 var DidChangeWatchedFilesNotification;\r
4660 (function (DidChangeWatchedFilesNotification) {\r
4661     DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
4662 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
4663 /**\r
4664  * The file event type\r
4665  */\r
4666 var FileChangeType;\r
4667 (function (FileChangeType) {\r
4668     /**\r
4669      * The file got created.\r
4670      */\r
4671     FileChangeType.Created = 1;\r
4672     /**\r
4673      * The file got changed.\r
4674      */\r
4675     FileChangeType.Changed = 2;\r
4676     /**\r
4677      * The file got deleted.\r
4678      */\r
4679     FileChangeType.Deleted = 3;\r
4680 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
4681 var WatchKind;\r
4682 (function (WatchKind) {\r
4683     /**\r
4684      * Interested in create events.\r
4685      */\r
4686     WatchKind.Create = 1;\r
4687     /**\r
4688      * Interested in change events\r
4689      */\r
4690     WatchKind.Change = 2;\r
4691     /**\r
4692      * Interested in delete events\r
4693      */\r
4694     WatchKind.Delete = 4;\r
4695 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
4696 /**\r
4697  * Diagnostics notification are sent from the server to the client to signal\r
4698  * results of validation runs.\r
4699  */\r
4700 var PublishDiagnosticsNotification;\r
4701 (function (PublishDiagnosticsNotification) {\r
4702     PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
4703 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
4704 /**\r
4705  * How a completion was triggered\r
4706  */\r
4707 var CompletionTriggerKind;\r
4708 (function (CompletionTriggerKind) {\r
4709     /**\r
4710      * Completion was triggered by typing an identifier (24x7 code\r
4711      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
4712      */\r
4713     CompletionTriggerKind.Invoked = 1;\r
4714     /**\r
4715      * Completion was triggered by a trigger character specified by\r
4716      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
4717      */\r
4718     CompletionTriggerKind.TriggerCharacter = 2;\r
4719     /**\r
4720      * Completion was re-triggered as current completion list is incomplete\r
4721      */\r
4722     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
4723 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
4724 /**\r
4725  * Request to request completion at a given text document position. The request's\r
4726  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
4727  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
4728  * or a Thenable that resolves to such.\r
4729  *\r
4730  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
4731  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
4732  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
4733  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
4734  */\r
4735 var CompletionRequest;\r
4736 (function (CompletionRequest) {\r
4737     CompletionRequest.method = 'textDocument/completion';\r
4738     CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
4739     /** @deprecated Use CompletionRequest.type */\r
4740     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4741 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
4742 /**\r
4743  * Request to resolve additional information for a given completion item.The request's\r
4744  * parameter is of type [CompletionItem](#CompletionItem) the response\r
4745  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
4746  */\r
4747 var CompletionResolveRequest;\r
4748 (function (CompletionResolveRequest) {\r
4749     CompletionResolveRequest.method = 'completionItem/resolve';\r
4750     CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
4751 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
4752 /**\r
4753  * Request to request hover information at a given text document position. The request's\r
4754  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
4755  * type [Hover](#Hover) or a Thenable that resolves to such.\r
4756  */\r
4757 var HoverRequest;\r
4758 (function (HoverRequest) {\r
4759     HoverRequest.method = 'textDocument/hover';\r
4760     HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
4761 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
4762 /**\r
4763  * How a signature help was triggered.\r
4764  *\r
4765  * @since 3.15.0\r
4766  */\r
4767 var SignatureHelpTriggerKind;\r
4768 (function (SignatureHelpTriggerKind) {\r
4769     /**\r
4770      * Signature help was invoked manually by the user or by a command.\r
4771      */\r
4772     SignatureHelpTriggerKind.Invoked = 1;\r
4773     /**\r
4774      * Signature help was triggered by a trigger character.\r
4775      */\r
4776     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
4777     /**\r
4778      * Signature help was triggered by the cursor moving or by the document content changing.\r
4779      */\r
4780     SignatureHelpTriggerKind.ContentChange = 3;\r
4781 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
4782 var SignatureHelpRequest;\r
4783 (function (SignatureHelpRequest) {\r
4784     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
4785     SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
4786 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
4787 /**\r
4788  * A request to resolve the definition location of a symbol at a given text\r
4789  * document position. The request's parameter is of type [TextDocumentPosition]\r
4790  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
4791  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
4792  * to such.\r
4793  */\r
4794 var DefinitionRequest;\r
4795 (function (DefinitionRequest) {\r
4796     DefinitionRequest.method = 'textDocument/definition';\r
4797     DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
4798     /** @deprecated Use DefinitionRequest.type */\r
4799     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4800 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
4801 /**\r
4802  * A request to resolve project-wide references for the symbol denoted\r
4803  * by the given text document position. The request's parameter is of\r
4804  * type [ReferenceParams](#ReferenceParams) the response is of type\r
4805  * [Location[]](#Location) or a Thenable that resolves to such.\r
4806  */\r
4807 var ReferencesRequest;\r
4808 (function (ReferencesRequest) {\r
4809     ReferencesRequest.method = 'textDocument/references';\r
4810     ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
4811     /** @deprecated Use ReferencesRequest.type */\r
4812     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4813 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
4814 /**\r
4815  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
4816  * text document position. The request's parameter is of type [TextDocumentPosition]\r
4817  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
4818  * (#DocumentHighlight) or a Thenable that resolves to such.\r
4819  */\r
4820 var DocumentHighlightRequest;\r
4821 (function (DocumentHighlightRequest) {\r
4822     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
4823     DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
4824     /** @deprecated Use DocumentHighlightRequest.type */\r
4825     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4826 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
4827 /**\r
4828  * A request to list all symbols found in a given text document. The request's\r
4829  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
4830  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
4831  * that resolves to such.\r
4832  */\r
4833 var DocumentSymbolRequest;\r
4834 (function (DocumentSymbolRequest) {\r
4835     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
4836     DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
4837     /** @deprecated Use DocumentSymbolRequest.type */\r
4838     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4839 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
4840 /**\r
4841  * A request to provide commands for the given text document and range.\r
4842  */\r
4843 var CodeActionRequest;\r
4844 (function (CodeActionRequest) {\r
4845     CodeActionRequest.method = 'textDocument/codeAction';\r
4846     CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
4847     /** @deprecated Use CodeActionRequest.type */\r
4848     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4849 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
4850 /**\r
4851  * A request to list project-wide symbols matching the query string given\r
4852  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
4853  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
4854  * resolves to such.\r
4855  */\r
4856 var WorkspaceSymbolRequest;\r
4857 (function (WorkspaceSymbolRequest) {\r
4858     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
4859     WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
4860     /** @deprecated Use WorkspaceSymbolRequest.type */\r
4861     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4862 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
4863 /**\r
4864  * A request to provide code lens for the given text document.\r
4865  */\r
4866 var CodeLensRequest;\r
4867 (function (CodeLensRequest) {\r
4868     CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
4869     /** @deprecated Use CodeLensRequest.type */\r
4870     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4871 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
4872 /**\r
4873  * A request to resolve a command for a given code lens.\r
4874  */\r
4875 var CodeLensResolveRequest;\r
4876 (function (CodeLensResolveRequest) {\r
4877     CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
4878 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
4879 /**\r
4880  * A request to provide document links\r
4881  */\r
4882 var DocumentLinkRequest;\r
4883 (function (DocumentLinkRequest) {\r
4884     DocumentLinkRequest.method = 'textDocument/documentLink';\r
4885     DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
4886     /** @deprecated Use DocumentLinkRequest.type */\r
4887     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4888 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
4889 /**\r
4890  * Request to resolve additional information for a given document link. The request's\r
4891  * parameter is of type [DocumentLink](#DocumentLink) the response\r
4892  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
4893  */\r
4894 var DocumentLinkResolveRequest;\r
4895 (function (DocumentLinkResolveRequest) {\r
4896     DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
4897 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
4898 /**\r
4899  * A request to to format a whole document.\r
4900  */\r
4901 var DocumentFormattingRequest;\r
4902 (function (DocumentFormattingRequest) {\r
4903     DocumentFormattingRequest.method = 'textDocument/formatting';\r
4904     DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
4905 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
4906 /**\r
4907  * A request to to format a range in a document.\r
4908  */\r
4909 var DocumentRangeFormattingRequest;\r
4910 (function (DocumentRangeFormattingRequest) {\r
4911     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
4912     DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
4913 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
4914 /**\r
4915  * A request to format a document on type.\r
4916  */\r
4917 var DocumentOnTypeFormattingRequest;\r
4918 (function (DocumentOnTypeFormattingRequest) {\r
4919     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
4920     DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
4921 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
4922 /**\r
4923  * A request to rename a symbol.\r
4924  */\r
4925 var RenameRequest;\r
4926 (function (RenameRequest) {\r
4927     RenameRequest.method = 'textDocument/rename';\r
4928     RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
4929 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
4930 /**\r
4931  * A request to test and perform the setup necessary for a rename.\r
4932  */\r
4933 var PrepareRenameRequest;\r
4934 (function (PrepareRenameRequest) {\r
4935     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
4936     PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
4937 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
4938 /**\r
4939  * A request send from the client to the server to execute a command. The request might return\r
4940  * a workspace edit which the client will apply to the workspace.\r
4941  */\r
4942 var ExecuteCommandRequest;\r
4943 (function (ExecuteCommandRequest) {\r
4944     ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
4945 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
4946 /**\r
4947  * A request sent from the server to the client to modified certain resources.\r
4948  */\r
4949 var ApplyWorkspaceEditRequest;\r
4950 (function (ApplyWorkspaceEditRequest) {\r
4951     ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
4952 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
4953
4954
4955 /***/ }),
4956 /* 20 */
4957 /***/ (function(module, exports, __webpack_require__) {
4958
4959 "use strict";
4960 /* --------------------------------------------------------------------------------------------\r
4961  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4962  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4963  * ------------------------------------------------------------------------------------------ */\r
4964 \r
4965 Object.defineProperty(exports, "__esModule", { value: true });\r
4966 function boolean(value) {\r
4967     return value === true || value === false;\r
4968 }\r
4969 exports.boolean = boolean;\r
4970 function string(value) {\r
4971     return typeof value === 'string' || value instanceof String;\r
4972 }\r
4973 exports.string = string;\r
4974 function number(value) {\r
4975     return typeof value === 'number' || value instanceof Number;\r
4976 }\r
4977 exports.number = number;\r
4978 function error(value) {\r
4979     return value instanceof Error;\r
4980 }\r
4981 exports.error = error;\r
4982 function func(value) {\r
4983     return typeof value === 'function';\r
4984 }\r
4985 exports.func = func;\r
4986 function array(value) {\r
4987     return Array.isArray(value);\r
4988 }\r
4989 exports.array = array;\r
4990 function stringArray(value) {\r
4991     return array(value) && value.every(elem => string(elem));\r
4992 }\r
4993 exports.stringArray = stringArray;\r
4994 function typedArray(value, check) {\r
4995     return Array.isArray(value) && value.every(check);\r
4996 }\r
4997 exports.typedArray = typedArray;\r
4998 function objectLiteral(value) {\r
4999     // Strictly speaking class instances pass this check as well. Since the LSP\r
5000     // doesn't use classes we ignore this for now. If we do we need to add something\r
5001     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
5002     return value !== null && typeof value === 'object';\r
5003 }\r
5004 exports.objectLiteral = objectLiteral;\r
5005
5006
5007 /***/ }),
5008 /* 21 */
5009 /***/ (function(module, exports, __webpack_require__) {
5010
5011 "use strict";
5012 /* --------------------------------------------------------------------------------------------\r
5013  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5014  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5015  * ------------------------------------------------------------------------------------------ */\r
5016 \r
5017 Object.defineProperty(exports, "__esModule", { value: true });\r
5018 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5019 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
5020     constructor(method) {\r
5021         super(method);\r
5022     }\r
5023 }\r
5024 exports.ProtocolRequestType0 = ProtocolRequestType0;\r
5025 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
5026     constructor(method) {\r
5027         super(method);\r
5028     }\r
5029 }\r
5030 exports.ProtocolRequestType = ProtocolRequestType;\r
5031 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
5032     constructor(method) {\r
5033         super(method);\r
5034     }\r
5035 }\r
5036 exports.ProtocolNotificationType = ProtocolNotificationType;\r
5037 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
5038     constructor(method) {\r
5039         super(method);\r
5040     }\r
5041 }\r
5042 exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
5043
5044
5045 /***/ }),
5046 /* 22 */
5047 /***/ (function(module, exports, __webpack_require__) {
5048
5049 "use strict";
5050 /* --------------------------------------------------------------------------------------------\r
5051  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5052  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5053  * ------------------------------------------------------------------------------------------ */\r
5054 \r
5055 Object.defineProperty(exports, "__esModule", { value: true });\r
5056 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5057 const messages_1 = __webpack_require__(21);\r
5058 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5059 let __noDynamicImport;\r
5060 /**\r
5061  * A request to resolve the implementation locations of a symbol at a given text\r
5062  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5063  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5064  * Thenable that resolves to such.\r
5065  */\r
5066 var ImplementationRequest;\r
5067 (function (ImplementationRequest) {\r
5068     ImplementationRequest.method = 'textDocument/implementation';\r
5069     ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
5070     /** @deprecated Use ImplementationRequest.type */\r
5071     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5072 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
5073
5074
5075 /***/ }),
5076 /* 23 */
5077 /***/ (function(module, exports, __webpack_require__) {
5078
5079 "use strict";
5080 /* --------------------------------------------------------------------------------------------\r
5081  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5082  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5083  * ------------------------------------------------------------------------------------------ */\r
5084 \r
5085 Object.defineProperty(exports, "__esModule", { value: true });\r
5086 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5087 const messages_1 = __webpack_require__(21);\r
5088 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5089 let __noDynamicImport;\r
5090 /**\r
5091  * A request to resolve the type definition locations of a symbol at a given text\r
5092  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5093  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5094  * Thenable that resolves to such.\r
5095  */\r
5096 var TypeDefinitionRequest;\r
5097 (function (TypeDefinitionRequest) {\r
5098     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
5099     TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
5100     /** @deprecated Use TypeDefinitionRequest.type */\r
5101     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5102 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
5103
5104
5105 /***/ }),
5106 /* 24 */
5107 /***/ (function(module, exports, __webpack_require__) {
5108
5109 "use strict";
5110 /* --------------------------------------------------------------------------------------------\r
5111  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5112  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5113  * ------------------------------------------------------------------------------------------ */\r
5114 \r
5115 Object.defineProperty(exports, "__esModule", { value: true });\r
5116 const messages_1 = __webpack_require__(21);\r
5117 /**\r
5118  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
5119  */\r
5120 var WorkspaceFoldersRequest;\r
5121 (function (WorkspaceFoldersRequest) {\r
5122     WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
5123 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
5124 /**\r
5125  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
5126  * folder configuration changes.\r
5127  */\r
5128 var DidChangeWorkspaceFoldersNotification;\r
5129 (function (DidChangeWorkspaceFoldersNotification) {\r
5130     DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
5131 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
5132
5133
5134 /***/ }),
5135 /* 25 */
5136 /***/ (function(module, exports, __webpack_require__) {
5137
5138 "use strict";
5139 /* --------------------------------------------------------------------------------------------\r
5140  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5141  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5142  * ------------------------------------------------------------------------------------------ */\r
5143 \r
5144 Object.defineProperty(exports, "__esModule", { value: true });\r
5145 const messages_1 = __webpack_require__(21);\r
5146 /**\r
5147  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
5148  * configuration setting.\r
5149  *\r
5150  * This pull model replaces the old push model were the client signaled configuration change via an\r
5151  * event. If the server still needs to react to configuration changes (since the server caches the\r
5152  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
5153  * change event and empty the cache if such an event is received.\r
5154  */\r
5155 var ConfigurationRequest;\r
5156 (function (ConfigurationRequest) {\r
5157     ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
5158 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
5159
5160
5161 /***/ }),
5162 /* 26 */
5163 /***/ (function(module, exports, __webpack_require__) {
5164
5165 "use strict";
5166 /* --------------------------------------------------------------------------------------------\r
5167  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5168  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5169  * ------------------------------------------------------------------------------------------ */\r
5170 \r
5171 Object.defineProperty(exports, "__esModule", { value: true });\r
5172 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5173 const messages_1 = __webpack_require__(21);\r
5174 /**\r
5175  * A request to list all color symbols found in a given text document. The request's\r
5176  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
5177  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5178  * that resolves to such.\r
5179  */\r
5180 var DocumentColorRequest;\r
5181 (function (DocumentColorRequest) {\r
5182     DocumentColorRequest.method = 'textDocument/documentColor';\r
5183     DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
5184     /** @deprecated Use DocumentColorRequest.type */\r
5185     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5186 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
5187 /**\r
5188  * A request to list all presentation for a color. The request's\r
5189  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
5190  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5191  * that resolves to such.\r
5192  */\r
5193 var ColorPresentationRequest;\r
5194 (function (ColorPresentationRequest) {\r
5195     ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
5196 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
5197
5198
5199 /***/ }),
5200 /* 27 */
5201 /***/ (function(module, exports, __webpack_require__) {
5202
5203 "use strict";
5204 \r
5205 /*---------------------------------------------------------------------------------------------\r
5206  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5207  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5208  *--------------------------------------------------------------------------------------------*/\r
5209 Object.defineProperty(exports, "__esModule", { value: true });\r
5210 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5211 const messages_1 = __webpack_require__(21);\r
5212 /**\r
5213  * Enum of known range kinds\r
5214  */\r
5215 var FoldingRangeKind;\r
5216 (function (FoldingRangeKind) {\r
5217     /**\r
5218      * Folding range for a comment\r
5219      */\r
5220     FoldingRangeKind["Comment"] = "comment";\r
5221     /**\r
5222      * Folding range for a imports or includes\r
5223      */\r
5224     FoldingRangeKind["Imports"] = "imports";\r
5225     /**\r
5226      * Folding range for a region (e.g. `#region`)\r
5227      */\r
5228     FoldingRangeKind["Region"] = "region";\r
5229 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
5230 /**\r
5231  * A request to provide folding ranges in a document. The request's\r
5232  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
5233  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
5234  * that resolves to such.\r
5235  */\r
5236 var FoldingRangeRequest;\r
5237 (function (FoldingRangeRequest) {\r
5238     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
5239     FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
5240     /** @deprecated Use FoldingRangeRequest.type */\r
5241     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5242 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
5243
5244
5245 /***/ }),
5246 /* 28 */
5247 /***/ (function(module, exports, __webpack_require__) {
5248
5249 "use strict";
5250 /* --------------------------------------------------------------------------------------------\r
5251  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5252  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5253  * ------------------------------------------------------------------------------------------ */\r
5254 \r
5255 Object.defineProperty(exports, "__esModule", { value: true });\r
5256 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5257 const messages_1 = __webpack_require__(21);\r
5258 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5259 let __noDynamicImport;\r
5260 /**\r
5261  * A request to resolve the type definition locations of a symbol at a given text\r
5262  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5263  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
5264  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
5265  * to such.\r
5266  */\r
5267 var DeclarationRequest;\r
5268 (function (DeclarationRequest) {\r
5269     DeclarationRequest.method = 'textDocument/declaration';\r
5270     DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
5271     /** @deprecated Use DeclarationRequest.type */\r
5272     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5273 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
5274
5275
5276 /***/ }),
5277 /* 29 */
5278 /***/ (function(module, exports, __webpack_require__) {
5279
5280 "use strict";
5281 \r
5282 /*---------------------------------------------------------------------------------------------\r
5283  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5284  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5285  *--------------------------------------------------------------------------------------------*/\r
5286 Object.defineProperty(exports, "__esModule", { value: true });\r
5287 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5288 const messages_1 = __webpack_require__(21);\r
5289 /**\r
5290  * A request to provide selection ranges in a document. The request's\r
5291  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
5292  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
5293  * that resolves to such.\r
5294  */\r
5295 var SelectionRangeRequest;\r
5296 (function (SelectionRangeRequest) {\r
5297     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
5298     SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
5299     /** @deprecated  Use SelectionRangeRequest.type */\r
5300     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5301 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
5302
5303
5304 /***/ }),
5305 /* 30 */
5306 /***/ (function(module, exports, __webpack_require__) {
5307
5308 "use strict";
5309 /* --------------------------------------------------------------------------------------------\r
5310  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5311  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5312  * ------------------------------------------------------------------------------------------ */\r
5313 \r
5314 Object.defineProperty(exports, "__esModule", { value: true });\r
5315 const vscode_jsonrpc_1 = __webpack_require__(5);\r
5316 const messages_1 = __webpack_require__(21);\r
5317 var WorkDoneProgress;\r
5318 (function (WorkDoneProgress) {\r
5319     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
5320 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
5321 /**\r
5322  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
5323  * reporting from the server.\r
5324  */\r
5325 var WorkDoneProgressCreateRequest;\r
5326 (function (WorkDoneProgressCreateRequest) {\r
5327     WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
5328 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
5329 /**\r
5330  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
5331  * initiated on the server side.\r
5332  */\r
5333 var WorkDoneProgressCancelNotification;\r
5334 (function (WorkDoneProgressCancelNotification) {\r
5335     WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
5336 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
5337
5338
5339 /***/ }),
5340 /* 31 */
5341 /***/ (function(module, exports, __webpack_require__) {
5342
5343 "use strict";
5344 /* --------------------------------------------------------------------------------------------\r
5345  * Copyright (c) TypeFox and others. All rights reserved.\r
5346  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5347  * ------------------------------------------------------------------------------------------ */\r
5348 \r
5349 Object.defineProperty(exports, "__esModule", { value: true });\r
5350 const messages_1 = __webpack_require__(21);\r
5351 /**\r
5352  * A request to result a `CallHierarchyItem` in a document at a given position.\r
5353  * Can be used as an input to a incoming or outgoing call hierarchy.\r
5354  *\r
5355  * @since 3.16.0 - Proposed state\r
5356  */\r
5357 var CallHierarchyPrepareRequest;\r
5358 (function (CallHierarchyPrepareRequest) {\r
5359     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
5360     CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
5361 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
5362 /**\r
5363  * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
5364  *\r
5365  * @since 3.16.0 - Proposed state\r
5366  */\r
5367 var CallHierarchyIncomingCallsRequest;\r
5368 (function (CallHierarchyIncomingCallsRequest) {\r
5369     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
5370     CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
5371 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
5372 /**\r
5373  * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
5374  *\r
5375  * @since 3.16.0 - Proposed state\r
5376  */\r
5377 var CallHierarchyOutgoingCallsRequest;\r
5378 (function (CallHierarchyOutgoingCallsRequest) {\r
5379     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
5380     CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
5381 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
5382
5383
5384 /***/ }),
5385 /* 32 */
5386 /***/ (function(module, exports, __webpack_require__) {
5387
5388 "use strict";
5389 /* --------------------------------------------------------------------------------------------\r
5390  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5391  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5392  * ------------------------------------------------------------------------------------------ */\r
5393 \r
5394 Object.defineProperty(exports, "__esModule", { value: true });\r
5395 const messages_1 = __webpack_require__(21);\r
5396 /**\r
5397  * A set of predefined token types. This set is not fixed\r
5398  * an clients can specify additional token types via the\r
5399  * corresponding client capabilities.\r
5400  *\r
5401  * @since 3.16.0 - Proposed state\r
5402  */\r
5403 var SemanticTokenTypes;\r
5404 (function (SemanticTokenTypes) {\r
5405     SemanticTokenTypes["comment"] = "comment";\r
5406     SemanticTokenTypes["keyword"] = "keyword";\r
5407     SemanticTokenTypes["string"] = "string";\r
5408     SemanticTokenTypes["number"] = "number";\r
5409     SemanticTokenTypes["regexp"] = "regexp";\r
5410     SemanticTokenTypes["operator"] = "operator";\r
5411     SemanticTokenTypes["namespace"] = "namespace";\r
5412     SemanticTokenTypes["type"] = "type";\r
5413     SemanticTokenTypes["struct"] = "struct";\r
5414     SemanticTokenTypes["class"] = "class";\r
5415     SemanticTokenTypes["interface"] = "interface";\r
5416     SemanticTokenTypes["enum"] = "enum";\r
5417     SemanticTokenTypes["typeParameter"] = "typeParameter";\r
5418     SemanticTokenTypes["function"] = "function";\r
5419     SemanticTokenTypes["member"] = "member";\r
5420     SemanticTokenTypes["property"] = "property";\r
5421     SemanticTokenTypes["macro"] = "macro";\r
5422     SemanticTokenTypes["variable"] = "variable";\r
5423     SemanticTokenTypes["parameter"] = "parameter";\r
5424     SemanticTokenTypes["label"] = "label";\r
5425 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
5426 /**\r
5427  * A set of predefined token modifiers. This set is not fixed\r
5428  * an clients can specify additional token types via the\r
5429  * corresponding client capabilities.\r
5430  *\r
5431  * @since 3.16.0 - Proposed state\r
5432  */\r
5433 var SemanticTokenModifiers;\r
5434 (function (SemanticTokenModifiers) {\r
5435     SemanticTokenModifiers["documentation"] = "documentation";\r
5436     SemanticTokenModifiers["declaration"] = "declaration";\r
5437     SemanticTokenModifiers["definition"] = "definition";\r
5438     SemanticTokenModifiers["reference"] = "reference";\r
5439     SemanticTokenModifiers["static"] = "static";\r
5440     SemanticTokenModifiers["abstract"] = "abstract";\r
5441     SemanticTokenModifiers["deprecated"] = "deprecated";\r
5442     SemanticTokenModifiers["async"] = "async";\r
5443     SemanticTokenModifiers["volatile"] = "volatile";\r
5444     SemanticTokenModifiers["readonly"] = "readonly";\r
5445 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
5446 /**\r
5447  * @since 3.16.0 - Proposed state\r
5448  */\r
5449 var SemanticTokens;\r
5450 (function (SemanticTokens) {\r
5451     function is(value) {\r
5452         const candidate = value;\r
5453         return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
5454             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
5455     }\r
5456     SemanticTokens.is = is;\r
5457 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
5458 /**\r
5459  * @since 3.16.0 - Proposed state\r
5460  */\r
5461 var SemanticTokensRequest;\r
5462 (function (SemanticTokensRequest) {\r
5463     SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
5464     SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
5465 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
5466 /**\r
5467  * @since 3.16.0 - Proposed state\r
5468  */\r
5469 var SemanticTokensEditsRequest;\r
5470 (function (SemanticTokensEditsRequest) {\r
5471     SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
5472     SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
5473 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
5474 /**\r
5475  * @since 3.16.0 - Proposed state\r
5476  */\r
5477 var SemanticTokensRangeRequest;\r
5478 (function (SemanticTokensRangeRequest) {\r
5479     SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
5480     SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
5481 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
5482
5483
5484 /***/ }),
5485 /* 33 */
5486 /***/ (function(module, exports, __webpack_require__) {
5487
5488 "use strict";
5489
5490 /*---------------------------------------------------------------------------------------------
5491  *  Copyright (c) Microsoft Corporation. All rights reserved.
5492  *  Licensed under the MIT License. See License.txt in the project root for license information.
5493  *--------------------------------------------------------------------------------------------*/
5494 var __importDefault = (this && this.__importDefault) || function (mod) {
5495     return (mod && mod.__esModule) ? mod : { "default": mod };
5496 };
5497 Object.defineProperty(exports, "__esModule", { value: true });
5498 exports.joinPath = exports.normalizePath = exports.resolvePath = exports.FileType = void 0;
5499 const path_1 = __importDefault(__webpack_require__(3));
5500 var FileType;
5501 (function (FileType) {
5502     /**
5503      * The file type is unknown.
5504      */
5505     FileType[FileType["Unknown"] = 0] = "Unknown";
5506     /**
5507      * A regular file.
5508      */
5509     FileType[FileType["File"] = 1] = "File";
5510     /**
5511      * A directory.
5512      */
5513     FileType[FileType["Directory"] = 2] = "Directory";
5514     /**
5515      * A symbolic link to a file.
5516      */
5517     FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
5518 })(FileType = exports.FileType || (exports.FileType = {}));
5519 const Dot = '.'.charCodeAt(0);
5520 function resolvePath(uri, p) {
5521     if (path_1.default.isAbsolute(p)) {
5522         return uri.with({ path: normalizePath(p.split('/')) });
5523     }
5524     return joinPath(uri, p);
5525 }
5526 exports.resolvePath = resolvePath;
5527 function normalizePath(parts) {
5528     const newParts = [];
5529     for (const part of parts) {
5530         if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) {
5531             // ignore
5532         }
5533         else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) {
5534             newParts.pop();
5535         }
5536         else {
5537             newParts.push(part);
5538         }
5539     }
5540     if (parts.length > 1 && parts[parts.length - 1].length === 0) {
5541         newParts.push('');
5542     }
5543     let res = newParts.join('/');
5544     if (parts[0].length === 0) {
5545         res = '/' + res;
5546     }
5547     return res;
5548 }
5549 exports.normalizePath = normalizePath;
5550 function joinPath(uri, ...paths) {
5551     const parts = uri.path.split('/');
5552     for (let path of paths) {
5553         parts.push(...path.split('/'));
5554     }
5555     return uri.with({ path: normalizePath(parts) });
5556 }
5557 exports.joinPath = joinPath;
5558
5559
5560 /***/ })
5561 /******/ ])));