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