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