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