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