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